Ask Your Question

darKoram's profile - activity

2018-05-18 05:35:59 -0600 received badge  Notable Question (source)
2016-01-18 04:30:18 -0600 received badge  Popular Question (source)
2012-08-11 12:53:41 -0600 commented answer Can't checkout from SVN repository, version 2.4.2

I found the test suite that I want at https://github.com/Itseez/opencv/tree/master/modules/java/android_test However, when i try to git clone it, i get fatal: https://github.com/Itseez/opencv/tree/master/modules/calib3d/tests/info/refs not found: did you run git update-server-info on the server?

I also tried git clone https://github.com/Itseez/opencv/tree/master/modules/calib3d/perf and got the same error.

2012-08-11 12:36:36 -0600 commented answer Can't checkout from SVN repository, version 2.4.2

truncate the above link to https://github.com/Itseez/opencv.git/ to be able to browse the repo and select what you want. Link above gives 404 onClick.

2012-08-11 00:23:51 -0600 asked a question could not connect to server (https://code.opencv.org)

I'm trying to download the android test tools following http://code.opencv.org/projects/opencv/wiki/QA_in_OpenCV

When i try the following svn co http://code.opencv.org/svn/opencv/trunk/opencv_extra/testdata
svn co https://code.opencv.org/svn/opencv/trunk/opencv/moduies/java/android_test

I get svn: Could not open the requested SVN filesystem
and could not connect to server (https://code.opencv.org)

any tips?

2012-08-06 09:22:24 -0600 asked a question android: how to put a column into Mat

According to the best practices page we want to use the fewest calls to the JNI as possible to get the job done.

In my application, I want to add a column of data (held in a List<double> or double[] to a Mat column. Rather than doing this

public void putColumn(int colIndex, List<Double> colData, MatOfDouble mat) {
    for( int i=0; i<colData.size(); i++) {
         mat.put(i, colIndex, colData[i]);
    }

I'd prefer to do something like this:

mat.putColumn(List<Double> colData);

Thus reducing the number of JNI calls from colData.size() to 1 call. Is there such a function in the Android API that does this, or do I have to build one with the JNI?

MatOfDouble has nice calls for exporting Mat data to java:
List<Double> mat.toList()
double[] mat.toArray()
but the fromArray(double...a) only seems to be for the constructor.

By the way, why the difference in declarations for float and double versions of put in MatOfDouble?

   public int put(int row, int col, double... data)

   public int put(int row, int col, float[] data)

I'm a c++ programmer and "double...a" is not something i'm familiar with. What does it mean?

2012-08-04 17:02:49 -0600 answered a question copying a portion of a matrix to itself

It should be possible to create two submatrices within the parent matrix. submatrix Window0 could stay fixed at the start of the Parent matrix. Window1 could me the moving window. When Window1 bumps into the end of the Parent matrix, copy its contents into window0.

Window1.copyTo(Window0);

This should do the trick, since the dimensions and type match, create() should just copy headers.

2012-08-04 15:00:09 -0600 commented question copying a portion of a matrix to itself

"JNI calls are really expensive and should be minimzed" http://opencv.org/platforms/android/android-best-practices.html so that's extra incentive to find a call from the native library that works for my case.

Looking at the source code for Mat::copyTo in copy.cpp and Mat::create in matrix.cpp it appears that create() only allocates memory if the dimensions or type don't match. So trying to call M.copyTo(submatrixOfM) would cause a problem because create() would see dimension mismatch and try to allocate data within an already alocated space, or allocate the new data outside of the parent matrix (not sure which).

2012-08-03 21:19:57 -0600 asked a question copying a portion of a matrix to itself

Hi, I'm working on an application that does some DSP for streaming data. OpenCV Mat seems like a pretty elegant solution for implementing a circular buffer inside a parent array. The moving window array will increment forward with each new dataRecord input as a column. When the front of the window (leading direction of motion) reaches the end of the parent matrix, I need to deep copy the window data to the start of the parent matrix. copyTo() looks good: http://docs.opencv.org/2.4/modules/core/doc/basic_structures.html#mat-copyto

The method copies the matrix data to another matrix. Before copying the data, the method invokes

m.create(this->size(), this->type);

so that the destination matrix is reallocated if needed. While m.copyTo(m); works flawlessly, the function does not handle the case of a partial overlap between the source and the destination matrices.

I'd like to use copyTo

public void wrapWindowToStart() {
            mWindowData.copyTo(mParentMatrix);
            //... extra code
        }

but based on the comments above i'm not sure if that will work. Does create() decide reallocation isn't needed and everything just works fine? For now, I'm doing something like this:

for (int i=mWindowBack; i<mWindowFront; i++) {
    for (int j=0; j<mRecordLength;j++) {
        mGpuDataBuffer.put(i-mQueueLength+mWindowLength, j, mGpuDataBuffer.get(i, j))
    }
}
2012-08-03 21:01:01 -0600 commented answer build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04

OpenCV 2.4.2 worked great. The OpenCV Library Manager for android is fantastic. Linking libs is a real weak spot on android development and with the new manager everything was so smooth.

2012-07-17 18:58:11 -0600 received badge  Supporter (source)
2012-07-12 10:55:38 -0600 received badge  Taxonomist
2012-07-07 11:02:31 -0600 answered a question build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04

Fixes: 1. Eclipse seems to have an easy tool for selecting JRE within a workspace without changing system settings (via update-alternatives). Right-click project -> Build Path -> Configure Build Path -> click Libraries Tab -> Add Library -> JRE -> Search. You can then browse to the top level install location of your Sun JDK distro and Eclipse will find the files it needs. 2. The OpenCV-2.4.0 package shows no errors or warnings in Eclipse

Problems: 1. All sample projects except OpenCV-2.4.0 (library) have errors due to import org.opencv.<package>
This is despite explicitly including the library in the project.properties, AndroidManifest.xml and listing it as a referenced package. http://www.pasteall.org/pic/show.php?id=34473

The following shows some of the paths I've tried in my 15-puzzle/project.properties file

# Project target.
target=android-11

sdk.dir=/home/kesten/android-sdk-linux
# This project.properties file lives in OpenCV-2.4.0/samples/android/15-puzzle
# relative path to folder with OpenCV-2.4.0.jar file
# android.library.reference.1=../../../modules/java/android
# relative path to folder with OpenCV-2.4.0 project.properties file
# android.library.reference.1=../../../
#android.library.reference.1=/home/kesten/Android-OpenCV-2.4.1/OpenCV-2.4.0/modules/java/android/

I'm not sure if android can handle absolute paths to resources, but neither relative nor abs worked for me.

2012-07-06 02:00:06 -0600 received badge  Famous Question (source)
2012-07-05 19:16:04 -0600 answered a question build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04

I was able to install the jdk from oracle.com .
http://www.oracle.com/technetwork/java/javase/install-linux-64-self-extracting-142068.html Select your flavour of distro. Mine: jdk-6u33-linux-x64.bin

It's possible that my problems installing before were from choosing an "RPM" type package. Instructions on another page indicate that Ubuntu prefers the auto-installer to rpms.

I followed the steps you gave. However, I have some concerns over using update-alternatives as it caused numerous problems in the past. (Changed phython to 3.2 for a project, but it broke nearly everything else in my distro).

It wasn't obvious in Eclipse where to locate the JRE. Selecting File->Build Path->Configure Build Path -> Select libraries tab -> Add Library -> System JRE Library -> Add [ I tried searching all through the /opt/java/64 hierarchy but Eclipse never recognized what it wanted. Finally, clicking on "Search" button instead of "Add" and Eclipse found it automatically.
http://www.pasteall.org/pic/show.php?id=34395

This didn't clear up my issues in Eclipse however. I tried File->Refresh and Project->Clean. Nope. I tried re-starting Eclipse... but it no longer starts:

[Popup dialog] An error has occurred. See the log file /home/kesten/.eclipse/org.eclipse.platform3.7.0155965261/configuration/1341530909313.log.

[log file] !ENTRY org.eclipse.osgi 4 0 2012-07-05 18:28:30.390 !MESSAGE Application error !STACK 1 java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: no swt-gtk-3740 in java.library.path no swt-gtk in java.library.path Can't load library: /home/kesten/.swt/lib/linux/x8664/libswt-gtk-3740.so Can't load library: /home/kesten/.swt/lib/linux/x8664/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)

libswt-gtk is installed, but it's in my java.library.path for openJDK, not the sun version.

I think I'd prefer a less "invasive" method that switches just the jdk/jre used for the project, rather than switching the whole system which may have unintended consequences. Will play with this idea.

BTW... I did get the commandline "$ ant debug" build working. Reading build.xml is very helpful. Was also able to fix the samples/android/fix_properties.sh script to work on my system. Will describe this in another post.

2012-07-05 12:20:09 -0600 received badge  Scholar (source)
2012-07-05 09:27:41 -0600 received badge  Notable Question (source)
2012-07-05 03:13:32 -0600 received badge  Popular Question (source)
2012-07-04 04:23:26 -0600 received badge  Student (source)
2012-07-03 23:13:14 -0600 received badge  Editor (source)
2012-07-03 15:25:16 -0600 asked a question build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04

Following the tutorial at: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/android_binary_package.html

*edit* new tutorial is OpenCV 2.4.2 for Android and the updated tutorial in answer below. As per recommendation, a summary of the problems*

Summary of problems building android_binary_package with Eclipse on Ubuntu

  1. Errors following the steps for JDK installation
  2. Errors attempting to build from commandline with Ant and build.xml.
  3. project.properties errors for all sample projects. There is a script in /samples/android/fix_properties.sh . It seems it is missing a #!/bin/bash and, for me, errors of Command not found android: occur. I needed to give a full path to the android executable in adnroid-sdk-linux/tools/ . I just discovered the script, it's not mentioned in the tutorial.
  4. Not sure how to link OpenCV-2.4.0 Library into Eclipse. Which folder should i reference? One containing .jar or AndroidManifest.xml?

[my comments in []s ]

1 Sun JDK 6 [First of all, I'm surprised if only the Sun JDK works that it isn't mentioned in https://developer.android.com/tools/sdk/eclipse-adt.html]

Dependencies: Java 1.6 or higher is required for ADT 20.0.0.

[In fact, i have been using Eclipse Indigo to develop android for a few projects and output from errors in the console say I'm running ]

java.version=1.6.0_24 java.vendor=Sun Microsystems Inc.

but in a terminal shell $ java -version gives

java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

[Following the instructions, i run into problems.]

Visit http://www.oracle.com/technetwork/java/javase/downloads/index.html and download installer for your OS.

[requires a long login, must sudo chmod +x the downloaded file, i get errors when i run the file of dependencies not found like /bin/sh but of course they are there. Exits with Done, but i don't know if it was successful or where it unpacked the files to. No easy checkpoint. Command-line output follows]

rpm: RPM should not be used directly install RPM packages, use Alien instead!
rpm: However assuming you know what you are doing...
many errors ending with...
error: Failed dependencies:
    /bin/sh is needed by sun-javadb-core-10.6.2-1.1.i386
Done.

[Continuing on with the tutorial]

Here is a detailed installation guide for Ubuntu and Mac OS: http://source.android.com/source/initializing.html#installing-the-jdk (only JDK sections are applicable for OpenCV)

[following their instructions I get problems]

$ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
$ sudo apt-get update
$ sudo apt-get install sun-java6-jdk

Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

E: Package 'sun-java6-jdk' has no installation candidate

Note OpenJDK is not usable for Android development because Android SDK supports only Sun JDK. If you use Ubuntu, after installation of Sun JDK you should ... (more)