测试程序出现的问题

  1. 通道问题
Traceback (most recent call last):
  File "C:/Users/64883/Desktop/Evaluation_metrics/all.py", line 150, in <module>
    img_gb = cv2.cvtColor(img_b, cv2.COLOR_RGB2GRAY)
cv2.error: OpenCV(4.6.0) d:\a\opencv-python\opencv-python\opencv\modules\imgproc\src\color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function '__cdecl cv::impl::`anonymous-namespace'::CvtHelper<struct cv::impl::`anonymous namespace'::Set<3,4,-1>,struct cv::impl::A0xf2302844::Set<1,-1,-1>,struct cv::impl::A0xf2302844::Set<0,2,5>,2>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)'
Invalid number of channels in input image:
    'VScn::contains(scn)'
where
     'scn' is 1 

这个错误是由于输入图像的通道数不匹配导致的OpenCV错误。根据错误信息,输入图像的通道数被认为是1,但实际上它可能具有不正确的通道数。

  1. 尺寸问题
Traceback (most recent call last):
  File "C:/Users/64883/Desktop/Evaluation_metrics/all.py", line 155, in <module>
    ssim_num = compare_ssim(img_ga, img_gb, data_range=255)
  File "D:\Anaconda3\envs\paddlepaddle\lib\site-packages\skimage\_shared\utils.py", line 348, in fixed_func
    return func(*args, **kwargs)
  File "D:\Anaconda3\envs\paddlepaddle\lib\site-packages\skimage\metrics\_structural_similarity.py", line 101, in structural_similarity
    check_shape_equality(im1, im2)
  File "D:\Anaconda3\envs\paddlepaddle\lib\site-packages\skimage\_shared\utils.py", line 569, in check_shape_equality
    raise ValueError('Input images must have the same dimensions.')
ValueError: Input images must have the same dimensions.

这个错误是由于输入图像的尺寸不匹配导致的值错误。根据错误信息,输入图像"img_ga"和"img_gb"的尺寸不相同,因此无法进行结构相似性比较。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值