logo

为什么运行示例会这样?

2024-05-15 11:11
M
wlyg
请在这里粘贴代码# This work is licensed under the MIT license.
# Copyright (c) 2013-2023 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Keypoints descriptor example.
# This example shows how to save a keypoints descriptor to file. Show the camera an object
# and then run the script. The script will extract and save a keypoints descriptor and the image.
# You can use the keypoints_editor.py util to remove unwanted keypoints.
import sensor
import time
import image

# Reset sensor
sensor.reset()

# Sensor settings
sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.VGA)
sensor.set_windowing((320, 240))
sensor.set_pixformat(sensor.GRAYSCALE)

sensor.skip_frames(time=2000)
sensor.set_auto_gain(False, value=100)

FILE_NAME = "desc"
img = sensor.snapshot()
# NOTE: See the docs for other arguments
# NOTE: By default find_keypoints returns multi-scale keypoints extracted from an image pyramid.
kpts = img.find_keypoints(max_keypoints=150, threshold=10, scale_factor=1.2)

if kpts is None:
    raise (Exception("Couldn't find any keypoints!"))

image.save_descriptor(kpts, "/%s.orb" % (FILE_NAME))
img.save("/%s.pgm" % (FILE_NAME))

img.draw_keypoints(kpts)
sensor.snapshot()
time.sleep_ms(1000)

raise (Exception("Please reset the camera to see the new file."))
![0_1715741831530_7c831c12-c730-4ff6-975e-01a0e5bc49f2-image.png](https://fcdn.singtown.com/b2b9accf-1b16-4d1c-95f3-08f94d124950.png)
b8e43864-a0eb-4d7d-84f8-fa11f76a158d.png
M
wlyg

Traceback (most recent call last):

File "<stdin>", line 32, in <module>

TypeError: extra keyword arguments given

OpenMV v4.5.4; MicroPython v1.22-omv.r22; OPENMV4P-STM32H743

Type "help()" for more information.

>>>

2024-05-16 18:19
I
网红小智智 星瞳科技

set_auto_gain这一行删除