07Dec/16

Histogram Equalization Implementation

This method usually increases the global contrast of many images, especially when the usable data of the image is represented by close contrast values. Through this adjustment, the intensities can be better distributed on the histogram. This allows for areas of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by effectively spreading out the most frequent intensity values. The method is useful in images with backgrounds and foregrounds that are both bright or both dark.

Implementation: Histogram equalization technique is theoretically described  on this link, click here.

Here I want to share source code of Histogram Equalization technique.

 

 

Example: Let’s analyze these pictures.

unequalized_hawkes_bay_nz

This picture is the example of unequalized brightness

unequalized

Brightness histogram representation for unequalized image

equalized_hawkes_bay_nz

Same image after Histogram equalization. It’s much more clear than before.

equalized

Brightness histogram representation for equalized image

 

 

21Jul/16

How to convert Video Data/Frames from YUV –> CIImage –> UIImage in iOS Platform

Here I have described tested and working solution for this procedure:

Here I am showing data structure of YUV(NV12) data  and how we can get the Y-Plane(y_ch0) and UV-Plane(y_ch1) which is used to create CVPixelBufferRef. Let’s look at the YUV(NV12) data structure..

YUVNV12_Structure

– Total Frame Size = Width * Height * 3/2,
– Y-Plane Size = Frame Size * 2/3,
– UV-Plane size = Frame Size * 1/3,
– Data stored in Y-Plane –>{Y1, Y2, Y3, Y4, Y5…..}.
– U-Plane–>(U1, V1, U2, V2, U3, V3,……}.

I hope it will be helpful to all. 🙂 Have fun with IOS Development 😀

 

21Jul/16

How to build OpenH264 for Windows Platform

You can build Openh264 using Visual Studio in windows. Here are the steps…

  • – i) Download OpenH264 source code provided by cisco from https://github.com/cisco/openh264 .
  • – ii) Now you will find two Visual Studio compatible projects in
    directory /OpenH264/codec/build/win32/dec and
    /OpenH264/codec/build/win32/enc.
  • – iii) You will need to download NASM software from http://www.nasm.us/pub/nasm/releasebuilds/2.12.02/ .
  • – iv) Install NASM software on the directory C:\NASM or wherever you like.
  • – v) Then Add NASM Executable path to all these visual studio projects.StaticDynamicSelection
  • – vi) You can either select static or dynamic library in general
    options based on your project requirements.NASMInclude
  • – vi) If you are able to perform all these operations successfully, you will have 5 different .lib or .dll files named welsdcore, welsdecplus, welsecore, welsencplus, welsvp and those
    are usable in any Visual Studio projects.

Now if you want to get Openh264 features, just add all these libraries to your project and enjoy.
Hope it will help you.. 🙂

17Jul/16

How to play Raw YUV Video files?

We can easily play YUV(I420) formatted video files using VLC by the following commands:

  • Windows: “C:\Program Files\VideoLAN\VLC\vlc.exe” –demux rawvideo –rawvid-fps 10 –rawvid-width 640 –rawvid-height 480 –rawvid-chroma I420 input.yuv
  • MAC: /Applications/VLC.app/Contents/MacOS/VLC –demux rawvideo –rawvid-fps 10 –rawvid-width 288 –rawvid-height 352 –rawvid-chroma I420 input.yuv

VLC is able to play raw H264 Encoded video files by the following command:

  • Windows: “C:\Program Files\VideoLAN\VLC\vlc.exe”  –demux h264 –h264-fps 10  input.h264
  • MAC: /Applications/VLC.app/Contents/MacOS/VLC –demux h264 –h264-fps 10  input.h264

There exists lot more YUV video format categories, like  YUV-I420, YUV-444, YUV-UYVY, YUV-YUYV, YUV-NV12, YUV-NV21 etc. (YUV video format structures are described in this link, http://www.fourcc.org/yuv.php ).

VLC is unable to play all these video formats. So either we have to write source code to create a new raw video player that will play raw yuv video files… Or we can use third party software to play raw yuv video files.

I use a third party video player named pYUV player, it will be found from this link, http://pyuv.software.informer.com/download. Thank You.

07Jul/15

How to Create, Read, Update, Delete Registry Key using C++

Here is shared complete working example of Registry Key processor using C++.

 

06Jul/15

Sample Client Program that connects with a TCP Server, Linux

The following is the complete source code for the basic TCP/IP Client Application.

Command to compile and execute:

 

06Jul/15

Sample Server Program that uses TCP Protocol, Linux

The following is the complete source code for the basic TCP/IP Server application in linux:

Command to Compile and Execute:

 

06Jul/15

Thread example in C++, Linux

Here given sample Thread implementation using C++ in Linux:

Here is the command to compile and run this sample program:

Here is the output of this program:

 

05Jul/15

Sample Server Program that uses TCP Protocol, Windows

The following is the complete source code for the basic Winsock TCP/IP Server application.

 

05Jul/15

Sample Client Program that connects with a TCP Server, Windows

The following is the complete source code for the basic Winsock TCP/IP Client Application.