Isolating specific dots in an image.
Mostrar comentarios más antiguos
Hello, I'm trying to get my image to the point where only the dots inside the black squares remain.
So far, all I've done with this code is use inmextendedmin on the original grayscale image, and then masked it ontop of the grayscale image to produce this result.
figure(1);
imshow(grayImage);
mask = imextendedmin(grayImage,2);
figure(2);
imshow(mask);
figure(3);
imshowpair(grayImage,mask,'blend');
Before, I had been trying to use watershedding, dividing the background, and a lot of other neat tricks to try and single out the black dots, but it seems that this simple bit of code alone gets me half way to what I want (As each black square has a dot already in it, all i want are those dots). Is there a way to get rid of everything else in this image besides the gray dots inside the black dots?
The problem I often had with watershedding and whatnot is I needed a variable threshold, as well as watershedding was rather time and processes intensive, so I'm trying to find more efficient ways of doing it.
1 comentario
Kimo Kalip
el 21 de Jun. de 2018
Editada: Kimo Kalip
el 25 de Jun. de 2018
Respuesta aceptada
Más respuestas (1)
Kimo Kalip
el 22 de Jun. de 2018
0 votos
13 comentarios
Anton Semechko
el 22 de Jun. de 2018
You are welcome!
Kimo Kalip
el 22 de Jun. de 2018
Image Analyst
el 22 de Jun. de 2018
Is that "almost worked.png" your input image or output image?
You marked this as Accepted. So is it working or not? I tried to find https://www.mathworks.com/matlabcentral/answers/uploaded_files/122320/2steps%20from%20perfection.PNG but you seem to have taken it down for some reason. Do you still want help or not? If so, please post your input image.
Anton Semechko
el 23 de Jun. de 2018
Kimo, that example was specific to the image you posted. To get it to work for other similar images, you will have to adjust the intensity threshold for the background (set to 50 in the previous example).
Kimo Kalip
el 25 de Jun. de 2018
Anton Semechko
el 25 de Jun. de 2018
Or you can cut-out a representative region of the original image and post that
Kimo Kalip
el 25 de Jun. de 2018
Editada: Kimo Kalip
el 25 de Jun. de 2018
Anton Semechko
el 25 de Jun. de 2018
I would include a larger portion of the region containing the "dots" you want to segment in the sample image
Kimo Kalip
el 25 de Jun. de 2018
Anton Semechko
el 25 de Jun. de 2018
Yeah, that should work. Now what is your question?
Kimo Kalip
el 26 de Jun. de 2018
Anton Semechko
el 26 de Jun. de 2018
Editada: Anton Semechko
el 26 de Jun. de 2018
For your type of image data, you can try to automate threshold selection as follows:
(1) Initialize threshold (e.g., thr=10)
(2) Apply threshold to image and count the number of connected components (representing the "wells" in which the white dots are embedded) above some a priori defined area
(3) Increment threshold: thr_new <-- thr + 1
(4) Repeat (2) using thr_new and compare number of connected components obtained with thr, if the number of "wells" decreases, accept thr as best value of intensity threshold and terminate search, otherwise set thr <-- thr_new and go to step (2)
Kimo Kalip
el 27 de Jun. de 2018
Categorías
Más información sobre Lighting, Transparency, and Shading en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
