How to find pixel location using ROIPOLY???

2 views (last 30 days)
Ellis Berry
Ellis Berry on 17 May 2016
Answered: Adam on 17 May 2016
Hi everyone,
I think I am on the right track using roipoly because I want to use it to locate a ROI within a picture. My ROI happens to be a piece of paper. When I have used the roipoly function I am given a binary image with the piece of paper area showing up as white with the rest of the background black. How do I find out the dimensions or pixel locations of the corners of this area? Maybe counting the number of '1' pixels? I need to know the size of this area because then I will crop the original RGB image to this specific area and then I can run some image processing code just on that ROI in the original image? Hope that makes sense!
Many thanks,
Ellis

Answers (1)

Adam
Adam on 17 May 2016
The
[BW, xi, yi] = roipoly(...)
syntax for calling roipoly gives you the vertices of the polygon/roi in xi and yi. Are these not what you want?

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!