Copiar un cv:: Mat dentro de un ROI de otro
Necesito copiar una imagen cv::Mat
(fuente) a un ROI de otra imagen (Destino) cv::Mat
.
Encontré esta referencia, pero parece que no funciona para mi caso. ¿Tiene algún indicador de cómo podría hacer esto usando la interfaz OpenCV C++?
44
3 answers
OpenCV 2.4:
src.copyTo(dst(Rect(left, top, src.cols, src.rows)));
OpenCV 2.x:
Mat dst_roi = dst(Rect(left, top, src.cols, src.rows));
src.copyTo(dst_roi);
67
Author: Andrey Kamaev,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-05 10:02:50
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-05 10:02:50
Funcionó para mí de esta manera:
Mat imgPanel(100, 250, CV_8UC1, Scalar(0));
Mat imgPanelRoi(imgPanel, Rect(0, 0, imgSrc.cols, imgSrc.rows));
imgSrc.copyTo(imgPanelRoi);
imshow("imgPanel", imgPanel);
waitKey();
Estoy usando Opencv 2.4.9 Basado en la respuesta de Andrey.
6
Author: Renato Aloi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-05 12:07:17
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-05 12:07:17
Además o corrección de las respuestas anteriores, si desea copiar una región más pequeña de open Mat
a otra Mat
, debe hacer:
src(Rect(left,top,width, height)).copyTo(dst);
6
Author: Mich,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-10 20:30:11
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-10 20:30:11