Problem with imresize function
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Dani D
am 12 Feb. 2016
Beantwortet: Image Analyst
am 12 Feb. 2016
Hello, I have problem with imresize :(
clear;
A=imread('dentist.jpg');
B=imread('gol.JPG');
imshow(A); pause(3);
imshow(B);pause(4);
B = imresize(A,size(B));
C = imadd(A,B);imshow(C);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154865/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154867/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/154868/image.jpeg)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 12 Feb. 2016
B is an RGB image, so size(B) is a 3 element array. When you pass in a 3 column vector or matrix into imresize, it expects it to be a colormap, not a size, and if it's a colormap it must be doubles in the range 0-1, not integers in the range of 0-thousands or whatever your size is.
You need to get the rows and columns by themselves. NEVER use size() like that on an image you read in with imread(). Why not? See this: http://blogs.mathworks.com/steve/2011/03/22/too-much-information-about-the-size-function/
The fix
[rowsB, columnsB, numberOfColorChannelsB] = size(B);
% Now resize A and overwrite the old B
B = imresize(A, [rows, columns]);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Red finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!