Grid Shifts for Coordinate Transformation

Introduction to Look-up tables
Back in the DOS era and 80×86 CPU (I guess it’s quite old), mathematical operations for 3D Graphics were too expensive. One of the tricks to speed-up the graphics pipeline was using a pre-computed trigonometric functions implemented in a table. The benefit of using discretization of function parameter is measured by how complex the computation of function relative to accessing a table using a discretized input parameter. This method of replacing function call into looking up a table for already computed values are generally called Memoization.

Generalizing Look-up table for higher dimension
In previous example(trigonometric function) the input parameter is only one. If we think the parameter as a dimension, then the domain of the input parameter is a one dimensional object (a line). Of course the memoization technique is not only limited to one dimensional look-up table but can also be generalized to higher dimensions. In 3D Graphics (again), The memoization for higher dimension is used in texture mapping (2D) or voxel(volume pixel) representation for object modeling.

Grid shift: LUT in Coordinate transformation
Now let’s move from 3D Graphics to another area. In Geospatial domain, the same technique (look-up table) is used to transform coordinate from one Coordinate Reference System (CRS) to another CRS. Since most geographical coordinates only has two horizontal components (latitude and longitude). The look-up table is in the form of a two-dimensional grid. This grid-based transformation is also known as ‘Grid Shifts’.
Read More

Iklan

Simple Entity Extraction from News Article in Bahasa Indonesia

Tulisan kali ini membahas cara mengekstrak informasi dari teks berita menggunakan python. Entitas yang dimaksud adalah entitas berupa tempat, orang, organisasi atau entitas lain yang diketahui dalam basis pengetahuan. Basis pengetahuan yang dipakai dalam tulisan ini adalah dbpedia bahasa Indonesia. Sebetulnya DBPedia sudah menyediakan layanan semacam ini yaitu Spotlight namun sayangnya belum tersedia dalam bahasa Indonesia.
Read More

GSoC 2013 so far : pre mid-term Evaluation

It’s been quite a while since my last post about Google Summer of code activities. I was trying to understand the inner working of the library which I use and gathering deeper knowledge about spatial coordinate and mapping. As I may previously mentioned in earlier post, I am working with GDAL and PROJ.4 Library. GDAL/OGR is mainly used for supporting many raster/vector format and also dealing with WKT (Well Known Text) representation of coordinate system. The Coordinate system is defined in WKT Format although in the GDAL/OGR Library, the main coordinate system transformation is done in the PROJ.4 library which is wrapped through an interface which consists of OGRSpatialReference and OGRCoordinateTransformation.
Read More

Histogram of Oriented Gradient in Numpy

Di tulisan terdahulu saya pernah mencoba menulis tentang menghitung fitur HOG lalu tulisan tentang mempercepat perhitungan hog dengan menggunakan inlince c++ dari scipy. Tulisan kali ini sebetulnya hampir sama dengan tulisan terdahulu, yaitu menghitung fitur yang sama, yang berbeda adalah tulisan yang dulu dibuat dengan menggunakan interface opencv versi 1 (import cv) sedangkan tulisan kali ini dibuat menggunakan interface versi kedua (cv2). Pada opencv versi pertama, objek citra disimpan menggunakan struktur berbasis C (IplImage) sedangkan di versi 2, objek citra sudah terintegrasi dengan Numpy array (ndarray) dan opencv versi 2 sudah ditulis ulang dengan menggunakan C++. Dengan terintegrasinya struktur penyimpanan citra menjadi array numpy, maka operasi2 pengolahan citra jadi seperti yang dilakukan dengan MATLAB. operasi-operasi tertentu juga menjadi makin mudah melalui operasi array slicing yang ada pada Numpy. Oleh sebab itu, saya coba membuat algoritma penghitungan fitur HOG yang mengeksploitasi fasiltas yang ada di Numpy yang lebih cepat karena menghindari loop yang eksplisit dilakukan pada kode python tetapi mendelegasikan operasi yang bersifat element-wise ke numpy.

modul yang diimpor
kalau di versi opencv pertama modul yang digunakan adalah cv, maka sekarang adalah cv2. modul cv masih dapat diakses untuk menjaga kompatibilitas ke versi sebelumnya menjadi submodul di dalam cv2.

# jika ingin menggunakan antarmuka opencv versi 1
import cv2.cv as cv 
# interface opencv versi 2
import numpy as np
import cv2

Menghitung HOG secara umum
fitur HOG yang dibahas pada tulisan ini adalah varian penyederhanaan dari varian-varian utama yang digunakan saat ini :

  • varian HOG Dalal-Triggs untuk pedestrian detection
  • varian HOG Felzenswalb untuk deformable part model di PASCAL VOC (Visual Object Categories/Classes) Challenge

Read More

Building PROJ.4 Library in Windows

First thing to do is to make sure all libraries are there. This is actually part of pre-application puzzle challenge. But then, the libraries are already in the github repo. This time, I would like to build it myself. just in case there will be another release during this project. I will only cover building under windows.

Using Visual Studio 2010
PROJ.4 usually come with autotools (autoconf and automake) but for VS, PROJ.4 comes with custom makefile (although no solution or VS project file). In order to build this library using visual studio, one can follow these steps:

  1. run cmd.exe as Administrator (this is important since my OS is 64-bit, otherwise it will generate errors with the debug informations)
  2. execute vcvars32.bat from visual studio directory (in my case it’s in VC\bin\vcvars32.bat)
  3. execute “nmake /f makefile.vc”
  4. if you want to install it then execute “nmake /f makefile.vc install-all”. It will then create a PROJ directory at C:\

Using MinGW/MSYS
I tried to build PROJ.4 by calling sh.exe from cmd but it was not seems to work and then I had to run from msys shell (by running msys.bat). BTW, I use latest MinGW distribution (using mingw-get). I guess these steps are similar with the steps to build a package in linux-based systems.

  1. open msys shell
  2. execute “./configure” from proj-x.y.z directory
  3. execute “./make”
  4. execute “./make install”

Notes
The whole building process is faster when using VS than MinGW even when configuring time is ignored. There is an issue though. At first, I was using “mingw32-make” command in which the build cannot be done. When i checked, the version of ‘mingw32-make’ is different with ‘make’. mingw32-make was mapped to later version (3.82.90 i686-pc-mingw32) while ‘make’ command was mapped to earlier version (3.81 i686-pc-msys).