Single color grayscale tracking +modbus, indexError:bytes index out of range

# Single Color Grayscale Blob Tracking Example
# This example shows off single color grayscale tracking using the OpenMV Cam.

import sensor, image, time, math

# Color Tracking Thresholds (Grayscale Min, Grayscale Max)
# The below grayscale threshold is set to only find extremely bright white areas.
thresholds = (0, 104)#(0, 38, 10, 70, -111, 127)

sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False) # must be turned off for color tracking
sensor.set_auto_whitebal(False) # must be turned off for color tracking
clock = time.clock()
import time
from pyb import UART
from modbus import ModbusRTU
uart = UART(3,9600, parity=None, stop=2, timeout=2, timeout_char=4)
modbus = ModbusRTU(uart,2, register_num=9999)
# Only blobs that with more pixels than "pixel_threshold" and more area than "area_threshold" are
# returned by "find_blobs" below. Change "pixels_threshold" and "area_threshold" if you change the
# camera resolution. "merge=True" merges all overlapping blobs in the image.

    if modbus.any():
        modbus.REGISTER[0] = 1000
        modbus.REGISTER[1] += 1
        modbus.REGISTER[3] += 3
        # image processing in there
    img = sensor.snapshot()
    for blob in img.find_blobs([thresholds], pixels_threshold=100, area_threshold=5000, merge=True):
        # These values depend on the blob not being circular - otherwise they will be shaky.
        if blob.elongation() > 0.5:
            img.draw_edges(blob.min_corners(), color=0)
            img.draw_line(blob.major_axis_line(), color=0)
            img.draw_line(blob.minor_axis_line(), color=0)
        # These values are stable all the time.
        img.draw_rectangle(blob.rect(), color=127)
        img.draw_cross(,, color=127)
        # Note - the blob rotation is unique to 0-180 only.
        img.draw_keypoints([(,, int(math.degrees(blob.rotation())))], size=40, color=127)

win7+ide3.0.3+openmv4 h7 plus.
how to fix that ?

Hi, you need to look at the source code of the mod us module:

It probably because the packet sent to the camera was not formatted correctly.

thank you ,i will look that file