Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Zoton

Member

12-02-2020 01:49 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Hi everyone,

I am trying to implement a VI and I need to get the co-ordinates of all pixels enclosed by a ROI (Freehand). With IMAQ ROIProfile I can only extract the pixel co-ordinates of the points lying on the contour line only. It would be very helpful if anyone could tell me how can I get the all pixel co-ordinates withing the ROI.

Thanks in advance!!

Solved! Go to Solution.

Bob_Schor

Knight of NI

12-02-2020 09:47 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

I've not used IMAQ ROI Profile, but if it does give you the coordinates of the pixels on the ROI boundary, you can write code to find the coordinates of all the points in the ROI. It's simple math (though there can be some minor complications). I'm assuming the following (which might not be true, in which case, ignore all of this ...) -- if you choose any pixel anywhere, then if it is inside the ROI, moving left or right to the edge of the screen will intersect multiple pixels (and an even number of them) on the ROI boundary.

- Find the Boundary Pixel with the highest Y value.
- Start at the left edge of the screen at this Y value.
- Move to the right until you hit a ROI Boundary Pixel. Remember it.
- Continue moving right until you hit another Boundary Pixel or hit the right edge of the screen.
- If you hit another Boundary Pixel, you've found a collection of points inside the ROI. Go back to Step 3 and see if there are other ROI Pixels at this Y. Otherwise, you found a "singular" Pixel (think the point at the top of a triangle.
- When you hit the right edge of the screen, move down one Pixel and start another "scan" until you reach the bottom of the Screen or find a Y level that has no points on the ROI Boundary.

Bob Schor

Solution

Accepted by topic author Zoton

RamonG

Member

12-03-2020 05:55 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

You could let IMAQ ROItoMask do the hard work for you.

Is there a reason you need a list of coordinates? A lot of IMAQ functions work with masks.

12-03-2020 03:23 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report to a Moderator

Thanks a lot. That's what I needed! Kudos!!!