从文件夹中检索图像并将其显示在matlab的图形窗口中

从文件夹中检索图像并将其显示在matlab的图形窗口中

本文介绍了从文件夹中检索图像并将其显示在matlab的图形窗口中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正致力于基于内容的图像检索。

I am working on content based image retrieval.

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

I have found the images which are more similar to the query image and stored the result in a matrix as follows

q =

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

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

100th image is more similar, 50th image is the second image that is more similar.

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

All these images are in a folder. How to retrieve these images inside matlab ?

推荐答案

怎么样

 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

这篇关于从文件夹中检索图像并将其显示在matlab的图形窗口中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-07 00:33