array op array Error

asked 2019-04-22 10:52:30 -0600

Hossam gravatar image

I am getting the following error: Exception during the frame elaborationCvException [org.opencv.core.CvException: cv::Exception: OpenCV(4.0.1) C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\core\src\arithm.cpp:663: error: (-209:Sizes of input arguments do not match) The operation is neither 'array op array' (where arrays have the same size and the same number of channels), nor 'array op scalar', nor 'scalar op array' in function 'cv::arithm_op' ]

Extra information: I am trying to apply this "Core.addWeighted(imageROI, 1.0, logo, -0.7, 0.0, imageROI);" as mentioned in the following tutorial: https://github.com/opencv-java/video-... Does anyone have any idea

edit retag flag offensive close merge delete

Comments

what is it, you don't understand about the error msg ?

berak gravatar imageberak ( 2019-04-22 13:18:49 -0600 )edit

I just got an update, but the error still exists. The code mentioned in the link has this line "this.logo = Imgcodecs.imread("resources/Poli.png");" ^ When I check the; width and height of that code, I always get 0, and the channel always give 1. No matter what Image I choose (and I have chosen several images) the result is always the same. width = 0; height = 0; channels = 1; I really do not understand why this is happening, any idea would be appreciated.

Hossam gravatar imageHossam ( 2019-04-22 19:58:57 -0600 )edit

I really do not understand why this is happening

most likely, you're a noob, and it's the 1st time ever, you get in contact with file paths.

your logo did not load. that path is not correct. the image is not, where you're looking for it. full stop.

if (logo.empty()) {/*load fail, you cannot go on*/}
berak gravatar imageberak ( 2019-04-23 02:06:35 -0600 )edit

You are indeed correct when it comes to my level related to the file paths. Also, two things confused me: 1) I already have an if condition that says if logo is empty then do something else which it did not do. 2) I fixed this by using the absolute path and not the relative path, which is awkward since I though that my image is indeed in my source file. This is why I was I am confused

Hossam gravatar imageHossam ( 2019-04-23 19:02:35 -0600 )edit