1,我不知道你说的数据存储地址是什么。
2,19200,N,8,2 正确。
3,我不知道你说的端口地址是什么。
kidswong999 发布的帖子
-
RE: 与海为PLC联接,接线是否错误?
@3pgs 在 与海为PLC联接,接线是否错误? 中说:
只能用uart = UART(1,19200),不能用uart = UART(3,19200),否则会报错(超出范围值)。这是不是正常的?
这不是正常的,硬件使用的是UART3,而不是UART1
原理图在这里:https://singtown.com/product/50775/openmv-rs485-shield/
-
RE: 寻求帮助:与海为PLC联接的参数设置?
modbus的程序是根据西门子PLC写的,海为PLC我没用过,不清楚里面的细节是否有差异。
modbus的代码是开源的:https://github.com/openmv/openmv/blob/master/scripts/libraries/modbus.py
另外你的报错提示,应该全部放上来。
-
RE: usb连接openmv4 H7时 最初能打开 显示文件或目录损坏,然后一直弹出U盘接入,摄像头灯一直闪烁,求解答,大佬们
不要使用OpenMV IDE直接打开OpenMV磁盘中的文件。而是代码文件保存在电脑上,需要脱机运行的时候才写入到OpenMV的磁盘里。
-
RE: 我用串口发送单个num就可以,但是以数据包的行使就不行,而且还自动断开openmv,只能识别一次,而且打印不了
import sensor, image, time, os, tf, uos, gc from pyb import UART uart = UART(3, 9600) net = None labels = None sensor.reset() # 初始化感光元件 sensor.set_pixformat(sensor.GRAYSCALE) # 设置图像格式为灰度 sensor.set_framesize(sensor.QVGA) # 设置图像大小为 QVGA (320x240) sensor.set_windowing((240, 240)) # 设置窗口大小为 240x240 sensor.skip_frames(10) # 跳过一些帧,使以上设置生效 try: # 加载模型文件 net = tf.load("trained.tflite", load_to_fb=uos.stat('trained.tflite')[6] > (gc.mem_free() - (64*1024))) except Exception as e: print(e) raise Exception('Failed to load "trained.tflite", did you copy the .tflite and labels.txt file onto the mass-storage device? (' + str(e) + ')') try: labels = [line.rstrip('\n') for line in open("labels.txt")] except Exception as e: raise Exception('Failed to load "labels.txt", did you copy the .tflite and labels.txt file onto the mass-storage device? (' + str(e) + ')') clock = time.clock() # 创建时钟对象 while True: clock.tick() # 更新FPS帧率时钟 img = sensor.snapshot() # 拍一张照片并返回图像 # default settings just do one detection... change them to search the image... for obj in net.classify(img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5): #print("**********\nPredictions at [x=%d,y=%d,w=%d,h=%d]" % obj.rect()) img.draw_rectangle(obj.rect()) # 将分类和对应的相似度以列表套元组形式返回 predictions_list = list(zip(labels, obj.output())) # 打印分类和与图像中检测到的物体的对应的相似度 #for i in range(len(predictions_list)): #print("%s = %f" % (predictions_list[i][0], predictions_list[i][1])) if max(obj.output()) > 0.7: # 当识别到的最大的相似度大于0.7时才认为是识别到了数字 # 将识别到的数字赋值给num num = labels[obj.output().index(max(obj.output()))] # 打印识别到的数字 print('识别到的数字是 %s' % num) #uart.write('\n') ##uart.write("识别到了,大傻瓜!!!\r\n") #uart.write(num) num1 = bytearray([0xFE,0xBC,obj.output().index(max(obj.output())),0xEF]) uart.write(num1) time.sleep_ms(100) #print(clock.fps(), "fps") # 打印帧率
-
RE: 矩形识别中心十字线无法准确识别甚至识别不出来,另外校正畸变好像会降低画质,有什么办法吗
因为你把加号写成乘号了。
img.draw_cross(int(max_blob[0]+max_blob[2]/2), int(max_blob[1]*max_blob[3]/2))