Does the drawchessboardcorner method work?

asked 2018-02-28 20:25:17 -0600

baihualinxin gravatar image

updated 2018-02-28 20:49:16 -0600

cv::Size board_size=cv::Size(8, 6); int board_width=board_size.width; int board_height=board_size.height; UIImage *image=[UIImage imageNamed:[NSString stringWithFormat:@"%d",1]];
cv::Mat imageInput; UIImageToMat(image, imageInput);

       bool ok = cv::findChessboardCorners(imageInput, cv::Size(board_width, board_height), 
       image_points,cv::CALIB_CB_ADAPTIVE_THRESH |  cv::CALIB_CB_NORMALIZE_IMAGE);
       if (ok==false) {

  }else{
    cv::Mat view_gray;
     cv::cvtColor(imageInput, view_gray, cv::COLOR_BGR2GRAY);
       UIImage *images=MatToUIImage(view_gray);
    cv::TermCriteria criteria = cv::TermCriteria(
                                                 cv::TermCriteria::MAX_ITER + cv::TermCriteria::EPS,
                                                 30,
                                                 0.1);
    cv::cornerSubPix(view_gray, image_points, cvSize(5,5), cvSize(-1,-1), criteria);
    image_points_seq.push_back(image_points);

    cv::drawChessboardCorners(imageInput, cv::Size(board_width, board_height), image_points, true);
    UIImage *image=MatToUIImage(imageInput);
            }

     }
edit retag flag offensive close merge delete

Comments

drawchessboardCorner works. Please read the FAQ and improve your question : insert images, show where you have got a problem...

LBerger gravatar imageLBerger ( 2018-03-01 01:25:16 -0600 )edit