OpenCV C++, getting Region Of Interest (ROI) using cv::Mat

后端 未结 2 1937
南方客
南方客 2020-12-14 18:43

I\'m very new to OpenCV (started using it two days ago), I\'m trying to cut a hand image from a depth image got from Kinect, I need the hand image for gesture recognition. I

2条回答
  •  无人及你
    2020-12-14 19:27

    You can use the overloaded function call operator on the cv::Mat:

    cv::Mat img = ...;
    cv::Mat subImg = img(cv::Range(0, 100), cv::Range(0, 100));
    

    Check the OpenCV documentation for more information and for the overloaded function that takes a cv::Rect. Note that using this form of slicing creates a new matrix header, but does not copy the data.

提交回复
热议问题