Changing image not showing upon display.

I am trying to crop an image and be able to manipulate in some way (I adjusted contrast) and show change in formatting as its displayed beside the original image (by making it turn more and more blue).
The code runs successfully, but it seems to already have made the cropped image as blue as the for loop would take it.
How can I edit the code so that as the original is displayed beside the cropped, the cropped image is showing the change in formatting of turning more and more blue?
This is my attempt thus far:
I = imread('peppers.png');
I2 = imcrop(I);
I3 = imadjust(I2,[.2 .3 0; .6 .7 1],[]);
subplot(1,2,1), subimage(I);
for i = 1:0.1:7
I3(:,:,3) = I3(:,:,3) + i;
subplot(1,2,2), subimage(I3)
end
To understand what I mean when I say the image turns more and more blue, please run:
img = imread('peppers.png');
for i = 1:0.1:7
figure(1)
img(:,:,3) = img(:,:,3) + i;
imshow(img)
end
Help would be much appreciated.

답변 (1개)

Siam
Siam 2014년 11월 12일

0 개 추천

Do you mean you want original image, cropped of the original and then enhancement to blue fro the cropped one next to the original cropped?
If so, you can try this !!!
I = imread('peppers.png');
subplot(1,3,1);
imshow(I,[]);
I2 = imcrop(I);
subplot(1,3,2),
subimage(I2);
I3 = imadjust(I2,[.2 .3 0; .6 .7 1],[]);
for i = 1:0.1:7
I3(:,:,3) = I3(:,:,3) + i;
subplot(1,3,3),
subimage(I3);
end

댓글 수: 3

Muaaman
Muaaman 2014년 11월 12일
I need one image that's the original, and beside it is the cropped image. The cropped image has to show its enhancing of blue effect when displayed, but the issue when running the code is that it already enhances to its maximal effect upon the cropped image displaying.
Thanks for your effort and reply though.
Siam
Siam 2014년 11월 12일
What do yo mean by blue effect? Its it blue channel only? To display only blue channel after cropped and enhancement just use subimage(I3(:,:,3)) instead of subimage(I3);
DGM
DGM 2022년 11월 13일
All you need to do is use pause() (and maybe a drawnow()) in the loop so that the intermediate results have some time to be seen.
Whew! Answered that one just in the nick of time.

댓글을 달려면 로그인하십시오.

질문:

2014년 11월 11일

편집:

DGM
2022년 11월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by