How to do image segmentation of a beam?

2 visualizaciones (últimos 30 días)
U B
U B el 5 de Sept. de 2023
Comentada: Image Analyst el 7 de Sept. de 2023
How to use image segmentation to select the whole light beam?
My final aim is to select the whole beam using image segmentation and then calcuate the minimum intensity point (center here but not necessary in other images) and plot it in an XY cartesian cordinate plane.
  9 comentarios
U B
U B el 7 de Sept. de 2023
About the colormap I was using before, it was not an inbuilt colormap. We customised it with certain value of color for our need. We call it RainbowColormap256.
Image Analyst
Image Analyst el 7 de Sept. de 2023
Uh, thanks. But why couldn't you attach the original gray scale (non-colorized) image? That would save us the trouble of having to undo the colormap.

Iniciar sesión para comentar.

Respuestas (1)

DGM
DGM el 7 de Sept. de 2023
Editada: DGM el 7 de Sept. de 2023
Oog. I'm answering with gloves on, so this is hasty.
First, a preliminary solution:
% we should be working with 2D data, not RGB
[inpict,map] = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1475201/88.bmp');
% map is close, but not quite exactly the same as hot(256);
% dunno what's going on there or why
% going to treat the index array as a grayscale image (again, not a good idea)
% after this point, we're working with 2D grayscale data.
% that's where we should be starting in practice.
inpict = mat2gray(inpict);
% assume that the bg is a minimal region
% assume that the bg is connected to the image boundary,
% but not connected to the interior minima
bgmask = inpict == inpict(1,1); % find the background
% i'm assuming that the interior minima are always
% exactly the same value as the exterior minima
% so re-find the minima only within the fg region
bgmask = imclearborder(bgmask);
% get the centroids of the interior minima
S = regionprops(bgmask,'centroid');
C = vertcat(S.Centroid);
% display the things
imshow(inpict); hold on
plot(C(:,1),C(:,2),'x','linewidth',2)
Two things:
We still don't want to work with colormapped (pseudocolor) images. The colormapping is a tool for human visualization, but it's not helpful for the actual programmatic processing of the image. The images we should be working with are simple 2D grayscale data. They might be on some arbitrary scale, and they might not be stored in what we might consider an "image file" format, but conceptually, they're just 2D data.
Second (and this is entirely optional and inconsequential to the solution), could you attach the .m file used to generate said colormap?

Categorías

Más información sobre Red en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by