Opencv with hadoop

asked 2016-11-20 05:21:58 -0600

guylot gravatar image

Hi, Is it possible to make an hive udf that runs opencv code (java)? When I try to run the function from hive I get error ClassNotFoundException: org.opencv I think its something about the native library but I not able to solve it or maybe its just impossible to run it on hive.

edit retag flag offensive close merge delete

Comments

i can't help you, but this is for sure not the exact error msg.

please be more precise, on what you're doing, and the output of it.

berak gravatar imageberak ( 2016-11-20 05:57:25 -0600 )edit

For now im just trying to run a hive udf that does nothing but can use opencv library. I wrote java code that include opencv jar (linux version). my code is just: public string evaluate (string a) { MatOfRect matType = new MatOfRect(); return null; }

I run this function on a table column in hive. When I outline the MatOfRect type line I get null as expected. When the MatOfRect type line is included the function fails. So look like the function cant load the opencv library propertly.

On windows I had to load the opencv.dll as native library, now im running on linux is there any folder I need to load?

guylot gravatar imageguylot ( 2016-11-20 06:37:49 -0600 )edit
1

sure, you need a native opencv_java310.so on linux, too.

berak gravatar imageberak ( 2016-11-20 06:59:33 -0600 )edit

I have added system.load("%path%/libopencv_java2413.so") to my project (this line passed without error) but still I get ClassNotFoundException: org.opencv.core.MatOfRect error

guylot gravatar imageguylot ( 2016-11-20 07:29:47 -0600 )edit
1

it won't be able to expand the path var by magic, also %path% is only valid on windows.

then, your error still means, that the opencv jar file was not found (the so would be the next problem)

berak gravatar imageberak ( 2016-11-20 07:47:42 -0600 )edit

sorry, I meant the %path% only in this comment to not spam the full location here. In the code I gave the complete path

guylot gravatar imageguylot ( 2016-11-20 07:50:22 -0600 )edit