Make images into the same dimensions
17 ビュー (過去 30 日間)
古いコメントを表示
hello, So i am having trouble making images the same dimensions. I have a library of images and i need help accomplishing this.
i would like to search for the image with the biggest dimensions then have the other images form to that.
i tried useing
imresize(img(i),[376 292], 'bilinear')
just using a base row col but not all of them became the same
0 件のコメント
採用された回答
その他の回答 (1 件)
Image Analyst
2014 年 1 月 20 日
Inside the loop you just check the size of each image
[rows, columns, numberOfColorChannels] = size(theImage);
if rows > mostRows
mostRows = rows;
end
if columns > mostColumns
mostColumns = columns
end
Then do the loop again but call imresize() inside the loop
theImage = imresize(theImage, [mostRows, mostColumns]);
You can save it with the new size if you want, or just process it in the loop with whatever operations you want to do on it.
2 件のコメント
Diah Junaidi
2019 年 8 月 1 日
Got this error sir:
Undefined function or variable 'mostRows'.
Error in hitungRMSE (line 21)
if rows > mostRows
Image Analyst
2019 年 8 月 2 日
You should know the max number of rows that your images have. So just assign that variable to that number. You can find out in many ways, such as with a MATLAB script, or simply by looking at your images in File Explorer and see what it says the sizes are.
参考
カテゴリ
Help Center および File Exchange で Image Processing Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!