【问题标题】:Retrieving images from a folder and displaying it in the figure window of matlab从文件夹中检索图像并在matlab的图形窗口中显示
【发布时间】:2013-02-25 10:02:35
【问题描述】:

我正在研究基于内容的图像检索。

我找到了与查询图像更相似的图像并将结果存储在矩阵中,如下所示

q =

     100       -1293
      50       -1237
       8       -1075
     102       -1024
     141        -951

第 100 个图像更相似,第 50 个图像是第二个更相似的图像。

所有这些图像都在一个文件夹中。如何在 matlab 中检索这些图像?

【问题讨论】:

    标签: image matlab image-processing matrix matlab-figure


    【解决方案1】:

    怎么样

     folder = 'c:\images'; % folder were all images are
     img_names; % a cell array where each cell is the name of the image, e.g. img_names{3} is 'photo005.png'
     n = size(q,1); % number of images to be displayed
     w = max(1, floor( sqrt(n) ) );
     h = ceil( n / w );
     figure('Name','Query results');
     for ii = 1:n,
         subplot(w,h,ii);
         img = imread( fullfile( folder, img_names{ q(ii,1) } ) );
         imshow( img );
         title( sprintf( '(%d) img %d score %d', ii, q(ii,1), q(ii,2) ) );
     end
    

    【讨论】:

    • 使用 img_names @Shai 时出现错误“未定义的函数或变量”
    • @user2031552 - 你必须自己定义这个变量,并根据它们的顺序用所有图像的文件名填充它。
    • @Mrk q 是您在问题中定义的查询结果。它是n by 2 矩阵,第一列是图像索引,第二列是分数。
    • 是的@Shai :-)。我忘记了问题中的变量(大声笑)。现在我做对了。非常感谢您的帮助。
    • @Mrk - 很高兴我能提供帮助!
    猜你喜欢
    • 2014-05-06
    • 2016-02-21
    • 2014-10-02
    • 2021-11-03
    • 1970-01-01
    • 2021-12-26
    • 2019-01-16
    • 1970-01-01
    相关资源
    最近更新 更多