0
Python 3.11.3 (tags/v3.11.3:f3909b8, Apr  4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.

=================== RESTART: C:\Users\smrut\Documents\dct.py ===================
Traceback (most recent call last):
  File "C:\Users\smrut\Documents\dct.py", line 66, in <module>
    detect_copy_move_forgeries('C:/Users/smrut/Desktop/tree.jpg', block_size=8, num_clusters=256)
  File "C:\Users\smrut\Documents\dct.py", line 48, in detect_copy_move_forgeries
    image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)
AttributeError: module 'cv2' has no attribute 'imread'

working on VSCode environment and Python 3.11.3 is installed on system win 11 both IDE throughing same error. uninstallation reinstallation everything i tried. thanks in advance

Christoph Rackwitz
  • 11,317
  • 4
  • 27
  • 36
  • 1
    Does this help https://stackoverflow.com/questions/47857141/attributeerror-module-cv2-has-no-attribute-imread? – gsamaras May 16 '23 at 09:47
  • question needs debugging details. that `RESTART` makes me think that could be the problem. run the script properly. -- also run `pip list` in a shell and list everything that says "opencv" – Christoph Rackwitz May 17 '23 at 10:38
  • Show your code as Minimal Reproductive Example, please. – Misinahaiya May 17 '23 at 10:42
  • Please be reminded that if you are using `pip` and installing `OpenCV` through `pip install opencv`, it provides only (maybe about a empty wrapper), which is not containing the attribute `imread` or others. To install a complete module of OpenCV, use `pip install opencv-python`. (Probably bare `pip install opencv` will give out some errors in later versions of `pip`, because now there aren't any `opencv` in PyPI). – Misinahaiya May 17 '23 at 10:45
  • Does this answer your question? [AttributeError: module 'cv2' has no attribute 'imread'](https://stackoverflow.com/questions/47857141/attributeerror-module-cv2-has-no-attribute-imread) – gsamaras May 17 '23 at 11:54
  • thank you everyone, the issue is resolved but the thing is I have uninstalled VSCode and working on python 3.11.3 if again I go with VSCode then issue will arise – Samruddhi D May 20 '23 at 12:00

0 Answers0