How can i make vector lengths the same?

11 vues (au cours des 30 derniers jours)
Lucaci Diana le 26 Nov 2020
Commenté : Lucaci Diana le 26 Nov 2020
subplot(311);
imshow(im);
title('Normal Image');
subplot(312);
imshow(im1);
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);
b1 = imshow(b);
impixelinfo(b1);
vector = reshape(b, [1600*1200 1]);
c1 = imshow(c);
impixelinfo(c1);
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 commentairesAfficher AucuneMasquer Aucune
KSSV le 26 Nov 2020
To make vectors lengths same, have a look on interp1. You can do interpolation.
Lucaci Diana le 26 Nov 2020
thank you

Connectez-vous pour commenter.

Réponse acceptée

LO le 26 Nov 2020
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 commentaireAfficher -1 commentaires plus anciensMasquer -1 commentaires plus anciens
Lucaci Diana le 26 Nov 2020
thank you so much

Connectez-vous pour commenter.

Catégories

En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by