loading
 
Problems with Blob Tracker and with VBScript
Joy from United States  [2 posts]
5 year
Hi STeven,

I have enclosed the filtering I'm having issues with. The program should do the following:

1) identify the three features with "+" enclosed in circular halos via a blob_tracking filter
2) assign the vertex of the resulting triangle based on which angle between the three blobs is near 30.0 degrees.
3) display triangle (later I will need to know the orientation of this triangle)

The issues are twofold:

1) I'm not certain how to ensure that the Blob_Tracking module will always see the three blobs it's presented with. It used to be able to locate all three blobs and assign IDs to them, but lately it will only find one blob, or two at most, assign the ID, and discard the rest. How can I improve this?

2) My VBScript seems to ignore the condition within the first "if" statement and executes the expression regardless of the validity of the expression. For example, in the following expression:

    if sensor_angle_2 <= 31.0 Or sensor_angle_2 >= 329.0 then
        sensor_point(0) = blobTracking(1)
        sensor_point(1) = blobTracking(2)
        sensor_tails(0) = blobTracking(4)
        sensor_tails(1) = blobTracking(5)
        sensor_tails(2) = blobTracking(7)
        sensor_tails(3) = blobTracking(8)
    .
    .
    .
    end if

When 'sensor_angle_2' is 75.0, the program goes on and assigns values to the sensors when it should, instead, move on to the next statement.

Please let me know what you think.

-Joy


 

program.robo
Steven Gentner from United States  [1446 posts] 5 year
Joy,

You were quite far along. Thanks for the image and robofile. A couple of suggestions:

1. In the VBScript you need to assign the sensor_angle_X variables using GetVariable. Otherwise their values are undefined. The VBScript module executes in isolation from the rest of the system so that variables need to get Get and Set in order to interact with the rest of the pipeline.

2. Unless you actually want to know the movement of the circles between images the blob tracking module is probably not the one to use. Instead, use the Blob Filter with the checkbox to create the BLOBS array which will include a zero based array (i.e. starting from 0) of the remaining center of the blobs. These are what you want to use in the calculate angle module.

3. I changed some of the processing to simplify things since I knew what your final result is using. While using modules like smooth_hull do create a nicer image the actual numbers (center of the blob) are not affected much by these and thus can be removed ... you want to keep the modules to the bare minimum so that the system continue to run AFAP and when modifications need to be made its easier to review and update.

There wasn't anything wrong with the way that you were processing things but I also changed the processing just to show you (and others) yet another way to achieve the desired result. There isn't a "right" way to do it but different ways are worth keeping around just for review and learning.

Attached are the resulting image and robofile that appears to work just for this image. As you have probably noticed having many more images to test is required!

Thanks again for posting a sample image AND your current robofile. That helps us to help you!

STeven.

 

program.robo
Joy from United States  [2 posts] 5 year
Hi STeven,

Thank you so much for your prompt, really helpful response! Your edits really helped me move past the unexpected results I was seeing and allowed me to find the mismatch I had in my indexing as well. I realized that I wasn't matching up my angle checks with my index stuffing and that also contributed to my issues with finding the vertex of the triangle.


I have enclosed my latest result. You'll notice that the coordinates of the sensor_point variable now correspond to the appropriate coordinates of the triangle vertex.

Thanks again,

Joy

 

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