Category Archives: C/C++

Mathematical Morphology – Opening and Closing, Top Hat, Black Hat, Gradient in OpenCV

We discussed dilation and erosion in previous article where we discussed that one expands the object pixels and the other shrinks them. What if we combine these operations? Fine these interesting details written below. Opening An erosion operation followed by dilation operation with the same structuring element is known as opening operation. An opening removes… Read More »

Mathematical Morphology – Erosion in OpenCV

Mathematical Morphology – Erosion Erosion can be used to shrink object shapes by removing pixels from boundary. It is exact opposite of dilation (expands the object pixels). Performing erode operation on object shape results the following : Removes any small points of noise or any narrow features Reduce the size of objects ( Number of… Read More »

Mathematical Morphology – Dilation in OpenCV

Mathematical Morphology – Dilation Mathematical morphology is a technique that is used for object of having spatial nature such as images, graphs and meshes. It is a framework for describing image processing and analysis operations. Consider two things while working with morphology Image Structure Element (Smaller then image but can be of different block size… Read More »

Insert Multiple lines of text into frame / image using OpenCV

Unfortunately, there is no direct way to insert multiple lines of text into a video frame. Only possible way is to call putText method multiple times. I wrote following methods to add four line of text on bottom right side of a video frame.

Please watch video to see how this program is working… Read More »

Motion Detection : Mean Background Model

The simplest technique is to take a background image without any moving object. Subtract current frame from static background image to find changes in current frame. But it can’t deal with objects being added or removed from static scene, illumination changes and changes in camera position etc. To overcome above mentioned issues frame difference approach… Read More »

Motion Detection using Frame Differencing

Instead of using static background model to find difference in current frame, I am using frame difference technique where current frame is compared or subtracted from previous frame. The difference depends upon speed of moving objects. Making a fair analysis is very difficult. Find the code bellow to find difference in frames.

Frame Difference

Opencv 3 installation on windows 10 and configure with visual studio 2012

Opencv 3 installation procedure on window 10 is as follows. Step1:Download windows version of opencv from Step2: Extract into a folder Step3: Configure opencv with Visual studio Set envirenment Vairable variable name: OPENCV3_DIR value: D:\\development\opencv\build\x86\vc11 Set Path: %OPENCV_DIR%\bin Configure visual studio for opencv project C/C++ additional include directories $(OPENCV3_DIR)\..\..\include linker additional include directories $(OPENCV3_DIR)\lib Input opencv_world300d.lib… Read More »

Find difference between frames

The following openCV code will help you to check changes between two frames and display result in a window.