Skip to content

Add traditional-face-detection-python materials folder - #1005

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/traditional-face-detection-python-20261204
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/traditional-face-detection-python-20261204

Conversation

@realpython-bot

Copy link
Copy Markdown
Collaborator

Adds the sample code for Traditional Face Detection With Python, which had no materials folder (preflight NoMaterialsRepoLink).

  • detect_faces.py mirrors the article's code as the update draft has it: load an image, convert it to grayscale, load haarcascade_frontalface_alt.xml from cv.data.haarcascades, run .detectMultiScale(), and draw rectangles. An optional second argument saves the result with cv.imwrite() instead of cv.imshow(), matching the article's note for headless machines.
  • requirements.txt pins opencv-contrib-python==5.1.0.95, the same pin as the draft's dependencies field. In OpenCV 5, CascadeClassifier is only in the contrib package.
  • README.md covers setup (Python 3.12+, the draft's minimum-python) and usage.

Update draft: https://realpython.com/pbjt/blog/post/2511/change/
Card: https://trello.com/c/LWzVXNjX

Verification: fresh venv on Python 3.15.2, python -m pip install -r requirements.txt, then ran the script on scikit-image's astronaut photo: 2 detections, result image written. Also checked the missing-argument and unreadable-image error paths. ruff@0.14.1 format --check and check pass, and dircheck.py passes.

🤖 Generated with Claude Code

Sample code for the updated tutorial Traditional Face Detection With Python.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant