Changing image not showing upon display.

1 vue (au cours des 30 derniers jours)
Muaaman
Muaaman le 11 Nov 2014
Modifié(e) : DGM le 13 Nov 2022
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.

Réponses (1)

Siam
Siam le 12 Nov 2014
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 commentaires
Siam
Siam le 12 Nov 2014
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 le 13 Nov 2022
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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by