Domanda

It might be a simple task but I'm stuck on it, here is what I want to do :

When we want to only see a part of the grayscales of an image we can do this :

figure, imshow(GrayScaleImage, [0 0.6]);

My problem is that I would like to get a usable image from this, not just for display, something like :

PartGrayScaleImage = GrayScaleImage([0 0.6]);

Does anyone know the proper way of doing this?

Thanks!

È stato utile?

Soluzione

This should work:

%create Mask
mask = GrayScaleImage < 0.6;
%cope Image
PartGrayScaleImage = GrayScaleImage
%Apply the Mask
PartGrayScaleImage(~mask) = 0;

Altri suggerimenti

PartGrayScaleImage = GrayScaleImage/.6; %// amplify so that (0,0.6) becomes (0,1)
PartGrayScaleImage(PartGrayScaleImage>1) = 1; %// trim to 1 (like imshow does)
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top