|
Controlling RoboRealm through Java API Nivin from India [3 posts] |
11 year
|
Hello,
I'm doing a project on object recognition where the user will provide the image and based on training examples it must recognize the objects in that image. This task works fine in Roborealm GUI but i need all these to be done through a java program. I used the following functions,
rr.loadImage(null,"F:\\XXX\\FYP\\robo realm\\test3.jpg"));
rr.execute("<head><version>2.58.8</version></head><Object_Recognition> <absent_after_frames>0</absent_after_frames><base_folder>.\template samples</base_folder><black_is_mask>FALSE</black_is_mask><check_orientation>TRUE</check_orientation><check_scale>TRUE</check_scale><check_tx>TRUE</check_tx><check_ty>TRUE</check_ty><create_shape_array>TRUE</create_shape_array><display_confidence>TRUE</display_confidence><display_filename>TRUE</display_filename><display_orientation>FALSE</display_orientation><display_scale>FALSE</display_scale><display_tx>FALSE</display_tx><display_ty>FALSE</display_ty><enable_tracking>TRUE</enable_tracking><font_size_index>2</font_size_index><matched_color_index>3</matched_color_index><match_isolation>20</match_isolation><max_angle>360</max_angle><max_confidence>100</max_confidence><max_size>200</max_size><min_angle>0</min_angle><min_confidence>70</min_confidence><min_size>20</min_size><min_tracking_confidence>50</min_tracking_confidence><monitor_folder>FALSE</monitor_folder><present_after_frames>0</present_after_frames><recognition_method>4</recognition_method><select_top_objects>0</select_top_objects><sort_array_on_x>TRUE</sort_array_on_x><sort_array_on_y>TRUE</sort_array_on_y></Object_Recognition>");
System.out.println("objects:::"+rr.getVariable("OBJECT_NAME"));
Both Load image and execute returned true value, but the variable OBJECT_NAME is returning 'null'
Could you please suggest some ways to get it done?
Thanks in advance!
|
|
|
Steven Gentner from United States [1446 posts] |
11 year
|
Nivin,
You will get a null when no object is recognized. You should be able to verify when running the above that an object is actually recognized in the GUI.
Note that once you execute, you NEED to use wait to allow the execute to complete. Execute will return immediately without waiting for anything to be executed since RR assumes multiple frame execution. So add a
rr.waitImage(5000);
after the execute and before the GetVariable which will allow the system to at least run 1 image through the new configuration before checking for a result.
STeven.
|
|
|
Nivin from India [3 posts] |
11 year
|
But the problem is not yet solved. Yes, it did recognize in GUI. I actually ran it in GUI and pasted its .robo file contents in execute function.
I also have another problem in object recognition. Please find the attachment for a test image. My training set has images of desert,water and waves. I need water, waves,desert as the objects recognized in test image but it's returning 'desert' in the portions of 'water'. So could you please suggest some way to solve this or any other modules that could help me?
P.S:My project is to identify objects in an image and infer the location from those objects. For eg: if the objects retrieved are sand(desert), water and waves; the location inferred should be sea.
Thanks in advance.
|
|
|
Steven Gentner from United States [1446 posts] |
11 year
|
Nivin,
I'm not sure you will get what you want from using the Object Recognition module. That module is meant to be used with planar objects that have a rigid structure (i.e. like a painting) that has the same relative texture regardless of how you move the object, i.e. think of moving a painting around in 3D space, objects within the painting do NOT change location in relation to each other.
In your case, you have 3D objects that are undefined in terms of relative features. Sand, water, waves and sky can all change their internal configuration such that any training from the OR module will easily and quickly fail.
So, you have to define the different areas from the properties that ARE preserved under different images. For example, sand is normally brown/white/gray and has a certain texture depending on the viewing distance. Same with water, waves, sky etc. If you look at the 'bag of features' technique you may find that to be a better algorithm for the classification of an image based on 1000's of training samples. Currently we don't have any module that does this automatically.
We may add something that could do this in the future but this is not something currently available.
STeven.
|
|
|
Nivin from India [3 posts] |
11 year
|
Oh! ok. Thank you STeven.
|
|