SUSAN算子特征点检测实验报告Word文档格式.docx

上传人:b****3 文档编号:7980954 上传时间:2023-05-09 格式:DOCX 页数:11 大小:383.99KB
下载 相关 举报
SUSAN算子特征点检测实验报告Word文档格式.docx_第1页
第1页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第2页
第2页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第3页
第3页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第4页
第4页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第5页
第5页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第6页
第6页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第7页
第7页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第8页
第8页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第9页
第9页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第10页
第10页 / 共11页
SUSAN算子特征点检测实验报告Word文档格式.docx_第11页
第11页 / 共11页
亲,该文档总共11页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

SUSAN算子特征点检测实验报告Word文档格式.docx

《SUSAN算子特征点检测实验报告Word文档格式.docx》由会员分享,可在线阅读,更多相关《SUSAN算子特征点检测实验报告Word文档格式.docx(11页珍藏版)》请在冰点文库上搜索。

SUSAN算子特征点检测实验报告Word文档格式.docx

a、圆形模板如图所示,共37个像素。

b、相似度

第二步:

确定USAN区域。

第三步:

阈值化得到初步的边缘响应。

G的取值为USAN最大值的1/2。

USAN值越小,角点的响应就越强。

第四步:

可选择性进行非极大值抑制,角点特征就得到全部增强。

2、实验程序

BOOLCBmpProcessView:

:

Susan(LPSTRlpDIBBits,LONGlWidth,LONGlHeight)

{

//指向源图像的指针

LPSTRlpSrc;

//指向缓存图像的指针

LPSTRlpDst;

//指向缓存DIB图像的指针

LPSTRlpNewDIBBits;

HLOCALhNewDIBBits;

//循环变量

longi;

longj;

//像素值

intx,r,n=0;

unsignedcharpixel[37];

//暂时分配内存,以保存新图像

hNewDIBBits=LocalAlloc(LHND,lWidth*lHeight);

if(hNewDIBBits==NULL)

{

//分配内存失败

returnFALSE;

}

//锁定内存

lpNewDIBBits=(char*)LocalLock(hNewDIBBits);

//初始化新分配的内存,设定初始值为255

lpDst=(char*)lpNewDIBBits;

memset(lpDst,(BYTE)255,lWidth*lHeight);

POINTpointxy;

//定义一个POINT型数据

corner.clear();

//使用水平方向的结构元素进行腐蚀

for(j=lHeight-3;

j>

=2;

j--)

for(i=2;

i<

lWidth-2;

i++)

{

//指向源图像第j行,第i个象素的指针

lpSrc=(char*)lpDIBBits+lWidth*j+i;

//指向目标图像第j行,第i个象素的指针

lpDst=(char*)lpNewDIBBits+lWidth*j+i;

//取得当前指针处7*7区域的像素值,注意要转换为unsignedchar型

pixel[0]=(unsignedchar)*(lpSrc-3*lWidth-1);

pixel[1]=(unsignedchar)*(lpSrc-3*lWidth);

pixel[2]=(unsignedchar)*(lpSrc-3*lWidth+1);

pixel[3]=(unsignedchar)*(lpSrc-2*lWidth+2);

pixel[4]=(unsignedchar)*(lpSrc-lWidth+3);

pixel[5]=(unsignedchar)*(lpSrc+3);

pixel[6]=(unsignedchar)*(lpSrc+lWidth+3);

pixel[7]=(unsignedchar)*(lpSrc+2*lWidth+2);

pixel[8]=(unsignedchar)*(lpSrc+3*lWidth+1);

pixel[9]=(unsignedchar)*(lpSrc+3*lWidth);

pixel[10]=(unsignedchar)*(lpSrc+3*lWidth-1);

pixel[11]=(unsignedchar)*(lpSrc+2*lWidth-2);

pixel[12]=(unsignedchar)*(lpSrc+lWidth-3);

pixel[13]=(unsignedchar)*(lpSrc-3);

pixel[14]=(unsignedchar)*(lpSrc-lWidth-3);

pixel[15]=(unsignedchar)*(lpSrc-2*lWidth-2);

pixel[16]=(unsignedchar)*(lpSrc-2*lWidth-1);

pixel[17]=(unsignedchar)*(lpSrc-2*lWidth);

pixel[18]=(unsignedchar)*(lpSrc-2*lWidth+1);

pixel[19]=(unsignedchar)*(lpSrc-lWidth+2);

pixel[20]=(unsignedchar)*(lpSrc+2);

pixel[21]=(unsignedchar)*(lpSrc+lWidth+2);

pixel[22]=(unsignedchar)*(lpSrc+2*lWidth+1);

pixel[23]=(unsignedchar)*(lpSrc+2*lWidth);

pixel[24]=(unsignedchar)*(lpSrc+2*lWidth-1);

pixel[25]=(unsignedchar)*(lpSrc+lWidth-2);

pixel[26]=(unsignedchar)*(lpSrc-2);

pixel[27]=(unsignedchar)*(lpSrc-lWidth-2);

pixel[28]=(unsignedchar)*(lpSrc-lWidth-1);

pixel[29]=(unsignedchar)*(lpSrc-lWidth);

pixel[30]=(unsignedchar)*(lpSrc-lWidth+1);

pixel[31]=(unsignedchar)*(lpSrc+1);

pixel[32]=(unsignedchar)*(lpSrc+lWidth+1);

pixel[33]=(unsignedchar)*(lpSrc+lWidth);

pixel[34]=(unsignedchar)*(lpSrc+lWidth-1);

pixel[35]=(unsignedchar)*(lpSrc-1);

pixel[36]=(unsignedchar)*lpSrc;

n=0;

for(x=0;

x<

37;

x++)

{

if(abs(pixel[36]-pixel[x])<

=30)

//可根据实际情况确定阈值

n++;

}

r=0;

if(n<

18)

r=18-n;

pointxy.x=i;

pointxy.y=lHeight-1-j;

//记录检测出的角点行,列

corner.push_back(pointxy);

}

//返回

returnTRUE;

voidCBmpProcessView:

OnDraw(CDC*pDC)

//显示等待光标

BeginWaitCursor();

//获取文档

CBmpProcessDoc*pDoc=GetDocument();

ASSERT_VALID(pDoc);

//获取DIB

HDIBhDIB=pDoc->

GetHDIB();

//判断DIB是否为空

if(hDIB!

=NULL)

LPSTRlpDIB=(LPSTR):

GlobalLock((HGLOBAL)hDIB);

//获取DIB宽度

intcxDIB=(int):

DIBWidth(lpDIB);

//获取DIB高度

intcyDIB=(int):

DIBHeight(lpDIB);

:

GlobalUnlock((HGLOBAL)hDIB);

CRectrcDIB;

rcDIB.top=rcDIB.left=0;

rcDIB.right=cxDIB;

rcDIB.bottom=cyDIB;

CRectrcDest;

//判断是否是打印

if(pDC->

IsPrinting())

//是打印,计算输出图像的位置和大小,以便符合页面

//获取打印页面的水平宽度(象素)

intcxPage=pDC->

GetDeviceCaps(HORZRES);

//获取打印页面的垂直高度(象素)

intcyPage=pDC->

GetDeviceCaps(VERTRES);

//获取打印机每英寸象素数

intcxInch=pDC->

GetDeviceCaps(LOGPIXELSX);

intcyInch=pDC->

GetDeviceCaps(LOGPIXELSY);

//计算打印图像大小(缩放,根据页面宽度调整图像大小)

rcDest.top=rcDest.left=0;

rcDest.bottom=(int)(((double)cyDIB*cxPage*cyInch)

/((double)cxDIB*cxInch));

rcDest.right=cxPage;

//计算打印图像位置(垂直居中)

inttemp=cyPage-(rcDest.bottom-rcDest.top);

rcDest.bottom+=temp/2;

rcDest.top+=temp/2;

else

//不必缩放图像

rcDest=rcDIB;

//输出DIB

PaintDIB(pDC->

m_hDC,&

rcDest,pDoc->

GetHDIB(),

&

rcDIB,pDoc->

GetDocPalette());

//恢复正常光标

CPen*ppen=newCPen;

ppen->

CreatePen(PS_SOLID,1,RGB(255,0,0));

pDC->

SelectObject(ppen);

for(inti=0;

i<

corner.size();

i++)

pDC->

MoveTo(corner[i].x-3,corner[i].y);

LineTo(corner[i].x+3,corner[i].y);

MoveTo(corner[i].x,corner[i].y-3);

LineTo(corner[i].x,corner[i].y+3);

DeleteObject();

EndWaitCursor();

}

//在检测出的角点出画红十字

(3)实验结果

三、实验总结

本次实验是对图像特征点的一个检测。

边缘检测与特征点检测都是比较常用的图像处理过程,边缘检测是将图像的整体轮廓展现出来。

而特征点检测则将图像的拐点标记出来。

因此特征点检测更能清楚的反应图像的一些主要特征,以便对图像进行后续的处理。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2