Ask Your Question

vandelfi's profile - activity

2015-04-02 13:49:54 -0600 received badge  Student (source)
2014-02-25 17:28:36 -0600 asked a question Nose tip recognition in grayscale image

Hi,

Is there a way to recognize the nose tip in a grayscale image using openCV? Not just for a frontal head pose but also when the head is rotated to the side.

Cheers, Vedran

2013-12-02 01:30:13 -0600 asked a question CamShift on grayscael

Hi,

I would like to use Camshift to track the head and retrieve the roll angle like this. Is there a way to use CamShift on a grayscale image? I'm using a Time-of-flight camera and I can only get a grayscale image from it.

Cheers, V.

2013-11-28 07:13:25 -0600 answered a question cvFitEllipse error in points (points >=5)

Hi, I did the same thing in C, using the cvFitEllipse2. Try using my code to see if it works for you. But add the check >=5, because I didn't need it. What I'm using it for always has more than 6 points.

  CvBox2D box;
  CvPoint center;
  CvSize size;
  int count = largest_contour->total;

  CvMat* points_f = cvCreateMat( 1, count, CV_32FC2 );
  CvMat points_i = cvMat( 1, count, CV_32SC2, points_f->data.ptr );
  cvCvtSeqToArray(largest_contour, points_f->data.ptr, CV_WHOLE_SEQ );
  cvConvert( &points_i, points_f );

  box = cvFitEllipse2(points_f);
  center = cvPointFrom32f(box.center);
  size.width = cvRound(box.size.width*0.5);
  size.height = cvRound(box.size.height*0.5);

  cvEllipse(dst,center,size,box.angle,0,360,cvScalar(0,255,0),2,8,0);
2013-11-28 01:24:42 -0600 asked a question angle from cvFitEllipse2

Hi,

I'm doing some head tracking and I'm trying to estimate the roll angel by using openCV to fit an ellipse to the head contour. That all works fine. I would like to use the angle of the box to calculate the roll angle, i.e. the angle between the y axis of the image and the long axis of the ellipse.

It says that the box angle is the angle between the horizonal axis and the first side (i.e length), but the results that I get are somewhat strange.

  • The angel is 180° in case my head is upward.
  • When I tilt to the right the angle decreases to around 135° normally and then jumps suddenly to around 315°.
  • When I tilt to the left the angle rises normally until I get to 315° and jumps/changes suddenly to 135°

Here's short video of this: cvBox2D angle

Any idea what's going on and how I could calculate the roll angle properly?

Here is my code, but I would guess that what's happening is from the angle calculations done in cvFitEllipse2:

  CvBox2D box;
  CvPoint center;
  CvSize size;
  int count = largest_contour->total;

  CvMat* points_f = cvCreateMat( 1, count, CV_32FC2 );
  CvMat points_i = cvMat( 1, count, CV_32SC2, points_f->data.ptr );
  cvCvtSeqToArray(largest_contour, points_f->data.ptr, CV_WHOLE_SEQ );
  cvConvert( &points_i, points_f );

  box = cvFitEllipse2(points_f);
  center = cvPointFrom32f(box.center);
  size.width = cvRound(box.size.width*0.5);
  size.height = cvRound(box.size.height*0.5);

  cvEllipse(dst,center,size,box.angle,0,360,cvScalar(0,255,0),2,8,0);