Ask Your Question
0

ros-kinetic is blocking my new opencv install

asked 2019-06-05 07:48:37 -0500

cerebraldad gravatar image

updated 2019-06-05 11:12:19 -0500

gvdhoorn gravatar image

I'm working on my own custom opencv script and when I try to execute some methods i get the error:

OpenCV Error: Assertion failed (input.dims == 4 && (input.type() == 5 || input.type() == 6)) in finalize, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/module
s/dnn/src/layers/convolution_layer.cpp, line 78
Traceback (most recent call last):
  File "extract_embeddings.py", line 73, in <module>
    detections = detector.forward()
cv2.error: /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/dnn/src/layers/convolution_layer.cpp:78: error: (-215) input.dims == 4 && (input.type() == 5 || in
put.type() == 6) in function finalize

code:

detector = cv2.dnn.readNetFromCaffe(protoPath, modelPath)

...

detector.setInput(imageBlob)
detections = detector.forward()

How do I get my environment to not call the ros installed opencv package and the one I want to work on.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-06 02:07:05 -0500

andrejpan gravatar image

Hey cerebraldad,

I think here are at least two issues. The one that you paste here is that you are having an issue with your image or what it look like, lacking having one. You should search for OpenCV Error: Assertion failed and you will find a lot of similar issues and ideas on how to solve it.

Second, ros is not blocking your new opencv install but is more likely that it does not know where your new installation is. There are multiple ways how to solve it. One temporarily solution is that project`s CMakeList.txt should include these two lines

set(OpenCV_DIR /path/to/new/opencv/build)
find_package( OpenCV REQUIRED )

Best Andrej

edit flag offensive delete link more

Comments

Thank you. The image is being supplied in the call - I double checked the path is valid.

I am not running a package but a test python script that is calling opencv - but it seems like the python or kinetic is the only install that python recognizes...even though i installed opencv with pip install opencv-contrib-python I would like to use this for the new script and not the kinetic install.

How do I achieve the above.

cerebraldad gravatar imagecerebraldad ( 2019-06-06 09:36:53 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2019-06-05 07:48:37 -0500

Seen: 149 times

Last updated: Jun 06