Python decodedObjects=pyzbar.decode(im)->;导致->;类型错误:无法解压缩不可iterable非类型对象

Python decodedObjects=pyzbar.decode(im)->;导致->;类型错误:无法解压缩不可iterable非类型对象,python,Python,晚上好 我目前正在尝试检测多幅图像中各种QR码的位置。我开始尝试下面的代码,但不知怎么的,出现了TypeError消息“Cannotunexpacknoniterable NoneType对象”。我试图将图像转换为灰度,但没有效果。有什么想法吗?:) “Bild29_grau”似乎不太可能是图像文件的名称(它真的没有扩展名吗?)。打印出im,您可能会发现图像读取失败。omg,谢谢:D现在我觉得很尴尬,我真的忘了在图像名称中添加数据类型….“Bild29_grau”对于图像文件来说似乎不太可能是一

晚上好

我目前正在尝试检测多幅图像中各种QR码的位置。我开始尝试下面的代码,但不知怎么的,出现了TypeError消息“Cannotunexpacknoniterable NoneType对象”。我试图将图像转换为灰度,但没有效果。有什么想法吗?:)


“Bild29_grau”
似乎不太可能是图像文件的名称(它真的没有扩展名吗?)。打印出
im
,您可能会发现图像读取失败。omg,谢谢:D现在我觉得很尴尬,我真的忘了在图像名称中添加数据类型….
“Bild29_grau”
对于图像文件来说似乎不太可能是一个名称(它真的没有扩展名吗?)。打印出
im
,您可能会发现图像读取失败。omg,谢谢:D现在我觉得很尴尬,我真的忘了在图像名称中添加数据类型。。。。
from __future__ import print_function
import pyzbar.pyzbar as pyzbar
import numpy as np
import cv2

def decode(im) :
  # Find barcodes and QR codes
  **decodedObjects = pyzbar.decode(im)**
[enter image description here][1]
  # Print results
  for obj in decodedObjects:
    print('Type : ', obj.type)
    print('Data : ', str(obj.data),'\n')

  return decodedObjects


# Display barcode and QR code location
def display(im, decodedObjects):

  # Loop over all decoded objects
  for decodedObject in decodedObjects:
    points = decodedObject.polygon

    # If the points do not form a quad, find convex hull
    if len(points) > 4 :
      hull = cv2.convexHull(np.array([point for point in points], dtype=np.float32))
      hull = list(map(tuple, np.squeeze(hull)))
    else :
      hull = points;

    # Number of points in the convex hull
    n = len(hull)

    # Draw the convext hull
    for j in range(0,n):
      cv2.line(im, hull[j], hull[ (j+1) % n], (255,0,0), 3)

  # Display results
  cv2.imshow("Results", im);
  cv2.waitKey(0);


# Main
if __name__ == '__main__':

  # Read image
  im = cv2.imread('Bild29_grau')

  decodedObjects = decode(im)
  display(im, decodedObjects)