문제

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!

도움이 되었습니까?

해결책

This should work:

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

다른 팁

PartGrayScaleImage = GrayScaleImage/.6; %// amplify so that (0,0.6) becomes (0,1)
PartGrayScaleImage(PartGrayScaleImage>1) = 1; %// trim to 1 (like imshow does)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top