Borrar filtros
Borrar filtros

Need to remove the black background from image patches

1 visualización (últimos 30 días)
I have patches of an image . I want to remove those patches which only contain the black background of the image . The image is medical CT scan image of the brain. As you can see in the attachment, the original image and the patches of that image, i want to remove those patches which are only black patches i.e patches of the image background.
FYI , please ignore label of the patch.

Respuesta aceptada

Image Analyst
Image Analyst el 8 de Jul. de 2016
Inside your loop where you're creating the subplots of the subimages, do this
for k = 1 : 121
thisImage = ....whatever....
if mean2(thisImage) < 20 % Or whatever value you want
continue;
end
subplot(......
end

Más respuestas (1)

Thorsten
Thorsten el 8 de Jul. de 2016
Editada: Thorsten el 8 de Jul. de 2016
You can detect an all-black patch P if the maximum value is 0 (in the ideal case) or below a certain threshold, say 0.1 (if the image values range from 0 to 1)
threshold = 0.1;
isblack = max(P(:)) < threshold;
And if it is black, you do not show the patch.

Categorías

Más información sobre Image Processing Toolbox 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