Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get coordinates of the face #8

Closed
sonidiaz opened this issue Feb 18, 2019 · 6 comments
Closed

Get coordinates of the face #8

sonidiaz opened this issue Feb 18, 2019 · 6 comments

Comments

@sonidiaz
Copy link

Hi, guys, me again
In the app that I am working I need to get a picture of the face for each gesture that the user makes. For that I need to get the data of the x, y, width and height coordinates like jeelizFaceFilter does with detectState.
I saw that they added the method get_positionScale() (#5) but I can not get the data correctly and I do not know if it will help me for what I need. Could you tell me if that is the way to go to get that data (x, y, w, h) with JEEFACETRANSFERAPI?

Thank you!

@xavierjs
Copy link
Member

With positionScale you got Px,Py,s relative to the viewport
To get x,y,w,h in pixels you have:
x = W*(Px+1)/2
y = H*(Py+1)/2
w = W*s
h = w (because the face detection is a square)
W,H are the size of the viewport in pixels.
x,y are the coordinates of the center of the detection window (not the corner).

@sonidiaz
Copy link
Author

Thanks for the quick reply!
I will review that function.

@sonidiaz
Copy link
Author

Hi @xavierjs,

Sorry to bother you, but I can't get the data correctly, I'm probably doing something wrong, but with the data I get I can't do much. Do you have an example of how to apply it?

Thanks and sorry again!

xavierjs added a commit that referenced this issue Feb 21, 2019
@xavierjs
Copy link
Member

Hi,

I did a mistake, I correct it and commit the changes, it should be working now :)
I also updated the documentation. x and y are given between 0 and 1
Only 3 floats are returned by get_positionScale. Indeed since the detection window is a square we don't need the scale along the vertical axis.
It also allows me to detect and correct a bug relative to stabilization :).

@xavierjs
Copy link
Member

To resume,
To get x,y,w,h in pixels you have:
x = WPx
y = H
Py
w = W*s
h = w (because the face detection is a square)
W,H are the size of the viewport in pixels.
x,y are the coordinates of the center of the detection window (not the corner).

@sonidiaz
Copy link
Author

Hi, @xavierjs
Yea!!! Now it works very well and the stabilization has improved a lot.
Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants