Changing image not showing upon display.
2 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Siam
2014-11-12
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 个评论
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
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.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!