Image 2:1

조회 수: 3 (최근 30일)
elTurco
elTurco 2023년 6월 2일
댓글: DGM 2023년 6월 2일
Hello everyone.
I want to reduce 4 images of 256 x 256 pixels in a ratio of 2:1
.
After reducing it, I want to combine it side by side and one under the other so that it is a 2x2 matrix and make it a single picture.
I want to calculate the mean and standard deviation of this image I have obtained.
How can i do it??
% Read the four standard images
image1 = imread('image1.jpg');
image2 = imread('image2.jpg');
image3 = imread('image3.jpg');
image4 = imread('image4.jpg');
% Resize the images to the desired size of 256x256 pixels
image1_resized = imresize(image1, [256 256]);
image2_resized = imresize(image2, [256 256]);
image3_resized = imresize(image3, [256 256]);
image4_resized = imresize(image4, [256 256]);
% Create a blank canvas for the combined image
combined_image = uint8(zeros(256, 512, 3));
% Place the resized images side by side in the combined image
combined_image(:, 1:256, :) = image1_resized;
combined_image(:, 257:512, :) = image2_resized;
combined_image(:, 513:768, :) = image3_resized;
combined_image(:, 769:1024, :) = image4_resized;
% Display the combined image
imshow(combined_image);

답변 (1개)

DGM
DGM 2023년 6월 2일
편집: DGM 2023년 6월 2일
This is essentially a duplicate of this question
Since the images are already 256x256, and they aren't JPGs, I suspect that this code that everyone is copy-pasting wasn't written by anyone who is pasting it. Given that, it's not clear whether any resizing is necessary.
Concatenate images of compatible size using [] operators or cat().
  댓글 수: 2
elTurco
elTurco 2023년 6월 2일
I am aware that it is 256 x 256, what I want to do is to reduce this image to 2:1, that is to make these 128x128 pixels
DGM
DGM 2023년 6월 2일
Then you can resize them to that specific size
A = imresize(A,[128 128]);
Or you can resize them by that specific factor
A = imresize(A,0.5);

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

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by