Methods for analysis of plots in image processing

7 visualizaciones (últimos 30 días)
JCH
JCH el 29 de Jun. de 2020
Comentada: JCH el 30 de Jun. de 2020
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 comentarios
KSSV
KSSV el 29 de Jun. de 2020
Attach single image.....
JCH
JCH el 29 de Jun. de 2020
Thank you for your reply :)

Iniciar sesión para comentar.

Respuesta aceptada

Constantino Carlos Reyes-Aldasoro
Constantino Carlos Reyes-Aldasoro el 29 de Jun. de 2020
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 comentario
JCH
JCH el 30 de Jun. de 2020
Thank you so much friend. Your reply helped me a lot.

Iniciar sesión para comentar.

Más respuestas (1)

Image Analyst
Image Analyst el 29 de Jun. de 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');

Categorías

Más información sobre Image Segmentation and Analysis en Help Center y File Exchange.

Productos


Versión

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by