3 remarks come into mind right away
- It seems that there is an offset on your camera. Could you just calculate the difference between your detection in C++ and JAVA and add it as a hard constraint of always adding/removing the offset?
- It also seems that you are mixing width and height with x and y axis. X should correspond to width.
- Keep in mind that OpenCV in C++ uses upper left corner as origin with downwards pointing y axis. However it might be possible that Java on Android uses bottom left origin with upright y axis. That could be the exact reason of your problem.