Ask Your Question

Jose Gómez's profile - activity

2015-07-21 00:28:12 -0500 asked a question OpenCV Manager 3

I just tried the Face Detection sample app, and when it tries to download the libraries I have observed 2 issues:

  • The download dialog is forced to landscape. I was holding my phone in portrait, no need to force the user to rotate their phone.
  • Clicking on install I get an error "Package installation failed!"
2013-12-15 09:50:38 -0500 commented question Native libraries

Thanks for the link, but I am referring to the part in the Clojure tutorial where it specifies how to pack the native libraries inside the jar, but doesn't specify a way of loading those. As far as I know, Java cannot load native libraries from within a jar.

2013-12-14 19:01:42 -0500 asked a question Native libraries

The Clojure tutorial ( specifies how to pack the native libraries, using a specific folder structure.

However, I haven't found in the tutorial where and what is this used for, if at all. Only the main library is loaded:

(clojure.lang.RT/loadLibrary org.opencv.core.Core/NATIVE_LIBRARY_NAME)

What about the native ones? How are they extracted from the jar? In Java, you have to do it manually to the temp folder.

2013-11-28 03:41:58 -0500 received badge  Self-Learner (source)
2013-11-27 21:06:03 -0500 answered a question Modifying pixels efficiently in Java

As of OpenCV 2.4.7, it is not possible to create a ByteBuffer that points to the data of a Mat.

I have created a feature request ( for this functionality.

2013-11-27 21:03:41 -0500 commented answer make Mat from buffer byte

Just created a feature request ( and attached the result of my tests.

2013-11-19 18:07:12 -0500 received badge  Editor (source)
2013-11-19 18:06:21 -0500 answered a question I can not run the Java using Opencv on Linux, 64bit

You can easily compile OpenCV yourself, and get 64-bit libraries. I just did that with 2.4.7:


(update to suit your needs)

And then:

make -j4

2013-11-13 17:37:52 -0500 commented answer make Mat from buffer byte

In JavaCV's OpenCV wrapper, the IplImage has a "getDirectByteBuffer" native method that will from JNI create a new ByteBuffer with the address of the data of the Mat. In my tests modifying pixels like that performs much better than copying byte arrays to and from the Mat.

2013-11-13 17:22:08 -0500 received badge  Organizer (source)
2013-11-13 13:34:25 -0500 commented question Using get() and put() to access pixel values in JAVA

When ROIs are used (Mat.submat()), the resulting Mat is not continuous. This means when we use ROIs, we would not be able to read the image in one call, but we would have to do one get per row.

Update: Actually, it does work with ROIs (submat). Mat.get must be doing some magic inside, in order to retrieve only the relevant pixels.

2013-11-13 13:03:56 -0500 answered a question Mat to matOfByte conversion in java

This code compresses an image (Mat) to jpg, and returns that as a byte array.

The byteArray will be 300 x 400 x number of channels.

Or you can just use byteArray.length in order to find out.

2013-11-10 21:28:41 -0500 answered a question Opencv java - Load image to GUI

What about the solution in ? That seems simpler and faster.

2013-11-10 21:26:33 -0500 answered a question How can we use opencv library to load two images and show it with java ?
2013-11-10 19:49:13 -0500 answered a question VideoWriter filename doesn't accept certain charactars

Depending on the OS that you are using (for example, Windows), ":" may not be a valid character for file names.

Your safest bet is to replace all the ":" in the file name with something else, such as "_".

2013-11-10 11:25:03 -0500 answered a question Does OpenCV currently supply full APIs for Java?

VideoCapture supports now capturing from video file in Java (

As per SetImageROI, that corresponds to the C interface. As per my understanding, only the C++ interface is exported to Java.

2013-11-09 12:13:37 -0500 commented answer imshow equivalence in Java

Is it required to compress the image to jpg for uploading it into the component? Couldn't we just use Mat.get and copy the uncompressed byte array?

2013-11-09 11:13:59 -0500 asked a question Modifying pixels efficiently in Java

There are a series of topics covering how to efficiently modify pixels in Java:

These threads suggest copying the Mat image to a temporary array (byte[]), working with the array, and copying back the array to the image. But that has the additional cost of copying the image twice (img to array, array to img). That can impact the performance if a lot of processing steps are required, especially if we need to mix OpenCV functions and custom processing.

In the JavaCV wrapper, there is the possibility of accessing directly the image pixels using java.nio.ByteBuffers:!searchin/javacv/bytebuffer$20pixel/javacv/14EPaKP__cM/oDqDs2Hte_kJ

Would it be possible in OpenCV to create a ByteBuffer that points to the data of the image? I was considering something like this

    ByteBuffer mybb = ByteBuffer.wrap(new MatOfByte(myMat).toArray());

but I am afraid MatOfByte.toArray() will create a copy of the image anyway, instead of returning the original data.

ByteBuffer requires a byte[] for its constructor, so Mat.dataAddr() does not work.

2013-11-09 09:12:26 -0500 commented answer Memory management using C++ interface

On response to this follow-up question, I guess the response is no. I.e. the documentation of the method Mat.t() states: "...returns a temporary matrix transposition object...". So, watch out with those functions that create temporary objects...

2013-11-05 17:00:28 -0500 commented answer Memory management using C++ interface

Very interesting, thanks for the information.

Does the same apply when the Mat is not passed as a parameter, but returned in a function? I.e.:

Mat src; cap >> src;

Mat src_2 = src.mul(src);


Mat t1 = src1 + src2 + 2;

2013-11-05 16:50:23 -0500 received badge  Scholar (source)
2013-11-04 19:20:43 -0500 asked a question Memory management using C++ interface

Using the Old C interface I can create static IplImages during initialisation, and just reuse the surfaces across all the executions of my code.

However, the (much nicer) C++ interface doesn't provide this capability. You execute an operation, and you get a different surface as the output.

Is this optimised internally in order to reuse surfaces and this way avoid requiring much more memory, plus allocating and freeing memory per execution of the logic?

2013-07-05 18:14:46 -0500 commented answer Blink detection

Your comment seems interesting. I thought there was no way of getting Hough to be stable, especially with low resolution. Could you point to more detail on this technique? By k-mean, are you referring to the clustering function in ?

2013-07-02 22:45:32 -0500 commented answer Tagged eye tracking videos

Hi, thanks for the suggestion. I am familiar with the BioID database, as it is used in most of the research articles related to eye/gaze tracking. However, this database consists of standalone images (there are groups of images, but not in a specific sequence). So, it is not possible to test temporal optimizations (taking into account the positions in the previous frames).

2013-07-02 04:47:06 -0500 received badge  Student (source)
2013-07-01 19:03:43 -0500 answered a question JAVACV on Desktop

JavaCV is not the same as the Java port of OpenCV.

I think the book you are referring to uses JavaCV, whereas the documentation you are checking is for OpenCV.

2013-07-01 19:01:50 -0500 asked a question Tagged eye tracking videos


I am trying to develop a (to be open sourced) system that will do pupil detection. There are a huge number of datasets containing tagged images. I have also seen a couple of datasets containing videos, tagged with the position of the head, etc, like the Boston and HPEG datasets.

However, I would like to know if there is any dataset available with videos tagged with the position of the pupil.


2012-12-15 12:21:15 -0500 commented question Wrapping OpenCV with desktop Java: Building for 64-bit x86

Very much looking forward to this, thanks a lot for your work! I am a bit unconfortable with the current status of JavaCV being a separate project than OpenCV, with manually-created interfaces.

Do you have plans to create a tutorial in order to enable this experimental support? It would also be good to know what the OpenCV devs think about this port, apart from giving it low priority. I am about to start a new project in Java, and I am not sure which way to go: the experimental but integrated (maybe more future-looking), or the separate but manual (safer for now, but maybe worse for the long term).

2012-12-15 12:07:08 -0500 received badge  Supporter (source)