画面与程序卡在第一帧,有时运行几秒后卡住

程序是新建文件自带的,点击左下角开始后画面出现第一帧(有时甚至不会出现)就停止,有时运行几秒后停止,程序运行结果也随之停止。我再次点击左下角希望结束程序却显示忙碌中。我使用的是h7p lu s

x

Hi, can you update your firmware to the latest? Do Tools→Install Latest Development Firmware. Also, please use the latest version of OpenMV IDE v4.8.7.

Thank you for your reply, but it’s still not working. The current situation is that when I click the bottom left corner, the device disconnects.

Can you post a video showing what is happening? The H7 plus is extremely solid. This type of failure likely has some weird cause.

sorry, i’m a new user,i can’t post video

i will show you my code

import sensor
import time

import image

sensor.reset()  # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE)  # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)  # Set frame size to QVGA (320x240)
sensor.skip_frames(time=2000)  # Wait for settings take effect.ssekuaig
clock = time.clock()  # Create a clock object to track the FPS.

白色阈值 = (245, 82)
上一帧坐标 = None
上一帧时间 = None
x方向速度 = 0
y方向速度 = 0

def 主循环():
global 上一帧坐标, 上一帧时间, x方向速度, y方向速度
clock = time.clock()

while True:
    clock.tick()
    当前时间 = time.ticks_ms()

    img = sensor.snapshot()
    白色色块们 = img.find_blobs([白色阈值], merge=False)

    x_str, y_str = "0", "0"
    vx_str, vy_str = "0.00", "0.00"

    if 白色色块们:
        小球 = max(白色色块们, key=lambda b: b.area())
        当前坐标 = (小球.cx(), 小球.cy())
        if 上一帧坐标 is not None and 上一帧时间 is not None:
            时间差 = time.ticks_diff(当前时间, 上一帧时间)
            if 时间差 > 0:
                位移x = 当前坐标[0] - 上一帧坐标[0]
                位移y = 当前坐标[1] - 上一帧坐标[1]
                x方向速度 = 位移x*100/时间差
                y方向速度 = 位移y*100/时间差
                上一帧坐标 = 当前坐标
                上一帧时间 = 当前时间
        else:
            y方向速度 = 0.0
            x方向速度 = 0.0
            上一帧坐标 = 当前坐标
            上一帧时间 = 当前时间

        if 上一帧坐标 is not None:
            x_str = str(int(上一帧坐标[0]))
            y_str = str(int(上一帧坐标[1]))
        else:
            x_str = "None"
            y_str = "None"

        vx_str = "{:.2f}".format(x方向速度)
        vy_str = "{:.2f}".format(y方向速度)

    print(x_str, y_str, vx_str, vy_str)
    img.draw_cross(int(上一帧坐标[0]), int(上一帧坐标[1]), color=(255, 0, 0))
    img.draw_rectangle(小球.rect(), color=(0, 255, 0))

if name == “main”:
try:
主循环()
except KeyboardInterrupt:
print(“程序终止”)

I’m not sure if you can use Chinese names for functions and variables reliably. can you post the code with everything using ascii only? I will have an easier time debugging.

I’m borrowing the original poster’s thread to raise some of my questions. I also encountered lag issues. The lag occurs after I extract the facial feature points during face recognition. The whole screen freezes, and then the program stops running. I thought it was a firmware issue, but after updating the firmware, new problems appeared. …

Hi, we are resolving some issues with the newest protocol. Please use the latest stable firmware until we have these resolved.