原型基于颜色的图像检索与MATLAB

合集下载

基于内容的图像检索matlab小程序

基于内容的图像检索matlab小程序

基于内容的图像检索matlab小程序基于内容的图像检索matlab小程序,使用图像的9种主要颜色为检索特征。

% RGB retrieval%fid=fopen('ninecolor3_distr.dat','r'); normalized central moments fid=fopen('ninecolor2_distr.dat','r');%fid2=fopen('edge2_radon_svd0.dat','r');%fid1=fopen('edge2_radon_svd90.dat','r');%fid3=fopen('edge2_radon_0org.dat','r');%fid4=fopen('edge2_radon_90org.dat','r');fid2=fopen('ninecolor2_dist.dat','r');PCACOE=10;MU=0.78315;DLT=0.16879;MAX=1.6582;MIN=0;MU1=58.781;DLT1=19.922;MAX1=130.83;MIN1=0;MU2=2.6843;DLT2=0.66799;MAX2=4.5187;MIN2=0;%fid1=fopen('avecolor.dat','r'); %for (i=1:910)% tmp_mom=fread(fid1,10,'float'); % ind12(:,i)=tmp_mom(1:PCACOE); % tmp_mom=fread(fid2,10,'float'); % ind13(:,i)=tmp_mom(1:PCACOE); %end %ind_pca0=ind12';%ind_pca90=ind13';%fclose(fid1);%fclose(fid2);%for (i=1:910)% tmp_mom=fread(fid3,128,'float'); % ind14(:,i)=tmp_mom(1:128); % tmp_mom=fread(fid4,128,'float'); % ind15(:,i)=tmp_mom(1:128); %end %ind_0org=ind14';%ind_90org=ind15';%fclose(fid3);%fclose(fid4);for (i=1:910)hist1(:,i)=fread(fid2,18,'float'); endind_dis=hist1';fclose(fid2);for (i=1:910)hist(:,i)=fread(fid,63,'float'); endind_c=hist';fclose(fid);NULL_seg=[0 0 0 0 0 0 0];isize=910;qi=1;dist1=0;qi=input('Query image no:(1-910 or 0 to quit)');while (qi~=0)qh=ind_c(qi,:);for (cnt=1:910)dist=0;db=ind_c(cnt,:);for (j=1:9)%% L1/L2 Distancestmp_vec=qh((j-1)*7+1:j*7);tmp_vec1=db((j-1)*7+1:j*7);%if ((tmp_vec==NULL_seg)|(tmp_vec1==NULL_seg))%% if (sum(tmp_vec(4:6))~=0) %% angl=1-(2/pi)*acos(abs(tmp_vec(4:6)*tmp_vec1(4:6)'));%% else%% angl=0;%% end%% if (angl<0)%% angl=0;%% end%dist=dist+norm(tmp_vec(1:3)-tmp_vec1(1:3),2)+angl+abs(tmp_vec(7)-tmp_vec1(7));dist=dist+norm(tmp_vec(1:6)-tmp_vec1(1:6),2)+abs(tmp_vec(7)-tmp_vec1(7));%dist=dist+norm(tmp_vec-tmp_vec1,1);end% Distance of SVD coefficients%%dist1=0.5*(norm(ind_pca90(qi,:)-ind_pca90(cnt,:),2)+norm(ind_pca0(qi,:)-ind_pca0(cnt,:),2));%%dist2=0.5*(norm(ind_90org(qi,:)-ind_90org(cnt,:),2)+norm(ind_0org(qi,:)-ind_0org(cnt,:),2));%% New distance%%DIST=0;%% for (k=1:9)%% DIST=DIST+qh(k*7)^2;%5 end%% for (j=1:9)%% DIST=DIST+db(j*7)^2;%% end%% for (k=1:9)% for (j=1:9)% tmp_arr=db((j-1)*7+1:j*7);%% d1=norm(qh((k-1)*7+1:(k-1)*7+6)-tmp_arr(1:6),2); % if (d1>0.08)% a1=0;% else% a1=1-d1/0.096;% end% DIST=DIST-2*a1*qh(k*7)*tmp_arr(7);%dist00(k,j)=norm(query0((k-1)*4+1:(k-1)*4+3)-tmp_arr(1:3),2)+sum(abs(query0(k*4)-tmp_arr(4)));%dist00(k,j)=sum(abs(query0((k-1)*4+1:(k-1)*4+4)-tmp_arr(1:4)));%%dist00(k,j)=norm(query0((k-1)*4+1:(k-1)*4+3)-tmp_arr(1:3),1)+(1-min(query0(k*4),tmp_arr(4))/max(query0(k*4),tmp_arr(4)));%%dist01(k,j)=norm(query0((k-1)*2+1:k*2)-tmp_arr(1:2),2);%dist01(k,j)=norm(ind_ctroid(qi,(k-1)*2+1:k*2)-ind_ctroid(cnt,(j-1)*2+1:j*2),2);%%dist02(k,j)=norm(hsv_pca0(q_no+k-1,:)-hsv_pca0(db_no+j-1,:),2)+norm(hsv_pca90(q_no+k-1,:)-hsv_pca90(db_no+j-1,:),2);%% end%% end%% dist=DIST;dist1=norm(ind_dis(qi,:)-ind_dis(cnt,:),1);%dist=0.0*dist+1.0/1*(dist1-(MU-3*DLT))/(6*DLT);%dist=0.0*dist+1.0/1*(dist1-MIN)/MAX; dist2=0;dist=1.0*(dist-(MU2-3*DLT2))/(6*DLT2)+0.0*(dist1-(MU1-3*DLT1))/(6*DLT1)+0.0*dist2;result(:,cnt)=[dist cnt]';end%查询结果显示format short g;result1=result';%result2(:,1)=result1(:,2);%result2(:,2)=result1(:,1);result2=sortrows(result1);%disp(result2(isize-9:isize,:)); disp(result2(1:10,:));%Display first ten IMAGESpause;%name=input('Search image:','s'); i=0;%figure;rank=1;%for (k=isize:-1:isize-9)wh=figure;set(wh,'Color',[0.8 0.8 0.8]);set(wh,'Units','Normal');set(wh,'Position',[0.05 0.05 0.9 0.8]); set(wh,'MenuBar','none'); for (k=1:50)bmpno=round(result2(k,2)-1);iname=sprintf('f:\\image\\img\\%d.jpg',bmpno);[img map]=imread(iname);if (isrgb(img))[img map]=rgb2ind(img,256);endimg=imresize(img,[200 256]); %[128 128]hdl=subplot(5,10,rank);sv=strcat('',num2str(result2(k,1)));% frno=ceil(k/10);% fcno=mod(k,10);% if (fcno==0)% fcno=10;% end%subimage((frno-1)*0.1,(fcno-1)*0.1,img,map);subimage(img,map);%%set(hdl,'Units','Pixels');%%set(hdl,'Position',[0.05+mod(rank-1,10)*0.09 0.95-(floor((rank-1)/10)+1)*0.18 0.09 0.18]);%%lh=get(hdl,'Xlabel');%%set(lh,'String',sv);set(hdl,'Title',text('String',sv));posxy=get(hdl,'Position');%%set(gcf,'Units','normalized');rfcbox=uicontrol(gcf,'Style','Checkbox','Units','normalized',...'Position',[posxy(1) posxy(2)-0.02 0.086 0.052],...'String','RF=N','CallBack','my_rf');%% ['set(gca,"RF","N"),','if get(rfcbox,"Value")==1,', 'set(gca,"RF","Y"),','end'] 'String','Box=on',...set(hdl,'YTickLabel',[]),set(hdl,'XTickLabel',[]);%set(hdl,'YGrid','off'),set(hdl,'XGrid','off');set(hdl,'YTick',[]),set(hdl,'XTick',[]);set(hdl,'Box','off');rank=rank+1;end%end%flopsqi=input('Query image no:(1-110 or 0 to quit)');end。

基于HSV颜色特征图像检索算法在Matlab中的实现

基于HSV颜色特征图像检索算法在Matlab中的实现
提 出 的色 彩 直 方 图 的 方 法 日 。 由 于 色 彩 直 方 图具 有 简 单 且 随 图
因 此 ,人 们 迫 切 需 要 一 种 有 效 的 图像 信 息 检 索 工 具 来 满 足 检
索需求 。 传 统 的 图 像 检 索 技 术 是 基 于 文 本 索 引 的 图 像 检 索 ,它 通 过 用 文 本 描 述 图像 ,然 后 在 这 些 图像 文 本 标 注 基 础 上 应 用 成 熟 的文 本 搜 索 算 法 ,为 用 户 搜 索 预期 的 图像 。 虽 然 检 索 比较 准 确 而 且 速 度 很 快 .但 是 随 着 图 像 数 据 库 规 模 的 不 断 增 大 。 这 种 检 索 消 耗 的 时 间 也 大 大 增 加 。 另 外 , 人 工 标 注 具 有 强 烈 的 主 观 性 和 不 确 定 性 。不 同 用 户 对 同 一 图像 的 理 解 有 时 具 有 很 大 的差 异 ,进 而使 得 文 本 标 注 具 有 很 大 的 差 异 性 ,直 接 导 致 搜 索 的 不 正 确 性 。 鉴 于 上 述 因素 ,人 们 提 出 了一 种 新 的 图 像 检 索 技术 一 基 于 图像 内容 的 检 索 C B I R( c o n t e n t e d — b a s e d i m .
1 图像 检 索算 法研 究现状
随着 科 技 的不 断进 步 和多 媒体 技 术 的不 断发 展 .以 图 片 、图 表 、 动 画 和 视 频 为 主 要 形 式 的数 字 多 媒 体 的 数 据 量 日 益 庞 大 。尤 其 是 在 科 学 计 算 、可 视 化 、工 程 制 图 及 其 他 众 多
电脑编程技巧与维护
基于 H S V颜色特征 图像检索算法在 Ma t l a b中的实现

Matlab物体检测算法原型初步实验结果

Matlab物体检测算法原型初步实验结果

Matlab物体检测算法原型初步实验结果近年来,物体检测算法在计算机视觉和机器学习领域中得到了广泛应用。

本文将介绍一个基于Matlab的物体检测算法原型,并分享初步实验结果。

一、算法原理该算法的基本原理是通过图像处理和机器学习技术,对输入的图像进行分析和识别,识别出其中的物体。

具体步骤如下:1. 预处理:首先,对输入的图像进行预处理,包括图像增强、去噪和边缘检测等操作,以提高后续的物体检测效果。

2. 特征提取:使用特征提取算法,从图像中提取出有助于物体识别的特征,例如颜色直方图、形状描述符、纹理特征等等。

3. 目标识别:利用机器学习中的分类算法,通过训练一些样本图片,建立物体模型,并将模型应用于待检测图像,得出物体的位置和类别。

二、实验设置为了验证该算法的性能,我们使用了多个数据集进行实验。

其中包括含有不同物体的图像,如车辆、人体、动物等。

实验环境配置如下:- 操作系统:Windows 10- Matlab版本:R2020a- 计算机配置:Intel Core i7 CPU,16GB RAM三、实验结果针对不同数据集的图像,我们进行了一系列实验,并对实验结果进行了评估。

以下是部分实验结果的描述:1. 数据集A:- 物体类型:车辆- 实验结果:在100张测试图像中,平均准确率为85%。

大多数情况下,算法能够准确地检测出车辆的位置和类别。

2. 数据集B:- 物体类型:行人- 实验结果:在200张测试图像中,平均准确率为78%。

算法对于正面和侧面的行人识别效果较好,但对于背对相机的行人识别效果较差。

3. 数据集C:- 物体类型:动物- 实验结果:在50张测试图像中,平均准确率为92%。

算法能够准确地检测出动物的位置和类别,对于不同种类的动物表现出较好的泛化能力。

四、实验讨论根据实验结果,我们可以得出以下几点讨论:1. 该算法在不同数据集上的准确率存在一定差异,这可能是由于不同物体的外观特征和背景干扰的差异导致的。

基于MATLAB彩色图像的特征提取与研究

基于MATLAB彩色图像的特征提取与研究
随着计算机视觉研究的不断进步、多媒体技术和虚拟现实技术的不断完善、彩色成像设备的不断改进,彩色图像的应用越来越广泛,然而,图像处理研究仍然集中在灰度图像上。对灰度图像的技术通常不能用到彩色图像,因为彩色图像更复杂,对计算机的计算速度与存储容量更高。彩色图像处理己经成为当前图像处理领域重要的研究课题。图像的特征有颜色、形状、纹理等。颜色是物体表面的属性,因此对于图像分割和目标识别等的研究都具有非常重要的意义。
本文以普通的彩色图像为例,介绍了对彩色图像特征提取的原理。其具体过程分为原图像的预处理、图像信息分析、图像的特征提取,然后用MATLAB实现具体的过程,最后获得需要的颜色特征、纹理特征、轮廓特征等。测试结果表明,本课题充分利用MATLAB中已有的函数库,使整个研究简单易行。可以有效的掌握彩色图像特征信息提取的方法和知识点。从原理和应用效果上对经典的图像分割方法如边缘检测、阈值分割技术和区域增长等进行了分析。对梯度算法中的Roberts算子、Prewitt算子、坎尼(Canny)算子的分割步骤、分割方式、分割准则相互比较可以看出根据坎尼(Canny)边缘算子的3个准则得出的边缘检测结果最满意。而阈值分割技术的关键在于阈值的确定,只有阈值确定好了才能有效的划分物体与背景,这种方法对于那些灰度分布明显,背景与物体差别大的图像的分割效果明显。区域增长的基本思想是将具有相似性质的像素集合起来构成新区域。与此同时本文还分析了图像分割技术研究的方向。
关键词:彩色图像;特征提取;图像处理;图像分割;
Abstract
Feature extraction is a concept in computer vision and image processing. It refers to use the computer to extract image information, to determine whether each image point belongs to an image characteristic. Feature extraction is the result of the points on the image is divided into different subsets of these subsets are often belong to the isolated points, continuous curve or continuous area.In the case of ordinary color images, this paper introduces the principle of the color image feature extraction. The specificprocess is divided into original image preprocessing, image analysis, image feature extraction, and thenusedMATLAB to realize the process of concrete, finally get the need to color features and texture features, outline, etc. To general color images through the image preprocessing and image analysis, can extract the image feature, such as color, shape, texture feature, for image retrieval, and color image processing technology has a lot of help. Test results show that this topic make full use of MATLAB in the library, make whole study is simple.This article analyses the application effect to the classics imagesegmentationmethod like the edge examination, territory value division technology, and the region growth and so on.For comparing the Roberts operator,Prewitt operator,Cannyoperator in gradient algorithm,the way and thestandardof theimagesegmentation,we can find out the three standard of Canny edge operator the edge detection result of reaching most satisfy. And the key point of thresholdsegmentationlie in fixing the threshold value, it is good to have only threshold value to determine it then can be effective to divide object and background,but this kind of method is good to those gray scales,the big difference image effect between the background and object. The basic idea of area is to form the new region from similar nature.And also, this paper analyses the research direction of imagesegmentationtechnology at the same time.

一种基于颜色特征的图像检索方法的设计和实现

一种基于颜色特征的图像检索方法的设计和实现

一种基于颜色特征的图像检索方法的设计和实现陈雅卿【摘要】本文选用MATLAB程序设计语言,利用RGB颜色空间提取颜色特征值,用距离度量函数进行图像的相似性匹配,以符合视觉习惯的HSV模式显示检索结果,完成基于图像颜色特征的图像检索演示系统.【期刊名称】《安徽电子信息职业技术学院学报》【年(卷),期】2011(010)003【总页数】3页(P16-18)【关键词】颜色特征;图像检索;MATLAB语言【作者】陈雅卿【作者单位】泉州黎明职业大学计算机与信息工程系,福建泉州362100【正文语种】中文【中图分类】TP391.41一、引言随着网络图像的急剧增加,通过图像表达的信息越来越多,图像信息的查询技术的意义就在于从众多的图像中定位有用的信息。

基于内容的图像检索则可以直接对图像内容进行的特征检索,找到具有指定特征或内容的图像。

它借鉴了数据搜索的思想,旨在通过对视觉信息提供强有力的描述,实现视觉信息的结构化,最终达到用户对这些视觉信息内容自由访问的目标。

如今,基于内容的图像检索是当前最活跃的研究热点之一。

以图像特征为索引对静态图像进行检索是目前使用最多的方法。

主要思想是根据图像的颜色、纹理、形状特征以及语义特征等内容特征作为图像的索引,计算查询图像与目标图像的相似距离,按相似度匹配进行检索。

(1)对颜色的空间分布是人类判断图像的最初印象,因此颜色通常是图像中最为显著的特征。

颜色是描述一幅图像最简便而有效的特征,(2)纹理特征是图像的重要信息和特征,是一种全局特征,它描述了图像或图像区域所对应的景物的表面性质,包括表面结构组织及其与周围环境关系的许多重要信息。

(3)形状特征是图像的另一重要特征,当查询是针对同一类具有相似形状的物体时,虽然其颜色可能各不相同,但物体的轮廓却是大致相同的。

此时形状是它唯一重要的特征。

(4)语义特征包括图像来源,拍摄时间和地点、媒介类型,分辨率、输入设备、压缩方式以及与图片相关的注释信息,是对于图像信息最直接的描述。

如何使用MATLAB进行图像匹配与检索

如何使用MATLAB进行图像匹配与检索

如何使用MATLAB进行图像匹配与检索引言图像匹配与检索是图像处理和计算机视觉领域中的重要任务,其应用涵盖了人脸识别、图像搜索、智能监控等众多领域。

而MATLAB作为一款强大的数学计算和图像处理软件,提供了丰富的工具和函数,便于进行图像匹配与检索的研究与实践。

本文将介绍如何使用MATLAB进行图像匹配与检索的基本原理、方法以及示例应用。

一、图像匹配与检索的基本原理1.1 图像匹配图像匹配指的是在给定图像数据库中,找出与查询图像最相似的图像。

其基本原理是通过衡量图像间的相似度来进行匹配。

常用的相似度度量方法包括结构相似性指数(SSIM)、均方误差(MSE)、归一化互相关系数(NCC)等。

在MATLAB中,可以使用imfilter函数对图像进行滤波操作,并使用相关函数计算图像的相似度。

1.2 图像检索图像检索指的是根据查询图像的特征,从图像数据库中检索出相似的图像。

其基本原理是提取图像的特征,并根据特征之间的相似度进行检索。

常用的图像特征包括颜色直方图、边缘特征、纹理特征等。

在MATLAB中,可以使用histogram 函数对图像进行直方图特征提取,并使用特征匹配算法(如最近邻算法)进行图像检索。

二、图像匹配与检索的方法和实现2.1 图像匹配方法图像匹配方法包括基于特征点的匹配和基于全局特征的匹配。

前者是通过检测图像中的关键点,提取关键点的局部特征,然后通过寻找匹配点来实现图像匹配。

后者是通过提取图像的全局特征,比如颜色、纹理等信息,然后计算图像之间的相似度进行匹配。

在MATLAB中,可以使用SURF算法提取图像的特征点,或者使用Bag of Words(BoW)模型提取图像的全局特征,并通过最近邻算法进行匹配。

2.2 图像检索方法图像检索方法主要包括基于内容的检索和基于语义的检索。

前者是通过提取图像的低级视觉特征,比如颜色、形状等,然后根据相似度进行检索。

后者是通过利用机器学习和自然语言处理技术,将图像关联到语义标签,然后根据语义标签进行检索。

颜色识别matlab

颜色识别matlab

颜色识别matlab以颜色识别Matlab为标题,本文将介绍使用Matlab进行颜色识别的方法和步骤。

颜色识别是计算机视觉中的重要任务之一,可以广泛应用于图像处理、机器人导航、智能交通等领域。

我们需要明确颜色识别的定义。

颜色是由物体反射或发射的光的波长决定的,不同波长的光对应不同的颜色。

在计算机中,颜色通常由RGB(红、绿、蓝)三个通道的数值表示。

通过分析图像中每个像素的RGB值,我们可以判断该像素所对应的颜色。

在Matlab中,可以使用以下步骤实现颜色识别:1. 读取图像:使用imread函数读取待处理的图像。

确保图像文件在Matlab当前工作目录下,并指定文件名。

2. 转换颜色空间:大多数图像处理算法都是在RGB颜色空间下进行的,但颜色识别通常需要将图像转换到其他颜色空间。

常用的颜色空间包括HSV、Lab等。

在Matlab中,可以使用rgb2hsv、rgb2lab等函数进行颜色空间的转换。

3. 设定颜色阈值:根据需要识别的颜色,设定颜色阈值。

颜色阈值是一个范围,包括最小值和最大值。

在转换后的颜色空间中,将图像中的像素值与阈值进行比较,判断像素是否属于目标颜色范围。

4. 二值化处理:将图像进行二值化处理,即将图像中的像素值分为两类:目标颜色范围内的像素和其他像素。

可以使用imbinarize函数实现二值化处理。

5. 进行形态学操作:为了去除图像中的噪声和不连续的区域,可以使用形态学操作进行图像的腐蚀和膨胀。

常用的形态学操作函数包括imerode和imdilate。

6. 进行连通区域分析:使用bwlabel函数对二值化后的图像进行连通区域分析,得到图像中的不同颜色区域。

每个区域被赋予一个标签。

7. 可视化结果:可以使用imshow函数将处理后的图像显示出来,观察颜色识别的效果。

可以使用label2rgb函数将不同的连通区域标签以不同的颜色显示。

通过以上步骤,我们可以在Matlab中实现颜色识别。

利用Matlab进行图像检索和相似度匹配的技术

利用Matlab进行图像检索和相似度匹配的技术

利用Matlab进行图像检索和相似度匹配的技术图像检索和相似度匹配是计算机视觉领域的重要研究方向之一。

随着数字图像的快速增长,如何高效地从大规模图像数据库中检索出目标图像,成为了一个迫切需要解决的问题。

同时,对于图像的相似度匹配也可以应用于图像分类、目标识别等方面。

本文将介绍利用Matlab进行图像检索和相似度匹配的技术。

1. 图像检索图像检索是指根据用户的需求,在图像数据库中查找与查询图像相似的图像。

图像检索技术主要包括两个方面:特征提取和相似度度量。

1.1 特征提取特征提取是图像检索的基础,其目的是将图像转换为能够用于度量相似度的向量表示。

在Matlab中,可以使用各种特征提取算法,如颜色直方图、纹理特征、形状描述符等。

其中,颜色直方图是最常用的一种特征表示方法,可以通过统计图像中像素的颜色分布来描述图像的特征。

在Matlab中,可以利用图像处理工具箱中的函数实现颜色直方图的提取。

1.2 相似度度量相似度度量是图像检索的关键步骤,其目的是评价两个图像之间的相似度。

在Matlab中,可以利用各种相似度度量方法,如欧氏距离、余弦相似度等。

其中,欧氏距离是最常用的一种相似度度量方法,可以通过计算两个图像表示向量之间的距离来评价它们的相似程度。

在Matlab中,可以利用距离度量函数实现欧氏距离的计算。

2. 相似度匹配相似度匹配是指在给定一个查询图像后,从图像数据库中找出与之最相似的图像。

相似度匹配的关键是建立一个高效的索引结构来加速查询过程。

在Matlab中,可以利用各种索引结构,如KD树、LSH等。

其中,KD树是一种常用的索引结构,可以将高维空间划分为多个子空间,通过比较查询图像和数据库图像在子空间的分布情况来确定相似度。

在Matlab中,可以利用KD树算法包建立索引结构,并进行相似度匹配。

3. 实例应用图像检索和相似度匹配技术在实际应用中有着广泛的应用。

例如,在商业领域,可以利用这些技术实现商品的图像搜索,帮助用户更快速地找到所需的商品;在医学领域,可以利用这些技术实现图像的匹配和比对,帮助医生进行疾病的诊断和治疗等。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Prototyping Color-based Image Retrieval with MATLAB® Petteri Kerminen1, Moncef Gabbouj21Tampere University of Technology, Pori, Finland 2Tampere University of Technology, Signal ProcessingLaboratory, Tampere, FinlandAbstractContent-based retrieval of (image) databases has become more popular than before. Algorithm develop-ment for this purpose requirestesting/simulation tools,but there are no suitable commercial tools on the market.A simulation environment for retrieving images from database according histogram similarities is presented in this paper. This environment allows the use of different color spaces and numbers of bins. The algorithms are implemented with MATLAB. Each color system has its own m-files.The phases of the software building process are pre-sented from system design to graphical user interface (GUI). The functionality is described with snapshots of GUI.1. IntroductionNowadays there are thousands or hundreds of thousands of digital images in an image database. If the user wants to find a suitable image for his/her purposes, he/she has to go through the database until the correct image has been found or use a reference book or some “intelligent” program. Video on demand (VoD) services also requires an intelligent search system forend-users. VoD systems’ search methods differ slightly from image database’s methods.A reference book is a suitable option, if the images are arranged with a useful method, for example: 1)categories: animals, flags, etc, 2) names (requires a good naming technique) or 3) dates. An experienced user can use these systems as well as textual searches (keywords have to be inserted in a database) efficiently. There are situations when a multi-language system has to be used. There a language independent search system’s best properties can be utilized. A tool which is based on the images’ properties can be madelanguage independent. These properties can be for example color, shape, texture, spatial location of shape etc.In the MuVi-project [1] this kind of tool is under construction. It will cover the properties presented above.Research work on content-based image retrieval has been done in [2 – 6]. The system, which is presented in this paper, is a simulation environment, where MuVi’s color content based retrieval has been developed and tested.2. System developmentMATLAB is an efficient program for vector and matrix data processing. It contains ready functions for matrix manipulations and image visualization and allows a program to have modular structure. Because of these facts MATLAB has been chosen as prototyping software.2.1 System designBefore any m-files have been written, the system designhas been done. A system design for the HSV (hue, saturation and value) color system based retrieval process is presented in Figure 1. Similar design has been done for all used color systems.Figure 1: Function chart for HSV color space with 27 bins histogram.T esths27 is the main function for this color system and this number of bins. It calls other functions(hs27read, dif_hsv and image_pos) when needed. Each color system has a main function of its own and variable number (2 – 3) of sub-functions. If there is no need for color space conversion there are 2 functions,otherwise 3 functions on the first branch of the function chart.The function call of the main function is:matches=tesths27(imagen,directory,num)The variable imagen specifies the query image’s name and path. The directory is a path of the image database and num is a desired number of retrieved images.2.2 FunctionsAt this moment there are functions implemented for four color spaces: HSV, L*a*b*, RGB and XYZ [7]. Each color space has from 2 to 4 implementations for different numbers of bins. There are altogether 14 main functions.For some color systems it is possible to make these functions dynamic, i.e. dynamic histogram calculation. Every color system / bin combination requires its own histograms and these can be made only with an exhaustive method (pixel by pixel). Histogram calculation takes ½ - 5 minutes per image, each approximately 320×240 pixels, depending on the complexity of the color space on 150 MHz Pentium. Thus it is not reasonable to let the user select a bin number freely, especially in the case of large databases.The functions have been named so that the names contain information of the color space used, the purpose of the functions and the number of used bins. Some functions, for example image_pos, have been used by many or all main functions and these functions have not been named as described above.The main function checks, if the function call is correct. If the query image’s name doesn’t contain a path, the function assumes that the image is situated in the database directory. In addition to this, the main function checks,if the query image already has a histogram in the currently used database. If the required histogram is not there, the image read (for example hs27read) function is called. This function also normalizes pixel values and arranges image matrix data to a vector format. After that stage a color space conversion function (if needed) is called. Finally a quantization function builds the histogram with the correct number of bins.The histogram will then be saved into the database directory. If the histogram already exists there, the three previous steps will not be executed. Now the query image has been analyzed. Then the main function will go through all images in the database directory with an almost similar algorithm as in the case of the query image. The difference is that now there will be a histogram difference calculation between the query image’s and current image’s histogram. Finally the image_pos function will be used to put a query image and the desired number of best match images on the display.2.3 LinkingIt is not possible to use a program before the main function andsub-functions are connected to each other. The main function will be called from the command line or through the graphical user interface, which will be presented later in this paper. In both cases the function call will contain the same arguments. For multi-level search purposes separate main functions have been implemented, but it is possible to utilize “normal” functions and add one parameter, where the best matches array can be transferred for second a stage comparison function.The main function calls an image read function with the image’s name. The histogram will be returned to the main function. If a color space conversion is needed, the conversion function will be called from the read function with r, g and b –vectors. The histogram will be returned to the calling function. Finally the histogram build function will be called with converted color vectors. This function returns a quantized histogram, which will go through allfunctions until it achieves the main function.The main function calls the histogram difference function with two histogram vectors and will get a difference value as a response. The difference function uses Euclidean-distance calculation, but it can be easily changed to another algorithm due to the modularity of the program. If the difference is smaller than largest difference on a best match table, the current result will be written over the last result on the best match table. After that the table is arranged again in an ascending order of distance. When all the images have been analyzed, the sorted best match table, the number of desired output images, the query image’s name, the search image’s path and the database path are transferred to the image_pos function. These values can be transferred into larger components (vectors/containers). Now the program works faster with several input arguments, because there is no need for picking up variables from a container.2.4 Graphical user interfaceThe graphical user interface (GUI) is an important part of software development. The designing of the GUI have to solve the following problems: learning time, speed of performance, rate of errors by users, retention over time, and subjective satisfaction [9]. This software is, at the moment, intended to be used only for testing purposes. The most important property of this software is that the results of different test queries can be seen quickly and the results can be saved safely on a disk. Thus the visual layout is not as important as in case of a commercial software product.In Figure 2 the first screen on GUI is presented. The purposes of the buttons, menus and other components will be presented later. If this software is developed into a commercial product, the menu bar will be disabled in the future and the exit and help buttons will be added on the canvas.Figure 2: GUI before the search image selection.In Figure 3 the search screen is presented just before starting a search. The user is shown a search image,and in this way he/she can be sure that the search will be made with the correct image.Figure 3: GUI just before running a query.The results of the query will be presented on the screen in the format which is presented in Figure 6.3. Using the softwareThe first screen has already been presented in Figure 2. The user can choose from pop-up menus (see Figure 4), if the search is made with one a color system or as a multi-level search. In a one-level search a roughly quantized or a more accurate histogram is used in one loop (one color system).Figure 4: Color system selection from a popup menu.The second menu is disabled because a one-level search is selected.In a multi-level search two different color systems /histograms are used. During the first loop the roughly quantized histograms are used and during the second loop.the more accurate histograms are utilized for the best matches from the first loop. The color system on the second loop can be either the same as on the first loop or a different one. For queries with one-level search the selection of a second color system is disabled. The user can select the number of retrieved images at the final stage. The software can be linked to many image databases and the user can select a database where the query will be directed.The user can select a search image either from the same database where the query will be directed to (default) or from any directory in his/her PC. The selection will be made with the file – open dialog, which is presented inFigur e 5. The form can be cleared with the “Reset” button. A query is executedwith the “Search” button. Finally the results of the search will appear on the screen in a separate window, as presented in Figure 6. Earlier [8] the software opened each image in a separate window and evaluating/saving the results is more difficult than after the improvement. In the top left top corner is the original query image. Below that image the best matches are presented in a descending order of similarity from left to right and from top to bottom. The user can select suitable images for further use with the “Copy selected” or the “Print selected” buttons. The “New search” button closes this form and goes back to the original search form. The “Search similar” button executes a new search where a query histogram is composed of histograms of the selected images. If the user has selected a larger number than 21 as “Number of matching images”, the best matches will be shown on multiple screens. The user can browse these pages with t he “Previous page” and “Following page”buttons.Figure 5: The query image selection dialog. The language of the dialog depends on the language of the operating system used.Figure 6: The results of a query will be presented graphically.4. SummaryThe color content-based retrieval requires algorithms, which give visually correct results. Correctly working algorithms can not be chosen before simulations. The software presented in this paper is intended to be usedfor testing purposes. Some operations will be implemented, if the software is developed into a commercial product. Some modifications are under construction.This software has been used as a testing platform for histogram quantization tests. The modularity of this program makes it possible to take new algorithms as a part of the software in a short time. MATLAB makes quick prototyping possible. A possibility to save figures (search results) directly on a disk is a fulfillment of the program’s requirements. After the results have been analyzed visually, the best algorithms will be taken as a part of the final software.5. AcknowledgementsThis work has been founded by the European Union– ERDF, theT echnology Development Centre T ekes, Alma Media, the Helsinki T elephone Company, Nokia Research Center, the Satakunta High T echnology Foundation and Ulla Tuominen’s Foundation.References[1] Alaya Cheikh F et. al. MUVIS: A System for Content-Based Indexing and Retrieval in Large Image Databases. Proceedings of SPIE Storage and Retrieval for Image and Video Databases, San Jose, 1999,vol. 3656: 98 – 106.[2] Sawhney H. S., Hafner J. L., Efficient Color Histogram Indexing for Quadratic Form Distance Functions, IEEE Transactions on Pattern Analysis and Machine Intelligence, 1995, vol. 17 no. 7: 729 – 736.[3] Vellaikal A. et. al. Content-Based Retrieval of Color and Multispectral Images Using Joint Spatial-Spectral Indexing, SPIE vol. 2606: 232 – 243.[4] Ng V. et. al. Adaptive Histogram Indexing, SPIE vol. 2606: 202 – 211.[5] Smith J. R., Chang S. F. Automatic Image Retrieval Using Color andT exture, 1995-6,/~jrsmith/html/pubs/PAMI/pami_final_1.htm.[6] Flickner M. et. al. Query by Image and Video Content: The QBIC System, IEEE Computer 1995 vol. 28 no. 9: 23 – 32.[7] Jain A. K. Fundamentals of Digital Image Processing, Prentice Hall, 1989: 66 - 71.[8] Kerminen P, Gabbouj M. Image Retrieval Based on Color Matching. Proceedings of FINSIG’99, Oulun yliopistopaino, 1999: 89 – 93.[9] Shneiderman B. Designing the User Interface, AddisonWesley Longman, 1998: 14 – 16.原型基于颜色的图像检索与MATLAB ®Petteri Kerminen1,Moncef Gabbouj21坦佩雷理工大学,波里,芬兰2坦佩雷理工大学,信号处理实验室,坦佩雷,芬兰摘要基于内容的检索数据库(图像)已经变得越来越受欢迎。

相关文档
最新文档