Methods for analysis of plots in image processing

조회 수: 4 (최근 30일)
JCH
JCH 2020년 6월 29일
댓글: JCH 2020년 6월 30일
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.
  댓글 수: 2
KSSV
KSSV 2020년 6월 29일
Attach single image.....
JCH
JCH 2020년 6월 29일
Thank you for your reply :)

댓글을 달려면 로그인하십시오.

채택된 답변

Constantino Carlos Reyes-Aldasoro
This seems rather simple. First, project your data to a single dimension, say your image is called data_2D,
data_1D = sum(data_2D,1); % or change the 1 to 2 depending on the orientation of the image
This will sum all the elements of each column/row. Then you want to avoid the noise so threshold above a certain level, say 5 and use find to locate first and last points
find(data_1D>5,1,'first')
find(data_1D>5,1,'last')
Then you can insert that in between a loop that will process all your data sets.
Hope this solves your problem. If it does, please accept the answer, if it does not, let me know.
  댓글 수: 1
JCH
JCH 2020년 6월 30일
Thank you so much friend. Your reply helped me a lot.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2020년 6월 29일
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');
  댓글 수: 1
JCH
JCH 2020년 6월 30일
Thank you. I get more professional knowledge.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by