How to extract ROI on grayscale image using edge detection
Mostrar comentarios más antiguos
Hello.
I want to extract the white area on the image below (ROI) by using edge detection. I want to do this beacouse I must get very precise mask of white region. The image loks like this:

If I use some of matlab's inbuild function the prolem is that I also get edges outside of the white areas (on the border between black area and gray area).

I also have to close the whole white area to get mask, after properly detected edges...
Any other suggestions to calculate mask of white area on the first image?
Thank you all!!
Respuesta aceptada
Más respuestas (3)
Hello Andraz!
In order to solve this, you need to separate the black from the grey and from the white. To do so, it is necessary to apply a threshold algorithm which differentiates each one from another ( Thresholding a greyscale image).
At the moment I don't have Matlab with me, but I suggest you have a look at the following documentation about function imbinarize(): https://es.mathworks.com/help/images/ref/imbinarize.html?searchHighlight=threshold#inputarg_method ..specially to the coins example, in which you can see that the medium 'grey' has been supressed from the image.
Additionally, this demo might help you too: https://es.mathworks.com/matlabcentral/fileexchange/29372-thresholding-an-image
Regards,
Image Analyst
el 17 de Nov. de 2016
You don't want to use edge detection. Why would you want to do that??? Simply threshold and use sum(), bwarea(), or regionprops()
subplot(2,2,1);
imshow(grayImage, []);
subplot(2,2,2);
histogram(grayImage);
binaryImage = grayImage > someThreshold; %
subplot(2,2,3);
imshow(binaryImage);
area1 = sum(binaryImage(:))
area2 = bwarea(binaryImage)
props = regionprops(bwlabel(binaryImage), 'Area');
area3 = [props.Area]
Andraz Skoda
el 11 de Dic. de 2016
0 votos
1 comentario
Qazi Arbab Ahmed
el 21 de Dic. de 2016
Skoda may be you can also use this one, bw = imopen(bw, strel('disk', 5)); It can help you !
Categorías
Más información sobre Images en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

