1 #import "ViewController.h" 2 #import "ImageConversion.h" 3 #import "ImageDisplay.h" 8 #ifndef DOXYGEN_SHOULD_SKIP_THIS 9 @interface ViewController ()
12 @implementation ViewController
14 @synthesize myImageView;
23 UIImage *img = [UIImage imageNamed:@"AprilTag.png"];
26 self.myImageView = [[UIImageView alloc] initWithImage:img];
29 CGRect myFrame = CGRectMake(0.0f, 0.0f,
self.myImageView.frame.size.width,
self.myImageView.frame.size.height);
30 [
self.myImageView setFrame:myFrame];
33 [
self.view addSubview:self.myImageView];
36 [myImageView setImage:img];
44 double tagSize = 0.053;
45 float quad_decimate = 3.0;
47 std::vector<vpHomogeneousMatrix> cMo_vec;
60 detector.
detect(I, tagSize, cam, cMo_vec);
63 std::cout <<
"Number of tags in the image: " << detector.
getNbObjects() << std::endl;
65 std::cout <<
"- Detected tag: " << detector.
getMessage(i) << std::endl;
66 std::cout <<
" pose: " << cMo_vec[i] << std::endl;
71 std::vector<vpImagePoint> polygon = detector.
getPolygon(i);
72 for (
size_t j = 0; j < polygon.size(); j++) {
73 img = [ImageDisplay displayLine:img :polygon[j] :polygon[(j+1)%polygon.size()] :[UIColor redColor] :2];
79 img = [ImageDisplay displayFrame:img :cMo_vec[i] :cam :0.025 :2];
81 [myImageView setImage:img];
84 - (void)didReceiveMemoryWarning {
85 [
super didReceiveMemoryWarning];
void setAprilTagQuadDecimate(const float quadDecimate)
void setAprilTagPoseEstimationMethod(const vpPoseEstimationMethod &poseEstimationMethod)
size_t getNbObjects() const
void initPersProjWithoutDistortion(const double px, const double py, const double u0, const double v0)
Generic class defining intrinsic camera parameters.
std::vector< std::string > & getMessage()
void setAprilTagNbThreads(const int nThreads)
std::vector< std::vector< vpImagePoint > > & getPolygon()
bool detect(const vpImage< unsigned char > &I)