'error: ‘selectROI’ is not a member of ‘cv’

I use Ubuntu 18.04 and opencv3.4.0(with 3.3.1contrib), when i try to compile my project, these errors occured:

/home/sunyq/SiamMaskCpp/demo.cpp:98:24: error: ‘selectROI’ is not a member of ‘cv’
 cv::Rect roi = cv::selectROI("SiamMask", images.front(), false);
                    ^~~~~~~~~
/home/sunyq/SiamMaskCpp/demo.cpp:98:24: note: suggested alternative: ‘DetectionROI’
 cv::Rect roi = cv::selectROI("SiamMask", images.front(), false);
                    ^~~~~~~~~
                    DetectionROI
/home/sunyq/SiamMaskCpp/demo.cpp:100:12: error: ‘cv::Rect {aka class cv::Rect_<int>}’ has no member named ‘empty’
 if(roi.empty())
        ^~~~~
CMakeFiles/demo.dir/build.make:81: recipe for target 'CMakeFiles/demo.dir/demo.cpp.o' failed
make[2]: *** [CMakeFiles/demo.dir/demo.cpp.o] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/demo.dir/all' failed
make[1]: *** [CMakeFiles/demo.dir/all] Error 2

here's my code and include files:

#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <opencv/cv.hpp>


cv::namedWindow("SiamMask");
int64 toc = 0;
cv::Rect roi = cv::selectROI("SiamMask", images.front(), false);

if(roi.empty())
    return EXIT_SUCCESS;

Is it that I didn't get the right version of opencv or something else?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source