Compiling OpenCV code in Java -
i new java maybe little stupid. have written c++ code uses opencv, want convert java. used compile c++ code in terminal using
g++ main.cpp -o main `pkg-config opencv --libs` but unable find simple equivalent java. have tried using
javac -cp .:/usr/share/java/opencv.jar opencvdemo.java but gives compilation error looks if unable link library. looking way compile opencv java code in way similar c++ method.
it helpful if demonstrate how compile code
import org.opencv.core.core; import org.opencv.core.cvtype; import org.opencv.core.mat; public class hello { public static void main( string[] args ) { system.loadlibrary( core.native_library_name ); mat mat = mat.eye( 3, 3, cvtype.cv_8uc1 ); system.out.println( "mat = " + mat.dump() ); } } i have been able find ways configure ide compile program or using ant or sbt. want way compile program command line using javac.
finally figured out myself
compiling:
javac -cp .:/usr/share/opencv/java/opencv-248.jar hello.java executing
java -cp .:/usr/share/opencv/java/opencv-248.jar hello i think using incorrect jar file
Comments
Post a Comment