Automatic ROI selection of edges in grey scale image of squares
4 views (last 30 days)
Show older comments
I am trying to programatically select regions of interest (ROIs) along each edge of the tilted squares in the attached image. I have tried using various functions in the image processing toolbox, and keep running into dead ends. For example, regionprops and thresholding will allow me to find the centroids or boundaries of the BW image, but the corners are difficult to detect (moreso after thresholding). I'd like to either reliably find the corners, which would allow me to set rectangular ROIs between corners, or find the straight edges, then directly set ROIs at the center of the edge. Any thoughts?
2 Comments
Image Analyst
on 10 Apr 2020
Why is the image out of focus in the first place? And why do you think you need perfect rectangles? Why can't you just deal with whatever shape it happens to be? To find vertices of rectangles, see my attached demo.
Answers (1)
Image Analyst
on 10 Apr 2020
The number of peaks and valleys should be the same, but you have to take into account that the radii wrap[ around, so that if a peak is, say, close to index 1 and is rising from index 1 to wherever it is, then the other part of that peak (the left part) will also appear on the far right side of the plot and the last index in the signal may also be identified as a peak when it was actually part of the same peak as the one on the far left side.
One option is to threshold the blobs and then recognize that the max feret diameter is going to be at 45 degrees to the sides of the square. So you can then find the centroids from regionprops() and the feret diameter info from bwferet() and then take profiles along the edge perpendicular to the edge of the square using improfile(). Knowing the line spread function you can determine the MTF.
0 Comments
See Also
Categories
Find more on Image Segmentation and Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!