当前位置: 首页>>代码示例>>C++>>正文


C++ Pose::GetMatrixGL方法代码示例

本文整理汇总了C++中Pose::GetMatrixGL方法的典型用法代码示例。如果您正苦于以下问题:C++ Pose::GetMatrixGL方法的具体用法?C++ Pose::GetMatrixGL怎么用?C++ Pose::GetMatrixGL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pose的用法示例。


在下文中一共展示了Pose::GetMatrixGL方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: videocallback

void videocallback(IplImage *image)
{
    static IplImage *rgba;
    bool flip_image = (image->origin?true:false);
    if (flip_image) {
        cvFlip(image);
        image->origin = !image->origin;
    }

    if (init) {
        init = false;
        cout<<"Loading calibration: "<<calibrationFilename.str();
        if (cam.SetCalib(calibrationFilename.str().c_str(), image->width, image->height)) {
            cout<<" [Ok]"<<endl;
        } else {
            cam.SetRes(image->width, image->height);
            cout<<" [Fail]"<<endl;
        }
        double p[16];
        cam.GetOpenglProjectionMatrix(p,image->width,image->height);
        GlutViewer::SetGlProjectionMatrix(p);
        for (int i=0; i<32; i++) {
            d[i].SetScale(marker_size);
        }
        rgba = CvTestbed::Instance().CreateImageWithProto("RGBA", image, 0, 4);
    }
    static MarkerDetector<MarkerData> marker_detector;
    marker_detector.SetMarkerSize(marker_size); // for marker ids larger than 255, set the content resolution accordingly
    //static MarkerDetector<MarkerArtoolkit> marker_detector;
    //marker_detector.SetMarkerSize(2.8, 3, 1.5);

    // Here we try to use RGBA just to make sure that also it works...
    //cvCvtColor(image, rgba, CV_RGB2RGBA);
    marker_detector.Detect(image, &cam, true, true);
    GlutViewer::DrawableClear();
    for (size_t i=0; i<marker_detector.markers->size(); i++) {
        if (i >= 32) break;
        
        Pose p = (*(marker_detector.markers))[i].pose;
        p.GetMatrixGL(d[i].gl_mat);

        int id = (*(marker_detector.markers))[i].GetId();
        double r = 1.0 - double(id+1)/32.0;
        double g = 1.0 - double(id*3%32+1)/32.0;
        double b = 1.0 - double(id*7%32+1)/32.0;
        d[i].SetColor(r, g, b);

        GlutViewer::DrawableAdd(&(d[i]));
    }

    if (flip_image) {
        cvFlip(image);
        image->origin = !image->origin;
    }
}
开发者ID:campbeb6,项目名称:RedhawkQuad,代码行数:55,代码来源:DetectAlvar.cpp

示例2: videocallback

void videocallback(IplImage *image)
{
    bool flip_image = (image->origin?true:false);
    if (flip_image) {
        cvFlip(image);
        image->origin = !image->origin;
    }

    if (init) {
        init = false;
        cout << "Loading calibration: " << calibrationFilename.str();
        if (fernEstimator.setCalibration(calibrationFilename.str(), image->width, image->height)) {
            cout << " [Ok]" << endl;
        } else {
            fernEstimator.setResolution(image->width, image->height);
            cout << " [Fail]" << endl;
        }
        double p[16];
        fernEstimator.camera().GetOpenglProjectionMatrix(p, image->width, image->height);
        GlutViewer::SetGlProjectionMatrix(p);
        d.SetScale(10);
        gray = cv::Mat(image);
    }

    if (image->nChannels == 3) {
        cv::Mat img = cvarrToMat(image);
        cv::cvtColor(img, gray, CV_RGB2GRAY);
    }
    else {
        gray = image;
    }

    vector<CvPoint2D64f> ipts;
    vector<CvPoint3D64f> mpts;

    fernDetector.findFeatures(gray, true);
    fernDetector.imagePoints(ipts);
    fernDetector.modelPoints(mpts, true);
    double test = fernDetector.inlierRatio();
    if (test > 0.15 && mpts.size() > 4) {
        fernEstimator.calculateFromPointCorrespondences(mpts, ipts);
    }

    GlutViewer::DrawableClear();
    Pose pose = fernEstimator.pose();
    pose.GetMatrixGL(d.gl_mat);
    GlutViewer::DrawableAdd(&d);

    if (flip_image) {
        cvFlip(image);
        image->origin = !image->origin;
    }
}
开发者ID:campbeb6,项目名称:RedhawkQuad,代码行数:53,代码来源:SampleMarkerlessDetector.cpp


注:本文中的Pose::GetMatrixGL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。