资源简介
手指识别,里面含有全部源代码基于opencv,有论文等,可以正确2008下面编译,运行,具体算法,看里面的论文
代码片段和文件信息
#include
#include
#include “cv.h“
#include “highgui.h“
#include “Capture/Capture.h“
#define NUM_CHESS_POINT 48
#define NUM_CHESS_ROW 6
#define NUM_CHESS_COL 8
#define CHESS_CORNER_SIZE_MM 28.8
#define MAX_CALIBRATION_POINT 1000
Capture gCapture;
IplImage * frame = 0;
IplImage * gray = 0;
bool fChessboardFound = false;
// Camera Calibration Data
int calib_frame_count = 0;
float calib_obj_pt[MAX_CALIBRATION_POINT][3];
float calib_img_pt[MAX_CALIBRATION_POINT][2];
int chess_count = 0;
CvPoint2D32f chess_pt[NUM_CHESS_POINT];
// Camera Calibration Matrix
float camera_intrinsic[3][3];
float camera_distortion[4];
void TakeCalibrationframe()
{
if ( fChessboardFound )
{
int k = NUM_CHESS_POINT * calib_frame_count;
for ( int i = 0 ; i < NUM_CHESS_ROW ; i ++ )
{
for ( int j = 0 ; j < NUM_CHESS_COL ; j ++ )
{
// object coordinates
calib_obj_pt[k][0] = (float)CHESS_CORNER_SIZE_MM * j;
calib_obj_pt[k][1] = (float)CHESS_CORNER_SIZE_MM * i;
calib_obj_pt[k][2] = 1;
// image coordinates
calib_img_pt[k][0] = chess_pt[NUM_CHESS_COL * i + j].x;
calib_img_pt[k][1] = chess_pt[NUM_CHESS_COL * i + j].y;
k ++;
}
}
calib_frame_count ++;
printf( “# calibration frame: %d\n“ calib_frame_count );
}
}
void SaveCalibration()
{
FILE *fp = fopen(“calibration.txt“ “wt“);
if (fp == NULL) return;
fprintf(fp “%f “ camera_intrinsic[0][0]);
fprintf(fp “%f “ camera_intrinsic[1][1]);
fprintf(fp “%f “ camera_intrinsic[0][2]);
fprintf(fp “%f “ camera_intrinsic[1][2]);
fprintf(fp “\n“);
for (int i=0; i<4; i++)
fprintf(fp “%f “ camera_distortion[i]);
fprintf(fp “\n“);
fclose(fp);
printf(“fx=%.5f fy=%.5f cx=%.5f cy=%.5f\n“ camera_intrinsic[0][0] camera_intrinsic[1][1] camera_intrinsic[0][2] camera_intrinsic[1][2]);
printf(“k1=%.5f k2=%.5f p1=%.5f p2=%.5f\n“ camera_distortion[0] camera_distortion[1] camera_distortion[2] camera_distortion[3]);
}
void Calibration()
{
CvMat obj_pt = cvMat( NUM_CHESS_POINT * calib_frame_count 3 CV_32FC1 calib_obj_pt );
CvMat img_pt = cvMat( NUM_CHESS_POINT * calib_frame_count 2 CV_32FC1 calib_img_pt );
int * pt_count = (int *)malloc( sizeof(int) * calib_frame_count );
for ( int i = 0 ; i < calib_frame_count ; i ++ )
{
pt_count[ i ] = NUM_CHESS_POINT;
}
CvMat pt_counts = cvMat( calib_frame_count 1 CV_32SC1 pt_count );
CvMat intrinsic = cvMat( 3 3 CV_32FC1 camera_intrinsic );
CvMat distortion = cvMat( 4 1 CV_32FC1 camera_distortion );
cvCalibrateCamera2(
&obj_pt
&img_pt
&pt_counts
cvGetSize( gCapture.QueryF
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 501306 2007-10-09 21:38 DemoHandyAR Documentation.pdf
文件 242 2007-04-01 19:56 bin\artag_1023.cf
文件 57344 2007-10-05 23:38 bin\Calibrate.exe
文件 86 2007-02-20 13:50 bin\calibration.txt
文件 843824 2006-10-18 21:49 bin\cv100.dll
文件 1011764 2006-10-18 21:49 bin\cxcore100.dll
文件 1761280 2007-10-09 21:34 bin\DemoHandyAR.exe
文件 1884160 2007-10-09 21:30 bin\DemoHandyAR_ARTag.exe
文件 66159 2007-04-23 18:09 bin\earthTexture.jpg
文件 152 2007-04-23 14:57 bin\fingertip_320x240.dat
文件 237568 2001-11-07 18:27 bin\glut32.dll
文件 626741 2006-10-18 21:50 bin\highgui100.dll
文件 196608 2006-02-28 18:04 bin\libguide40.dll
文件 776 2007-01-17 15:19 bin\nonskin.mgm
文件 41088 2007-04-04 13:46 bin\panel_set.cf
文件 779 2007-01-17 15:19 bin\skin.mgm
文件 892 2007-10-05 16:42 Calibrate\Calibrate.sln
文件 10240 2007-10-09 11:08 Calibrate\Calibrate.suo
文件 4481 2007-10-05 16:50 Calibrate\Calibrate\Calibrate.vcproj
文件 1417 2007-10-09 11:08 Calibrate\Calibrate\Calibrate.vcproj.TAEHEE.Taehee Lee.user
文件 87 2007-10-05 23:39 Calibrate\Calibrate\calibration.txt
文件 5922 2007-10-05 23:38 Calibrate\Calibrate\main.cpp
文件 2539 2007-09-05 10:03 Calibrate\Calibrate\Capture\Capture.cpp
文件 994 2007-10-05 16:46 Calibrate\Calibrate\Capture\Capture.h
文件 4232 2007-10-05 16:46 Calibrate\Calibrate\Capture\FlyCap.cpp
文件 849 2007-02-24 13:36 Calibrate\Calibrate\Capture\FlyCap.h
文件 898 2007-09-05 09:49 DemoHandyAR\DemoHandyAR.sln
文件 29184 2007-10-09 21:34 DemoHandyAR\DemoHandyAR.suo
文件 242 2007-04-01 19:56 DemoHandyAR\DemoHandyAR\artag_1023.cf
文件 86 2007-02-20 13:50 DemoHandyAR\DemoHandyAR\calibration.txt
文件 11477 2007-09-05 10:02 DemoHandyAR\DemoHandyAR\cvFindExtrinsicCameraParams3.cpp
............此处省略38个文件信息
- 上一篇:CircularProgressButton
- 下一篇:QQ飞车卡商城源码.e
评论
共有 条评论