MATLAB Answers

How can i make vector lengths the same?

조회 수: 3(최근 30일)
Lucaci Diana
Lucaci Diana 2020년 11월 26일
댓글: Lucaci Diana 2020년 11월 26일
%%read normal image first
im = imread('thing.jpeg');
title('Normal Image');
%%read infrared image
im1 = imread('thing_infrared.jpeg');
title('Infrared Image');
%%convert normal inamge to gray scale
b = rgb2gray(im);
b = double(b);
%%covnert infrared image to gray scale
c = rgb2gray(im1);
c = double(c);
%%reading pixels for normal image
b1 = imshow(b);
vector = reshape(b, [1600*1200 1]);
%%reading pixels for infrared image
c1 = imshow(c);
vector1 = reshape(c, [1280*960 1]);
%%before plotting you need to make the vectors of the same length
%%plot(vector_lower(1:minlen) + vector1_lower(1:minlen), y);
%%maxlen = max(length(vector_lower), length(vector1_lower));
%%plot(vector_lower(1:maxlen) + vector1_lower(1:maxlen));
I have found this maxlen and minlen functions, but they aren t working. Should it be something to do with 255? Like divide somewhere to get 255 pixels?
Thank you
  댓글 수: 2
Lucaci Diana
Lucaci Diana 2020년 11월 26일
thank you

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

채택된 답변

LO 2020년 11월 26일
To solve a similar issue I use imresize
First get the size of the image (with the function "size"),
then resize image 2 according to the dimensions you got (see code below)
image_size = size(your_image);
resized_image = imresize(your_image, [image_size(1) image_size(2)]);
  댓글 수: 1
Lucaci Diana
Lucaci Diana 2020년 11월 26일
thank you so much

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

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by