Ask Your Question

1'''s profile - activity

2016-06-02 14:56:13 -0500 received badge  Notable Question (source)
2015-01-27 02:25:19 -0500 received badge  Popular Question (source)
2013-08-08 18:34:44 -0500 asked a question Using getThreshVal_Otsu_8u in OpenCV4Android

Is there any way to get the optimal threshold value for an image, as found with getThreshVal_Otsu_8u(), from OpenCV4Android? If not, could this be included in a future release?

2013-07-07 17:58:05 -0500 asked a question Froyo-exclusive XML exception loading SVM dataset

I use the following code to load an SVM dataset stored at res/raw/dataset.xml: it copies the dataset from the APK to a particular folder on the file system once, and then loads it from there every subsequent time. As far as I know, there's no way to directly load a file from inside the APK.

File datasetDirectory = ((Activity) getContext()).getApplication().getDir("dataset", Context.MODE_PRIVATE);
File datasetFile = new File(datasetDirectory, "dataset.xml");
if (!datasetFile.exists()) { 
    try {
        InputStream is = getResources().openRawResource(R.raw.dataset);
        FileOutputStream os = new FileOutputStream(datasetFile);
        byte[] buffer = new byte[4096];
        int bytesRead;
        while ((bytesRead = != -1) os.write(buffer, 0, bytesRead);
    } catch (IOException e) {

This code has worked on all devices, except for my only Froyo (API level 8) beta tester, who receives an error in svm.load(). Unfortunately, because I don't have access to the phone, I can't see whether the file was accurately copied.

E/AndroidRuntime(1630): CvException [org.opencv.core.CvException: ....\modules\core\src\persistence.cpp:2257: error: (-212) /data/data/com.myapp/app_dataset/dataset.xml(0): Valid XML should start with '<?xml ...?>' in function void icvXMLParse(CvFileStorage*)

What is the cause of this error? Is there another way to load the dataset that avoids this error?

2013-06-21 07:43:01 -0500 commented answer Disable CPU parallelization

Thanks very much!

2013-06-21 00:00:05 -0500 received badge  Student (source)
2013-06-20 19:26:24 -0500 received badge  Editor (source)
2013-06-20 19:25:52 -0500 asked a question Disable CPU parallelization

How can I benchmark OpenCV on Windows (Visual Studio) with CPU parallelization disabled? Is this possible without rebuilding the libraries? Should I insert an #undef HAVE_PARALLEL_FRAMEWORK somewhere? I haven't noticed a CMake option to disable compilation with the Parallel Patterns Library, among other parallel frameworks.

2013-06-19 15:59:22 -0500 commented answer Building OpenCV for GPU with CMake - cannot open file

Now I'm getting a whole bunch of sub-builds failing with fatal error C1033: cannot open program database '[OpenCV path]\bin\debug\opencv_[library name]249d.pdb' and error LNK2019: unresolved external symbol "public: static struct CUstream_st * __cdecl cv::gpu::StreamAccessor::getStream(class cv::gpu::Stream const &amp;)".

2013-06-19 13:18:53 -0500 commented answer Building OpenCV for GPU with CMake - cannot open file

Thanks, and thanks for the tip regarding the master branch also!

2013-06-19 13:18:26 -0500 received badge  Supporter (source)
2013-06-19 13:18:26 -0500 received badge  Scholar (source)
2013-06-18 12:32:25 -0500 asked a question Building OpenCV for GPU with CMake - cannot open file

I'm building OpenCV for CUDA 5.0 with CMake and Visual Studio 2010 based on this tutorial and many of the sub-builds are failing with the error

30>LINK : fatal error LNK1104: cannot open file '..\..\lib\Debug\opencv_gpuarithm249d.lib'

How can I debug or fix this error?

2012-08-13 12:59:32 -0500 asked a question OpenCV for Android

I created a new Android application with an activity called Start. I then went to project properties and added OpenCV as a library. Here's the code for the activity (

package com.test;

import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;

import android.os.Bundle;
import android.view.Menu;

public class Start extends Activity {

    public void onCreate(Bundle savedInstanceState) {

        Mat Image = Highgui.imread("/image.jpg");
        if (Image == null) {
            AlertDialog ad = new AlertDialog.Builder(this).create(); 
            ad.setMessage("Fatal error: can't open /image.jpg!");  

    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(, menu);
        return true;

And here's the log:

08-13 12:26:14.791: E/Trace(1067): error opening trace file: No such file or directory (2)
08-13 12:26:15.191: W/dalvikvm(1067): No implementation found for native Lorg/opencv/highgui/Highgui;.imread_1:(Ljava/lang/String;)J
08-13 12:26:15.191: D/AndroidRuntime(1067): Shutting down VM
08-13 12:26:15.191: W/dalvikvm(1067): threadid=1: thread exiting with uncaught exception (group=0x40a13300)
08-13 12:26:15.201: E/AndroidRuntime(1067): FATAL EXCEPTION: main
08-13 12:26:15.201: E/AndroidRuntime(1067): java.lang.UnsatisfiedLinkError: Native method not found: org.opencv.highgui.Highgui.imread_1:(Ljava/lang/String;)J
08-13 12:26:15.201: E/AndroidRuntime(1067):     at org.opencv.highgui.Highgui.imread_1(Native Method)
08-13 12:26:15.201: E/AndroidRuntime(1067):     at org.opencv.highgui.Highgui.imread(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at com.test.Start.onCreate(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at
08-13 12:26:15.201: E/AndroidRuntime(1067):     at
08-13 12:26:15.201: E/AndroidRuntime(1067):     at
08-13 12:26:15.201: E/AndroidRuntime(1067):     at
08-13 12:26:15.201: E/AndroidRuntime(1067):     at$600(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at$H.handleMessage(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at android.os.Handler.dispatchMessage(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at android.os.Looper.loop(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at
08-13 12:26:15.201: E/AndroidRuntime(1067):     at java.lang.reflect.Method.invokeNative(Native Method)
08-13 12:26:15.201: E/AndroidRuntime(1067):     at java.lang.reflect.Method.invoke(
08-13 12:26:15.201: E/AndroidRuntime(1067):     at$
08-13 12:26:15.201: E/AndroidRuntime(1067):     at
08-13 12:26:15.201: E/AndroidRuntime(1067):     at ...