Drawing limited by size of int in opencv
Hello
I have a large image greater than 32768px wide.
When I try and draw on the image at an x position greater than 32768 nothing is drawn. I think the value is limited to 16 bit even though the input value for cv::Line in cv::Point which specifies int. When I get the size of an int from c++ it states that the max is 2,147,483,648 which is 32 bit.
When I read the value from the cv::Point they are greater than 32768 but once they are passed to the opencv drawing functions it seems that they are truncated.
The system is 64bit Windows 7. VC++ 2010 and OpenCV 2.4.3. I am building a 64-bit application.
Thanks for any help,
Mike
Did you report it on the bug tracker? It seems that drawing line is using 16 bits integer (with the shift operation I'm not very familiar with...)
static void ThickLine(...) in modules/core/src drawing.cpp, L ~1463 seems to be the culprit.
the input points are left-shifted by 16, yes, that will overflow for values > 32768
update, looking at the docs again:
<code>
</code>
"shift – Number of fractional bits in the point coordinates."
what they're doing is this: <code>
p0.x <<= XY_SHIFT - shift;
</code>
so you could at least try a "tradeoff" by supplying a value for shift, 1 would double the range, 2 x4, etc, possibly reducing the quality, but increasing the range of your point coords this way
(sadly, i can't test or reproduce it, only 2gigs ram here ;[ )