新建
上传
首页
助手
最?/div>
资料?/div>
工具

自定义函数都在下?/p>

 

clc 

 

clear all 

 

% 

读入图片

  

pic

1

=

imread

('

lena

1

.

jpg

');  

pic

2

=

imread

('

lena

2

.

jpg

');  

% 

Harris

角点检?/p>

  

points

1

=

myHarris

(

pic

1

);  

points

2

=

myHarris

(

pic

2

);  

% 

画出

Harris

角点

  

figure

(

1

)  

drawHarrisCorner

(

pic

1

,

points

1

,

pic

2

,

points

2

);  

% 

角点特征描述

  

des

1

=

myHarrisCornerDescription

(

pic

1

,

points

1

);  

des

2

=

myHarrisCornerDescription

(

pic

2

,

points

2

);  

% 

角点粗匹?/p>

  

matchs

=

myMatch

(

des

1

,

des

2

);  

% 

获取各自出匹配角点位?/p>

  

matchedPoints

1

=

points

1

(

matchs

(:,

1

),:);  

matchedPoints

2

=

points

2

(

matchs

(:,

2

),:);  

% 

粗匹配角点连?/p>

  

figure

(

2

)  

drawLinedCorner

(

pic

1

,

matchedPoints

1

,

pic

2

,

matchedPoints

2

);  

% 

角点精匹?/p>

  

[

newLoc

1

,

newLoc

2

]=

pointsSelect

(

matchedPoints

1

,

matchedPoints

2

);  

% 

精匹配角点连?/p>

  

figure

(

3

)  

drawLinedCorner

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

图像拼接

  

im

=

picMatched

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

显示拼接图像

  

figure

(

4

)  

imshow

(

im

);  

set

(

gcf

,'

Color

','

w

');  

function points

=

myHarris

(

pic

)  

% 

功能:寻?/p>

Harris

角点

  

% 

输入?/p>

RGB

图像?/p>

gray

?/p>

 

% 

输出:角点所在的行、纵?/p>

N

×

2

矩阵

  

if length

(

size

(

pic

))==

3 

 

pic

=

rgb

2

gray

(

pic

);  

end 

 

pic

=

double

(

pic

);  

hx

=[-

1 0 1

];  

Ix

=

filter

2

(

hx

,

pic

);  

Ͼλ
新建
上传
首页
助手
最?/div>
资料?/div>
工具

自定义函数都在下?/p>

 

clc 

 

clear all 

 

% 

读入图片

  

pic

1

=

imread

('

lena

1

.

jpg

');  

pic

2

=

imread

('

lena

2

.

jpg

');  

% 

Harris

角点检?/p>

  

points

1

=

myHarris

(

pic

1

);  

points

2

=

myHarris

(

pic

2

);  

% 

画出

Harris

角点

  

figure

(

1

)  

drawHarrisCorner

(

pic

1

,

points

1

,

pic

2

,

points

2

);  

% 

角点特征描述

  

des

1

=

myHarrisCornerDescription

(

pic

1

,

points

1

);  

des

2

=

myHarrisCornerDescription

(

pic

2

,

points

2

);  

% 

角点粗匹?/p>

  

matchs

=

myMatch

(

des

1

,

des

2

);  

% 

获取各自出匹配角点位?/p>

  

matchedPoints

1

=

points

1

(

matchs

(:,

1

),:);  

matchedPoints

2

=

points

2

(

matchs

(:,

2

),:);  

% 

粗匹配角点连?/p>

  

figure

(

2

)  

drawLinedCorner

(

pic

1

,

matchedPoints

1

,

pic

2

,

matchedPoints

2

);  

% 

角点精匹?/p>

  

[

newLoc

1

,

newLoc

2

]=

pointsSelect

(

matchedPoints

1

,

matchedPoints

2

);  

% 

精匹配角点连?/p>

  

figure

(

3

)  

drawLinedCorner

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

图像拼接

  

im

=

picMatched

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

显示拼接图像

  

figure

(

4

)  

imshow

(

im

);  

set

(

gcf

,'

Color

','

w

');  

function points

=

myHarris

(

pic

)  

% 

功能:寻?/p>

Harris

角点

  

% 

输入?/p>

RGB

图像?/p>

gray

?/p>

 

% 

输出:角点所在的行、纵?/p>

N

×

2

矩阵

  

if length

(

size

(

pic

))==

3 

 

pic

=

rgb

2

gray

(

pic

);  

end 

 

pic

=

double

(

pic

);  

hx

=[-

1 0 1

];  

Ix

=

filter

2

(

hx

,

pic

);  

">
新建
上传
首页
助手
最?/div>
资料?/div>
工具

自定义函数都在下?/p>

 

clc 

 

clear all 

 

% 

读入图片

  

pic

1

=

imread

('

lena

1

.

jpg

');  

pic

2

=

imread

('

lena

2

.

jpg

');  

% 

Harris

角点检?/p>

  

points

1

=

myHarris

(

pic

1

);  

points

2

=

myHarris

(

pic

2

);  

% 

画出

Harris

角点

  

figure

(

1

)  

drawHarrisCorner

(

pic

1

,

points

1

,

pic

2

,

points

2

);  

% 

角点特征描述

  

des

1

=

myHarrisCornerDescription

(

pic

1

,

points

1

);  

des

2

=

myHarrisCornerDescription

(

pic

2

,

points

2

);  

% 

角点粗匹?/p>

  

matchs

=

myMatch

(

des

1

,

des

2

);  

% 

获取各自出匹配角点位?/p>

  

matchedPoints

1

=

points

1

(

matchs

(:,

1

),:);  

matchedPoints

2

=

points

2

(

matchs

(:,

2

),:);  

% 

粗匹配角点连?/p>

  

figure

(

2

)  

drawLinedCorner

(

pic

1

,

matchedPoints

1

,

pic

2

,

matchedPoints

2

);  

% 

角点精匹?/p>

  

[

newLoc

1

,

newLoc

2

]=

pointsSelect

(

matchedPoints

1

,

matchedPoints

2

);  

% 

精匹配角点连?/p>

  

figure

(

3

)  

drawLinedCorner

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

图像拼接

  

im

=

picMatched

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

显示拼接图像

  

figure

(

4

)  

imshow

(

im

);  

set

(

gcf

,'

Color

','

w

');  

function points

=

myHarris

(

pic

)  

% 

功能:寻?/p>

Harris

角点

  

% 

输入?/p>

RGB

图像?/p>

gray

?/p>

 

% 

输出:角点所在的行、纵?/p>

N

×

2

矩阵

  

if length

(

size

(

pic

))==

3 

 

pic

=

rgb

2

gray

(

pic

);  

end 

 

pic

=

double

(

pic

);  

hx

=[-

1 0 1

];  

Ix

=

filter

2

(

hx

,

pic

);  

Ͼλ">
Ͼλ
Ŀ

图像拼接基于harris检测matlab代码 - 百度文库
新建
上传
首页
助手
最?/div>
资料?/div>
工具

自定义函数都在下?/p>

 

clc 

 

clear all 

 

% 

读入图片

  

pic

1

=

imread

('

lena

1

.

jpg

');  

pic

2

=

imread

('

lena

2

.

jpg

');  

% 

Harris

角点检?/p>

  

points

1

=

myHarris

(

pic

1

);  

points

2

=

myHarris

(

pic

2

);  

% 

画出

Harris

角点

  

figure

(

1

)  

drawHarrisCorner

(

pic

1

,

points

1

,

pic

2

,

points

2

);  

% 

角点特征描述

  

des

1

=

myHarrisCornerDescription

(

pic

1

,

points

1

);  

des

2

=

myHarrisCornerDescription

(

pic

2

,

points

2

);  

% 

角点粗匹?/p>

  

matchs

=

myMatch

(

des

1

,

des

2

);  

% 

获取各自出匹配角点位?/p>

  

matchedPoints

1

=

points

1

(

matchs

(:,

1

),:);  

matchedPoints

2

=

points

2

(

matchs

(:,

2

),:);  

% 

粗匹配角点连?/p>

  

figure

(

2

)  

drawLinedCorner

(

pic

1

,

matchedPoints

1

,

pic

2

,

matchedPoints

2

);  

% 

角点精匹?/p>

  

[

newLoc

1

,

newLoc

2

]=

pointsSelect

(

matchedPoints

1

,

matchedPoints

2

);  

% 

精匹配角点连?/p>

  

figure

(

3

)  

drawLinedCorner

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

图像拼接

  

im

=

picMatched

(

pic

1

,

newLoc

1

,

pic

2

,

newLoc

2

);  

% 

显示拼接图像

  

figure

(

4

)  

imshow

(

im

);  

set

(

gcf

,'

Color

','

w

');  

function points

=

myHarris

(

pic

)  

% 

功能:寻?/p>

Harris

角点

  

% 

输入?/p>

RGB

图像?/p>

gray

?/p>

 

% 

输出:角点所在的行、纵?/p>

N

×

2

矩阵

  

if length

(

size

(

pic

))==

3 

 

pic

=

rgb

2

gray

(

pic

);  

end 

 

pic

=

double

(

pic

);  

hx

=[-

1 0 1

];  

Ix

=

filter

2

(

hx

,

pic

);  



ļ׺.doc޸Ϊ.docĶ

  • ҽѧģ()
  • ĿӰ۱-
  • ΢۾ѧ --- {ȫ} ϰ (ϺѧԺ)
  • ʮ׹㲥̰
  • ѧ¶о״
  • صǸȹ㱨
  • СϪͺաϰ
  • ʮһ̰¬̲İ
  • 2013ʡ߿Ӣ⼰(word)
  • ս̰꼶Ʒ²ȫ̰

վ

԰ Ͼλ
ϵͷ779662525#qq.com(#滻Ϊ@)