Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Ask for ROI problem help urgently

Hi,
I have a very headache problem with ROI setting dynamically but I don't know how to do it so far.

My device is being constructed and CCD camera has to be taken down away frequently present phase for other components tuning and adjustment. I have to retuning the optical system and collect a new reference image(background image) and reset ROI once more. It always makes my tested and workable vi become unworkable. I found, if I can set up a constant-size ROI dynamically in every new image which will be processed, this headche problem could be solved. I have studied the manual and website about the ROI but have no ideas to solve it yet and I need you help, the project will be closed 10 days later and it's very urgent to me.


Take a look the images first please, the goal is for a vi to find the fibers in the glass tube. The ROI should be a rectagle zone exact as the inside space of tube. I can easily get the up-edge of tube with coordinates of its both endings and its angle in horizontal. How can I set up a constant-size ROI dynamically in every new image which will be processed?
Of course it is very ease to get the ROI size in pixels by measuring under Vision Builder. I have done that the new image snaped shifts and rotates based on the reference image(background image).

Comments and suggestion are highly appreciated!

Best wishes to you for newly 2003!

Swedlin
Download All
0 Kudos
Message 1 of 5
(3,645 Views)
Swedlin,

It would not be easy to do this in Vision Builder, but in LabVIEW it is fairly simple. Your goal is to specify the width and height of a rectangle and its angle of rotation. Using a ROI conversion routine "Rectangle to ROI", you can generate the ROI.

You can use the "Find Edge" vi to locate the bottom edge of your glass tube. This returns the equation of the line. Evaluate this at the center (x=320) to get the coordinates of the center of the line. Calculate the y displacement by multiplying the height of your rectangle by 0.5*cos(theta), where theta is the angle of rotation. Subtract this from the center point of the line to get the center of the rectangle. Use "Rectangle to ROI" to create the ROI.

Bruce
Bruce Ammons
Ammons Engineering
0 Kudos
Message 2 of 5
(3,645 Views)
Thank you very much, Bruce

The problem right now becomes how to set up a zone by 4 points(their coordinates known!) as ROI.

I tried to figure out what is your exact meaning in the procedure but still half understanding right now.About vision, I am much relying on the IMAQ Vision Builder, of course I will try to do it in labview when it's much simple. But I found some new factors and I'd like to solve my ROI problem in another way and maybe it is simpler and makes my vi work more reliable and stabler.

I made a vi which creates a new image(bottom edge horizontal angle=0 or 360) from a previous reference image(used as background image, its related angle not =360 or 0)by rotating itself and this new image under Vision Builder was tested and it firmly proves both top and bottom edges are exactly horizontal. And at the same time I found that both top and bottom edges can be very easily and exactly found by " find straight edge:horizontal/edge" function and it indicates an exact zone to be ROI as desiration. But it shows the zone is not exact rectangle by glacing at their coordinates of 4 points. I used this script to test other images that are not exact horizontal and their results show both top and bottom edges are located badly. These promt something to me that it would be perfect if my ROI could be set up by the coordinates of these 4 points from both top/bottom edges found by vision vi and it exactly reflects the dynamically changes of ROI in real process operation. In another words, The ROIs are very tiny differnces and dynamically changed in machine-vision-view since settings up with device opticals,reflection of lightings are not exact the same each time and system vibration, and also the tube space is not exact rectagle due to its manufecturing tolorence, etc.

Hence, the problem becomes how to set up the zone marked by these 4 points as ROI. I didn't find the related way to do this in Vision Builder but suppose it should be simple in labview. I still have no any idea of the function to do this now. Comments are still warm welcome, especially what functions to be used on this purpose.

Thanks! Nice weekend!

Swedlin
0 Kudos
Message 3 of 5
(3,645 Views)
Hello,
It sounds like from your last e-mail you want to create a rectangle ROI from a set of four coordinate points. Here is an example VI which does that exact thing:

http://zone.ni.com/devzone/explprog.nsf/6c163603265406328625682a006ed37d/f66686e27d08fa208625686900759cbe?OpenDocument

Regards

Russell Blake
Applications Engineering
National Instruments
Director of Engineering
G Systems, www.gsystems.com
Certified LabVIEW Architect
Certified LabVIEW Embedded Systems Developer
Certified Professional Instructor
GCentral
0 Kudos
Message 4 of 5
(3,645 Views)
Thank you very much, Russell

I will try it soon to see how the result is. You did give me a bottle of spring water, who is in the desert.

Thanks again!

Swedlin
0 Kudos
Message 5 of 5
(3,645 Views)