Image Processing Techniques — Open CV BY – A. Packiashri

The intended purpose of Vision is to reconstruct the complex, colorful, and vivid three-dimensional world from the most simple and elementary building blocks leveraging on reliable models that would help to interpret images in an estimable way. Images are basically blocks of numbers displayed with different intensities.

In OpenCV, images are converted into multi-dimensional arrays, which greatly simplifies their manipulation. For instance, a grayscale image is interpreted as a 2D array with pixels varying from 0 to 255.Colored images are slightly more complicated because we are dealing with 3D arrays where each pixel is rendered in three different color channels. It would be interesting to split the original image into its blue, green, and red components to grasp how the color layered structure works.

For face detection , here the below code works in detecting the face , using the harcascade classifier .

This can be used to detect the face ,we can also detect face in videos and this is how the code works. we have to just change it into video capture.

When using your computer cam use 0 or 1 ,while using external camera.Upscaling each channel to a 3D array will render the desired colors. For that use, mixChannels() comes in handy.

blue_channel = np.zeros(input_image.shape, input_image.dtype)
green_channel = np.zeros(input_image.shape, input_image.dtype)
red_channel = np.zeros(input_image.shape, input_image.dtype)
 
# We match each color channel to a 3D dimension:
    # Blue Rendering : [blue; 0; 0]
    # Green Rendering: [0; green; 0]
    # Red Rendering: [0; 0; red]
cv.mixChannels([blue, green, red], [blue_channel], [0,0])
cv.mixChannels([blue, green, red], [green_channel], [1,1])
cv.mixChannels([blue, green, red], [red_channel], [2,2])
 
# Display the three obtained images
cv.imshow(‘Blue Channel’, blue_channel)
cv.imshow(‘Green Channel’, green_channel)
cv.imshow(‘Red Channel’, red_channel)
 
cv.waitKey(0)
cv.destroyAllWindows()      

Leave a Comment

Your email address will not be published. Required fields are marked *