1 | initial version |
First of all, let's check that you are using the right indices for each part,
The photo below is sort of a map for all the coordinates of the face components and structures. But we have to make sure to decrease them by one since the cpp indexing starts by 0.
Let's take the example of the right eye, its coordinates are basically from 42 to 47
but you should use the point 45
to compute the width and the center and not 47, so your code should be as follows instead:
cv::Point centerEyeRight = cv::Point((shape.part(42).x() + shape.part(45).x()) / 2,(shape.part(42).y() + shape.part(45).y()) / 2);
int widthEyeRight = abs(shape.part(45).x() - shape.part(42).x());
For the left eye its the coordinates 36 and 39 that matters in your case.
This will normally give you a centered ROI, but regarding its size and if it contains the interesting parts of the face. I'm not sure why you are focusing on the eyes and why you are using these "eyes based" formulas to get your ROI ?
I think that it would be much simpler and better to use other coordinates instead. What about 19, 24, 3, 14, 6 and 10
you can get from them the center and dimensions of a ROI that matches perfectly the red desired one!
Good luck!
2 | No.2 Revision |
First of all, let's check that you are using the right indices for each part,
The photo below is sort of a map for all the coordinates of the face components and structures. But we have to make sure to decrease them by one since the cpp indexing starts by 0.
Let's take the example of the right eye, its coordinates are basically from 42 to 47
but you should use the point 45
to compute the width and the center and not 47, so your code should be as follows instead:
cv::Point centerEyeRight = cv::Point((shape.part(42).x() + shape.part(45).x()) / 2,(shape.part(42).y() + shape.part(45).y()) / 2);
int widthEyeRight = abs(shape.part(45).x() - shape.part(42).x());
For the left eye its the coordinates 36 and 36 and
39 that matters in your case.
This will normally give you a centered ROI, but regarding its size and if it contains the interesting parts of the face. I'm not sure why you are focusing on the eyes and why you are using these "eyes based" formulas to get your ROI ?
I think that it would be much simpler and better to use other coordinates instead. What about 19, 24, 3, 14, 6 and 10
you can get from them the center and dimensions of a ROI that matches perfectly the red desired one!
Good luck!
3 | No.3 Revision |
First of all, let's check that you are using the right indices for each part,
The photo image below is sort of a map for all the coordinates of the face components and structures. But we have to make sure to decrease them by one since the cpp indexing starts by 0.
Let's take the example of the right eye, its coordinates are basically from 42 to 47
but you should use the point 45
to compute the width and the center and not 47, so your code should be as follows instead:
cv::Point centerEyeRight = cv::Point((shape.part(42).x() + shape.part(45).x()) / 2,(shape.part(42).y() + shape.part(45).y()) / 2);
int widthEyeRight = abs(shape.part(45).x() - shape.part(42).x());
For the left eye its the coordinates 36 and 39
that matters in your case.
This will normally give you a centered ROI, but regarding its size and if it contains the interesting parts of the face. I'm not sure why you are focusing on the eyes and why you are using these "eyes based" formulas to get your ROI ?
I think that it would be much simpler and better to use other coordinates instead. What about 19, 24, 3, 14, 6 and 10
you can get from them the center and dimensions of a ROI that matches perfectly the red desired one!
Good luck!
4 | No.4 Revision |
First of all, let's check that you are using the right indices for each part,
The image below is sort of a map for all the coordinates of the face components and structures. But we have to make sure to decrease them by one since the cpp indexing starts by 0.
Let's take the example of the right eye, its coordinates are basically from 42 to 47
but you should use the point 45
to compute the width and the center and not 47, so your code should be as follows instead:
cv::Point centerEyeRight = cv::Point((shape.part(42).x() + shape.part(45).x()) / 2,(shape.part(42).y() + shape.part(45).y()) / 2);
int widthEyeRight = abs(shape.part(45).x() - shape.part(42).x());
For the left eye its the coordinates 36 and 39
that are those who matters in your case.
This will normally give you a centered ROI, but regarding its size and if it contains the interesting parts of the face. I'm not sure why you are focusing on the eyes and why you are using these "eyes based" formulas to get your ROI ?
I think that it would be much simpler and better to use other coordinates instead. What about 19, 24, 3, 14, 6 and 10
you can get from them the center and dimensions of a ROI that matches perfectly the red desired one!
Good luck!