46 #include <visp3/core/vpConfig.h>
48 #if defined(VISP_HAVE_OPENCV)
57 #include <visp3/core/vpDisplay.h>
58 #include <visp3/core/vpImageTools.h>
59 #include <visp3/core/vpIoTools.h>
60 #include <visp3/core/vpMath.h>
61 #include <visp3/gui/vpDisplayOpenCV.h>
64 #include <visp3/core/vpDebug.h>
65 #include <visp3/core/vpDisplayException.h>
67 #if (VISP_HAVE_OPENCV_VERSION >= 0x020408)
69 #include <opencv2/core/core_c.h>
70 #include <opencv2/imgproc/imgproc.hpp>
73 #define CV_RGB(r, g, b) cv::Scalar((b), (g), (r), 0)
78 #include <visp3/gui/vpDisplayX.h>
83 std::vector<std::string> vpDisplayOpenCV::m_listTitles = std::vector<std::string>();
84 unsigned int vpDisplayOpenCV::m_nbWindows = 0;
109 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
110 m_background(NULL), col(NULL), cvcolor(), font(NULL),
112 m_background(), col(NULL), cvcolor(), font(cv::FONT_HERSHEY_PLAIN), fontScale(0.8f),
114 fontHeight(10), x_move(0), y_move(0), move(false), x_lbuttondown(0), y_lbuttondown(0), lbuttondown(false),
115 x_mbuttondown(0), y_mbuttondown(0), mbuttondown(false), x_rbuttondown(0), y_rbuttondown(0), rbuttondown(false),
116 x_lbuttonup(0), y_lbuttonup(0), lbuttonup(false), x_mbuttonup(0), y_mbuttonup(0), mbuttonup(false), x_rbuttonup(0),
117 y_rbuttonup(0), rbuttonup(false)
149 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
150 m_background(NULL), col(NULL), cvcolor(), font(NULL),
152 m_background(), col(NULL), cvcolor(), font(cv::FONT_HERSHEY_PLAIN), fontScale(0.8f),
154 fontHeight(10), x_move(0), y_move(0), move(false), x_lbuttondown(0), y_lbuttondown(0), lbuttondown(false),
155 x_mbuttondown(0), y_mbuttondown(0), mbuttondown(false), x_rbuttondown(0), y_rbuttondown(0), rbuttondown(false),
156 x_lbuttonup(0), y_lbuttonup(0), lbuttonup(false), x_mbuttonup(0), y_mbuttonup(0), mbuttonup(false), x_rbuttonup(0),
157 y_rbuttonup(0), rbuttonup(false)
160 init(I, x, y, title);
183 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
184 m_background(NULL), col(NULL), cvcolor(), font(NULL),
186 m_background(), col(NULL), cvcolor(), font(cv::FONT_HERSHEY_PLAIN), fontScale(0.8f),
188 fontHeight(10), x_move(0), y_move(0), move(false), x_lbuttondown(0), y_lbuttondown(0), lbuttondown(false),
189 x_mbuttondown(0), y_mbuttondown(0), mbuttondown(false), x_rbuttondown(0), y_rbuttondown(0), rbuttondown(false),
190 x_lbuttonup(0), y_lbuttonup(0), lbuttonup(false), x_mbuttonup(0), y_mbuttonup(0), mbuttonup(false), x_rbuttonup(0),
191 y_rbuttonup(0), rbuttonup(false)
219 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
220 m_background(NULL), col(NULL), cvcolor(), font(NULL),
222 m_background(), col(NULL), cvcolor(), font(cv::FONT_HERSHEY_PLAIN), fontScale(0.8f),
224 fontHeight(10), x_move(0), y_move(0), move(false), x_lbuttondown(0), y_lbuttondown(0), lbuttondown(false),
225 x_mbuttondown(0), y_mbuttondown(0), mbuttondown(false), x_rbuttondown(0), y_rbuttondown(0), rbuttondown(false),
226 x_lbuttonup(0), y_lbuttonup(0), lbuttonup(false), x_mbuttonup(0), y_mbuttonup(0), mbuttonup(false), x_rbuttonup(0),
227 y_rbuttonup(0), rbuttonup(false)
230 init(I, x, y, title);
257 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
258 m_background(NULL), col(NULL), cvcolor(), font(NULL),
260 m_background(), col(NULL), cvcolor(), font(cv::FONT_HERSHEY_PLAIN), fontScale(0.8f),
262 fontHeight(10), x_move(0), y_move(0), move(false), x_lbuttondown(0), y_lbuttondown(0), lbuttondown(false),
263 x_mbuttondown(0), y_mbuttondown(0), mbuttondown(false), x_rbuttondown(0), y_rbuttondown(0), rbuttondown(false),
264 x_lbuttonup(0), y_lbuttonup(0), lbuttonup(false), x_mbuttonup(0), y_mbuttonup(0), mbuttonup(false), x_rbuttonup(0),
265 y_rbuttonup(0), rbuttonup(false)
270 if (!title.empty()) {
273 std::ostringstream s;
275 m_title = std::string(
"Window ") + s.str();
281 for (
size_t i = 0; i < m_listTitles.size(); i++) {
282 if (m_listTitles[i] ==
m_title) {
283 std::ostringstream s;
285 m_title = std::string(
"Window ") + s.str();
292 m_listTitles.push_back(
m_title);
316 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
317 m_background(NULL), col(NULL), cvcolor(), font(NULL),
319 m_background(), col(NULL), cvcolor(), font(cv::FONT_HERSHEY_PLAIN), fontScale(0.8f),
321 fontHeight(10), x_move(0), y_move(0), move(false), x_lbuttondown(0), y_lbuttondown(0), lbuttondown(false),
322 x_mbuttondown(0), y_mbuttondown(0), mbuttondown(false), x_rbuttondown(0), y_rbuttondown(0), rbuttondown(false),
323 x_lbuttonup(0), y_lbuttonup(0), lbuttonup(false), x_mbuttonup(0), y_mbuttonup(0), mbuttonup(false), x_rbuttonup(0),
324 y_rbuttonup(0), rbuttonup(false)
334 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
335 cvReleaseImage(&m_background);
400 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
401 int flags = CV_WINDOW_AUTOSIZE;
403 int flags = cv::WINDOW_AUTOSIZE;
407 if (!title.empty()) {
411 std::ostringstream s;
413 m_title = std::string(
"Window ") + s.str();
419 for (
size_t i = 0; i < m_listTitles.size(); i++) {
420 if (m_listTitles[i] ==
m_title) {
421 std::ostringstream s;
423 m_title = std::string(
"Window ") + s.str();
430 m_listTitles.push_back(
m_title);
434 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
435 if (cvNamedWindow(this->
m_title.c_str(), flags) < 0) {
439 cv::namedWindow(this->
m_title, flags);
441 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
453 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
500 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
502 cvInitFont(font, CV_FONT_HERSHEY_PLAIN, 0.70f, 0.70f);
505 cvGetTextSize(
"A", font, &fontSize, &baseline);
510 fontSize = cv::getTextSize(
"A", font, fontScale, thickness, &baseline);
513 fontHeight = fontSize.height + baseline;
564 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
565 cvMoveWindow(this->
m_title.c_str(), winx, winy);
567 cv::moveWindow(this->
m_title.c_str(), winx, winy);
587 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
591 if (m_background != NULL) {
592 if (m_background->nChannels != channels || m_background->depth != depth ||
593 m_background->height != (
int)
m_height || m_background->width != (
int)
m_width) {
594 if (m_background->nChannels != 0)
595 cvReleaseImage(&m_background);
596 m_background = cvCreateImage(size, depth, channels);
599 m_background = cvCreateImage(size, depth, channels);
603 for (
unsigned int i = 0; i <
m_height; i++) {
604 unsigned char *dst_24 = (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep);
605 for (
unsigned int j = 0; j <
m_width; j++) {
606 unsigned char val = I[i][j];
613 for (
unsigned int i = 0; i <
m_height; i++) {
614 unsigned char *dst_24 = (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep);
615 for (
unsigned int j = 0; j <
m_width; j++) {
628 if (m_background.channels() != channels || m_background.depth() != depth || m_background.rows != (int)
m_height ||
629 m_background.cols != (
int)
m_width) {
630 m_background = cv::Mat(size, CV_MAKETYPE(depth, channels));
634 for (
unsigned int i = 0; i <
m_height; i++) {
635 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width);
636 for (
unsigned int j = 0; j <
m_width; j++) {
637 unsigned char val = I[i][j];
644 for (
unsigned int i = 0; i <
m_height; i++) {
645 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width);
646 for (
unsigned int j = 0; j <
m_width; j++) {
677 const unsigned int h)
680 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
683 CvSize size = cvSize((
int)this->m_width, (
int)this->m_height);
684 if (m_background != NULL) {
685 if (m_background->nChannels != channels || m_background->depth != depth ||
686 m_background->height != (
int)
m_height || m_background->width != (
int)
m_width) {
687 if (m_background->nChannels != 0)
688 cvReleaseImage(&m_background);
689 m_background = cvCreateImage(size, depth, channels);
692 m_background = cvCreateImage(size, depth, channels);
696 unsigned int i_min = (
unsigned int)iP.
get_i();
697 unsigned int j_min = (
unsigned int)iP.
get_j();
698 unsigned int i_max = (std::min)(i_min + h,
m_height);
699 unsigned int j_max = (std::min)(j_min + w,
m_width);
700 for (
unsigned int i = i_min; i < i_max; i++) {
701 unsigned char *dst_24 =
702 (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep + j_min * 3);
703 for (
unsigned int j = j_min; j < j_max; j++) {
704 unsigned char val = I[i][j];
711 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
712 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
715 for (
int i = i_min; i < i_max; i++) {
716 unsigned char *dst_24 =
717 (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep + j_min * 3);
718 for (
int j = j_min; j < j_max; j++) {
731 if (m_background.channels() != channels || m_background.depth() != depth || m_background.rows != (int)
m_height ||
732 m_background.cols != (
int)
m_width) {
733 m_background = cv::Mat(size, CV_MAKETYPE(depth, channels));
737 unsigned int i_min = (
unsigned int)iP.
get_i();
738 unsigned int j_min = (
unsigned int)iP.
get_j();
739 unsigned int i_max = (std::min)(i_min + h,
m_height);
740 unsigned int j_max = (std::min)(j_min + w,
m_width);
741 for (
unsigned int i = i_min; i < i_max; i++) {
742 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width + j_min * 3);
743 for (
unsigned int j = j_min; j < j_max; j++) {
744 unsigned char val = I[i][j];
751 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
752 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
755 for (
int i = i_min; i < i_max; i++) {
756 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width + j_min * 3);
757 for (
int j = j_min; j < j_max; j++) {
786 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
789 CvSize size = cvSize((
int)this->m_width, (
int)this->m_height);
790 if (m_background != NULL) {
791 if (m_background->nChannels != channels || m_background->depth != depth ||
792 m_background->height != (
int)
m_height || m_background->width != (
int)
m_width) {
793 if (m_background->nChannels != 0)
794 cvReleaseImage(&m_background);
795 m_background = cvCreateImage(size, depth, channels);
798 m_background = cvCreateImage(size, depth, channels);
802 for (
unsigned int i = 0; i <
m_height; i++) {
803 unsigned char *dst_24 = (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep);
804 for (
unsigned int j = 0; j <
m_width; j++) {
812 for (
unsigned int i = 0; i <
m_height; i++) {
813 unsigned char *dst_24 = (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep);
814 for (
unsigned int j = 0; j <
m_width; j++) {
825 cv::Size size((
int)this->m_width, (
int)this->m_height);
826 if (m_background.channels() != channels || m_background.depth() != depth || m_background.rows != (int)
m_height ||
827 m_background.cols != (
int)
m_width) {
828 m_background = cv::Mat(size, CV_MAKETYPE(depth, channels));
832 for (
unsigned int i = 0; i <
m_height; i++) {
833 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width);
834 for (
unsigned int j = 0; j <
m_width; j++) {
842 for (
unsigned int i = 0; i <
m_height; i++) {
843 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width);
844 for (
unsigned int j = 0; j <
m_width; j++) {
874 const unsigned int h)
877 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
880 CvSize size = cvSize((
int)this->m_width, (
int)this->m_height);
881 if (m_background != NULL) {
882 if (m_background->nChannels != channels || m_background->depth != depth ||
883 m_background->height != (
int)
m_height || m_background->width != (
int)
m_width) {
884 if (m_background->nChannels != 0)
885 cvReleaseImage(&m_background);
886 m_background = cvCreateImage(size, depth, channels);
889 m_background = cvCreateImage(size, depth, channels);
893 unsigned int i_min = (
unsigned int)iP.
get_i();
894 unsigned int j_min = (
unsigned int)iP.
get_j();
895 unsigned int i_max = (std::min)(i_min + h,
m_height);
896 unsigned int j_max = (std::min)(j_min + w,
m_width);
897 for (
unsigned int i = i_min; i < i_max; i++) {
898 unsigned char *dst_24 =
899 (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep + j_min * 3);
900 for (
unsigned int j = j_min; j < j_max; j++) {
908 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
909 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
912 for (
int i = i_min; i < i_max; i++) {
913 unsigned char *dst_24 =
914 (
unsigned char *)m_background->imageData + (
int)(i * m_background->widthStep + j_min * 3);
915 for (
int j = j_min; j < j_max; j++) {
926 cv::Size size((
int)this->m_width, (
int)this->m_height);
927 if (m_background.channels() != channels || m_background.depth() != depth || m_background.rows != (int)
m_height ||
928 m_background.cols != (
int)
m_width) {
929 m_background = cv::Mat(size, CV_MAKETYPE(depth, channels));
933 unsigned int i_min = (
unsigned int)iP.
get_i();
934 unsigned int j_min = (
unsigned int)iP.
get_j();
935 unsigned int i_max = (std::min)(i_min + h,
m_height);
936 unsigned int j_max = (std::min)(j_min + w,
m_width);
937 for (
unsigned int i = i_min; i < i_max; i++) {
938 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width + j_min * 3);
939 for (
unsigned int j = j_min; j < j_max; j++) {
947 int i_min = (std::max)((
int)ceil(iP.
get_i() /
m_scale), 0);
948 int j_min = (std::max)((
int)ceil(iP.
get_j() /
m_scale), 0);
951 for (
int i = i_min; i < i_max; i++) {
952 unsigned char *dst_24 = (
unsigned char *)m_background.data + (
int)(i * 3 *
m_width + j_min * 3);
953 for (
int j = j_min; j < j_max; j++) {
987 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
994 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
995 cvDestroyWindow(this->
m_title.c_str());
997 cv::destroyWindow(this->
m_title);
1000 for (
size_t i = 0; i < m_listTitles.size(); i++) {
1001 if (
m_title == m_listTitles[i]) {
1002 m_listTitles.erase(m_listTitles.begin() + (
long int)i);
1021 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1022 cvShowImage(this->
m_title.c_str(), m_background);
1025 cv::imshow(this->
m_title, m_background);
1039 const unsigned int )
1042 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1043 cvShowImage(this->
m_title.c_str(), m_background);
1046 cv::imshow(this->
m_title.c_str(), m_background);
1059 static bool warn_displayed =
false;
1060 if (!warn_displayed) {
1062 warn_displayed =
true;
1074 unsigned int w,
unsigned int h,
unsigned int thickness)
1082 if ((std::fabs(a) <= std::numeric_limits<double>::epsilon()) &&
1083 (std::fabs(b) <= std::numeric_limits<double>::epsilon())) {
1128 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1129 cvPutText(m_background, text,
1133 cv::putText(m_background, text,
1135 font, fontScale, col[color.
id]);
1138 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1139 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1140 cvPutText(m_background, text,
1144 cv::putText(m_background, text,
1146 font, fontScale, cvcolor);
1163 unsigned int thickness)
1166 if (fill ==
false) {
1168 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1169 cvCircle(m_background,
1171 (int)radius /
m_scale, col[color.
id], (
int)thickness);
1173 cv::circle(m_background,
1175 (int)radius /
m_scale, col[color.
id], (
int)thickness);
1178 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1179 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1180 cvCircle(m_background,
1182 (int)radius /
m_scale, cvcolor, (
int)thickness);
1184 cv::circle(m_background,
1186 (int)radius /
m_scale, cvcolor, (
int)thickness);
1190 #if VISP_HAVE_OPENCV_VERSION >= 0x030000
1191 int filled = cv::FILLED;
1193 int filled = CV_FILLED;
1196 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1197 cvCircle(m_background,
1199 (int)radius /
m_scale, col[color.
id], filled);
1201 cv::circle(m_background,
1203 (int)radius /
m_scale, col[color.
id], filled);
1206 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1207 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1208 cvCircle(m_background,
1210 (int)radius /
m_scale, cvcolor, filled);
1212 cv::circle(m_background,
1214 (int)radius /
m_scale, cvcolor, filled);
1231 unsigned int thickness)
1258 unsigned int thickness)
1263 double deltaj = size / length * (ip2.
get_j() - ip1.
get_j());
1264 double deltai = size / length * (ip2.
get_i() - ip1.
get_i());
1266 double orig = ip1.
get_i() - slope * ip1.
get_j();
1267 for (
unsigned int j = (
unsigned int)ip1.
get_j(); j < ip2.
get_j(); j += (
unsigned int)(2 * deltaj)) {
1268 double i = slope * j + orig;
1283 unsigned int thickness)
1287 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1297 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1298 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1322 for (
unsigned int i = 0; i < thickness; i++) {
1324 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1327 col[color.
id], (int)thickness);
1331 col[color.
id], (int)thickness);
1334 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1335 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1338 cvcolor, (int)thickness);
1342 cvcolor, (int)thickness);
1365 const vpColor &color,
bool fill,
unsigned int thickness)
1368 if (fill ==
false) {
1370 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1374 col[color.
id], (
int)thickness);
1379 col[color.
id], (
int)thickness);
1382 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1383 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1387 cvcolor, (
int)thickness);
1392 cvcolor, (
int)thickness);
1396 #if VISP_HAVE_OPENCV_VERSION >= 0x030000
1397 int filled = cv::FILLED;
1399 int filled = CV_FILLED;
1402 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1406 col[color.
id], filled);
1411 col[color.
id], filled);
1414 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1415 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1445 const vpColor &color,
bool fill,
unsigned int thickness)
1448 if (fill ==
false) {
1450 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1451 cvRectangle(m_background,
1454 col[color.
id], (int)thickness);
1459 col[color.
id], (int)thickness);
1462 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1463 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1464 cvRectangle(m_background,
1467 cvcolor, (int)thickness);
1472 cvcolor, (int)thickness);
1476 #if VISP_HAVE_OPENCV_VERSION >= 0x030000
1477 int filled = cv::FILLED;
1479 int filled = CV_FILLED;
1482 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1483 cvRectangle(m_background,
1486 col[color.
id], filled);
1491 col[color.
id], filled);
1494 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1495 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1496 cvRectangle(m_background,
1528 if (fill ==
false) {
1530 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1535 col[color.
id], (int)thickness);
1541 col[color.
id], (int)thickness);
1544 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1545 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1550 cvcolor, (int)thickness);
1557 cvcolor, (int)thickness);
1562 #if VISP_HAVE_OPENCV_VERSION >= 0x030000
1563 int filled = cv::FILLED;
1565 int filled = CV_FILLED;
1568 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1573 col[color.
id], filled);
1579 col[color.
id], filled);
1582 cvcolor = CV_RGB(color.
R, color.
G, color.
B);
1583 #if VISP_HAVE_OPENCV_VERSION < 0x020408
1624 lbuttondown =
false;
1625 mbuttondown =
false;
1626 rbuttondown =
false;
1631 lbuttondown =
false;
1635 mbuttondown =
false;
1639 rbuttondown =
false;
1642 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1647 }
while (ret ==
false && blocking ==
true);
1681 lbuttondown =
false;
1682 mbuttondown =
false;
1683 rbuttondown =
false;
1688 u = (
unsigned int)x_lbuttondown *
m_scale;
1689 v = (
unsigned int)y_lbuttondown *
m_scale;
1692 lbuttondown =
false;
1696 u = (
unsigned int)x_mbuttondown *
m_scale;
1697 v = (
unsigned int)y_mbuttondown *
m_scale;
1700 mbuttondown =
false;
1704 u = (
unsigned int)x_rbuttondown *
m_scale;
1705 v = (
unsigned int)y_rbuttondown *
m_scale;
1708 rbuttondown =
false;
1711 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1716 }
while (ret ==
false && blocking ==
true);
1750 lbuttondown =
false;
1751 mbuttondown =
false;
1752 rbuttondown =
false;
1757 u = (
unsigned int)x_lbuttondown *
m_scale;
1758 v = (
unsigned int)y_lbuttondown *
m_scale;
1762 lbuttondown =
false;
1766 u = (
unsigned int)x_mbuttondown *
m_scale;
1767 v = (
unsigned int)y_mbuttondown *
m_scale;
1771 mbuttondown =
false;
1775 u = (
unsigned int)x_rbuttondown *
m_scale;
1776 v = (
unsigned int)y_rbuttondown *
m_scale;
1780 rbuttondown =
false;
1783 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1788 }
while (ret ==
false && blocking ==
true);
1832 u = (
unsigned int)x_lbuttonup *
m_scale;
1833 v = (
unsigned int)y_lbuttonup *
m_scale;
1841 u = (
unsigned int)x_mbuttonup *
m_scale;
1842 v = (
unsigned int)y_mbuttonup *
m_scale;
1850 u = (
unsigned int)x_rbuttonup *
m_scale;
1851 v = (
unsigned int)y_rbuttonup *
m_scale;
1858 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1863 }
while (ret ==
false && blocking ==
true);
1884 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1885 case CV_EVENT_MOUSEMOVE:
1887 case cv::EVENT_MOUSEMOVE:
1895 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1896 case CV_EVENT_LBUTTONDOWN:
1898 case cv::EVENT_LBUTTONDOWN:
1901 disp->lbuttondown =
true;
1902 disp->x_lbuttondown = x;
1903 disp->y_lbuttondown = y;
1906 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1907 case CV_EVENT_MBUTTONDOWN:
1909 case cv::EVENT_MBUTTONDOWN:
1912 disp->mbuttondown =
true;
1913 disp->x_mbuttondown = x;
1914 disp->y_mbuttondown = y;
1917 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1918 case CV_EVENT_RBUTTONDOWN:
1920 case cv::EVENT_RBUTTONDOWN:
1923 disp->rbuttondown =
true;
1924 disp->x_rbuttondown = x;
1925 disp->y_rbuttondown = y;
1928 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1929 case CV_EVENT_LBUTTONUP:
1931 case cv::EVENT_LBUTTONUP:
1934 disp->lbuttonup =
true;
1935 disp->x_lbuttonup = x;
1936 disp->y_lbuttonup = y;
1939 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1940 case CV_EVENT_MBUTTONUP:
1942 case cv::EVENT_MBUTTONUP:
1945 disp->mbuttonup =
true;
1946 disp->x_mbuttonup = x;
1947 disp->y_mbuttonup = y;
1950 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1951 case CV_EVENT_RBUTTONUP:
1953 case cv::EVENT_RBUTTONUP:
1956 disp->rbuttonup =
true;
1957 disp->x_rbuttonup = x;
1958 disp->y_rbuttonup = y;
1993 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
1994 int key_pressed = cvWaitKey(delay);
1996 int key_pressed = cv::waitKey(delay);
1999 if (key_pressed == -1)
2036 #if (VISP_HAVE_OPENCV_VERSION < 0x020408)
2037 int key_pressed = cvWaitKey(delay);
2039 int key_pressed = cv::waitKey(delay);
2041 if (key_pressed == -1)
2045 std::stringstream ss;
2074 double u = (
unsigned int)x_move /
m_scale;
2075 double v = (
unsigned int)y_move /
m_scale;
2104 u = (
unsigned int)x_move /
m_scale;
2105 v = (
unsigned int)y_move /
m_scale;
2123 #if defined(VISP_HAVE_X11)
2126 #elif defined(VISP_HAVE_XRANDR)
2127 std::string command =
"xrandr | grep '*'";
2128 FILE *fpipe = (FILE *)popen(command.c_str(),
"r");
2130 while (fgets(line,
sizeof(line), fpipe)) {
2131 std::string str(line);
2132 std::size_t found = str.find(
"Failed");
2134 if (found == std::string::npos) {
2135 std::vector<std::string> elm;
2137 for (
size_t i = 0; i < elm.size(); i++) {
2138 if (!elm[i].empty()) {
2140 if (resolution.size() == 2) {
2141 std::istringstream sswidth(resolution[0]), ssheight(resolution[1]);
2151 #elif defined(_WIN32)
2153 w = GetSystemMetrics(SM_CXSCREEN);
2154 h = GetSystemMetrics(SM_CYSCREEN);
2157 "implemented on winrt"));
2167 unsigned int width, height;
2177 unsigned int width, height;
2182 #elif !defined(VISP_BUILD_SHARED_LIBS)
2185 void dummy_vpDisplayOpenCV(){};