Rudi's Homepage - Image processing



Description: Elementary access to pixel data of S&W- and color images using OpenCV.


Generated images


Basics V. 1.0
Source code


Description: Simple examples for using the OpenCV library. This program detects circles/lines on images of a video device using the Hough transformation and marks them with a green frame/red lines. The program finishes by keypress and saves the actual image to a JPEG picture.


Detected Circle.

Detected Lines.


HoughTr V. 1.0
HoughTr V. 1.0



Detection of optical flow in images. The programs detects good points to track using the maximal-eigenvalues method (goodFeaturesToTrack()) and marks these with green circles.

Then it calculates the optical flow for these points using the Lucas-Kanade method and displays the flow using red arrows.

The program finishes by keypress and saves the actual image to a JPEG picture.


Example 1.

Example 2.


oFlow V. 1.0



Reduction of background noise for star images by shift-compensated additional overlay of multiple images of the same region. For motion compensation between the images you can choose between two methods

Normalized crosscorrelation spectrum method

For this method the spectrum of the crosscorrelation of actual image A and its sucessor B will be calculated as Hc=fft(A).*conj(fft(B)). Then this spectrum will be magnitude-normalized so it contains only the phase information.

Another viewpoint is to see this spectrum as the spectrum of a shifted delta peak (when only shifting occurs between the images!). Convoluting B with the shifted delta peak would perform the shifting operation between B and A.

This convolution will be done in frequency domain to correct the shifting of B: fft(B')=fft(B).*Hc. This can be done with the overlay operation as Ha = 0.5*(Ha+Hb.*Hc) where Ha=fft(A) and Hb=fft(B) (all fft's are seperable two-dimensional).

The crosscorrelation spectrum can be calculated from thresholded copies of the images by choice to improve the Delta-peak character of the stars.

This process will be repeated with further images with respect to the result of the last averaging.

Feature Tracking

This method tracks the motion of a triangle from A to B to compute the affine transformation which maps A to B. The triangle is build up from the three best-to-track points computed by the maximal-eigenvalue-method (goodFeaturesToTrack()-Funktion of OpenCV).

The motion of the triangle is then computed by the Lucas-Kanad-method for calculating the optical flow of points. From the movement an affine Transformation will be calculated which is used to map the actual image A to its successor image B before overlaying them. For the next iteration the result is the actual image.


Input image 1.

Input image 2.

Input image 3.

Output image for first method.

Output image for second method.


ovlDen V. 1.0