Methods for analysis of plots in image processing
Show older comments
Hello everyone.
I have difficulty in image processing. I have to figure out a specific length through a plot that counts each pixel value of the image. I try to obtain the length through the x-values of the first y=0, and the x-values of the second y=0. Also, I need to analyze hundreds of images, so I need to repeat code accordingly. I want to save the final x value as an Excel file.
I would like to hear the opinions of various experts.
Thank you.

Accepted Answer
More Answers (1)
Image Analyst
on 29 Jun 2020
Another way. If you want to look at only the largest blob, and ignore the disconnected noise, call bwareafilt() first, then call regionprops()
mask = bwareafilt(mask, 1); % Take largest
props = regionprops(mask, 'BoundingBox'); % Find bounding box location.
boundingBox = props.BoundingBox
topRow = ceil(boundingBox(2))
bottomRow = ceil(boundingBox(2) + boundingBox(4))
Or you can sum the mask sideways and threshold to find rows with a significant number of white pixels:
verticalProfile = sum(mask, 2)
inSpray = verticalProfile > 10; % Only find rows with more than 10 white pixels.
topRow = find(inSpray, 1, 'first');
bottomRow = find(inSpray, 1, 'last');
Categories
Find more on Image Processing Toolbox 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!