Roi to small? [closed]
Hi,
I am using ROIs to crop my images and I just noticed that the ROIs are always one pixel to small.
Actually I am not sure whether I misunderstood how I select a roi or whether there is something wrong.
For example if I select a Roi from a Mat with 100 rows and the roi shall have the same height I do it with these points: Point(x1,0), Point(x2,Mat.rows-1). I thought from 0 to 99 is 100 and would select the full Mat height, but this is not the case.
See this example:
#include <opencv2/opencv.hpp>
#include <iostream>
cv::Mat test = cv::Mat::zeros(cv::Size(1000, 100), CV_64FC1);
cv::Rect ROI(cv::Point2i{0,0},cv::Point2i{319,test.rows-1});
std::cout << "Cols: " << ROI.width << " Rows: " << ROI.height << std::endl; //Returns 99, 319 instead of 100, 320
Why is that? Thank you very much!
did you miss, that the idea of a "Range" here excludes the upper value ? it's
(for any dimension) ??
:D Yes, i missed that! Thank you very much, problem solved ;-)