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


C++ ImageRGB::resize方法代码示例

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


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

示例1: getScreenShot

void Application::getScreenShot(ImageRGB& img) {
    int w = 0, h = 0;
    glfwGetFramebufferSize(context->window, &w, &h);
    img.resize(w, h);
    glReadPixels(0, 0, w, h, GL_RGB, GL_UNSIGNED_BYTE, img.ptr());
}
开发者ID:galek,项目名称:Alloy-Graphics-Library,代码行数:6,代码来源:AlloyApplication.cpp

示例2: main

int main(int argc, char* argv[]) {
    std::string hostname,user,password;
    int port;
    double pan,tilt,zoom;

    if(argc!=10) {
        std::cout << "Usage :" << std::endl
                  << "  " << argv[0]
                  << " <hostname> <port:80> <username> <password> <pan> <tilt> <zoom> <x> <y>"
                  << std::endl;
        return 0;
    }

    hostname = argv[1];
    port     = atoi(argv[2]);
    user     = argv[3];
    password = argv[4];

    axis::PTZ axis(hostname,port);
    if(!axis.connect(user,password)) {
        std::cout << "Connot connect " << user
                  << " (" << password << ") on "
                  << hostname << ':' << port << ". Aborting."
                  << std::endl;
        return 1;
    }

    axis.setAutoiris("off");
    axis.setIris(1000);

    axis.getPosition(pan,tilt,zoom);
    std::cout << "Current position is " << std::endl
              << "  pan  = " << pan << std::endl
              << "  tilt = " << tilt << std::endl
              << "  zoom = " << zoom << std::endl;

    pan  = atof(argv[5]);;
    tilt = atof(argv[6]);
    zoom = atof(argv[7]);

    std::cout << "Reaching now... " << std::endl
              << "  pan  = " << pan << std::endl
              << "  tilt = " << tilt << std::endl
              << "  zoom = " << zoom << std::endl;
    axis.setPanTilt(pan,tilt);
    axis.setZoom(zoom);
    axis.wait();

    std::cout << "... reached." << std::endl;
    axis.getPosition(pan,tilt,zoom);
    std::cout << "  pan  = " << pan << std::endl
              << "  tilt = " << tilt << std::endl
              << "  zoom = " << zoom << std::endl;

    // Let us now grab an image.
    // We wait 2 seconds for autofocus to stabilize, since we mah have zoomed.
    ost::Thread::sleep(2000);
    axis.getDefaultBMPImage();

    // Let us now handle the image with mirage
    ImageRGB img;
    int dummy;
    mirage::img::Coordinate img_size(axis.getWidth(),axis.getHeight());
    img.resize(img_size,
               (ImageRGB::value_type*)axis.getImageBytes(dummy,dummy,dummy));

    // Let is save the mirage image in a file.
    std::ostringstream outputnamestream;
    outputnamestream << "X_" << argv[8] << "Y_" << argv[9] << "pan_" << pan << "tilt_" << tilt << "zoom_" << zoom << ".jpg";
    std::string outputname = outputnamestream.str();
    rgb2bgr(img);
    mirage::img::JPEG::write(img,outputname,80);
    std::cout << "Image has been captured in ptz.jpg file." << std::endl;

    return 0;
}
开发者ID:jedirandy,项目名称:NaoTrack,代码行数:76,代码来源:camera.cpp


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