You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
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
importcv2img=cv2.imread("image.jpg")
# Create a Selective Search objectss=cv2.ximgproc.segmentation.createSelectiveSearchSegmentation()
# Set the input imagess.setBaseImage(img)
# Run the selective search algorithmss.switchToSelectiveSearchFast()
rects=ss.process()
# Show the resultsfori, rectinenumerate(rects):
x, y, w, h=rectcv2.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 with Python 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")