问题描述
我在Python 3.8
的{{1}}和OpenCV 4.4.0.44
上使用AKAZE构造函数。
我试图在构造函数中组合不同的参数,并计划在数据集上执行它们。 构造函数可以使用其默认参数正常工作。
查看代码和传递的不同值:
PIP
当我使用 # [ 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,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
我已经查看过Documentation,但我不知道自己缺少什么。
有关可能是什么错误的任何指导?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)