programming

Install OpenCV 3 non-free module on Ubuntu

The opencv_nonfree module provides very useful features such as two prominent image features SIFT and SURF (including the CUDA’s implementation). In this tutorial, I demonstrate how to install this module into OpenCV 3 on Ubuntu. Prerequisites Remove the old version which has been installed in the system. Do not install opencv via apt-get Install cmake : sudo apt-get install cmake Installation Download opencv git clone https://github.com/opencv/opencv Do not download the source from homepage.

OpenCV on Android: practices and tips

Transfer MAT objects from Android to NDK The main idea is to use the address of an MAT object in order to manipulate the data. Basically, we have a function playing as a bridge between Java APIs and NDK: public native void function_name(long matAddress); To call the function, we use Mat’s address by calling getNativeObjAddr(). All computations in NDK will affect the content of MAT in both Java and NDK layers.

Setup OpenCV and Android Studio with NDK support

In this tutorial, I will demonstrate how to configurate the renowned computer vision libary, OpenCV, with the current Android Studio version (3.0.1). Let get started. The compiled version of OpenCV which supports Android is available at OpenCV Homepage. Download and extract it. Please note that to test the application properly on the mobile devices, the OpenCV Manager has to be installed. In another tutorial, I will talk about how to compile our own OpenCV library and put it to Android Studio since the pre-compiled library misses some interesting and important components, e.

Matlab

General Show the information of a variable. It is very useful when we the code takes so much memory: whos <variable name>. Sum of squared of elements: sumsqr(X). Use sum(sum(A.^2, 1)) instead if you want to use less memory. Memory optimizations tips and tricks: [Undocumented Matlab] Use column-based representation instead of the row-based one. For example, to represent a list of items from 1 to 5, use 1 2 3 4 5.

Install the OpenCV library on Visual Studio

Compiling the libray There are many benefits of compiling the library from source instead of using the pre-compiled version: Supporting the latest IDE (Vision Studio). For example, pre-compiled OpenCV 3.0 (22/11/2015) is not compatible with Visual Studio 2015. Be able to customize the library, we can add several options to OpenCV, for example, we can add APIs for Kinect SDK, OpenCL, Python, etc. Down the source code for the Windows environment here.