You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 11, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: content/tutorials/portenta-h7/por-openmv-fd/content.md
+7-7Lines changed: 7 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ import time # Import module for tracking elapsed time
45
45
46
46
The next step is to calibrate the camera sensor for achieving the best results using the `sensor` module. You can use the `set_contrast()` function to set the contrast of the sensor to its highest value (3). This can help the algorithm identifying lines and edges more easily. `set_gainceiling()` controls the amplification of the signal from the camera sensor including any associated background noise. For maximising the detection success rate it is recommended to set the camera frame size to `HQVGA`.
47
47
48
-
```python
48
+
```py
49
49
# Sensor settings
50
50
sensor.set_contrast(3)
51
51
sensor.set_gainceiling(16)
@@ -59,7 +59,7 @@ OpenMV provides a Haar Cascade class ready to be used with the Vision Shield's c
59
59
60
60
***Remember: Fewer stages make the detection faster while leading to more false positives.***
print(face_cascade) # Prints the Haar Cascade configuration
65
65
```
@@ -78,13 +78,13 @@ Download [this file](assets/face.pbm) containing the smiley bitmap and copy it t
78
78
79
79
Load the image into a variable called `faceImage` using the `Image()` function from the `image` module. The inital slash refers to the root directoy of the flash drive. In order to use the image as an overlay to the camera stream instead of directly displaying it set the `copy_to_fb` to False such that it doesn't get copied into the frame buffer automatically.
Before drawing the image on top of the camera stream you need to figure out the scale ratio to match the detected face size in the camera stream. The provided bitmap image comes in a 128x128 px resolution. You can calculate the correct scale ratio with the following formula:
Let's program the Portenta with the complete script and test if the algorithm works. Copy the following script and paste it into the new script file that you created.
105
105
106
-
```python
106
+
```py
107
107
import sensor # Import the module for sensor related functions
import time # Import module for tracking elapsed time
@@ -161,7 +161,7 @@ In this tutorial you learned how to use OpenMV's built-in face detection algorit
161
161
# Next Steps
162
162
The [HaarCascade](https://docs.openmv.io/library/omv.image.html#class-Haarcascade-feature-descriptor) class provided by OpenMV can also detect other facial features such as eyes. For example you could tweak your **face_detection.py** script to detect your eyes simply by changing the `path` parameter from `frontalface ` to `eye` which is also a built-in model. Go ahead and replace the following line in your script and try to figure out how to overlay your eyes with a bitmap image of an eye.
0 commit comments