确定集合中最大图像的大小 - Matlab

时间:2015-11-12 14:13:46

标签: matlab

我有5个不同的图像(可以更改),确定哪个图像尺寸最大的最有效方法是什么?

脚本:

Img1 = rgb2gray(imread('http://oi41.tinypic.com/2d9qx6o.jpg'));
size(Img1);
Img2 =  rgb2gray(imread('pillsetc.png'));
size(Img2);
Img3 =  rgb2gray(imread('peppers.png'));
size(Img3);
Img4 =  rgb2gray(imread('http://oi43.tinypic.com/239lhv.jpg'));
size(Img4);
Img5 =  (imread('rice.png'));
size(Img5);

A = [Img1 Img2 Img3 Img4 Img5];
max(A)

1 个答案:

答案 0 :(得分:1)

确定哪一个“更大”或具有“最大因子”的几种方法: - )

images = {Img1, Img2, Img3, Img4, Img5};

[~, n_max_pixels]    = max(cellfun(@numel,         images));
[~, n_max_height]    = max(cellfun(@(x) size(x,1), images));
[~, n_max_width]     = max(cellfun(@(x) size(x,2), images));
[~, n_max_kewlness]  = max(cellfun(@(x) rand(1),   images));