Hello there! Welcome to another blog. In this blog you are going to learn to detect iris using OpenCv python. Here is the video in case you missed it. So, let's get started. We will start by importing the necessary libraries. import cv2 import numpy as np Now, let us import the face and eye classifier files and set the camera resolution as follows. eye = cv2.CascadeClassifier( 'haarcascade_eye.xml' ) face = cv2.CascadeClassifier( 'haarcascade_frontalface_alt.xml' ) Kernal = np.ones(( 3 , 3 ) , np.uint8) #Declare kernal for morphology cap = cv2.VideoCapture( 0 ) cap.set(cv2.CAP_PROP_FRAME_WIDTH , 320 ) ##Set camera resolution cap.set(cv2.CAP_PROP_FRAME_HEIGHT , 240 ) In a while loop let us capture an image frame, flip it(in case your camera captures inverted images) and convert it into a gray scale image. ret , frame = cap.read() ##Read image frame frame = cv2.flip(frame , + 1 ) ##Flip the image in case your camera
Hello friends! Welcome to the last post on Image Editing Software. In this post, you will be learning how to apply color filters to an image. We will be doing this using the OpenCV library package. You can also check out the video below. So let's get started. We will start by importing Opencv and Numpy to our code. import cv2 import numpy as np And now we will start writing the callback methods for applying filters. Let us start with the yellowButton_callback() method. def yellowButton_callback (): opencvImage = cv2.cvtColor(np.array(originalImage) , cv2.COLOR_RGB2BGR) opencvImage[: , : , 0 ] = 20 global outputImage outputImage = Image.fromarray(cv2.cvtColor(opencvImage , cv2.COLOR_BGR2RGB)) dispayImage(outputImage) Alright. Let us understand the above code line by line. To apply a color filter I have to manipulate the image array. So I need the image in an array form. np.array(originalImage) converts the image that we read using the PIL library into a 3D