IDE Disconnect

Not sure if this is related to the other post on IDE disconnects.

12 files on the SD card and this program is supposed to loop through them and look for blue blobs.

IDE 1.6.0
Windows 8 system
board is running latest firmware.

Ii never completes all 12 files and the images never display in the framebuffer. The first several images are not expected to have blue blobs.

import sensor
import image
import time
import sys
import os

threshold_index = 2 # 0 for red, 1 for green, 2 for blue

# Color Tracking Thresholds (L Min, L Max, A Min, A Max, B Min, B Max)
# The below thresholds track in general red/green/blue things. You may wish to tune them...
thresholds = [(30, 100, 15, 127, 15, 127), # generic_red_thresholds
              (30, 100, -64, -8, -32, 32), # generic_green_thresholds
              (0, 100, 27, 55, 75, -60)] # generic_blue_thresholds

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.snapshot()

print("=== start ===")

file_path = "/ftc/2016images/tests"
files = os.listdir(file_path)
print(files)

for file in files:
    full_file = '/'.join((file_path, file))
    print(full_file)
    img = image.Image(full_file, copy_to_fb=True)
    i = 0
    for blob in img.find_blobs([thresholds[threshold_index]], pixels_threshold=20, area_threshold=20, merge=True):
        i = i + 1
        img.draw_rectangle(blob.rect(), color=(255,0,0))
        img.draw_cross(blob.cx(), blob.cy(), color=(255,0,0))
        print(i)
    sensor.snapshot()

The output is inconsistent

=== start ===
['gears_bright.bmp', 'gears_dark.bmp', 'gears_identical.bmp', 'legos_bright.bmp', 'legos_dark.bmp', 'legos_identical.bmp', 'plyers_bright.bmp', 'plyers_dark.bmp', 'plyers_identical.bmp', 'wheels_bright.bmp', 'wheels_dark.bmp', 'wheels_identical.bmp']
/ftc/2016images/tests/gears_bright.bmp

=== start ===
['gears_bright.bmp', 'gears_dark.bmp', 'gears_identical.bmp', 'legos_bright.bmp', 'legos_dark.bmp', 'legos_identical.bmp', 'plyers_bright.bmp', 'plyers_dark.bmp', 'plyers_identical.bmp', 'wheels_bright.bmp', 'wheels_dark.bmp', 'wheels_identical.bmp']
/ftc/2016images/tests/gears_bright.bmp
/ftc/2016images/tests/gears_dark.bmp
/ftc/2016images/tests/gears_identical.bmp

Any help you can provide would be appreciated.

Eric aka DaddyOh

Can you upload a test package? Also, did you install the latest IDE? If not then yo’re getting hit by the 40 ms timeout. This is causing the IDE to disconnect but your script should run fine.

The latest IDE being the one I posted on the forums you alluded too. Going to do a patch release for the IDE this weekend.

Here’s the link: http://upload.openmv.io/openmv-ide-windows-1.7.0/openmv-ide-windows-1.7.0.exe

Nyamekye,

Thanks. Runs perfect now. I really appreciate the fast response.

Eric