Ⅰ matlab實現SIFT特徵點檢測及配准
sift是一種提取特徵點的演算法,可以用matlab編程實現,但沒有現成的語句,得自己寫程序。另外還有很多提取特徵的演算法,sift是其中比較好的一種。
Ⅱ 如何利用matlab實現特徵提取
Ox=sum(x)/2;
Oy=sum(y)/2;
%求E1,E2的中心O(Ox,Oy)
I1=imcrop(OriImg,[Ox-0.9*d
Oy-0.5*d
1.8*d
2*d]);
%切割人臉
str=strcat('H:\CMU表情庫\cohn-kanade\cohn-kanade\cohn-kanade\S010\001\Standard\',int2str(i),'.bmp');
eval('imwrite(I1,str);');
%執行字元串
每次循環讀入img
%讀入圖像
%保存歸一化後的人臉圖像
close
all;
end
Ⅲ matlab 中有提取圖像特徵點的函數嗎
本人恰巧正在做角點的提取與匹配,特徵點有很多種,看是基於區域還是邊緣,先是要檢測特徵點,這個主要是利用微分,然後再提取,貌似沒有現成的函數,這個給你參考一下,效果還可以
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Harris提取演算法
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc,clear all;
filename='camera2.bmp';
X= imread(filename); % 讀取圖像
Info=imfinfo(filename); %這個要習慣用
% f=rgb2gray(X);
f=X;
ori_im=double(f)/255; %unit8轉化為64為雙精度double64
fx = [-2 -1 0 1 2]; % x方向梯度運算元(用於Harris角點提取演算法)
Ix = filter2(fx,ori_im); % x方向濾波 善於使用filter
% fy = [5 8 5;0 0 0;-5 -8 -5]; % 高斯函數一階微分,y方向(用於改進的Harris角點提取演算法)
fy = [-2;-1;0;1;2]; % y方向梯度運算元(用於Harris角點提取演算法)
Iy = filter2(fy,ori_im); % y方向濾波
Ix2 = Ix.^2;
Iy2 = Iy.^2;
Ixy = Ix.*Iy;
clear Ix;
clear Iy; %消除變數哈
h= fspecial('gaussian',[10 10 ],2); % 產生7*7的高斯窗函數,sigma=2
Ix2 = filter2(h,Ix2);
Iy2 = filter2(h,Iy2);
Ixy = filter2(h,Ixy); %分別進行高斯濾波
height = size(ori_im,1);
width = size(ori_im,2);
result = zeros(height,width); % 紀錄角點位置,角點處值為1 ,背景都是黑色的哈
R = zeros(height,width);
Rmax = 0; % 圖像中最大的R值 以便設置門限
for i = 1:height
for j = 1:width
M = [Ix2(i,j) Ixy(i,j);Ixy(i,j) Iy2(i,j)]; %2*2的矩陣
R(i,j) = det(M)-0.06*(trace(M))^2; % 計算R ,求得RMAX,看來是整體求得的,角點響應函數
if R(i,j) > Rmax
Rmax = R(i,j);
end;
end;
end;
cnt = 0; %記錄點數的
for i = 2:height-1
for j = 2:width-1 % 進行非極大抑制,窗口3*3
if R(i,j) > 0.01*Rmax && R(i,j) > R(i-1,j-1) && R(i,j) > R(i-1,j) && R(i,j) > R(i-1,j+1) && R(i,j) > R(i,j-1) && R(i,j) > R(i,j+1) && R(i,j) > R(i+1,j-1) && R(i,j) > R(i+1,j) && R(i,j) > R(i+1,j+1)
result(i,j) = 1;
cnt = cnt+1;
end;
end;
end;
%
% i=1;
% for j=1:height
% for k=1:width
% if result(j,k)==1;
% corners1(i,1)=j;
% corners1(i,2)=k;
% i=i+1;
% end;
% end;
% end;
[posc, posr] = find(result == 1);
cnt % 角點個數
imshow(ori_im*255) %和 X的效果是一樣的
hold on;
plot(posr,posc,'g+');
Ⅳ matlab中使用快速pca提取特徵
1、參數mA代表A的均值,也就是mean(A)。
其實這個參數完全沒必要,因為可以從參數A計算得到。
2、解釋一下你問的兩個語句的含義:
Z=(A-repmat(mA,m,1)); 作用是去除直流成分
T=Z*Z'; 計算協方差矩陣的轉置
3、關於函數的調用:
MATLAB統計工具箱中有函數princomp,也是進行主成分分析的(2012b之後有函數pca),基本調用格式:
[pc,score]=princomp(x)
其中,輸入參數x相當於你這個函數的A,輸出參數score相當於你這里的pcaA,而pc大致相當於你這里的V(符號相反)。具體說明請參考函數的文檔。
Ⅳ 如何用matlab實現指紋圖像特徵的提取
其實學數字圖像處理,關鍵的不是源代碼(和一般編程還是有區別的,這個是經驗之談,其實一般博導未必會編程,但是你和他說說你的方法,他一般都能切中要害),而是你能理解基於概念及適用場所。
基於顏色、紋理、形狀都屬於低層特徵,這些你理解就夠了,關鍵是對你的課題適合哪種方法來映射到高層語義上面,例如:識別物體輪廓,那可能形狀就比較適合等。
我之所以寫上面那段話,主要是我感覺你索取代碼也不說明具體要求,也就是方向不明確。
如今顏色特徵提取演算法有很多,諸如顏色直方圖、顏色矩、顏色集、顏色聚合向量、顏色相關圖等,既然你沒說,我就給個IEEE CSVT 2001的一篇關於顏色直方圖法的論文(源碼版權歸作者所有):
function colorhist = colorhist(rgb)
% CBIR_colorhist() --- color histogram calculation
% input: MxNx3 image data, in RGB
% output: 1x256 colorhistogram == (HxSxV = 16x4x4)
% as the MPEG-7 generic color histogram descriptor
% [Ref] Manjunath, B.S.; Ohm, J.-R.; Vasudevan, V.V.; Yamada, A., "Color and texture descriptors"
% IEEE Trans. CSVT, Volume: 11 Issue: 6 , Page(s): 703 -715, June 2001 (section III.B)
% check input
if size(rgb,3)~=3
error('3 components is needed for histogram');
end
% globals
H_BITS = 4; S_BITS = 2; V_BITS = 2;
%rgb2hsv可用rgb2hsi代替,見你以前的提問。
hsv = uint8(255*rgb2hsv(rgb));
imgsize = size(hsv);
% get rid of irrelevant boundaries
i0=round(0.05*imgsize(1)); i1=round(0.95*imgsize(1));
j0=round(0.05*imgsize(2)); j1=round(0.95*imgsize(2));
hsv = hsv(i0:i1, j0:j1, :);
% histogram
for i = 1 : 2^H_BITS
for j = 1 : 2^S_BITS
for k = 1 : 2^V_BITS
colorhist(i,j,k) = sum(sum( ...
bitshift(hsv(:,:,1),-(8-H_BITS))==i-1 &...
bitshift(hsv(:,:,2),-(8-S_BITS))==j-1 &...
bitshift(hsv(:,:,3),-(8-V_BITS))==k-1 ));
end
end
end
colorhist = reshape(colorhist, 1, 2^(H_BITS+S_BITS+V_BITS));
% normalize
colorhist = colorhist/sum(colorhist);
%基於紋理特徵提取灰度共生矩陣用於紋理判斷
% Calculates cooccurrence matrix
% for a given direction and distance
%
% out = cooccurrence (input, dir, dist, symmetric);
%
% INPUT:
% input: input matrix of any size
%
% dir: direction of evaluation
% "dir" value Angle
% 0 0
% 1 -45
% 2 -90
% 3 -135
% 4 -180
% 5 +135
% 6 +90
% 7 +45
%
% dist: distance between pixels
%
% symmetric: 1 for symmetric version
% 0 for non-symmetric version
%
% eg: out = cooccurrence (input, 0, 1, 1);
% Author: Baran Aydogan (15.07.2006)
% RGI, Tampere University of Technology
% [email protected]
function out = cooccurrence (input, dir, dist, symmetric);
input = round(input);
[r c] = size(input);
min_intensity = min(min(input));
max_intensity = max(max(input));
out = zeros(max_intensity-min_intensity+1);
if (dir == 0)
dir_x = 0; dir_y = 1;
end
if (dir == 1)
dir_x = 1; dir_y = 1;
end
if (dir == 2)
dir_x = 1; dir_y = 0;
end
if (dir == 3)
dir_x = 1; dir_y = -1;
end
if (dir == 4)
dir_x = 0; dir_y = -1;
end
if (dir == 5)
dir_x = -1; dir_y = -1;
end
if (dir == 6)
dir_x = -1; dir_y = 0;
end
if (dir == 7)
dir_x = -1; dir_y = 1;
end
dir_x = dir_x*dist;
dir_y = dir_y*dist;
out_ind_x = 0;
out_ind_y = 0;
for intensity1 = min_intensity:max_intensity
out_ind_x = out_ind_x + 1;
out_ind_y = 0;
[ind_x1 ind_y1] = find (input == intensity1);
ind_x1 = ind_x1 + dir_x;
ind_y1 = ind_y1 + dir_y;
for intensity2 = min_intensity:max_intensity
out_ind_y = out_ind_y + 1;
[ind_x2 ind_y2] = find (input == intensity2);
count = 0;
for i = 1:size(ind_x1,1)
for j = 1:size(ind_x2,1)
if ( (ind_x1(i) == ind_x2(j)) && (ind_y1(i) == ind_y2(j)) )
count = count + 1;
end
end
end
out(out_ind_x, out_ind_y) = count;
end
end
if (symmetric)
if (dir < 4)
dir = dir + 4;
else
dir = mod(dir,4);
end
out = out + cooccurrence (input, dir, dist, 0);
end
Ⅵ matlab 特徵點提取。
新建個ff.m文件:
%%MATLABR2013a
functionfeature=ff(im)
rot=@(t)[cos(t)-sin(t);sin(t)cos(t)];
im=~im2bw(im);
Size=size(im);
CC=bwconncomp(im);
feature=zeros(CC.NumObjects,1);
fori=1:CC.NumObjects
[x,y]=ind2sub(Size,CC.PixelIdxList{i});
t=fminsearch(@(t)Loss([xy],t),0);
[~,width]=Loss([xy],t);
feature(i)=width(1)/width(2);
end
feature=sort(feature,1,'descend');
function[Loss,width]=Loss(G,t)
R=rot(t);
G=G*R;
width=max(G,[],1)-min(G,[],1);
Loss=-width(1)/width(2);
end
end
主程序:
im=imread(圖片名稱);
feature=ff(im)
對於題目中的輸入圖片,得到的feature是:
分別對應四個區域的長寬比。
Ⅶ matlab圖像提取特徵演算法
可以在網上下載bwconncomp這個函數,然後放到你的matlab7.0庫函數目錄就行了啊,就可以用這個函數了
Ⅷ 如何用matlab 處理圖像提取特徵值呢
,你可以參照一下圖像增強的有關演算法(Image Enhancement)
2.周長、面積、角度都需要你知道圖像中所包含的幾何形狀,建議看一下Hough變換的原理
Ⅸ 有關matlab的圖像特徵提取問題
方程 take_character 輸入為RBG三維數組圖像,輸出為像素統計character三維數組,首先讀取圖像數組width寬,height高。統計RGB各像素值到相應二維數組。灰度量化,對RGB每個像素值與256灰度比較,賦值灰度。character數組統計灰度值。返回結果。