Skip to main content

Posts

Showing posts with the label cv2.COLOR_RGB2BGR

Image Editing Software | Applying Color Filters on Image

 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 PI...