logo       

Some problems with cvcam: msg#00711

lib.opencv

Subject: Some problems with cvcam

Ok, I fixed my last errors (sometimes I'm freaking idiot)...
I forgot
to put a '!' in the condition...
Anyway I've still some problems:
-
cvFindChessBoardCornerGuesses() always fails to find the chessboard
-
if I render the video in a window using cvcam, all others windows
created with highgui seem to be busy and if I move them they don't
refresh anymore
Could anyone answer to at least one of these questions?
Thanks to everybody

Here's my code:

bool calibrate(unsigned cam)
{
const char *name= "Grayscale image";

const int width= 4;
const int height= 5;

int npoints[]= { width*height };


float distortion[4];
float homography[9];
float translation[3];
float rotation[9];

CvMat mat1, mat2;

static CvPoint2D32f
img_point[width*height];
static CvPoint3D32f obj_point[width*height]
=
{
cvPoint3D32f(1.0, 1.0, 0.0),
cvPoint3D32f(2.0,
1.0, 0.0),
cvPoint3D32f(3.0, 1.0, 0.0),
cvPoint3D32f
(4.0, 1.0, 0.0),
cvPoint3D32f(1.0, 2.0, 0.0),

cvPoint3D32f(2.0, 2.0, 0.0),
cvPoint3D32f(3.0, 2.0, 0.0),
cvPoint3D32f(4.0, 2.0, 0.0),
cvPoint3D32f(1.0, 3.0,
0.0),
cvPoint3D32f(2.0, 3.0, 0.0),
cvPoint3D32f(3.0,
3.0, 0.0),
cvPoint3D32f(4.0, 3.0, 0.0),
cvPoint3D32f
(1.0, 4.0, 0.0),
cvPoint3D32f(2.0, 4.0, 0.0),

cvPoint3D32f(3.0, 4.0, 0.0),
cvPoint3D32f(4.0, 4.0, 0.0),
cvPoint3D32f(1.0, 5.0, 0.0),
cvPoint3D32f(2.0, 5.0,
0.0),
cvPoint3D32f(3.0, 5.0, 0.0),
cvPoint3D32f(4.0,
5.0, 0.0)
};

static IplImage *gray= cvCreateImage(size,
IPL_DEPTH_8U, 1);
static IplImage *tmp= cvCreateImage(size,
IPL_DEPTH_8U, 1);

cvCvtColor(rgb, gray, CV_BGR2GRAY);


gray->origin= rgb->origin;

cvNamedWindow(name, 1);

cvShowImage(name, gray);

if(!cvFindChessBoardCornerGuesses
(gray, tmp, 0,
cvSize(width, height), img_point))

return false;

cvCalibrateCamera(1, npoints, size, img_point,
obj_point,
distortion, homography, translation, rotation, 1);

cvSetIdentity(camera_mat[cam]);

mat1= cvMat(3, 3, CV_32FC1,
rotation);
cvGetSubRect(camera_mat[cam], &mat2, cvRect(0, 0, 3,
3));
cvCopy(&mat1, &mat2);

mat1= cvMat(3, 1, CV_32FC1,
translation);
cvGetSubRect(camera_mat[cam], &mat2, cvRect(3, 0, 1,
3));
cvCopy(&mat1, &mat2);

mat1= cvMat(3, 3, CV_32FC1,
homography);
cvGetSubRect(camera_mat[cam], &mat2, cvRect(0, 0, 4,
3));
cvMatMul(&mat1, &mat2, &mat2);

cvInvert(camera_mat
[cam], camera_invmat[cam]);

trace(camera_mat[cam]);
trace
(camera_invmat[cam]);

return true;
}



Change settings: http://www.yahoogroups.com/mygroups, select
Get Emails (get all posts)
Daily Digest (one summary email per day)
Read on the web (read posts on the web only)Or Unsubscribe by mailing
OpenCV-unsubscribe@xxxxxxxxxxxxxxx



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise