我在Python 3.8
上使用AKAZE构造函数&OpenCV 4.4.0.44
来自{
我试图在构造函数中组合不同的参数,并计划在数据集上执行它们。 构造函数可以很好地使用其默认参数
请参阅代码和传递的不同值:
# [ options is the argparser ]
grayscale_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
grayscale_image = cv2.resize(grayscale_image, (256, 256), interpolation=cv2.INTER_AREA)
if mask is not None:
mask = cv2.resize(mask, (256, 256), interpolation=cv2.INTER_AREA)
mask = (mask == 0).astype(np.uint8) * 255
# Options of the constructor
# - descriptor_type Type of the extracted descriptor: DESCRIPTOR_KAZE,
# DESCRIPTOR_KAZE_UPRIGHT, DESCRIPTOR_MLDB or DESCRIPTOR_MLDB_UPRIGHT.
# - descriptor_size Size of the descriptor in bits. 0 -> Full size
# - descriptor_channels Number of channels in the descriptor (1, 2, 3)
# - threshold Detector response threshold to accept point
# - nOctaves Maximum octave evolution of the image
# - nOctaveLayers Default number of sublevels per scale level
# - diffusivity Diffusivity type. DIFF_PM_G1, DIFF_PM_G2, DIFF_WEICKERT or DIFF_CHARBONNIER
# Assuring type is the expected for each one
descriptor_size = int(options.ak_desc_size) ## 0 = full size
descriptor_type = int(options.ak_desc_type) ## 5 or 4 or 3 or 2 descriptor
threshold = float(options.ak_threshold) ## variable (0.001)
channels = int(options.ak_desc_chan) ## with 3 works, not with 1 or 2
num_octaves = int(options.ak_num_octav) ## 4
octave_layers = int(options.ak_oct_layer) ## 4
difussivity = int(options.ak_diffusivt) ## 0..3
akaze = cv2.AKAZE_create(descriptor_size=descriptor_size,
descriptor_type=descriptor_type,
threshold=threshold,
descriptor_channels=channels,
nOctaves=num_octaves,
nOctaveLayers=octave_layers,
diffusivity=difussivity)
keypoints = akaze.detect(grayscale_image, mask=mask)
当我使用descriptor_channels == 2 or ==1
执行参数组合时,会出现以下异常:
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-6amqbhlx/opencv/modules/features2d/src/kaze/AKAZEFeatures.cpp:1986: error: (-215:Assertion failed) dpos == 486 in function 'Get_MLDB_Full_Descriptor'
我已经复习了Documentation,但我不知道我遗漏了什么
关于可能出现的错误有什么指导吗
目前没有回答
相关问题 更多 >
编程相关推荐