资源简介

在vc++6.0+opencv环境下,实现对二值化后的圆心的定位,并显示坐标。

资源截图

代码片段和文件信息

#include
using namespace std;
#include 
#include
CvPoint GetCenterPoint(IplImage *src);
void main()
{
IplImage *src;
src=cvLoadImage(“11.jpg“-1);
CvPoint CenterPoint;
CenterPoint=GetCenterPoint(src);
cout<<“CenterPoint.x: “ < cvCircle(srcCenterPoint3CV_RGB(02550)183 );
cvNamedWindow(“Center“CV_WINDOW_AUTOSIZE);
cvShowImage(“Center“src);
cvWaitKey(-1);
cvDestroyWindow(“Center“);
cvReleaseImage(&src);
}
CvPoint GetCenterPoint(IplImage *src)
{
int ij;
int x0=0y0=0sum=0;
CvPoint center;
CvScalar pixel;
for (i=0;iwidth;i++)
for(j=0;jheight;j++)
{
pixel=cvGet2D(srcji);
if(pixel.val[0]==1)
{
x0=x0+i;
y0=y0+j;
sum=sum+1;
}
}
center.x=x0/sum;
center.y=y0/sum;
return center;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-03-22 23:44  opencv 求二值化图像的形心(只能是二值化后黑白的)\
     目录           0  2013-03-22 23:44  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\
     目录           0  2013-03-22 23:44  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\Debug\
     文件       41472  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\Debug\MyOpencvGetCenter.exe
     文件      411428  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\Debug\MyOpencvGetCenter.ilk
     文件     1313792  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\Debug\MyOpencvGetCenter.pdb
     目录           0  2013-03-22 23:44  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\
     文件        7461  2013-03-21 20:14  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\10.jpg
     文件        6032  2013-03-21 22:05  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\11.jpg
     文件        4651  2013-03-21 22:32  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\12.jpg
     文件        4542  2013-03-21 22:32  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\13.jpg
     文件       10620  2013-03-22 15:46  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\15.jpg
     文件        6762  2013-03-22 15:53  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\17.jpg
     文件        5195  2013-03-21 19:29  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\6.jpg
     文件        2238  2013-03-21 19:33  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\7.jpg
     文件        5217  2013-03-21 20:09  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\9.jpg
     目录           0  2013-03-22 23:44  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\
     文件        8002  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\BuildLog.htm
     文件      532616  2013-03-22 16:08  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.exe
     文件         663  2013-03-16 22:21  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.exe.embed.manifest
     文件         728  2013-03-16 22:21  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.exe.embed.manifest.res
     文件         621  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.exe.intermediate.manifest
     文件      782700  2013-03-22 16:08  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.ilk
     文件      161914  2013-03-22 16:08  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.obj
     文件     2001784  2013-03-21 19:41  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.pch
     文件     1098752  2013-03-22 16:08  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\MyOpencvGetCenter.pdb
     文件          65  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\mt.dep
     文件      230400  2013-03-22 20:47  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\vc60.idb
     文件      159744  2013-03-22 16:08  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\vc60.pdb
     文件      814080  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\vc90.idb
     文件      913408  2013-03-16 22:22  opencv 求二值化图像的形心(只能是二值化后黑白的)\MyOpencvGetCenter\MyOpencvGetCenter\Debug\vc90.pdb
............此处省略12个文件信息

评论

共有 条评论