没有合适的资源?快使用搜索试试~ 我知道了~
首页基于颜色和纹理的图像检索,颜色矩和gabor小波变换源代码程序
基于颜色和纹理的图像检索,颜色矩和gabor小波变换源代码程序
需积分: 21 194 浏览量
更新于2023-05-29
评论 4
收藏 181KB PDF 举报
图像特征提取,基于颜色和纹理的图像检索,颜色矩和gabor小波变换源代码程序,可直接使用
资源详情
资源评论
资源推荐

close all;
clc;
rgb=imread('show.bmp');
hsv=rgb2hsv(rgb);
% figure,imshow(rgb);
% figure,subplot(2,2,1);
% imshow(hsv);
% subplot(2,2,2);
% imshow(hsv(:,:,1));
% subplot(2,2,3);
% imshow(hsv(:,:,2));
% subplot(2,2,4);
% imshow(hsv(:,:,3));
h=hsv(:,:,1);
s=floor(hsv(:,:,2)./0.1);
v=floor(hsv(:,:,3)./0.1);
h360=floor(h.*360);
[m,n]=size(h360);
H=zeros(m,n);
S=H;
V=H;
G=H;
for i=1:1:m*n
if h360(i)<21
H(i) = 0;
elseif h360(i)<40
H(i) = 1;
elseif h360(i)<75
H(i) = 2;
elseif h360(i)<155
H(i) = 3;
elseif h360(i)<190
H(i) = 4;
elseif h360(i)<270
H(i) = 5;
elseif h360(i)<295
H(i) = 6;
elseif h360(i)<315
H(i) = 7;
else
H(i) = 0;
end

end
for i=1:1:m*n
switch s(i)
case {0,1}
S(i) = 0;
case {2,3,4,5,6}
S(i) = 1;
case {7,8,9,10}
S(i) = 2;
end
end
for i=1:1:m*n
switch v(i)
case {0,1}
V(i) = 0;
case {2,3,4,5,6}
V(i) = 1;
case {7,8,9,10}
V(i) = 2;
end
end
H;
G = 9 .* H + 3 .* S + V;
imhist(G./71)
function Xll = DWT2_3layers(X)
nbcol = size(X,1);
% Perform one step decomposition.
[ca1,ch1,cv1,cd1] = dwt2(X,'db1');
% Image coding.
cod_ca1 = wcodemat(ca1,nbcol);
cod_ch1 = wcodemat(ch1,nbcol);
cod_cv1 = wcodemat(cv1,nbcol);
cod_cd1 = wcodemat(cd1,nbcol);
% image([cod_ca1,cod_ch1;cod_cv1,cod_cd1]);
% decompose approx. cfs of level 1.
[ca2,ch2,cv2,cd2] = dwt2(ca1,'db1');

% Code ca2, ch2,cv2 and cd2.
cod_ca2 = wcodemat(ca2,nbcol);
cod_ch2 = wcodemat(ch2,nbcol);
cod_cv2 = wcodemat(cv2,nbcol);
cod_cd2 = wcodemat(cd2,nbcol);
%
image([[cod_ca2,cod_ch2;cod_cv2,cod_cd2],cod_ch1;cod_cv1,cod_cd1]);
% decompose approx. cfs of level 2.
[ca3,ch3,cv3,cd3] = dwt2(ca2,'db1');
cod_ca3 = wcodemat(ca3,nbcol);
cod_ch3 = wcodemat(ch3,nbcol);
cod_cv3 = wcodemat(cv3,nbcol);
cod_cd3 = wcodemat(cd3,nbcol);
Xll=cod_ca3;
%function [gab]=gaborcreate(M,N)
%CREATION OF GABOR MASK
%Parameters -m=0,1,...M-1 scales ; n=0,1,...N-1 orientation
%CREATION OF GABOR MASK
%Parameters -m=0,1,...M-1 scales ; n=0,1,...N-1 orientation
M=4;
N=3;
a=(0.4 / 0.05)^(1/(M-1));
gab=cell(2,2)
count=1;
for m=1:M
for n=1:N
W=a^m * 0.05;
sigmax=((a+1)*sqrt(2 * log(2))) / (2 * pi * a^m * (a-1) * 0.05);
sigmay1=((0.4 *0.4) / (2*log(2))) - (( 1 / (2 *pi* sigmax))^2);
sigmay=1 / ((2* pi * tan(pi/(2*N)) * sqrt ( sigmay1)));
theta=(n*pi)/N ;
for ij=1:2
for i=1:3
for j=1:3
xb=a^(-m) * (i*cos(theta) + j*sin(theta));
yb=a^(-m) * ((-i)*sin(theta) + j*cos(theta));

phi1=(-1/2) * ((xb*xb)/(sigmax*sigmax) + (yb*yb)/(sigmay*sigmay));
if ij==1
prob=i;
else
prob=j;
end
phi=(1/(2*pi*sigmax*sigmay)) * exp(phi1) * exp(2*2*pi*W*prob);
gab1(i,j)=phi* a^(-m);
end
end
gab{count,ij}=gab1;
end
count=count+1;
end
end
gab
function varargout = ImigeRetrieval(varargin)
% IMIGERETRIEVAL M-file for ImigeRetrieval.fig
% IMIGERETRIEVAL, by itself, creates a new IMIGERETRIEVAL or raises the existing
% singleton*.
%
% H = IMIGERETRIEVAL returns the handle to a new IMIGERETRIEVAL or the handle
to
% the existing singleton*.
%
% IMIGERETRIEVAL('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in IMIGERETRIEVAL.M with the given input arguments.
%
% IMIGERETRIEVAL('Property','Value',...) creates a new IMIGERETRIEVAL or raises
the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before ImigeRetrieval_OpeningFunction gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to ImigeRetrieval_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES
% Copyright 2002-2003 The MathWorks, Inc.
剩余16页未读,继续阅读



















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0