Code Monkey home page Code Monkey logo

Comments (13)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
This seems to be a problem with the Eclipse debugger... can you confirm that it 
runs
correctly *outside* Eclipse, from the command line? Thank you

Samuel

Original comment by [email protected] on 5 May 2010 at 12:50

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
[deleted comment]

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
I am brand new to Java, so I am not entirely sure how to compile it outside of 
an IDE. I tried "javac *" from the 
current directory, but it complained.

What I did instead was downloaded NetBeans and tried it from there. This time I 
got a different error about a 
missing library:

debug:
Have no FileObject for 
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/jsfd.jar
Have no FileObject for 
/System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Classes/sunrsasign.ja
r
Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load 
library 'cxcore': 
dlopen(libcxcore.dylib, 9): image not found
        at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:164)
        at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:237)
        at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:200)
        at name.audet.samuel.javacv.jna.Loader.load(Loader.java:44)
        at name.audet.samuel.javacv.jna.cxcore.<clinit>(cxcore.java:114)
        at name.audet.samuel.javacv.JavaCvErrorCallback.redirectError(JavaCvErrorCallback.java:95)
        at com.JohnJenkins.VideoFaceRecognition.FindFaces.FindFacesImage(FindFaces.java:32)
        at com.JohnJenkins.VideoFaceRecognition.VideoFaceServer.main(VideoFaceServer.java:16)
Java Result: 1
BUILD SUCCESSFUL (total time: 27 seconds)

I am now starting to believe that it is something I am missing and not your 
library, but I would appreciate any 
assistance you could give me. Where can I obtain a library with cxcore in it? 
Thank you.

Original comment by [email protected] on 5 May 2010 at 7:01

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
You said you could compile it fine under Eclipse, so compile it under Eclipse, 
close
Eclipse, open a command line (aka terminal, console, whatever name Mac OS X 
uses),
and run Java from there

The error from NetBeans indicates that you did not install JNA 3.2.4 or more 
recent,
or OpenCV 1.0, 1.1pre1, 2.0 or 2.1. You need to install JNA 3.2.4 or more 
recent as
well as OpenCV 1.0, 1.1pre1, 2.0 or 2.1. All the URLs, sites, explanations and
everything is all in the README.txt file. Please take the time to reread it 
once more.

Samuel

Original comment by [email protected] on 6 May 2010 at 3:12

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
What I had originally done was install the OpenCV Framework as well as import 
an OpenCV.jar file, but neither of 
these were adequate. I have now installed OpenCV from source, and it appears to 
work until it loads the cascade 
file. It will crash giving different errors depending on if I am using Eclipse 
or NetBeans, but I believe they are 
both representing the same problem. Here is the relevant code:

        final String CASCADE_PATH = 
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.or
g_release_ports_graphics_o
pencv/work/OpenCV-2.0.0/data/haarcascades/";

    String cascadeName = CASCADE_PATH + "haarcascade_frontalface_alt.xml";
        CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(cvLoad(cascadeName));

The cascade XML files are world readable, so that shouldn't be an issue. I have 
also tried different files, 
"haarcascade_frontalface_alt2.xml" for example, and they give the same error.


The error from Eclipse is:

OpenCV Error: Unspecified error (The node does not represent a user object 
(unknown type?))
in function cvRead, 
/Users/Phoenix/Downloads/OpenCV-2.1.0/src/cxcore/cxpersistence.cpp(4720)
java.lang.Exception: Stack trace
    at java.lang.Thread.dumpStack(Thread.java:1230)
    at name.audet.samuel.javacv.JavaCvErrorCallback.callback(JavaCvErrorCallback.java:67)
    at name.audet.samuel.javacv.jna.cxcore.cvLoad(Native Method)
    at name.audet.samuel.javacv.jna.cxcore.cvLoad(cxcore.java:3973)
    at com.JohnJenkins.VideoFaceRecognition.FindFaces.FindFacesImage(FindFaces.java:67)
    at com.JohnJenkins.VideoFaceRecognition.VideoFaceServer.main(VideoFaceServer.java:16)
terminate called after throwing an instance of 'cv::Exception'
  what():  /Users/Phoenix/Downloads/OpenCV-2.1.0/src/cxcore/cxpersistence.cpp:4720: error: (-2) The node 
does not represent a user object (unknown type?) in function cvRead


The error in NetBeans is correctly caught by my try-catch expression. It gives 
an exception type of 
"UncompilableSourceCode". This leads me to believe that the XML files are 
potentially corrupt or that I am 
supposed to be getting them from somewhere else. I looked at the files 
themselves, and they appear to be fine. 
Should I not be using the ones that come with the installation of OpenCV?


Thank you for your help.

Original comment by [email protected] on 7 May 2010 at 6:01

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
That problem is not related to JavaCV... the "solution" is well documented on
OpenCV's wiki:
http://opencv.willowgarage.com/wiki/FaceDetection

Marking this issue as "done" as everything appears to be working as expected 
now...?

Original comment by [email protected] on 8 May 2010 at 12:38

  • Changed state: Done

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Well, I openly admit my ignorance to OpenCV, but this code seems 
straightforward and is almost directly taken from your example.


package com.JohnJenkins.VideoFaceRecognition;

import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import javax.imageio.ImageIO;

import name.audet.samuel.javacv.*;
import static name.audet.samuel.javacv.jna.cxcore.*;
import static name.audet.samuel.javacv.jna.cv.*;


public class FindFaces
{
        private static final String CASCADE_PATH = 
"/opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.or
g_release_ports_graphics_opencv/work/OpenCV-
2.0.0/data/haarcascades/";

    public static FaceInfoArray FindFacesImage(Images images)
    {
        int i = 0;

                new JavaCvErrorCallback().redirectError();

                String cascadeName = CASCADE_PATH + "haarcascade_frontalface_default.xml";
                CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(cvLoad(cascadeName)); // Throws error.



That is all the code it gets through before it throws the "Uncompilable Source 
Code" exception. This is taken almost directly from your 
example and is roughly equivalent to the example in the link you posted, so I 
don't see how this could be a problem with OpenCV, as 
opposed to JavaCV. 

I looked into it a little further and took out the cvLoad(cascadeName) from the 
CvHaarClassifierCascade() and created a local variable as 
such,

Pointer test = cvLoad(cascadeName);

which crashed with the same error.

Finally, I created a C++ program by copying the code that you linked to using 
the "haarcascade_frontalface_default.xml" file, and it worked 
just fine. This, to me, appears to localize the problem to JavaCV.

Original comment by [email protected] on 8 May 2010 at 2:08

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
"Almost" is not "exactly the same". Copy/paste the Test2 class from
http://code.google.com/p/javacv/, *do not modify it*, and it will run.

Samuel

Original comment by [email protected] on 8 May 2010 at 2:12

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Hi samuel,  
I want to suggest you to add the path "/opt/local/lib" in the cxcore class for 
those who installed opencv via 
Macports (that's the default installation directory) to avoid the first error 
discussed in this thread.
ps. thanks for the great work!

Original comment by [email protected] on 27 May 2010 at 12:38

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Ah, that's good to know.. thanks for letting me know, will do!

Original comment by [email protected] on 27 May 2010 at 12:40

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Hi Samuel,
I was wondering if you have now included the default path for OpenCV when using 
Macports? Otherwise, any workaround so that I can use it on my Mac?

Thanks!

Original comment by [email protected] on 25 Jan 2011 at 1:41

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
It should work yes, let me know if it does not

Original comment by [email protected] on 26 Jan 2011 at 4:26

from javacv.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 16, 2024
Hi,

For OpenCV Error: Unspecified error (The node does not represent a user object 
(unknown type?)) in function cvRead

Try to check your xml file. 
<opencv_storage>
<cascade type_id="opencv-haar-classifier">

If you did training and have your own cascade.xml file. Then add the above 
type_id in file. This error will be resolved.

Note: Old format of Xml file is required. so during opencv_traincascade add 
-baseFormatSave.

Thanks,
Lakshmiprabha

Original comment by [email protected] on 13 Dec 2012 at 10:20

from javacv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.