예제 #1
0
FSFrame::FSFrame(FSPoint p)
{
  frame=NULL;
  //size will be reset
  size = FSMakeSize(FRAME_WIDTH, FRAME_WIDTH, 0.0f);
  position = p;
}
예제 #2
0
CvPoint CSVision::convertFSPointToCvPoint(FSPoint fsPoint)
{
  CvSize cvImageSize = cvSize(
              FSController::config->CAM_IMAGE_WIDTH,
              FSController::config->CAM_IMAGE_HEIGHT);
  FSSize fsImageSize = FSMakeSize(
              FSController::config->FRAME_WIDTH,
              FSController::config->FRAME_WIDTH*(FSController::config->CAM_IMAGE_HEIGHT/FSController::config->CAM_IMAGE_WIDTH), 0.0f);

  CvPoint origin;
  origin.x = cvImageSize.width/2.0f;
  origin.y = cvImageSize.height*FSController::config->ORIGIN_Y;

  CvPoint cvPoint;

  cvPoint.x = fsPoint.x*cvImageSize.width/fsImageSize.width;
  cvPoint.y = -fsPoint.y*cvImageSize.height/fsImageSize.height;

  //translate
  cvPoint.x += origin.x;
  cvPoint.y += origin.y;

  return cvPoint;

}
예제 #3
0
void FSFrame::setFrame(IplImage* frame)
{
  if(frame == NULL){
    this->frame = NULL;
    return;
  }
  //cout << frame->width << " " << frame->height << " " << endl;
  size = FSMakeSize((FSFloat)frame->width/(FSFloat)frame->width*size.width, (FSFloat)frame->height/(FSFloat)frame->width*size.width, 0.0f);
  //cout << __PRETTY_FUNCTION__ << size.width << " " << size.height << " " << endl;
  //position.x = -(size.width)/2.0;
  cvReleaseImage(&(this->frame));//remove old frame befor setting new one
  this->frame = frame;
}
예제 #4
0
FSPoint FSVision::convertCvPointToFSPoint(CvPoint cvPoint)
{
    CvSize cvImageSize = cvSize(CAM_IMAGE_WIDTH, CAM_IMAGE_HEIGHT);
    FSSize fsImageSize = FSMakeSize(FRAME_WIDTH, FRAME_WIDTH*(CAM_IMAGE_HEIGHT/CAM_IMAGE_WIDTH), 0.0f);

    //here we define the origin of the cvImage, we place it in the middle of the frame and in the corner of the two perpendiculair planes
    CvPoint origin;
    origin.x = cvImageSize.width/2.0f;
    origin.y = cvImageSize.height*ORIGIN_Y;

    FSPoint fsPoint;
    //translate
    cvPoint.x -= origin.x;
    cvPoint.y -= origin.y;
    //scale
    fsPoint.x = cvPoint.x*fsImageSize.width/cvImageSize.width;
    fsPoint.y = -cvPoint.y*fsImageSize.height/cvImageSize.height;
    fsPoint.z = 0.0f;

    return fsPoint;
}
예제 #5
0
FSFrame::FSFrame()
{
  frame=NULL;
  size = FSMakeSize(14.0f, 14.0f, 0.0f);
  position = FSMakePoint(0.0f, 0.0f, 0.0f);
}