Skip to main content

Posts

Showing posts from 2020

Image Editing Software | GUI Designing | Creating Sliders

 Hello friends! Let us continue developing our GUI of image editing software. You can check out the previous post by clicking here , where we have learned to create a window and add a few buttons to it. In this post, we will be adding sliders to our GUI which will be used to adjust the brightness and contrast of the image. You can check out the video below. We will continue developing our previous code. For placing the sliders we will use another frame. For creating the frame use the code below.  Frame2 = tk.Frame(window , height = 20 ) Frame2.pack( anchor =tk.NW) Frame2 will be holding the sliders of brightness and contrast adjustments. We have anchored the Frame2 to the northwest corner in our window. Let us now create the sliders for our window.  brightnessSlider = tk.Scale(Frame2 , label = "Brightness" , from_ = 0 , to = 2 , orient =tk.HORIZONTAL , length =screen_width , resolution = 0.1 , command =brightness_callback) brightnessSlider.pack...

Image Editing Software | GUI Designing | Creating Buttons

Hello Friends! We are going to develop an Image Editing Software in python. We will be using various libraries like Tkinter, PIL, and OpenCV. We will be developing several features like brightness adjustment, contrast adjustment, applying various filters on the image, etc. So why wait? Let's get started. Make sure to check out the video below before starting. We will start by designing the GUI and later on, we will add the required functionalities to it for image editing. In this tutorial, we will be creating a window that will hold 3 buttons(Import, Save, Close). To create the GUI we will start by importing the Tkinter in our python file as shown below. import tkinter as tk To create a window we will have to call a method called tk.Tk(). window = tk.Tk() So the window is ready. But if you run the above code, you won't see anything appearing on the screen. This is because the program has finished execution. You will have to add a loop to hold the window on the screen. For that,...

How Far You Are From Your Camera? Python | OpenCv

Hello Friends! In this blog, you will learn to find out the distance between you and your webcam. Take a look at the video below.  Let's get started. For this project, we will be using face detection using the Haar Cascade method. Therefore, we need to download the cascade classifier for face detection from Github. You can download and paste the file from this link . Let us first understand what is Haar Cascade?  Haar Cascade  is a machine learning object detection algorithm used to identify objects in an image or video and based on various​​ features.  If you want to read a more detailed version of it, check out this link . Now, we will start by importing the libraries and define a variable to capture video from my webcam. import cv2 import numpy as np cap = cv2.VideoCapture( 0 ) Let us import our classifier file which we downloaded from Github. face = cv2.CascadeClassifier( 'haarcascade_frontalface_alt.xml' ) write a while loop and capture the image frames. Also, w...

Make an object invisible using Python- OpenCV

In this blog, you will learn how to make an object disappear in a video in python using the OpenCV library.  Check out the demo below. So let's get started.  We will start by importing the required libraries  and define a variable to capture the video from my webcam. import cv2 import numpy as np cap = cv2.VideoCapture( 0 ) Now, start capturing the image frames from the camera and save the first frame in a variable called replace_image . But why we did this? Keep Reading. ret , frame = cap.read() frame = cv2.flip(frame , + 1 ) ##Mirror image frame replace_image = frame ##live image to replace with Let's write a while loop to capture the image frames continuously. while ( 1 ): ret , frame = cap.read() ##Read image frame frame = cv2.flip(frame , + 1 ) ##Mirror image frame if not ret: ##If frame is not read then exit break if cv2.waitKey( 1 ) == ord ( 's' ): ##While loo...

Pattern Matching in Python- OpenCV

Hello guys. Today we will learn a pattern matching algorithm in python using the OpenCV library. Check out the video below to get a gist of what we are going to build. I have black and white grid patterns with white as background and black foreground. As usual, we will start by first importing the required libraries and define a variable to capture the video from my webcam. import cv2 import numpy as np cap = cv2.VideoCapture( 0 ) Now, we write a while loop and capture the image frames. Also, we need to mirror the frames so that we can see it right. while 1 : ret , frame = cap.read() ##Read image frame frame = cv2.flip(frame , + 1 ) ##Mirror image frame if not ret: ##If frame is not read then exit break if cv2.waitKey( 1 ) == ord ( 's' ): ##While loop exit condition break In the third part, we have to convert the image frames into a binary image. But why binary images?  You must ask. 1. ...