Image processing in python using openCV
First of all we need to install opencv-python library
Install this with the help of pip command
pip install opencv-python
Some basic functions we need to know before creating image are
img=cv2.imread(“path”)-For reading the image, use the imread() method of the cv2 module.
cv2.imshow(‘name’,variable_name)-This command is used to show the image.
cv2.waitKey()-The waitKey() function take the time as an arguement in millisecond as a delay for a windows to close.
cv2.destroyAllWindows()-On pressing any key on keyboard it closes the image window.
img.shape-This function displays the size of the image.
cut_image-img[x1:x2,y1:y2]-We can crop the image using this function.
- )CREATING AN IMAGE USING PYTHON CODE
Normally in opencv the order of colours are reverse.
BGR-COLOUR ORDER
0- less than 255 range gives black or grey colour so for black image we took numpy. Zeros( )
2.)How to take two image and crop some part of image and swap it
3.)Take 2 image and combine it to form single image