Ask Your Question

danksch's profile - activity

2021-07-14 02:26:01 -0600 received badge  Popular Question (source)
2014-01-11 16:28:55 -0600 received badge  Editor (source)
2014-01-11 16:28:19 -0600 asked a question Android: Problem passing BGRA Mat to JNI function with C++ background

Hello,

I'm currently trying to develop an android app that utilizes my desktop webcam project I've written in C++; it is basic image processing stuff with an OOP approach. So far I've managed to launch the app onto my via USB connected HTC device (without selecting a modifier; just showing the plain frame), but as soon as I select a process mode in the Menubar the application closes (or more precisely, it closes the window, but I can reenter the application again.)

It seems like it cannot access the function I need from my C++ files, at least LOGCAT prints an error that implies this assumption:

01-11 23:15:53.097: E/cv::error()(22022): OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvNamedWindow, file /home/reports/ci/slave_desktop/50-SDK/opencv/modules/highgui/src/window.cpp, line 483

Theres another error immediately after the app launches:

01-11 23:15:45.630: E/OpenCV_for_Tegra(22022): Tegra Version detected: 0

I've also tried several ways to get the frame passed from java to jni, and as of now im using the getNativeObjAddr to pass a pointer to the rgba frame.

ProcessPlainFrame(mRgba.getNativeObjAddr(), mRgba.width(), mRgba.height(), mBw, mCart, mScary, mColhead);

I'm using booleans to determine which process type object shall be created. They're toggled in the onOptionsItemSelected method and then passed in the ProcessPlainFrame method, which is a native method defined in the JNI file:

JNIEXPORT void JNICALL Java_com_example_opencvandroidapp_MainActivity_ProcessPlainFrame(JNIEnv*, jobject, jlong rgba, jint width, jint height, jboolean bw_on, jboolean cart_on, jboolean scary_on, jboolean colhead_on){


Mat* pMatRgba = (Mat*)rgba;                         // create pointer to rgba mat that will function as input parameter
Mat plainFrame(height, width, CV_8UC3);             // create a an output Mat (processedFrame)


// call C++ code
if(bw_on){
    BlackWhiteSketch sketch;
    sketch.processFrame(*pMatRgba, plainFrame);
}
else if(cart_on){
    CartoonPainter cart;
    cart.processFrame(*pMatRgba, plainFrame);
}
else if(scary_on){
    ScaryFigure scary;
    scary.processFrame(*pMatRgba, plainFrame);
}
else if(colhead_on){
    ColorHead colhead;
    colhead.processFrame(*pMatRgba, plainFrame);
}

}

The processFrame() funtion does different things (it's virtual), depending on the class. You can take a look at them in my github repository:

Github Link

Sorry for the huge wall of text, but I'd greatly appreciate if anyone of you folks could take a look at it, I'm still a beginner in all of this and dont really know if my whole approach makes sense at all.

Regards

2013-12-30 15:11:43 -0600 commented question LNK2001 fatal error: unresolved external symbols - any ideas ?

oh god...this is so embarassing...i totally missed the forest for the trees right there...thanks a lot for the hint, works like a charm now.

2013-12-30 12:48:46 -0600 asked a question LNK2001 fatal error: unresolved external symbols - any ideas ?

Hello,

I am trying to solve this error for days now and I'm running out of ideas:

CameraEngine.obj : error LNK2001: unresolved external symbol ""public: virtual void __cdecl CameraEngine::showCameraFrame(class cv::Mat const &)" (?showCameraFrame@CameraEngine@@UEAAXAEBVMat@cv@@@Z)". 1>CameraEngine.obj : error LNK2001: unresolved external symbol ""public: virtual void __cdecl CameraEngine::processFrame(class cv::Mat const &,class cv::Mat &)" (?processFrame@CameraEngine@@UEAAXAEBVMat@cv@@AEAV23@@Z)". 1>CameraEngine.obj : error LNK2001: unresolved external symbol ""public: virtual void __cdecl CameraEngine::showProcessedFrame(class cv::Mat const &)" (?showProcessedFrame@CameraEngine@@UEAAXAEBVMat@cv@@@Z)". 1>C:\Users\Nic\documents\visual studio 2010\Projects\ImageSketcher\x64\Debug\ImageSketcher.exe : fatal error LNK1120: 3 unresolved external symbols.

I'm using opencv 2.4.6 with x64 libraries on a 64bit system with VS2010, also changed debugger from Win32 to x64. I've checked my PATH variable and all the other settings several times now and it's all just set as in the tutorial:

  • OPENCV_DIR: D:\opencv\build
  • PATH: %OPENCV_DIR%\x64\vc10\bin
  • C/C++ - General: $(OPENCV_DIR)\include
  • Linker - General: $(OPENCV_DIR)\x64\vc10\lib
  • Linker - Input:

opencv_core246d.lib;opencv_imgproc246d.lib;opencv_highgui246d.lib;opencv_ml246d.lib;opencv_video246d.lib;opencv_features2d246d.lib;opencv_calib3d246d.lib;opencv_objdetect246d.lib;opencv_contrib246d.lib;opencv_legacy246d.lib;opencv_flann246d.lib;

Everything else set for Release options respectively (without the "d" in the linked libs).

Last but not least my code sofar:

Project at Github

Thanks in advance!