How to convert Mat coordinates to Layout coordinates in android?

asked 2018-03-16 10:34:33 -0500

AleksB gravatar image

Hi!

I want to place the image buttons on positions above bitmap image. For this I have created special markers in bitmap image (black dots). After that I used OpenCV for recognition of markers on the image and getting their X, Y positions. But the problem is coordinates from the Mat incompatible with android layout - see pic below. I tried to normalize values for X, Y, but I can`t do it correct.

image description

Is it right way? or I should solve a problem by another tools?

edit retag flag offensive close merge delete

Comments

berak gravatar imageberak ( 2018-03-16 11:08:21 -0500 )edit

Not quite. In your sample we have touch coordinates, but I want to map given coordinates from Mat object to Android ConstraintLayout coordinates. E.g. - we have XY position from Mat (it`s the center of recognized black circle). Now this taken coordinates should be map (or transform) to Layout coordinates.

AleksB gravatar imageAleksB ( 2018-03-19 05:09:44 -0500 )edit