loading
 
C# Sample Project
Sameer from Australia  [2 posts]
2 years
Has anyone created a simple C# Form Application for RGB Filter? Not really able to follow the sample project that I downloaded as part of the API. Wonderful piece of software. Love it. But would really love to be able to start making own form applications using the API.

Someone please guide me in starting...
Steven Gentner from United States  [1370 posts] 2 years
Sam,

The easiest way is to learn by example. Run RR and enable the API server (Options button->API Server tab->select checkbox). Then copy

'--//--
set rr=CreateObject("RoboRealm.API.1")

if not rr.Startup() then
  WScript.Echo "Could not connect to RoboRealm Server"
  WScript.Quit(EXIT_INVALID_INPUT)
end if

rr.Execute("<RGB_Filter><hue_value>50</hue_value><min_value>100</min_value><channel>1</channel></RGB_Filter>")

'get a variable from RR
WScript.Echo "Image_Count: " & rr.GetVariable("RGB_FILTER_RED_COUNT")

rr.Disconnect()
'--//--

into something.vbs

Then run a command prompt console and run it using

cscript something.vbs

That's the quickest way to see how the API works and to get a meaningful number back from the RGB Filter module. If you look at the RR GUI after this is run you will see the RGB_Filter still present in the pipeline. You can now rerun the about without needing the execute (since its still in the pipeline).

Hope this helps.
STeven.

Sameer from Australia  [2 posts] 2 years
Hi Steven,

Thank you for your support. Very much appreciated. I am trying to track a 2 color image using the C# application & RoboRealm API. There could be multiple types of 2 color combinations and also multiple instances of each of the 2 color combination. Each type of combination is to be considered as a different type of object. How can I achieve this? Also, in RoboRealm software, is there an option to change the overlay shape with an array of images creating like an animation overlay over the tracked object?

Regards,
Sameer

 
Steven Gentner from United States  [1370 posts] 2 years
Sameer,

1. Have a look at how the attached robofile and image works to detect color barcodes of 3 colors. This is a more complicated problem that you have. In the case of this robofile we want to isolate the red/green/blue color strip ONLY (or blue/green/red). The trick here is to single out those green blocks touching red and blue strips. In your case you would pick one of the colors and see if another of similar size is very near to it.

Be sure to download the latest version 2.77.15 of RR for this to work.

If you have trouble with this, please include an original unannotated unmodified image as would be seen by the camera and your current robofile (i.e. press save button, type something.jpg and then press save button again and type something.robo) as we would need those to replicate your environment.

2. There isn't a single module to overlay images at particular locations. Once the coordinate is detected you can use the Display_Image module to show a particular image at the specified coordinate. You'll have to use the Load_Image module to load in the image AS A MARKER so that the Display_Image can just reference that marker to display the image. If you don't load in the image as a marker it will simply overwrite the current image ... which you probably don't want to do.

http://www.roborealm.com/help/Display_Image.php
http://www.roborealm.com/help/Load_Image.php

You will notice in the Blob_Filter module an option to create a 'create BLOBS array' which when selected will produce a coordinate array. You can access these elements directly using

[BLOBS:0], [BLOBS:1]

for the first x and y in the array. You would enter those into the X Y coordinated for the Display_Image module.

STeven.

 

program.robo

This forum thread has been closed due to inactivity (more than 4 months) or number of replies (more than 50 messages). Please start a New Post and enter a new forum thread with the appropriate title.

 New Post   Forum Index