用的是openMV-H7 R1
还有R1、R2、R3有什么区别呢?
eagr
@eagr
eagr 发布的帖子
-
MemoryError: Out of fast Frame Buffer Stack Memory!
# Edge Impulse - OpenMV Image Classification Example import sensor, image, time, os, tf import gc gc.threshold(100000) sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QQVGA) # Set frame size to QVGA (320x240) sensor.set_windowing((240, 240)) # Set 240x240 window. sensor.skip_frames(time=2000) # Let the camera adjust. net = "trained.tflite"#模型文件 labels = [line.rstrip('\n') for line in open("labels.txt")] #1 - clock = time.clock() while(True): clock.tick() gc.collect() img = sensor.snapshot() # default settings just do one detection... change them to search the image... for obj in tf.classify(net, 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()) # This combines the labels and confidence values into a list of tuples 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])) print(clock.fps(), "fps")
-
arduino不能完全接受openmv发送的图像像素坐标数据。
openmv代码
Blob Detection and uart transport
import sensor, image, time
from pyb import UART
import jsonFor color tracking to work really well you should ideally be in a very, very,
very, controlled enviroment where the lighting is constant...
yellow_threshold = (65, 100, -10, 6, 24, 51)
You may need to tweak the above settings for tracking green things...
Select an area in the Framebuffer to copy the color settings.
sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.RGB565) # use RGB565.
sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
sensor.skip_frames(10) # Let new settings take affect.
sensor.set_auto_whitebal(False) # turn this off.
clock = time.clock() # Tracks FPS.uart = UART(3, 19200)
def find_max(blobs):
max_size=0
for blob in blobs:
if blob.pixels() > max_size:
max_blob=blob
max_size = blob.pixels()
return max_blobwhile(True):
img = sensor.snapshot() # Take a picture and return the image.blobs = img.find_blobs([yellow_threshold]) if blobs: max_blob=find_max(blobs) print('sum :', len(blobs)) img.draw_rectangle(max_blob.rect()) img.draw_cross(max_blob.cx(), max_blob.cy()) output_str="[%d,%d]" % (max_blob.cx(),max_blob.cy()) #方式1 #output_str=json.dumps([max_blob.cx(),max_blob.cy()]) #方式2 print('you send:',output_str) uart.write(output_str+'\r\n') else: print('not found!')
Arduino代码
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
}void loop() {
// put your main code here, to run repeatedly:
if (Serial.available()) {
// Read the most recent byte
byte byteRead = Serial.read();
// ECHO the value that was read
Serial.write(byteRead);
}
} -
RE: 一直报UART(3)不存在怎么解决
@kidswong999
https://shop67799229.taobao.com/?spm=a230r.7195193.1997079397.15.53f144e3nsTnhp
淘宝店的链接。
OpenMV4 H7 Cam
标配(主板+OV7725模组)