[英]Error: 'numpy.ndarray' object has no attribute 'mode'
我在這里看過這個錯誤,但代碼不同,他使用了 PIL.ImageOps
所以基本上我得到了這段代碼的錯誤:
img1 = cv2.imread(r'C:\Users\Yael\Desktop\final project\Image processing\PC3\PC3_Glucose_1.tif', 0)
enhancer = ImageEnhance.Brightness(img1)
enhancer = ImageEnhance.Brightness(img1)
enhanced_im = enhancer.enhance(1.8)
# enhanced_im.save("enhanced.sample5.png")
img = cv2.resize(enhanced_im, (960, 540))
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
回溯是:
Traceback (most recent call last):
File "C:/Users/Yael/PycharmProjects/FinalProject/Cell_Detection.py", line 9, in <module>
enhancer = ImageEnhance.Brightness(img1)
File "C:\Users\Yael\AppData\Roaming\Python\Python37\site-packages\PIL\ImageEnhance.py", line 84, in __init__
self.degenerate = Image.new(image.mode, image.size, 0)
AttributeError: 'numpy.ndarray' object has no attribute 'mode'
我試圖拍攝一張非常暗的圖像並使其更亮,以便我可以看到圖像。 當我使用 MATLAB 時,我使用了 imadjust
image = imadjust(dark_image,[0 adjustment],[]);
所以我試圖在 Python 上模仿它
謝謝:)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.