Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
How can I set the size of figure window, so all the figures can how the images only within the window?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
I get multiple images from my code and they have different sizes, such as 30x10, 50x10, 70x10, and 90x10 as an example. If I am only interested in 60x10 in the center of all figures, can I crop the outsides of bigger images before the figures are created?
For example, I want 30x10 and 50x10 images just to be output, but 70x10 and 90x10 to be cropped. In other words, I want to look at the figures through 60x10 window and save them.
Is there any way to do that? I tried figure('Position',[left bottom width height]), but it just shrank the whole figure.
Any comment would be appreciated.
Thanks,
ROJO
0 Commenti
Risposte (1)
Walter Roberson
il 1 Feb 2017
newimage = YourImage;
if size(newimage, 1) > 60; newimage = newimage(1:60,:,:); end
if size(newimage, 2) > 10; newimage = newimage(:, 1:10, :); end
2 Commenti
Walter Roberson
il 1 Feb 2017
Example:
YourImage = imread('peppers.png');
gimg = rgb2gray(YourImage);
[~, h] = contour(gimg);
axis off
frame_struct = getframe( ancestor(h, 'axes') );
contour_img = frame_struct(1).cdata;
newImage = contour_img;
if size(newImage, 1) > 60; newImage = newImage(1:60,:,:); end
if size(newImage, 2) > 10; newImage = newImage(:, 1:10, :); end
imshow(newImage)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!