Skip to content

Commit 7f11b68

Browse files
authored
Merge pull request larymak#245 from azamtoiri/main
Add project: Face-Detecting
2 parents 54f5322 + 31d0261 commit 7f11b68

File tree

10 files changed

+69117
-14
lines changed

10 files changed

+69117
-14
lines changed

MachineLearning Projects/Face-detecting/Cascade-Files/face_default.xml

Lines changed: 33314 additions & 0 deletions
Large diffs are not rendered by default.

MachineLearning Projects/Face-detecting/Cascade-Files/more_bet.xml

Lines changed: 35712 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Detecting face from photo or camera
2+
___
3+
### Setup
4+
`pip install -r requirements.txt`
5+
6+
___
7+
### Usage
8+
`python3 main.py` detecting face from camera
9+
`q` for exit from frame
10+
11+
12+
`pyhton3 detect_face_from_image` detecting face from images on
13+
directory images `q` for exit from frame
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import cv2
2+
3+
img = cv2.imread('images/im1.jpg')
4+
img2 = cv2.imread('images/im2.jpg')
5+
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
6+
gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)
7+
8+
window_name = 'Image'
9+
10+
faces = cv2.CascadeClassifier('Cascade-Files/more_bet.xml')
11+
12+
results = faces.detectMultiScale(gray, 1.1, 4)
13+
# results = faces.detectMultiScale(gray2, 1.1, 4)
14+
15+
for (x, y, w, h) in results:
16+
cv2.rectangle(img, (x, y), (x + w, y + h), (0, 0, 255), 2)
17+
cv2.rectangle(img2, (x, y), (x + w, y + h), (0, 0, 255), 2)
18+
19+
cv2.imshow(window_name, img)
20+
cv2.waitKey(0)
Loading
Loading
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# обнаруживает пока что только лицо и пишет на рамочке
2+
3+
import cv2
4+
5+
video = cv2.VideoCapture(0)
6+
hands_hear_cascade = cv2.CascadeClassifier('Cascade-Files/more_bet.xml')
7+
8+
# Write some Text
9+
10+
font = cv2.FONT_ITALIC
11+
text = 'Face detected'
12+
fontScale = 1
13+
fontColor = (0, 255, 0)
14+
thickness = 3
15+
lineType = 1
16+
17+
while True:
18+
_r, frame = video.read()
19+
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
20+
hands = hands_hear_cascade.detectMultiScale(gray, 1.1, 3)
21+
22+
if len(hands):
23+
print("Face")
24+
25+
for x, y, w, h in hands:
26+
bottomLeftCornerOfText = (x - 5, y - 5)
27+
cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2)
28+
cv2.putText(frame, text,
29+
bottomLeftCornerOfText,
30+
font,
31+
fontScale,
32+
fontColor,
33+
thickness,
34+
lineType)
35+
cv2.imshow("test", frame)
36+
if cv2.waitKey(1) & 0xFF == ord('q'):
37+
break
38+
video.release()
39+
cv2.destroyAllWindows()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
numpy==1.23.4
2+
opencv-python==4.6.0.66

README.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,29 @@
1515
### Description
1616

1717
Welcome aboard fellow developer, this is where you will find Python scripts which you are free to contribute to.
18-
You can contribute by submitting your own scripts, also written in Python, which you think would be amazing for other people to see.
18+
You can contribute by submitting your own scripts, also written in Python, which you think would be amazing for other
19+
people to see.
1920

2021
### Contribution Guidelines
2122

22-
The contribution guidelines are as per the guide [HERE](https://github.com/larymak/Python-project-Scripts/blob/main/CONTRIBUTING.md).
23+
The contribution guidelines are as per the
24+
guide [HERE](https://github.com/larymak/Python-project-Scripts/blob/main/CONTRIBUTING.md).
2325

2426
### Instructions
2527

26-
- Fork this repository
27-
- Clone your forked repository
28-
- Add your scripts
29-
- Commit and push
30-
- Create a pull request
31-
- Star this repository
32-
- Wait for pull request to merge
33-
- Celebrate your first step into the open source world and contribute more
28+
- Fork this repository
29+
- Clone your forked repository
30+
- Add your scripts
31+
- Commit and push
32+
- Create a pull request
33+
- Star this repository
34+
- Wait for pull request to merge
35+
- Celebrate your first step into the open source world and contribute more
3436

3537
## Additional tools to help you get Started with Open-Source Contribution
3638

37-
- [How to Contribute to Open Source Projects – A Beginner's Guide](https://www.freecodecamp.org/news/how-to-contribute-to-open-source-projects-beginners-guide/)
38-
- [How to Write a Good README File for Your GitHub Project](https://www.freecodecamp.org/news/how-to-write-a-good-readme-file/)
39+
- [How to Contribute to Open Source Projects – A Beginner's Guide](https://www.freecodecamp.org/news/how-to-contribute-to-open-source-projects-beginners-guide/)
40+
- [How to Write a Good README File for Your GitHub Project](https://www.freecodecamp.org/news/how-to-write-a-good-readme-file/)
3941

4042
---
4143

@@ -46,7 +48,7 @@ The contribution guidelines are as per the guide [HERE](https://github.com/larym
4648
## Projects
4749

4850
| SR No | Project | Author |
49-
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------- |
51+
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------|
5052
| 1 | [Ascii Image Converter](https://github.com/larymak/Python-project-Scripts/tree/main/ART%20SCRIPTS/image-ascii) | [Lary Mak](https://github.com/larymak) |
5153
| 2 | [DigitalClock](https://github.com/larymak/Python-project-Scripts/tree/main/TIME%20SCRIPTS/DigitalClock) | [Logan Ozdyck](https://github.com/ozdyck3) |
5254
| 3 | [Insta Spam Bot](https://github.com/larymak/Python-project-Scripts/tree/main/BOTS/InstaSpamBot) | [Lary Mak](https://github.com/larymak) |
@@ -112,4 +114,5 @@ The contribution guidelines are as per the guide [HERE](https://github.com/larym
112114
| 63 | [QtQuiz](https://github.com/larymak/Python-project-Scripts/tree/main/GUI/QtQuiz) | [Eduardo C.](https://github.com/ehcelino) |
113115
| 64 | [Umbrella Reminder](https://github.com/larymak/Python-project-Scripts/tree/main/AUTOMATION/Umbrella%20Reminder) | [Edula Vinay Kumar Reddy](https://github.com/vinayedula) |
114116
| 65 | [Image to PDF](https://github.com/larymak/Python-project-Scripts/tree/main/IMAGES%20%26%20PHOTO%20SCRIPTS/Image%20to%20PDF) | [Vedant Chainani](https://github.com/Envoy-VC) |
115-
| 66 | [KeyLogger](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/KeyLogger) | [Akhil](https://github.com/akhil-chagarlamudi) |
117+
| 66 | [KeyLogger](https://github.com/larymak/Python-project-Scripts/tree/main/OTHERS/KeyLogger) | [Akhil](https://github.com/akhil-chagarlamudi) |
118+
| 67 | [Face-detecting](https://github.com/azamtoiri/Python-project-Scripts/tree/main/MachineLearning%20Projects/Face-detecting) | [Azam Toiri](https://github.com/azamtoiri) |

0 commit comments

Comments
 (0)