linpolar example error

I am trying to run the following code as seen on youtube Fun Time With Linear and Log Polar Reprojection - YouTube

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

while(True):

    clock.tick()
    img = sensor.snapshot().linpolar(reverse=True)
    print(clock.fps())

I get an error :
File “”, line 17, in
AttributeError: ‘Image’ object has no attribute ‘linpolar’ - can I please get some help on what I might be doing wrong. thanks

Sorry I just uploaded from 1.8 to 1.81 and all is well. I really appreciate the commitment to a very comprehensive documentation and . The one thing I would like to see is an example on how to keep the previously drawn element on screen. For example I would like to draw a trail of where an eye is looking. I see how to plot a circle but I guess I am looking on how to store the previous circles and add them to the newly drawn circles. thanks

Hi, to do that you need to store a list that is not tossed per frame. Then draw that list every frame. This doesn’t require a lot of CPU power… But keep in mind the limited heap space.

Just take the object that is returned, what it is and add it to a list. Then if that list grows over let’s say 100 values toss the last thing.

I apologize that I don’t have any experience in python but this board will certainly motivate me to learn more. I’ve already made some animations that I am really excited about. My main goal in using this device is to make experimental graphics and animations. Glitch is great in my world. Anyways, I tried a few things but it only ends up drawing a single rectangle. If you don’t mind can you take a look and give me a few more tips. If you can give me a little help I will study it and take it from there.

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)
    rect = []
    # Draw objects
    for r in objects:    
         rect.append(r)  # thought this might add to rect array     
         rect +=[r]   # tried this too to add to rect array still no dice
         img.draw_rectangle(r)
         
    for i in rect:       
         print(i)    
       # rect.append(i) # this caused a memory overload error
         img.draw_rectangle(i)

Here you go:

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()

rect_list = []

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:       
         rect_list.append(r)
         if len(rect_list) > 10: rect_list.pop(0) # remove oldest
         
    for i in rect_list:       
         img.draw_rectangle(i)

I can’t thank you enough. I managed to get it working but before I could let you know you already uploaded the solution. It is really fun to draw with the tracking methods and I am really enjoying the visuals. Again your support is really impressive and much appreciated. It will certainly give new users an opportunity to succeed in learning to use openMV.