HumanMotion.cpp
上传用户:jsylhbnbhn
上传日期:2013-11-03
资源大小:119k
文件大小:19k
- // HumanMotion.cpp: implementation of the HumanMotion class.
- //
- //////////////////////////////////////////////////////////////////////
- #ifdef _CH_
- #pragma package <opencv>
- #endif
- #ifndef _EiC
- #include "cv.h"
- #include "highgui.h"
- #include <stdio.h>
- #include <ctype.h>
- #include "skelecton.h"
- #include "skeletons.h"
- #include "kalman.h"
- #include "OpenGL.h"
- #include "stdafx.h"
- #include "HumanMotion.h"
- #endif
- IplImage *image = 0, *grey = 0, *prev_grey = 0,
- *pyramid = 0, *prev_pyramid = 0,*motion_track_img = 0, *swap_temp;
- IplImage* background_image = 0;
- int win_size = 10;
- const int MAX_COUNT = 13; //骨架节点数
- CvPoint2D32f* points[2] = {0,0}, *swap_points;
- char* status = 0;
- int count = 0;
- int need_to_init = 1;
- int night_mode = 0;
- int flags = 0;
- int add_remove_pt = 0;
- int pause = 0;
- bool init_OK = false;
- CvPoint pt;
- CvSize image_sz;
- OpenGL *pgl;
- //五个U形点
- U_Joint ujoints[5];
- int ujoints_count = 0;
- //三个n形点,即手臂与身体两个,裆部一个
- U_Joint njoints[3];
- int njoints_count = 0;
- const float pi = 3.1415926f;
- CvMemStorage* storage = 0; // temporary storage
- IplImage* abs_image = 0;
- IplImage* add_abs_image = 0;
- IplImage* add_abs_image2 = 0;
- IplImage* dst = 0;
- IplImage* src = 0;
- CvSeq* contour = 0;
- IplConvKernel* element = 0;
- int frame_count =0;
- void on_mouse( int event, int x, int y, int flags, void *param )
- {
-
- if( !image )
- return;
- if( image->origin )
- y = image->height - y;
- if( event == CV_EVENT_LBUTTONDOWN )
- {
- pt = cvPoint(x,y);
- add_remove_pt = 1;
- }
- }
- HumanMotion::HumanMotion()
- {
- }
- HumanMotion::~HumanMotion()
- {
- }
- int HumanMotion::Start()
- {
- main_loop(1);
- return 0;
- }
- int HumanMotion::main_loop( int useCAM)
- {
- skelecton *ske = new skelecton();
- skelectons *skes = new skelectons();
- kalman *bone_kalmans = new kalman[MAX_COUNT];
-
- CvCapture* capture = 0;
-
- if( useCAM == 1)
- capture = cvCaptureFromFile("e:\mse\movie\capture4.avi");
-
- else if( useCAM == 2 )
- capture = cvCaptureFromCAM(-1);
- if( !capture )
- {
- fprintf(stderr,"Could not initialize capturing...n");
- return -1;
- }
- printf( "Hot keys: n"
- "tESC - quit the programn"
- "tr - auto-initialize trackingn"
- "tc - delete all the pointsn"
- "tn - switch the "night" mode on/offn"
- "tp - pause on/offn"
- "n" );
- cvNamedWindow( "LkDemo", 1 );
- cvNamedWindow( "Contour", 1 );
- cvSetMouseCallback( "LkDemo", on_mouse, 0 );
- for(;;)
- {
- IplImage* frame = 0;
-
- int i, k, c;
- if(pause)
- frame = image ;
- else
- frame = cvQueryFrame( capture );
- if( !frame ) break;
- if( !image )
- {
- /* allocate all the buffers */
- image_sz = cvGetSize(frame) ;
- image = cvCreateImage(image_sz , 8, 3 );
- image->origin = frame->origin;
-
- motion_track_img = cvCreateImage( image_sz, 8, 3 );
- motion_track_img->origin = frame->origin;
- grey = cvCreateImage( image_sz, 8, 1 );
- prev_grey = cvCreateImage( image_sz, 8, 1 );
- pyramid = cvCreateImage( image_sz, 8, 1 );
- prev_pyramid = cvCreateImage( image_sz, 8, 1 );
- points[0] = (CvPoint2D32f*)cvAlloc(MAX_COUNT*sizeof(points[0][0]));
- points[1] = (CvPoint2D32f*)cvAlloc(MAX_COUNT*sizeof(points[0][0]));
- status = (char*)cvAlloc(MAX_COUNT);
- flags = 0;
- CvSize sz = cvSize( image->width/2 & -1, image->height/2 & -1 );
- CvSize sz2 = cvSize( sz.width/2 & -1, sz.height/2 & -1 );
- abs_image = cvCreateImage( cvGetSize(image), 8, 1 );
- add_abs_image =cvCreateImage(sz, 8, 1 );
- add_abs_image2 =cvCreateImage(sz2, 8, 1 );
- dst = cvCreateImage( image_sz, 8, 3 );
- dst->origin = frame->origin;
- background_image = cvCreateImage( image_sz, 8, 1 );
- background_image->origin = frame->origin;
-
- storage = cvCreateMemStorage(0);
- }
- cvCopy( frame, image, 0 );
- cvCvtColor( image, grey, CV_BGR2GRAY );
- cvZero( motion_track_img );
- if( night_mode )
- cvZero( image );
-
- if( need_to_init )
- {
- //分析轮廓,开始自动标定
- analyze_contour(grey);
- if(init_OK)
- {
- count = MAX_COUNT;
- cvFindCornerSubPix( grey, points[1], count,
- cvSize(win_size,win_size), cvSize(-1,-1),
- cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03));
-
- for(int s=0;s<count;s++)
- {
- ske->CalcLengthRatio (s+1,points[1][s]);
- bone_kalmans[s].init_kalman (points[1][s].x,0,points[1][s].y,0);
- }
- }
- }
- else if( count > 0 )
- {
- cvCalcOpticalFlowPyrLK( prev_grey, grey, prev_pyramid, pyramid,
- points[0], points[1], count, cvSize(win_size,win_size), 3, status, 0,
- cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03), flags );
- flags |= CV_LKFLOW_PYR_A_READY;
- for( i = k = 0; i < count; i++ )
- {
- if( add_remove_pt )
- {
- double dx = pt.x - points[1][i].x;
- double dy = pt.y - points[1][i].y;
- if( dx*dx + dy*dy <= 25 )
- {
- add_remove_pt = 0;
- continue;
- }
- }
-
- if( !status[i] )
- continue;
-
- points[1][k++] = points[1][i];
- ske->CorrectPosition (i+1,points[1][i],bone_kalmans[i],grey);
- cvCircle( image, cvPointFrom32f(points[1][i]), 3, CV_RGB(0,255,0), -1, 8,0);
- }
- count = k;
- }
-
- //
- skelecton *pske;
- pske = skes->get_previous_skelecton ();
- if(pske!=NULL) ske->set_previous_skelecton (pske);
- ske->pgl = pgl;
- ske->drawOpenGL3D(image);
- //ske->draw2D(image);
- skes->add (ske); //to do list 不需要每次都保存,应该隔单位时间保存一次
-
- if( add_remove_pt && count < MAX_COUNT )
- {
- points[1][count++] = cvPointTo32f(pt);
- cvFindCornerSubPix( grey, points[1] + count - 1, 1,
- cvSize(win_size,win_size), cvSize(-1,-1),
- cvTermCriteria(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03));
- add_remove_pt = 0;
- bone_kalmans[count-1].init_kalman (points[1][count-1].x,0,points[1][count-1].y,0);
- ske->CalcLengthRatio (count,points[1][count-1]);
- }
- CV_SWAP( prev_grey, grey, swap_temp );
- CV_SWAP( prev_pyramid, pyramid, swap_temp );
- CV_SWAP( points[0], points[1], swap_points );
- //need_to_init = 0;
- cvShowImage( "LkDemo", image );
- //cvShowImage( "MotionTrackDemo", motion_track_img );
- c = cvWaitKey(10);
- //printf("%c,%d",c,c);
- if( c == 27 )
- break;
- switch( c )
- {
- case 'r':
- need_to_init = 1;
- break;
- case 'c':
- count = 0;
- ske->reset();
- break;
- case 'n':
- night_mode ^= 1;
- break;
- case 'p':
- pause ^= 1;
- break;
- case 'o':
- if(ske->ske_pause) ske->ske_pause= false;
- else ske->ske_pause= true;
- break;
- case 'i':
- ske->view_up();
- break;
- case 'k':
- ske->view_down();
- break;
- case 'j':
- ske->view_left();
- break;
- case 'l':
- ske->view_right();
- break;
- default:
- ;
- }
- frame_count++;
- }
- cvReleaseCapture( &capture );
- cvDestroyWindow("LkDemo");
- cvDestroyWindow("Contour");
-
-
- delete ske;
- ske = NULL;
- delete skes;
- skes = NULL;
- delete []bone_kalmans;
-
- return 0;
- }
- int HumanMotion::analyze_contour(IplImage* grey_image)
- {
-
- getContour(grey_image);
- cvShowImage( "Contour", dst );
- return 0;
- }
- int HumanMotion::getContour( IplImage* grey)
- {
- double d_count = frame_count;
-
- cvAddWeighted(background_image, d_count/(d_count+1),
- grey, 1/(d_count+1),
- 0,background_image);
- cvAbsDiff( grey,background_image, abs_image );
- cvThreshold( abs_image, abs_image, 50, 255, CV_THRESH_BINARY );
- //cvPyrDown(abs_image, add_abs_image, 7);
- //cvPyrDown(add_abs_image, add_abs_image2, 7);
- //cvCanny(add_abs_image2, add_abs_image2, 20.0, 20.0*3, 3);
-
-
- int pos = 4;
- const int element_shape = CV_SHAPE_RECT;
- element = cvCreateStructuringElementEx( pos*2+1, pos*2+1, pos, pos, element_shape, 0 );
- cvDilate(abs_image,abs_image,element,1);
- cvErode(abs_image,abs_image,element,1);
- cvReleaseStructuringElement(&element);
-
-
- cvFindContours( abs_image, storage, &contour, sizeof(CvContour),
- CV_RETR_TREE , CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0) );
- cvZero( dst );
- if(contour != NULL)
- {
- //int ApproxCount = image_sz.height / 30; //估算的简化度,待完善。
- int ApproxCount = 14;
- contour = cvApproxPoly( contour, sizeof(CvContour), storage, CV_POLY_APPROX_DP,ApproxCount, 1 );
-
- CvSeq* contour2 = contour;
- int N = contour->total;
-
- CvSeqReader reader;
- int i;
- CvPoint pt;
- CvPoint pre_pt;
- //for (; contour != NULL; contour = contour->h_next)
- //{
- cvStartReadSeq(contour, &reader);
- CV_READ_SEQ_ELEM(pt, reader);
- pre_pt= pt;
- for (i = 1; i < N+1; i++)
- {
-
- CV_READ_SEQ_ELEM(pt, reader);
- cvLine( dst, pt,pre_pt,CV_RGB(0,255,0),2,CV_AA, 0 );
- pre_pt= pt;
- }
- //}
-
- contour = contour2;
- if(contour != NULL)
- {
- //简化模型中只有8个节点
- if(N==8)
- {
-
- // cvShowImage( "Contour", dst );
- // cvWaitKey(0);
- SegmentBody(contour);
- FindBody();
- ClearBodyJoints();
- }
- }
- }
-
- return 0;
- }
- int HumanMotion::SegmentBody(CvSeq* contour)
- {
- const float StandBodyLength = 1.0;
- const float StandArc = 90;
- const float nStandArc = 90;
- float l1,l2=0;
- CvPoint pt1,pt2;
- double total_arc = 0; //内旋角度
- double rarc12= 0;
- double arc12= 0;
- bool Haslkvec = false; //是否存在先前记录的矢量
- bool HasFoundedJoint = false; //是否找到拐点
-
- CvSeqReader reader;
- CvSeqReader subReader;
- int N = contour->total;
- int i;
- CvPoint pt;
- CvPoint pre_pt;
- CvPoint pre_pre_pt;
- ujoints_count=0;
- njoints_count=0;
- cvStartReadSeq(contour, &reader);
- for (i= 0; i < N; i++)
- {
- CV_READ_SEQ_ELEM(pt, reader);
- pre_pt = pre_pre_pt = pt;
- //printf("in sub %d,%d n",pt.x,pt.y);
-
- //计算两点之间的距离
- subReader = reader ;
- Haslkvec = false;
- total_arc =0;
- for(int j=0;j<3;j++)
- {
-
- l1=calc_2Point_Magnitude(pt,pre_pt);
- if (l1>StandBodyLength)
- {
- //是否存在先前记录的点,如果有,检查角度范围
- if(Haslkvec)
- {
-
- Vector3f vt1 = Vector3f (pt2.x-pt1.x,pt2.y-pt1.y,0);
- Vector3f vt2 = Vector3f (pt1.x-pt.x,pt1.y-pt.y,0);
- arc12 = AngleBetweenVectors(vt1,vt2);
- rarc12 = 180*arc12/pi;
- Vector3f vtnor=Cross(vt1,vt2); //使用叉集检查矢量是内旋还是外旋。
- if(vtnor.z <0) total_arc -= rarc12;
- else total_arc += rarc12;
- //检查角度范围合理U -200 -160
- if (abs(total_arc+180)<StandArc)
- {
-
- //绘出U形的位置
- //draw_2Points(pt,pre_pt,pt1,pt2,CV_RGB(255,255,250));
- save_Points(pt,pre_pt,pt1,pt2,U_TYPE);
- HasFoundedJoint = true ;
- }
- //检查角度范围N 150 210
- if (abs(total_arc-180)<nStandArc)
- {
- //记录n形点的位置
- //draw_2Points(pt,pre_pt,pt1,pt2,CV_RGB(230,255,0));
- save_Points(pt,pre_pt,pt1,pt2,N_TYPE);
- HasFoundedJoint = true ;
- }
- if(HasFoundedJoint)
- {
- //记录两个矢量,清空标记
- Haslkvec = false;
- total_arc = 0;
- HasFoundedJoint = false;
- break;
- }
- }
- else
- {
- //记录两个点
- pt1=pt;
- pt2=pre_pt;
- Haslkvec = true;
- }
-
- }
- pre_pre_pt = pre_pt;
- pre_pt= pt;
- CV_READ_SEQ_ELEM(pt, subReader);
-
- }
- }
- return 0;
- }
- float HumanMotion::calc_2Point_Magnitude(CvPoint pt1,CvPoint pt2)
- {
- return (float)sqrt( pow((pt1.x-pt2.x),2) + pow((pt1.y-pt2.y),2) );
-
- }
- int HumanMotion::draw_2Points(CvPoint pt1,CvPoint pt2,CvPoint pt3,CvPoint pt4,CvScalar color)
- {
-
- cvLine( dst,pt1,pt2,color,1, CV_AA, 0);
- cvLine( dst,pt3,pt4,color,1, CV_AA, 0);
- cvLine( dst,pt1,pt4,color,1, CV_AA, 0);
- cvLine( dst,pt2,pt3,color,1, CV_AA, 0);
- return 0;
- }
- //检查平行线之间构成四边形是否在同一轴线上,正方形相似度判断
- //方法如下,取两个矢量中心点连线,取连线与较大矢量的夹角,如果夹角在90度偏差20度内认为是正方形。
- bool HumanMotion::Is_Closed_Vectors(CvPoint pt1,CvPoint pt2,CvPoint pt3,CvPoint pt4)
- {
-
- CvPoint pt5,pt6;
- const float StandSqArc = 40;
- pt5.x= (pt1.x + pt2.x ) /2;
- pt5.y= (pt1.y + pt2.y ) /2;
- pt6.x= (pt3.x + pt4.x ) /2;
- pt6.y= (pt3.y + pt4.y ) /2;
- Vector3f vt1 = Vector3f (pt1.x-pt2.x,pt1.y-pt2.y,0);
- Vector3f vt2 = Vector3f (pt3.x-pt4.x,pt3.y-pt4.y,0);
- Vector3f vtc = Vector3f (pt6.x-pt5.x,pt6.y-pt5.y,0);
- Vector3f vtmax;
- if(Magnitude(vt1) > Magnitude(vt2))
- vtmax= vt1;
- else
- vtmax= vt2;
- double arc12 = AngleBetweenVectors(vtc,vtmax);
- double rarc12 = 180*arc12/pi;
- if (abs(abs(rarc12)-90)<StandSqArc)
- return true;
- else
- return false;
- }
- //排除的第二种情况
- //1.两矢量长度不等,差距相差4倍时,认为无效
- //2.两矢量错位,不协调,即对角线长度大于两矢量长度的两倍。
- bool HumanMotion::Is_Apar_Vectors(CvPoint pt1,CvPoint pt2,CvPoint pt3,CvPoint pt4)
- {
- bool result = false;
- const float StandLenRatio = 4.0;
- const float StandCrossLenRatio = 2.0;
- Vector3f vt1 = Vector3f (pt1.x-pt2.x,pt1.y-pt2.y,0);
- Vector3f vt2 = Vector3f (pt3.x-pt4.x,pt3.y-pt4.y,0);
- //1.两矢量长度不等,差距相差4倍时,认为无效
- double lenvct1,lenvct2,raido12;
- lenvct1 = Magnitude(vt1);
- lenvct2 = Magnitude(vt2);
- raido12 = lenvct1/lenvct2;
- if( raido12<StandLenRatio && raido12 > 1/StandLenRatio )
- result = true ;
- //2.两矢量错位,不协调,即对角线长度大于两矢量长度的两倍。
- if(result)
- {
- Vector3f vtc1 = Vector3f (pt1.x-pt3.x,pt1.y-pt3.y,0); //对角线1
- Vector3f vtc2 = Vector3f (pt1.x-pt3.x,pt1.y-pt3.y,0); //对角线2
- double c1,c2,ratio12;
- double vct_min,cross_vct_max;
- c1 = Magnitude(vtc1);
- c2 = Magnitude(vtc2);
- if (lenvct1>lenvct2)
- vct_min = lenvct2;
- else
- vct_min = lenvct1;
- if(c1>c2)
- cross_vct_max = c1;
- else
- cross_vct_max = c2;
- ratio12 = cross_vct_max/vct_min;
- if (ratio12<StandCrossLenRatio)
- result = true ;
- else
- result = false;
- }
- return result;
- }
- int HumanMotion::FindBody()
- {
- init_OK = false;
- if(ujoints_count==5 && njoints_count==3)
- {
-
- CvPoint pt1,pt2,pt3,pthead;
- //右腋下
- pt1 = njoints[0].pt;
- //裆部
- pt2 = njoints[1].pt;
-
- //左腋下
- pt3 = njoints[2].pt;
- //寻找head 节点
- int Head_i;
- int temp = 0;
- for(int i= 0; i<5 ;i++)
- {
- pthead.y = ujoints[i].pt.y ;
- if (pthead.y>temp) Head_i =i;
- }
- pthead=ujoints[Head_i].pt ;
- CvPoint pt_neck;
- pt_neck.x = ( pthead.x - pt2.x )*0.75 + pt2.x;
- pt_neck.y = ( pthead.y - pt2.y )*0.75 + pt2.y;
- CvPoint pt_waist;
- pt_waist.x = ( pthead.x - pt2.x )*0.3 + pt2.x;
- pt_waist.y = ( pthead.y - pt2.y )*0.3 + pt2.y;
- CvPoint pt_lhand;
- pt_lhand = ujoints[3].pt ;
- CvPoint pt_rhand;
- pt_rhand = ujoints[0].pt ;
- CvPoint pt_rAnkle;
- pt_rAnkle = ujoints[1].pt ;
- CvPoint pt_lAnkle;
- pt_lAnkle = ujoints[2].pt ;
- CvPoint pt_rknee;
- pt_rknee.x =( pt_waist.x + pt_rAnkle.x ) /2;
- pt_rknee.y =( pt_waist.y + pt_rAnkle.y ) /2;
- CvPoint pt_lknee;
- pt_lknee.x =( pt_waist.x + pt_lAnkle.x ) /2;
- pt_lknee.y =( pt_waist.y + pt_lAnkle.y ) /2;
- CvPoint pt_lshoulder;
- //pt_lshoulder.x = ( pthead.x - pt_lhand.x )*(pt_neck.y - pt_lhand.y)/(pthead.y - pt_lhand.y) + pt_lhand.x;
- //pt_lshoulder.y = pt_neck.y;
- CvPoint pt_rshoulder;
- //pt_rshoulder.x =( pthead.x - pt_rhand.x )*(pt_neck.y - pt_rhand.y)/(pthead.y - pt_rhand.y) + pt_rhand.x;
- //pt_rshoulder.y = pt_neck.y;
- CvPoint pt_relbow;
- pt_relbow.x =( pt_rshoulder.x + pt_rhand.x ) /2;
- pt_relbow.y =( pt_rshoulder.y + pt_rhand.y ) /2;
- CvPoint pt_lelbow;
- pt_lelbow.x =( pt_lshoulder.x + pt_lhand.x ) /2;
- pt_lelbow.y =( pt_lshoulder.y + pt_lhand.y ) /2;
- ZoomLine(pthead,pt_neck);
-
- ZoomLine(pt_neck,pt_waist);
- ZoomLine(pt_neck,pt_rshoulder);
- ZoomLine(pt_neck,pt_lshoulder);
- ZoomLine(pt_rshoulder,pt_relbow);
- ZoomLine(pt_lshoulder,pt_lelbow);
- ZoomLine(pt_relbow,pt_rhand);
- ZoomLine(pt_lelbow,pt_lhand);
- ZoomLine(pt_waist,pt_rAnkle);
- ZoomLine(pt_waist,pt_lAnkle);
- points[1][0] = Point_to_32f(pt_neck) ;
- points[1][1] = Point_to_32f(pthead) ;
- points[1][2] = Point_to_32f(pt_rshoulder) ;
- points[1][3] = Point_to_32f(pt_lshoulder) ;
- points[1][4] = Point_to_32f(pt_relbow) ;
- points[1][5] = Point_to_32f(pt_lelbow) ;
- points[1][6] = Point_to_32f(pt_rhand) ;
- points[1][7] = Point_to_32f(pt_lhand) ;
- points[1][8] = Point_to_32f(pt_waist) ;
- points[1][9] = Point_to_32f(pt_rknee) ;
- points[1][10] = Point_to_32f(pt_lknee) ;
- points[1][11] = Point_to_32f(pt_rAnkle) ;
- points[1][12] = Point_to_32f(pt_lAnkle) ;
- need_to_init = 0 ;
- init_OK = true ;
- cvShowImage( "LkDemo", image );
- cvWaitKey(0);
- }
- return 0;
- }
- int HumanMotion::ClearBodyJoints()
- {
- for(int i= 0; i<5 ;i++) ujoints[i].HasSet = false;
- for(i= 0; i<3 ;i++) njoints[i].HasSet = false;
- ujoints_count = 0;
- njoints_count = 0;
- return 0;
- }
- int HumanMotion::save_Points(CvPoint pt1,CvPoint pt2,CvPoint pt3,CvPoint pt4,JointType upoint_type)
- {
- if(upoint_type == U_TYPE)
- {
- ujoints_count = ujoints_count % 5;
- ujoints[ujoints_count].next_pt = pt1;
- ujoints[ujoints_count].pt = pt2;
- ujoints[ujoints_count].pre_pt = pt4;
- ujoints[ujoints_count].HasSet = true;
- ujoints_count ++;
- }
-
- if(upoint_type == N_TYPE)
- {
- njoints_count = njoints_count % 3;
- njoints[njoints_count].next_pt = pt1;
- njoints[njoints_count].pt = pt2;
- njoints[njoints_count].pre_pt = pt4;
- njoints[njoints_count].HasSet = true;
- njoints_count ++;
- }
- return 0;
- }
- int HumanMotion::ZoomLine(CvPoint pt1,CvPoint pt2)
- {
- CvPoint pts1,pts2;
- int zoom = 1;
- pts1.x = pt1.x * zoom ;
- pts1.y = pt1.y * zoom ;
- pts2.x = pt2.x * zoom ;
- pts2.y = pt2.y * zoom ;
- cvCircle( image,pts1,5, CV_RGB(0,233,250),3, CV_AA, 0 );
- cvCircle( image,pts2,5, CV_RGB(0,233,250),3, CV_AA, 0 );
- cvLine( image,pts1,pts2,CV_RGB(240,210,0),1, CV_AA, 0);
- cvShowImage( "LkDemo", image );
- cvWaitKey(0);
- return 0;
- }
- CvPoint2D32f HumanMotion::Point_to_32f(CvPoint pt)
- {
- CvPoint2D32f pt32;
- int zoom = 1;
- pt32.x = pt.x * zoom;
- pt32.y = pt.y * zoom;
- return pt32;
- }