本文整理汇总了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());
}
示例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;
}