About Digital Image Processing
In the field of computer science, digital image processing is the use of computer algorithms to perform image processing to manipulate digital images. The most conventional way of changing the features or characteristics of an image is to convert the image into its pixel matrix form and pass a spatial filter over it using the mathematical operation of convolution.
About Python and Open-CV libraries
Python is an interperted high-level programming language for general purpose programming. It supports multiple programming paradigms including object oriented and procedural, and has a large and comprehensive standard library.
OpenCV-Python is a library of Python bindings designed to solve computer vision problems. The library is cross-platform and free for use under the open-source license. All the OpenCV array structures are converted to and from Numpy arrays. This also makes it easier to integrate with other libraries that use Numpy such as SciPy and Matplotlib. Numpy is a library which adds support for large, multi-dimensional arrays and matrices, along with a large collection of high-level mathematical functions to operate on these arrays. Matplotlib is a plotting library for Python programming language which provides embedded plots into various applications.
Download Python from https://www.python.org/
To test for successful installation of pip, run it on the Command Prompt
To install/uninstall a library using pip; run a command on Command Prompt:
pip install (name of the library)/ pip uninstall (name of the library)
About High Pass Filters
High pass filtering in image processing has a plain objective that is pretty self-explanatory; taking a transform function into account, it attenuates all low frequency components without disturbing higher frequency information. By maintaining the same, it is observed that while the high pass filter is implemented upon an image as a masking factor, image sharpening can be obtained in the frequency domain as opposed to low pass filters which causes blurring on the image since it attenuates low frequencies. (The intended function of the filters here is to perform precisely perform the reverse operation of low pass filters). With a strong characteristic of image sharpening which is implemented using HPF, it can be using in applications of boundary or edge detections in an image. In other terms, abrupt changes in frequencies are associated with high frequency components and hence the same can be highlighted. An ideal high pass filter can be defined as
H(u,v)=0 if D(u,v)<Do
H(u,v)=1 if D(u,v)>D0
Where D0 is the cut-off distance measured from the origin of the frequency. It sets zero to all frequency to the area bounded with the circle of radius D0, while passing without attenuation, all frequencies outside the circle. Results of ideal high pass filters may be associated with problems related to ringing effects. In order to look into highlighting edges and boundaries, if the cut-off distance of the filter is selected with a low pixel order, the edges produced may be thicker and distorted. Selecting a filter of higher order can enable filtering of smaller objects in the image and the edges will look cleaner and less distorted.
A high pass filter when defined in matrix form in very general terms, the sum of all values in the filter matrix should add up to zero. Since high pass filters looks for quick abrupt changes in frequencies and attenuates lower frequencies, it has a response of zero in DC. An edge/boundary detection filter gets rid of all DC offsets.
(Reference: Raquel Gonzalez for Digital Image Processing)
Output using various high pass filters:
Output to display a general high pass filtered image in pixel matrix form:
Program Code: Run and Execute
For the complete program code and incase of furthur queries, do drop in a message via the contact forms of our blog or care to drop a comment! ^_^