原始问题:
基于OpenMV的Python程序:识别有色差图形并打印坐标及模型序号
以下是基于OpenMV的Python程序:
import OpenMV library
import openmv
Initialize camera and find the target with color difference
camera = openmv.mv()
img = camera.capture() # capture an image from the camera
blobs = img.find_blobs([(0, 0, 0), (255, 255, 255)], pixels_threshold=100, area_threshold=100) # find blobs of colors between black and white
# Print out the coordinates of each target found in the image and its order number
for blob in blobs:
x_coordinate = blob[0] # get x coordinate of the target
y_coordinate = blob[1] # get y coordinate of the target
print("The coordinates for this target are ({}, {}). This is target number {}".format(x_coordinate, y_coordinate, blobs.index(blob)+1))
Prev:表面分析的解决的问题