本文整理汇总了C++中cv::Mat::assignTo方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat::assignTo方法的具体用法?C++ Mat::assignTo怎么用?C++ Mat::assignTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cv::Mat
的用法示例。
在下文中一共展示了Mat::assignTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: set_img
void GUI::set_img(const cv::Mat &frame, cv::Mat &result, Controller &controller) {
/** result == controller.current_image_to_display. */
// Convert controller.current_image_to_process (as src) to RGB(A) controller.current_image_to_display (as dst).
convert_image_to_gui_output_format(frame, result) ;
if (widget_current_image_to_display != NULL) {
delete widget_current_image_to_display ;
}
widget_current_image_to_display = Gtk::manage(new Gtk::Image());
widget_current_image_to_display->clear() ;
if (result.depth() != CV_8U) { // This desnt' should be !
result.assignTo(result, CV_8U) ;
}
// We resize the original image every time we display it.
// It's better like this because the image is resized (if needed) only one time per changement
// Not always resizing the same image.
//controller.resize_image_to_display(result) ;
if (controller.get_image_size_gt_layout()) {
cv::resize(result, result, cv::Size(controller.display_image_size.first, controller.display_image_size.second), 1.0, 1.0, cv::INTER_LINEAR) ;
}
IplImage iplimg = _IplImage(result) ;
widget_current_image_to_display->set(Gdk::Pixbuf::create_from_data( (const guint8 *) iplimg.imageData,
Gdk::COLORSPACE_RGB,
(result.channels() == 4),
iplimg.depth,
iplimg.width,
iplimg.height,
iplimg.widthStep)) ;
widget_current_image_to_display->show() ;
display_area.put(*widget_current_image_to_display, controller.current_image_position.first, controller.current_image_position.second) ;
}