How to Shift a rect by a certain offset in openCV4Android
Here,opencv docs say:
In addition to the class members, the following operations on rectangles are implemented:
rect = rect + point (shifting a rectangle by a certain offset)
...
I want to use this in openCV4Android.So I did like this:
Rect r = new Rect(...);
r + new Point(4,5);
But this error occurs:
Type mismatch: cannot convert from Point to Rect
Did I do wrong or it (shifting a rectangle by a certain offset in openCV4Android) or it is not possible and I have to declare Rect
again?
sorry, but this is a c++ feature only (there are no overloadable operators in java)
@berak So can I calculate new coordinates and use
r.set(new double[4])
instead of that?If yes,is it better than this:r = new Rect(...)
? thank you.wouldn't it be simply:
r.x += 4; r.y += 5;
?