smartcrop.py
smartcrop.py copied to clipboard
Using face detection possible?
What would be an easy way to incorporate face detection using openCV or something similair? The original smartcrop.js library has some examples to do this but I can't find anything similair for the Python-port.
Hello,
I personally have no time to implement this feature. However, I am ready to help you integrating this criteria to the heuristic.
Thank you.
Regarding your question, I will investigate it promptly.
OK https://github.com/jwagner/smartcrop.js/commit/afc15fd5831a890ce7c97fd7a21f4a5df71cfadb is using the alpha channel to store what they call the "boost" value.
- The alpha channel is probably zeroed (default).
- The regions (pixels in alpha channel) with faces are set to a positive value (the weight).
- Finally, the alpha channel / boost is integrated to the scoring heuristic.
So in summary, integrating a similar feature requires some boilerplate code. I am ready to implement such a skeleton hosting an extra criteria to scoring (boost).
Then I will let you, @jaapiyo, implement a particular boost method (e.g. based on OpenCV face detection).
Do you agree with my proposal?
can anyone help me to integrate face detection?
It has been quite some time, so rebump this issue.
@davidfischer-ch is it possible to detect faces now?
I add face detection to the lib. You may have a try: https://github.com/eeyrw/smartcrop.py The OpenCV>=4.8.0 is required due to face detection.