JavaCV:( - 2)文件无法打开写入!在函数cv :: FaceRecognizer :: load中

时间:2015-03-19 03:53:52

标签: rest opencv tomcat javacv

我构建了webservice,它具有方法面部识别功能。 Webservice reslful框架,tomcat服务器,人脸识别使用javacv。它有问题:

OpenCV错误:未指定错误(无法打开文件进行编写!)在cv :: FaceRecognizer :: load,file ........ \ opencv \ modules \ contrib \ src \ facerec.cpp中,第398行 19-Mar-2015 10:21:48.340 SEVERE [http-nio-8084-exec-13] com.service.Searcher.FaceRecognitionService.findInfomation null  java.lang.RuntimeException:........ \ opencv \ modules \ contrib \ src \ facerec.cpp:398:错误:( - 2)无法打开文件进行写入!在函数cv :: FaceRecognizer :: load

at org.bytedeco.javacpp.opencv_contrib$FaceRecognizer.load(Native Method)
at com.samsung.facerecognition.FaceRecognition.test(FaceRecognition.java:103)
at com.service.Searcher.FaceRecognitionService.findInfomation(FaceRecognitionService.java:84)
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:606)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:195)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:323)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:372)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:335)
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:218)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:301)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:136)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:74)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:516)

代码java:

int[] predictedLabel = {-1};
    double[] confidence = {0.0};
    FaceRecognizer model = null;
    switch (param) {
        case CV_FISHER:
            model = createFisherFaceRecognizer();
            model.load(CV_FISHER + ".model");
            break;
        case CV_EIGEN:
            model = createEigenFaceRecognizer();
            model.load(CV_EIGEN + ".model");
            break;
        case CV_LBPH:
            model = createLBPHFaceRecognizer();
            model.load(CV_LBPH + ".model");
            break;
        default:
            break;
    }
    Mat testImage = imread(image, CV_LOAD_IMAGE_GRAYSCALE);
    resize(testImage, testImage, new Size(92, 112));
    model.predict(testImage, predictedLabel, confidence);
    System.out.println(predictedLabel[0] + " " + confidence[0]);
    return predictedLabel[0];

请帮我修理一下。 谢谢你

0 个答案:

没有答案