Archive for the Category: Digital Image Processing

Using OpenCV inside a C# WPF application

In this example I will create a C++ dll that with contain the OpenCV image processing code. I then will create a C# WPF application, within this application i will then include the dll and using the image processing function. Install OpenCV http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html#windows-installation Create a C++ Win32 console Application, in this example it will be […]

Also posted in C# 1 Comment

Detecting the Dominant points on an image using OpenCV

To detect the dominant points within an image first we must find the edges. In this example the edges are found using cvFindContours. The resulting contours are then processed to find the dominant points along the contour. This is done using the cvFindDominantPoints function, this function implements the IPAN99 algorithm to find the points. A […]

Tagged , , , , Leave a comment

Image Contour detection and display using OpenCV

In this example we threshold the image based on the position of the track bar. Then find contours on the image an display the contours as white lines. #include “stdafx.h” #include “cv.h” #include “highgui.h” // global variables IplImage* input = NULL; IplImage* gray = NULL; int threshold = 100; CvMemStorage* storage = NULL; /** trackbar […]

Tagged , , , , , Leave a comment

Threshold an Image using OpenCV

The cvThreshold function allows us to reject pixels above or below a set value while keeping the others. In this example the input image is separated into the RGB channels. Then we preform a threshold on the red channel, with a maximum value of 100. The result of this is that all the light areas […]

Tagged , , , , Leave a comment

Flood Fill using OpenCV

To use the flood fill, first a seed point is selected, then all neighbouring pixels of a similar colour are converted to a uniform colour. In this example the seed point is at 200, 200 (shown by a blue circle). The neighbouring pixels are then flood filled with a red colour. #include “stdafx.h” #include “cv.h” […]

Tagged , , , Leave a comment

Drawing simple shapes using OpenCV

When creating Machine Vision and Image Processing Algorithms it is often useful to draw simple shape on to the image being processed. This simple example shows how to draw some basic shapes using OpenCV. #include “stdafx.h” #include “cv.h” #include “highgui.h” int _tmain(int argc, _TCHAR* argv[]) { // create the output image IplImage* output = cvCreateImage(cvSize(400,400),8,3); […]

Leave a comment

Splitting multichannel images into RGB using OpenCV

To separate a multi channel image into the three component RGB channels, we can use the cvSplit function. The example below opens a RGB image and then using the cvSplit function creates three output images. #include “stdafx.h” #include “cv.h” #include “highgui.h” int _tmain(int argc, _TCHAR* argv[]) { // open and display input image IplImage* input […]

Tagged , , , , Leave a comment

OpenCV Hello World

Here is the Hello World example code for OpenCV. This simple example creates a image called output, then the text “Hello World” is added to the image. #include “stdafx.h” #include “cv.h” #include “highgui.h” int _tmain(int argc, _TCHAR* argv[]) { // create image IplImage* output = cvCreateImage(cvSize(400, 200), 8, 3); // create font and add text […]

Tagged , , , Leave a comment

Gaussian image smoothing using OpenCV

Image smoothing is often used in digital image processing to reduce noise or camera artifacts. An example of a common algortihm used to perform image smoothing is Gaussian. Gaussian filtering is done by convolving each pixel in the input image with a Gaussian Kernal and then summing to produce the output image. #include “stdafx.h” #include […]

Leave a comment