android - Convert image x,y, coordinates to View coordinates when Scale,Translation and Rotation apply -
in 1 of project using face detection api .after getting points(x,y) bitmap need convert view points(x,y) . have applied scale, translation,rotation image
please check code
float point[] = {(float)mface.facelandmarks.nosetip.x, (float)mface.facelandmarks.nosetip.y}; matrix matrix = new matrix(); matrix.prescale(imageview.getscalex(), imageview.getscaley()); matrix.postrotate(imageview.getrotation()); matrix.settranslate(imageview.gettranslationx(), imageview.gettranslationy()); matrix.mappoints(point); xp = ((point[0] * adjustpicturestep2.getwidth()) / mbitmap.getwidth()); yp = (((point[1] * adjustpicturestep2.getheight()) / mbitmap.getheight()));
values used above
origional points : x= 2595.5, y=1764.0
point after mapping p[0]=2595.5, p1=1764.0
translationy -815.51404
translationx -114.501785
rotation -12.940008
scale 4.0
Comments
Post a Comment