Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code in netbeans #2

Open
oconnorhorrill opened this issue Aug 8, 2016 · 13 comments
Open

code in netbeans #2

oconnorhorrill opened this issue Aug 8, 2016 · 13 comments

Comments

@oconnorhorrill
Copy link
Owner

facerecognition

@sa94my
Copy link

sa94my commented May 11, 2017

i was hoping you could help me on this
this error appears as soon as the program runs ,and the camera doesn't open
java.lang.NullPointerException
at userrecognition.FXController.trainModel(FXController.java:263)
at userrecognition.FXController.init(FXController.java:115)
at userrecognition.Main.start(Main.java:49)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
at java.lang.Thread.run(Thread.java:745)

@oconnorhorrill
Copy link
Owner Author

That’s annoying.
Its late night here so I can’t try to replicate the issue. Are you trying the windows version or running this on Linux?
I’ve not seen this runtime error before. When you run the app, does the FX gui come up, and then it crashes when you start the camera?
If Windows, I presume you have openCV and the DLL correctly located.

@sa94my
Copy link

sa94my commented May 11, 2017

first of all i can't explain how grateful i'm for your quick response
and i'm trying the windows version,and both openCV and the DLL are correctly located
the gui comes up , it doesn't crash i mean it remains open but the error is displayed in the output window
and when i start the camera it shows even more errors related to the classifier like this

OpenCV Error: Assertion failed (!empty()) in cv::CascadeClassifier::detectMultiScale, file C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\objdetect\src\cascadedetect.cpp, line 1639
ERROR: CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win32-vc12-static\opencv\modules\objdetect\src\cascadedetect.cpp:1639: error: (-215) !empty() in function cv::CascadeClassifier::detectMultiScale
]

@sa94my
Copy link

sa94my commented May 11, 2017

if i may ask did you use jdk 8 developing this program ?
the first problem might be related to Init() method , and i tried searching about it but all i could understand is that due to changing syntax in jdk 8 it might give null output (pardon me for poor description i'm still a beginner)
all i could found about the second one is that the classifier doesn't exit where the code implies , my question is does the dependency of folders matter ? my configuration is (src,lib) src->(resources,userrecognition)

@oconnorhorrill
Copy link
Owner Author

Hi sa94my,
error indicates the issue is with openCV and not the java code. You’ll find even slightly different versions of openCV will cause issues. From what I see here I check you have the haar classifier in the right location and make sure you have set the OpenCV enviroment variable and add it to the systems path. There’s good docs here.

@sa94my
Copy link

sa94my commented May 12, 2017

Hi oconnorhorrill
i managed to solve the first error by installing jdk 64-bit instead of the 32-bit one i had ,
because the DLL you edited wasn't being used as the JVM ran the 32-bit one
-Djava.library.path="C:\opencv\build\java\x86" so i figured i needed to change my jdk version
and now i'm working on the second error which appears when i start the camera ,hope you can give me some guidelines

@oconnorhorrill
Copy link
Owner Author

Thanks for the feedback. It’s always like this when loading a github app onto a machine.

What kind of machine are you running this on. OpenCV should be able to detect your camera

@sa94my
Copy link

sa94my commented May 12, 2017

it did detect the camera
inside FXcontroller.java -> haarSelected method i changed the path in this.checkboxSelection to the absolute path on my pc and now the camera starts

conidering the output I've got to line 294 what should i do in this line ?

also ; it detects my face but says (prediction=unknown confidence=(random number))

@oconnorhorrill
Copy link
Owner Author

What does it say about line 294 in the log?

@sa94my
Copy link

sa94my commented May 12, 2017

it's in the output window you used a println statement in line 287
System.out.println("I've got to line 294");
likely this line BasicFaceRecognizer faceRecognizer = Face.createFisherFaceRecognizer(0,1500);

i know i asked too many questions but hopefully this will be the last one
faceRecognizer.save("traineddata"); where is this traineddata file ?? and if i'm supposed to create it what type of file should i create ?
and thank you very much for tolerating me

@oconnorhorrill
Copy link
Owner Author

Yes, I keep forgetting to delete the comment on line 287

No you don’t need to save the data with this app. If it is detecting your face but not recognising you take a look at what is in your resource folder, how many images of you are there and do you have any image different from you (something to compare with). What camera are you using? You will find openCV is hopelessly reliant on lighting conditions.

@sa94my
Copy link

sa94my commented May 23, 2017

i thank you so much for your collaboration ,the app is now working , all i had to do was to change paths of the folders in the code

@oconnorhorrill
Copy link
Owner Author

Pleased you got it going sa94my.
Any comments on how your implementation is performing re: face recognition?

Don’t forget to add a star if this was useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants