After cloning the GitHub repo of OpenCV, I am trying to run grabcut.py but I am getting error : Traceback (most recent call last): File "grabcut.py", line 114, in img = cv.imread(cv.samples.findFile(filename)) AttributeError: module 'cv2.cv2' has no attribute 'samples'

Here is the link to the file: https://github.com/opencv/opencv/blob/master/samples/python/grabcut.py

1 Answers

1
Safwan On Best Solutions

samples submodule is available in opencv-python version 4.0.0.21. Use pip install to install that specific version.

pip install opencv-python==4.0.0.21