Fixed target point

General discussion about topics related to OpenMV.
DavidMactavish
Posts: 14
Joined: Tue Sep 26, 2017 7:43 pm

Fixed target point

Postby DavidMactavish » Fri Sep 29, 2017 7:27 am

Hi everyone.
How to make Fixed target point or One point on the middle of the camera??? :!: :?: :!: :?:
please help me. :!: :!: :roll: :roll:

for example:
Attachments
15488254-young-roe-deer-calf-being-targeted-by-a-hunter-with-the-crosshairs-of-the-scope-on-hiss-rifle.jpg
15488254-young-roe-deer-calf-being-targeted-by-a-hunter-with-the-crosshairs-of-the-scope-on-hiss-rifle.jpg (48.71 KiB) Viewed 265 times
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: Fixed target point

Postby kwagyeman » Fri Sep 29, 2017 11:43 am

Please put more effort into you forum requests. I don't know what you want. Please try to write about what you want, why you want it, etc. Try to write a paragraph or so.
Nyamekye,
User avatar
iabdalkader
Posts: 380
Joined: Sun May 24, 2015 3:53 pm

Re: Fixed target point

Postby iabdalkader » Thu Oct 05, 2017 7:51 pm

Try:

Code: Select all

img.draw_cross(img.width()//2, img.height()//2)
DavidMactavish
Posts: 14
Joined: Tue Sep 26, 2017 7:43 pm

Re: Fixed target point

Postby DavidMactavish » Sun Oct 29, 2017 4:16 pm

iabdalkader wrote:
Thu Oct 05, 2017 7:51 pm
Try:

Code: Select all

img.draw_cross(img.width()//2, img.height()//2)


hi men.tanks
Can this code be used in face detection???? :!: :?:
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: Fixed target point

Postby kwagyeman » Sun Oct 29, 2017 5:14 pm

Yeah, just draw the target cross after detecting the face.
Nyamekye,
DavidMactavish
Posts: 14
Joined: Tue Sep 26, 2017 7:43 pm

Re: Fixed target point

Postby DavidMactavish » Thu Nov 02, 2017 6:55 am

iabdalkader wrote:
Thu Oct 05, 2017 7:51 pm
Try:

Code: Select all

img.draw_cross(img.width()//2, img.height()//2)
Hi, man. I want to have this square on the face detection. And I want this sign to be a positive sign.please help me. :!: :?: :idea:
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: Fixed target point

Postby kwagyeman » Thu Nov 02, 2017 10:14 am

Just draw the cross after the face is detected on not. It's really that simple. Call the face detection method first. Then draw the cross.
Nyamekye,
DavidMactavish
Posts: 14
Joined: Tue Sep 26, 2017 7:43 pm

Re: Fixed target point

Postby DavidMactavish » Thu Nov 02, 2017 5:12 pm

kwagyeman wrote:
Thu Nov 02, 2017 10:14 am
Just draw the cross after the face is detected on not. It's really that simple. Call the face detection method first. Then draw the cross.
Please write the code for me.Because I do not know the writing code.
tanks men :!: :roll: :!:
User avatar
kwagyeman
Posts: 1248
Joined: Sun May 24, 2015 2:10 pm

Re: Fixed target point

Postby kwagyeman » Fri Nov 03, 2017 1:04 am

Code: Select all

# Face Detection Example
#
# This example shows off the built-in face detection feature of the OpenMV Cam.
#
# Face detection works by using the Haar Cascade feature detector on an image. A
# Haar Cascade is a series of simple area contrasts checks. For the built-in
# frontalface detector there are 25 stages of checks with each stage having
# hundreds of checks a piece. Haar Cascades run fast because later stages are
# only evaluated if previous stages pass. Additionally, your OpenMV Cam uses
# a data structure called the integral image to quickly execute each area
# contrast check in constant time (the reason for feature detection being
# grayscale only is because of the space requirment for the integral image).

import sensor, time, image

# Reset sensor
sensor.reset()

# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)

# Load Haar Cascade
# By default this will use all stages, lower satges is faster but less accurate.
face_cascade = image.HaarCascade("frontalface", stages=25)
print(face_cascade)

# FPS clock
clock = time.clock()

while (True):
    clock.tick()

    # Capture snapshot
    img = sensor.snapshot()

    # Find objects.
    # Note: Lower scale factor scales-down the image more and detects smaller objects.
    # Higher threshold results in a higher detection rate, with more false positives.
    objects = img.find_features(face_cascade, threshold=0.75, scale_factor=1.25)

    # Draw objects
    for r in objects:
        img.draw_rectangle(r)

    img.draw_cross(img.width()//2, img.height()//2, size = min(img.width()//5, img.height()//5))

    # Print FPS.
    # Note: Actual FPS is higher, streaming the FB makes it slower.
    print(clock.fps())
Nyamekye,

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 1 guest