-
Notifications
You must be signed in to change notification settings - Fork 940
Description
Expected behaviour
I didn't expect this error. I checked various forums about this issue, like StackOverflow or this GitHub repo and it seems to be caused by conflicting installation of opencv but I checked and I have only one version of the package installed (opencv-python
)
Actual behavior
I receive the following error :
Traceback (most recent call last):
File "[...]/pattern.py", line 7, in <module>
ss = cv2.ximgproc.segmentation.createSelectiveSearchSegmentation()
AttributeError: module 'cv2' has no attribute 'ximgproc'
Steps to reproduce
- Run the following file
import cv2
img = cv2.imread("image.jpg")
# Create a Selective Search object
ss = cv2.ximgproc.segmentation.createSelectiveSearchSegmentation()
# Set the input image
ss.setBaseImage(img)
# Run the selective search algorithm
ss.switchToSelectiveSearchFast()
rects = ss.process()
# Show the results
for i, rect in enumerate(rects):
x, y, w, h = rect
cv2.rectangle(img, (x, y), (x+w, y+h), (0, 255, 0), 2)
cv2.imshow("Selective Search", img)
cv2.waitKey(0)
- operating system & architecture : I use Ubuntu 22.04 (x86-64)
- opencv-python version :
opencv_python-4.7.0.72
withPython 3.10.6
I used to following methods to try to mitigate this issue:
- I uninstalled
opencv-python
and checked that it was not installed anymore. - I purged the download cache of
pip
- I installed
opencv-python
with pip.
Issue submission checklist
-
This is not a generic OpenCV usage question (looking for help for coding, other usage questions, homework etc.)
-
I have read the README of this repository and understand that this repository provides only an automated build toolchain for OpenCV Python packages (there is no actual OpenCV code here)
-
The issue is related to the build scripts in this repository, to the pre-built binaries or is a feature request (such as "please enable this additional dependency")
-
I'm using the latest version of
opencv-python