C/C++ Archive

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

Motion Detection using Frame Differencing and Mean Background Model

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. VideoCapture capture("ewap/seq_hotel.avi"); Mat

Opencv 3 installation, Difference between Frames and Averaging Frames

Opencv 3 installation on windows 10 and configure with visual studio 2012 Step1:Download windows version of opencv from www.opencv.org   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

Convert Hex to Dec and Dec to Hex

Convert from Decimal to Hexadecimal WORD DecToHex(WORD wDec) { return (wDec / 1000) * 4096 + ((wDec % 1000) / 100) * 256 + ((wDec % 100) / 10) * 16 + (wDec % 10); } Convert from Hexadecimal to Decimal WORD HexToDec(WORD wHex) { return (wHex / 4096) * 1000 + ((wHex % 4096)

Reading data from multiple COM serial ports part II

Remain part of reading data from multiple serial ports is as follows. Handler.h file #include "SerialCom.h" class Handler { private: CSerialCom port; BYTE data; DWORD BaudRate; BYTE byteSize; DWORD fparity; BYTE parity; BYTE stopBit; public: Handler(void); void setPortDetail(DWORD BaudRate,BYTE byteSize,DWORD fparity,BYTE parity, BYTE stopBit); void COMListen(); void listenCOM(); ~Handler(void); }; Handler.cpp class #include "Handler.h" #include

Reading data from multiple COM serial ports part I

I downloaded CSerialCom.cpp class from following link – A Simple Class for Implementing Serial Communication in Win-9X/2000 and modified it as follow to handle multiple communication ports. Here is SerialCom.h header file. #include atlstr.h class CSerialCom { // Construction public: CSerialCom(); // Attributes public: // Operations public: // Implementation public: void ClosePort(); BOOL ReadByte(BYTE &resp);

Configure MinGW, Eclipse IDE for C/C++ Developers and OpenCV 2.4.10

I spent few days to find suitable tutorial with complete information, how to configure OpenCV 2.4.10 with eclipse. New versions do not give pre-compiled binaries whereas OpenCV has support for JAVA and other languages. But it was developed in C++ and there are many ready made codes available in C/C++. Basically research community is still