JavaCV setup with Eclipse on Windows 7

Update: These instructions are also applicable for 2.4+ version of opencv and javacv.

I was looking for image processing library for Java. My search stopped at JavaCV. JavaCV provides wrappers for OpenCV. so you can directly use OpenCV functions in Java. JavaCV also provides hardware accelerated full screen Image display with CanvasFrame and GLCanvasFrame.

JavaCV provides jar files which can be used with OpenCV installation. Following steps can be followed to setup JavaCV with Eclipse on Windows 7.

1.Install Java Development Kit (JDK) from the link below. Make sure to install 32bit or 64 bit as per your processor.

http://www.oracle.com/technetwork/java/javase/downloads/jdk-6u32-downloads-1594644.html

2. Install Microsoft Visual C++ redistributable package

For 32 bit: http://www.microsoft.com/download/en/details.aspx?id=5555
For 64 bit: http://www.microsoft.com/download/en/details.aspx?id=14632

3. Download OpenCV super-pack from Sourceforge and extract it in you C:\Opencv

http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3.1/

4. Set OpenCV .dll in systems path so that JavaCV can access it.

Go to Control Panel > System Security > System > Advanced System Settings > Environment Variables
In System variable select path and click on Edit. Now add following address in Variable address. I have extracted opencv package in C:\ directory. If you have installed at different location please update address accordingly.

For OpenCV 2.4.2 and earlier version 

For 32 bit:
C:\opencv\build\x86\vc10\bin;C:\opencv\build\common\tbb\ia32\vc10\

For 64 bit:
C:\opencv\build\x64\vc10\bin;C:\opencv\build\common\tbb\intel64\vc10\


For OpenCV 2.4.3 and later version 

For 32 bit:
C:\opencv\build\x86\vc10\bin

For 64 bit:
C:\opencv\build\x64\vc10\bin



Once this is done, the most important step is to Restart Windows.

5. Download JavaCV- bin from link below and extract it.

http://code.google.com/p/javacv/downloads/list

6. Create New Java Project 'demo' in Eclipse. 

Once created, go to Project > Properties > Java Build Path > Libraries > Add External JARs .
Go to your JavaCV Extracted folder and add all jar files. It should look like the pic below



7. Now create demo.java in src folder of the project. 

Paste following code and run the project.Put your image in project folder. In my case it is 'img1.png'


Result will look like this  



83 comments:

  1. Do you have any idea why i get the following error when running your code?
    Exception in thread "main" java.lang.NullPointerException
    at com.googlecode.javacv.CanvasFrame.showImage(CanvasFrame.java:335)
    at com.googlecode.javacv.CanvasFrame.showImage(CanvasFrame.java:332)
    at FaceDetection.main(FaceDetection.java:16)

    ReplyDelete
    Replies
    1. did u put "jpeg" photo?


      I put "jpeg" picture, and used this file name in the code. then have the same error as u.

      and I change "jpeg" to "jpg" in code. then without any problem and showed picture~~=]

      Delete
    2. Put your image file in the Project Folder root instead of your "src" folder.
      That solved the problem for me.

      Delete
  2. It looks like your code is not able to locate image which is why it is showing null pointer exception. More specific reason can be identified by looking at code.

    ReplyDelete
  3. I get java.lang.UnsatisfiedLinkError C:\Users\..\AppData\Local\Temp\jniopencv_core4254130985403942592.dll Can't find dependent libraries exception when run the code.

    I have JDK 64bit and Netbeans 7.2 on windows 7 64bit
    i set the path to OpenCV as you mention in the blog post.

    ReplyDelete
    Replies
    1. Make sure you are setting path to 64 bit opencv. Also javacv and opencv version should be same. Don't forget to restart system after setting path.

      Delete
  4. Hi i even i m getting same error as above that is cant find dependent libraries. can you tell me the how should i identify OpenCV & JavaCV are 32/64 bits.plz help me my work is struc from 15days.

    ReplyDelete
    Replies
    1. 'Can't Dependent libraries' issue mostly arises due to following reasons.
      1. javacv and opencv version are not compatible. i.e. you should use opencv 2.4.0 for javacv 0.2
      Required opencv version can be found in readme file with javacv package.

      2. One should link 32 bit opencv libs with 32 bit javacv and 64 bit opencv libs with 64 bit javacv. You should have 64 bit process in order to use 64 bit libs.
      opencv comes with both 32 and 64 bit libs. You should link need libs are per explained in step 4 in above blog-post. You should worry about javacv if you are linking all the jar files provided by javacv package in step 6 in above blog-post.

      3. Set the 'path' correctly as suggested in setp 4 in above blog-post. Don't forget to restart your system before using it.

      I hope this should help. If you are still getting error after this, try posting full error log.

      Delete
  5. Thank you nikil its working...

    ReplyDelete
  6. I got it... please help

    java.lang.UnsatisfiedLinkError: C:\Users\Why We\AppData\Local\Temp\javacpp270039669094\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_imgproc$CvMoments.(opencv_imgproc.java:381)
    at com.googlecode.javacv.JavaCV.(JavaCV.java:61)
    Exception in thread "main"

    ReplyDelete
  7. On debugg i Got: ---

    The JAR javacpp.jar has no source attachment..

    ReplyDelete
    Replies
    1. Please refer to my comment and make sure you install compatible versions and set 'path' correctly.
      http://opencvlover.blogspot.in/2012/04/javacv-setup-with-eclipse-on-windows-7.html?showComment=1344237048477#c8922915921353597224

      Delete
  8. Hi..........
    I have a code that uses haartraining results to detect the hand gesture of FIST in video stream...
    But there is following error.....
    error: could not not load classifier cascade...
    Please tell me what will be the problem?????

    ReplyDelete
    Replies
    1. Either your file is corrupted or path of file you have given in code is not correct. I can comment more if I can see your code.

      Delete
  9. Hi, I have this message, of Java Virtual Machine Launcher: could not find the main class: com.googlecode.javacv.javaCV. Program will exit and from the Eclipse console I have this message: java.lang.UnsatisfiedLinkError: C:\Users\LOGIKS\AppData\Local\Temp\javacpp1902296841623\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_imgproc$CvMoments.(opencv_imgproc.java:381)
    at com.googlecode.javacv.JavaCV.(JavaCV.java:61)
    Exception in thread "main"


    I do installed all (opencv, javacv and exported all *.jar file)

    Do you helpme?!

    Than you advance!

    HAS

    ReplyDelete
    Replies
    1. It looks like your path is not set correctly. Make sure you have set correct path as mentioed in step 4 of the above post.

      Delete
  10. Hi,

    I've been going around and around with this! I have checked my path several times, and everything seems OK, but I still get this error:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\tmb\AppData\Local\Temp\javacpp1388179248459\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:85)
    at dmoPkg.Demo.main(Demo.java:15)

    I'm using the 64-bit versions of javacv v0.2 and opencv v2.4.2, with eclipse on Win7. Any guidance greatly appreciated - thanks!

    ReplyDelete
    Replies
    1. This error is generated when your setup is not able to find opencv binaries. Are you able to run opencv alone on your system. I got javacv working by following all steps mentioned in above post. Try re-installing opencv and see if it works. Make sure your processor and operating system both are 64 bit. Otherwise you will have to use everything 32bit.

      Delete
  11. Hi Nikhil,

    My processor is a i3-2310M and Win7 also reports 64 bits, so no problem there. I looked at eclipse but couldn't see anything that said 64 bits - I'm pretty sure that I installed the 64-bit version.

    For the paths: I copied them out of the Environment Variables and pasted them into the URL of a folder: up popped the files. So I think that part is OK. Don't know what's left to look at.

    How do I run opencv alone? I'm only using within eclipse.

    ReplyDelete
  12. Got it working.

    The problem was in Step 4: I did have the paths entered correctly in my Environment Variables. But I didn't have the opencv folder in the root of C:\.

    Moved the folder to C:\, then updated the paths, and everything started working!

    Thanks,
    Wouldn't have been possible without this site!

    ReplyDelete
  13. sorry for the same error, but none of the given approach worked for me

    I have core i7 processor, I installed opencv 2.4.0 (which is having both 32 and 64 version all together)

    used javacv 0.2 as mentioned

    I have eclipse Hellios 32 bit version

    so I have given the path of 32 bit opencv at system variable

    But nit working.....

    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Tanmoy\AppData\Local\Temp\javacpp455602868520\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:85)
    at sampleApplication.testSample.main(testSample.java:12)


    Please help..
    I have urgent requirement

    ReplyDelete
    Replies
    1. This error is generated when your setup is not able to find opencv binaries. Are you able to run opencv alone on your system? Make sure you have set correct path to Opencv bin folder in step 4.

      Delete
  14. i have the next issue


    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Ernesto\AppData\Local\Temp\javacpp452443458170\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:418)
    at com.googlecode.javacpp.Loader.load(Loader.java:368)
    at com.googlecode.javacpp.Loader.load(Loader.java:315)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:131)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:334)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:85)
    at demo.main(demo.java:10)




    i've done all the steps fine

    ReplyDelete
  15. Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\mypc\AppData\Local\Temp\jniopencv_core2814738007320535298.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:332)
    at com.googlecode.javacpp.Loader.load(Loader.java:266)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:118)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:87)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:88)
    at javaCVproj01.main(javaCVproj01.java:16)



    plz help me yaar

    ReplyDelete
  16. in eclipse on my compt, it should run the project as Demo, could you or have any explain on it ?, thnx

    sorry for my bad english

    ReplyDelete
  17. Hello,
    Is it possible detect the face in a video file using opencv in java,if so please guide me i need it urgently....

    ReplyDelete
    Replies
    1. Sorry for late reply. You can certainly do that. Look at my post on FaceDetection using Haar Classifier http://opencvlover.blogspot.in/2012/11/face-detection-in-javacv-using-haar.html
      Only thing you have to do is pass video frame instead of IplImage to the function 'cvHaarDetectObjects'.

      Delete
  18. In opencv 2.4.3 the does not appear to be a common folder so the paths listed in step 4 are correction and result in the "cant find dependent libraries" error many had above. I files are located in the gpu folder and the corrected paths are

    For 32 bit:
    C:\opencv\build\x86\vc10\bin;C:\opencv\build\gpu\x86\vc10\

    For 64 bit:
    C:\opencv\build\x64\vc10\bin;C:\opencv\build\gpu\x64\vc10\

    ReplyDelete
    Replies
    1. Thanks for updating. By the way you need gpu .dll in PATH only if you want to use gpu features. I have updated the blog.

      Delete
  19. I am getting the following error Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\ARNAB BANERJEE\AppData\Local\Temp\javacpp204753407340\jniopencv_core.dll: %1 is not a valid Win32 application
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:422)
    at com.googlecode.javacpp.Loader.load(Loader.java:372)
    at com.googlecode.javacpp.Loader.load(Loader.java:319)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:136)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.googlecode.javacpp.Loader.load(Loader.java:338)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:97)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at com.googlecode.javacpp.Loader.load(Loader.java:338)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:85)
    at Javacv5.main(Javacv5.java:12)
    I have abided with the steps that u recommened.
    Please sort out my mistake.
    Thanks,
    Arnab Banerjee

    ReplyDelete
    Replies
    1. This issue you are facing issue mostly arises due to following reasons.
      1. javacv and opencv version are not compatible. i.e. you should use opencv 2.4.0 for javacv 0.2
      Required opencv version can be found in readme file with javacv package.

      2. One should link 32 bit opencv libs with 32 bit javacv and 64 bit opencv libs with 64 bit javacv. You should have 64 bit process in order to use 64 bit libs.
      opencv comes with both 32 and 64 bit libs. You should link need libs are per explained in step 4 in above blog-post. You should worry about javacv if you are linking all the jar files provided by javacv package in step 6 in above blog-post.

      3. Set the 'path' correctly as suggested in setp 4 in above blog-post. Don't forget to restart your system before using it.

      If you still have this error then try to check if opencv is installed properly on your system.

      Delete
    2. "is not a valid Win32 application" suggests that most likely you might have 32 bit 64 bit problem. Make sure all JDK, Javacv and OpenCV are for either 64 bit or 32 bit system.

      Delete
  20. I also tried your tutorial step by step and i end up with the following error after running the "demo" app (i got open cv/javacv working on processing.org framework ):

    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Cosmin\AppData\Local\Temp\jniopencv_core8585445312827078444.dll: %1 is not a valid Win32 application
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:337)
    at com.googlecode.javacpp.Loader.load(Loader.java:271)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:126)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:96)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:291)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:91)
    at demo.main(demo.java:10)

    ReplyDelete
    Replies
    1. "is not a valid Win32 application" suggests that most likely you might have 32 bit 64 bit problem. Make sure all JDK, Javacv and OpenCV are for either 64 bit or 32 bit system.

      Delete
  21. Hi I just followed your guide and everything is ok, except the image in canvas frame is much brighter than the original. I use opencv243. Can you please give me some advices?

    ReplyDelete
    Replies
    1. Which javacv version are you using?

      Delete
    2. This comment has been removed by the author.

      Delete
    3. I'm using JavaCV 0.3
      the result is something like this:
      http://imageshack.us/a/img690/2525/capturectt.png

      Delete
    4. What is the file format of your original image? Can you provide your original image so that I can check it on my system?

      Delete
  22. I think file type is not a problem. I just take some random images on Internet with png, jpg, gif type and the result is always brighter than the original . I also try to import video by following your tut here http://opencvlover.blogspot.com/2012/05/importing-video-using-javacv.html and the same problem happens to output video. If you need a recorded video please tell me.

    ReplyDelete
    Replies
    1. oh I just found out the problem: gamma correction :)
      you can read it here: https://groups.google.com/forum/?fromgroups#!topic/javacv/ObGpzsumEL8
      thanks Nikhil!

      Delete
    2. Thanks for informing back. This sure is a helpful issue.

      Delete
  23. I am always getting this error
    Exception in thread "main" java.lang.NoClassDefFoundError: com/jogamp/opencl/CLObject
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
    at java.lang.Class.getMethod0(Class.java:2694)
    at java.lang.Class.getMethod(Class.java:1622)
    at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)
    Caused by: java.lang.ClassNotFoundException: com.jogamp.opencl.CLObject
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 6 more

    what to do?

    ReplyDelete
  24. #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    # EXCEPTION_ILLEGAL_INSTRUCTION (0xc000001d) at pc=0x623c7c4c, pid=3960, tid=3524
    #
    # JRE version: 7.0_07-b10
    # Java VM: Java HotSpot(TM) Client VM (23.3-b01 mixed mode, sharing windows-x86 )
    # Problematic frame:
    # C [opencv_objdetect243.dll+0x27c4c] cvSetImagesForHaarClassifierCascade+0x210c
    #
    # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
    #
    # An error report file with more information is saved as:
    # C:\Users\badboy\Desktop\eclipse projects\FACEDETECTION\hs_err_pid3960.log
    #
    # If you would like to submit a bug report, please visit:
    # http://bugreport.sun.com/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    #


    i'm getting this error plz help..

    ReplyDelete
    Replies
    1. Are you using 32bit processor or 64bit processor? what is bitness of JRE/JDK you are using?

      Delete
    2. both operating system (win 7) and java are 32bit

      Delete
    3. This comment has been removed by the author.

      Delete
  25. previously i used compaq 610(core 2 duo , win7 32bit) it worked fine , now i installed it in lenovo g580( i5 ,win7 32 bit) but getting this problem... plz help

    ReplyDelete
  26. Hi frendz I am new to this opencv and javacv while running a FaceDetection progam I am getting the following error, Even i made all the above steps correctly. But one thing i was not cleared about the version problem. I don't know wat bit (32 or 64) and version of opencv and javacv that i am using. I don't know how to find the bit and version that i am using. So plz give me a solution how to find opencv and javacv bit pattern and version that i am using.

    Give me the link to download the opencv and javacv both of same version and bit pattern (for both 32 and 64).

    I am using win7 64 bit, jdk 32 bit whether these should be also of same bit or some thing else.

    I am getting the following error,
    -------------------------------------------------------------------
    Starting OpenCV...
    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Angu\AppData\Local\Temp\jniopencv_core4630202936199523602.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1758)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1654)
    at java.lang.Runtime.load0(Runtime.java:770)
    at java.lang.System.load(System.java:1003)
    at com.googlecode.javacpp.Loader.load(Loader.java:332)
    at com.googlecode.javacpp.Loader.load(Loader.java:266)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:118)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:87)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:88)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at com.googlecode.javacv.cpp.opencv_objdetect.(opencv_objdetect.java:85)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:169)
    at com.googlecode.javacpp.Loader.load(Loader.java:286)
    at angu.FaceDetection.main(FaceDetection.java:50)
    ------------------------------------------------------

    ReplyDelete
  27. nikhil u owe me for this post yaraaaaaaaaaaaaaaaaaa <3

    ReplyDelete
  28. Anyone can post a program of JAVA which use OpenCV and JavaCV and perform AFFINE TRANSFORMATION for two images.

    ReplyDelete
  29. My Problem is:

    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Users\Elvin\AppData\Local\Temp\javacpp573515615490\jniopencv_core.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary1(Unknown Source)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:566)
    at com.googlecode.javacpp.Loader.load(Loader.java:489)
    at com.googlecode.javacpp.Loader.load(Loader.java:431)
    at com.googlecode.javacv.cpp.opencv_core.(opencv_core.java:136)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:453)
    at com.googlecode.javacv.cpp.opencv_imgproc.(opencv_imgproc.java:97)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.googlecode.javacpp.Loader.load(Loader.java:453)
    at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:85)
    at demo.main(demo.java:10)
    Caused by: java.lang.UnsatisfiedLinkError: no opencv_core245 in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:593)
    at com.googlecode.javacpp.Loader.load(Loader.java:481)
    ... 11 more

    Thanks in advance

    ReplyDelete
    Replies
    1. Hi Elvin, If you are still stuck with problem try this:
      This issue you are facing issue mostly arises due to following reasons.
      1. javacv and opencv version are not compatible. i.e. you should use opencv 2.4.0 for javacv 0.2
      Required opencv version can be found in readme file with javacv package.

      2. One should link 32 bit opencv libs with 32 bit javacv and 64 bit opencv libs with 64 bit javacv. You should have 64 bit process in order to use 64 bit libs.
      opencv comes with both 32 and 64 bit libs. You should link need libs are per explained in step 4 in above blog-post. You should worry about javacv if you are linking all the jar files provided by javacv package in step 6 in above blog-post.

      3. Set the 'path' correctly as suggested in setp 4 in above blog-post. Don't forget to restart your system before using it.

      If you still have this error then try to check if opencv is installed properly on your system.

      Read out comments on this post. There are many people who have faced similar issue like you.

      Delete
  30. i have a problem after install opencv and it runs correctly second time he appear this message for me
    a javae RUntime environment (jrt) or java Development Kit (jdk) Must be available in order to run eclipse. No java virtual machine was found after searching the following location :
    D:FCI\PROG\eclipse\jre\bin\javaw.exe
    java.exe in your current PATH

    ReplyDelete
    Replies
    1. Have you installed JDK on your system as per STEP 1 on this blog post?

      Delete
    2. yes i did , and i wanna you to help me to have a good tutorials for Android . and exactly in Camera Application because my Graduation Project will be Deliver in 26 this Month and i cant' found a solutions

      Delete
    3. after i changed the environment variables path eclipse didn't find the path of JDK how to solve it .. ?

      Delete
  31. I am taking this error.. I am new in this subject. I setup the javacv and I run this code which shown below and i take this error. What should i do ?
    Warning: Could not load class bin Test: java lang NoClassDefFoundError: bin / Test (wrong name: Test)
    Warning: No classes found in the unnamed package


    ReplyDelete
  32. The whole error is that i am taking:

    Warning: Could not load class bin.Test: java.lang.NoClassDefFoundError: bin/Test (wrong name: Test)
    Warning: No classes found in the unnamed package
    JavaCPP version 0.5

    Usage: java -jar javacpp.jar [ ] [class or package (suffixed with .* or .**)]

    ReplyDelete
  33. Огромное спасибо!! очень помогло!

    ReplyDelete
    Replies
    1. >>Огромное спасибо!! очень помогло!
      "thank you very much! very helpful!" - translate!

      thank you so much and from the Russian-speaking population!!! =)

      Delete
  34. hi...Im student from Informatics engineering nice article,
    thanks for sharing :)

    ReplyDelete
  35. Thanks for this effective article. It worked :D
    Can you please tell me that If I want to work with javacv for android in Eclipse what extra tasks should i need to do.
    I tried. But facing some problem :(

    canvas.showImage(image); //this line shows a problem and suggesstion shows to configure build path.

    Please help.

    ReplyDelete
  36. Hello,
    I installed the openCV 2.4.6 and then the javaCV. I am running the example code however i am getting the following issue!

    Exception in thread "main" java.lang.Error: Unresolved compilation problems:
    The method cvLoadImage(String) is undefined for the type demo
    Access restriction: The method setDefaultCloseOperation(int) from the type JFrame is not accessible due to restriction on required library C:\Users\user\Desktop\eclipse\jre\lib\rt.jar
    Access restriction: The type JFrame is not accessible due to restriction on required library C:\Users\user\Desktop\eclipse\jre\lib\rt.jar
    Access restriction: The field EXIT_ON_CLOSE from the type JFrame is not accessible due to restriction on required library C:\Users\user\Desktop\eclipse\jre\lib\rt.jar

    Please help me.

    ReplyDelete
  37. The method cvLoadImage(String) is undefined for the type demo
    CanvasFrame cannot be resolved to a type
    CanvasFrame cannot be resolved to a type

    at demo.main(demo.java:10)
    sir can u tell me why these error?

    ReplyDelete
  38. to : nikhil

    I performed all the steps very carefully, still having problem, reply soon,
    I am using windows xp, intel core processor, javacv0.2, opencv-2.4.6

    Its giving following error :

    Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Documents and Settings\Admin\Local Settings\Temp\javacpp1339844566278\jniopencv_core.dll: Can't find dependent libraries

    ReplyDelete
  39. Thank you very much :-)

    ReplyDelete
  40. to : nikhil

    hello, i am doing project on recognizing marathi(devnagari) text from image. how can i use javacv for this?? or which libraries can be used to detect marathi text from image.

    do reply,

    thankyou... :)

    ReplyDelete
  41. You can use JavaCV for text recognition. Opencv provides haar training and cascade training tools which you can use for training your images and then you can use your training data set for character recognition. Once you have trained data, you can use it something like face detection as I have explained in post http://opencvlover.blogspot.in/2012/11/face-detection-in-javacv-using-haar.html

    ReplyDelete
  42. hi.
    thanks because of your excellent post.
    i followed the steps and i runed the code without any problem. but when i want to run another code which i downloaded from gitHub, i get this exception:

    java.lang.UnsatisfiedLinkError: no jniavcodec in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
    at java.lang.Runtime.loadLibrary0(Runtime.java:845)
    at java.lang.System.loadLibrary(System.java:1084)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
    at com.googlecode.javacpp.Loader.load(Loader.java:586)
    at com.googlecode.javacpp.Loader.load(Loader.java:540)
    at com.googlecode.javacv.cpp.avcodec.(avcodec.java:39)
    at com.googlecode.javacv.FFmpegFrameGrabber.(FFmpegFrameGrabber.java:103)
    at edu.lipreading.vision.AbstractFeatureExtractor.getGrabber(AbstractFeatureExtractor.java:48)
    at edu.lipreading.vision.AbstractFeatureExtractor.extract(AbstractFeatureExtractor.java:34)
    at edu.lipreading.vision.GetFileTest.readFromUrlTest(GetFileTest.java:52)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
    Caused by: java.lang.UnsatisfiedLinkError: C:\Users\mgr\AppData\Local\Temp\javacpp4705494600370\jniavcodec.dll: Can't find dependent libraries
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1928)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1825)
    at java.lang.Runtime.load0(Runtime.java:792)
    at java.lang.System.load(System.java:1059)
    at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:700)
    ... 32 more

    ReplyDelete
    Replies
    1. This issue you are facing issue mostly arises due to following reasons.
      1. javacv and opencv version are not compatible. i.e. you should use opencv 2.4.8 for javacv 0.7
      Required opencv version can be found in readme file with javacv package.

      2. One should link 32 bit opencv libs with 32 bit javacv and 64 bit opencv libs with 64 bit javacv. You should have 64 bit process in order to use 64 bit libs.
      opencv comes with both 32 and 64 bit libs. You should link need libs are per explained in step 4 in above blog-post. You should worry about javacv if you are linking all the jar files provided by javacv package in step 6 in above blog-post.

      3. Set the 'path' correctly as suggested in setp 4 in above blog-post. Don't forget to restart your system before using it.

      If you still have this error then try to check if opencv is installed properly on your system.

      Read out comments on this post. There are many people who have faced similar issue like you.

      Delete
  43. Hi...I am facing the problem with Gray Level Co-occurance Matrix(GLCM). Please let me know is there in built function for GLCM in Opencv? How to refer docs or function library of Opencv?
    Please help me...

    ReplyDelete
    Replies
    1. I have not used GLCM personally but following link might help you.
      http://answers.opencv.org/questions/scope:all/sort:age-desc/tags:GLCM/page:1/

      Delete
  44. Nice post,All the contents you mentioned in post is too good and can be very useful.Thanks for sharing such informative post.
    How To Remove Rundll Error
    Thank you
    Aalia lyon

    ReplyDelete
  45. THANKS so much..this solved all my issues

    ReplyDelete
  46. java.lang.NoClassDefFoundError: com.googlecode.javacpp.Loader
    10-29 12:52:14.715: E/AndroidRuntime(5645): at com.googlecode.javacv.cpp.avcodec.(avcodec.java:39)

    Help me to reolve this

    ReplyDelete