turret movement by face detection

Discussion related to "under the hood" OpenMV topics.
Arjan
Posts: 2
Joined: Fri Apr 06, 2018 9:11 am

turret movement by face detection

Postby Arjan » Fri Apr 06, 2018 9:28 am

I have the idea to control the turrets from my scale model warship by servo's controlled by the input of face detection.
So I went to find out how to get the x,y coordinates from the detected face. (by the face detection example supplied by openmv)

I thought I could do this by simply asking for index 0 and 1 from the 'objects' list. -> print(objects[0]) or print(objects[1]) (print for my visualisation)
But the error appears that the list index is out of range, what shouldn't be possible because the list has four elements when I print(objects) -> [(116, 65, 82, 82)]
'objects' is defined by: objects = img.find_features(face_cascade, threshold=0.75, scale_factor=1.25)


I have no experience with python, and very little with machine vision c++, so maybe someone can help me?
User avatar
kwagyeman
Posts: 2312
Joined: Sun May 24, 2015 2:10 pm

Re: turret movement by face detection

Postby kwagyeman » Fri Apr 06, 2018 12:32 pm

Hi, it's a list of tuples.

The tuple has 4 values and there's 1 tuple in the list.

Do:

Code: Select all

if objects:
    print(objects[0][0])
    print(objects[0][1])
Nyamekye,
Arjan
Posts: 2
Joined: Fri Apr 06, 2018 9:11 am

Re: turret movement by face detection

Postby Arjan » Mon Apr 09, 2018 2:10 am

Okay! Thanks a lot!

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 6 guests