This repository contains three Python scripts that apply various image processing techniques using OpenCV. These scripts allow users to perform different tasks such as basic image editing (grayscale, resizing, rotation, etc.), color segmentation, and applying artistic effects.
- Photo Editor Using Computer Vision: Perform basic image processing operations like grayscale conversion, resizing, rotation, cropping, blurring, and saving images.
- K-Means Color Segmentation: Segment an image into dominant color clusters using K-means clustering.
- Dreamy Glow Effect & Contour Enhancement: Apply a dreamy glow effect and contour enhancement to an image, providing an interactive way to adjust parameters dynamically.
Before running any of the scripts, ensure that you have the necessary dependencies installed:
pip install opencv-python numpyThis script applies basic image processing techniques such as grayscale conversion, resizing, rotation, cropping, blurring, and saving images. (I did this to to apply dreamy glow effect on photos initially, turns out it could work other ways too.)
- Grayscale conversion: Converts the image to black and white.
- Resizing: Scales the image to different resolutions.
- Rotation: Rotates the image to adjust orientation.
- Cropping: Focuses on specific areas of the image.
- Blurring: Applies a blur effect to reduce image noise.
- Place an image file named
image.jpgin the same directory. - Run the script:
python PhotoEditor.py
- The processed image will be displayed and saved as
output_image.jpg.
This script demonstrates essential image processing techniques for use in computer vision-based applications.
This script applies K-means clustering to segment an image into dominant color clusters. Users can adjust the number of clusters dynamically using a trackbar. (It could be useful for artists to simplify colour blocks or extract palette :D)
- K-means clustering groups similar colors in the image.
- Gaussian Blur is applied to reduce noise before clustering.
- The script assigns each pixel to a dominant color cluster and displays the segmented image and the RGB values of the dominant colors.
- Place an image named
sample.jpgin the same directory. - Run the script:
python colorCode.py
- A trackbar will appear, allowing you to adjust the number of color clusters (
K). - The segmented image and dominant colors will be displayed.
This script is useful for image color analysis, background simplification, and palette extraction using computer vision.
This script classifies an input image by comparing its features with reference images using the ORB (Oriented FAST and Rotated BRIEF) feature detector. It utilizes feature matching techniques to determine the most similar reference image and assigns a classification label accordingly.
- ORB Feature Detection: Extracts keypoints and descriptors from images.
- Feature Matching: Uses BFMatcher (Brute-Force Matcher) with Hamming distance to find similarities between images.
- Classification Based on Matches: Assigns the input image to the class with the highest feature match count.
- Place the input image (
img6.jpg) and reference images (img3.jpg,darwin.jpg,RCW.jpg) in the same directory as the script. - Run the script:
python image_classification.py
- The script will output the classification result and display the input and reference images.
This script provides a simple yet effective way to classify images based on feature matching. It can be extended for various applications such as object recognition, image retrieval, and automated categorization.
This script applies a dreamy glow effect and contour enhancement to an image using OpenCV. Users can adjust parameters like blur intensity, blending strength, RGB color balance, and contour thickness through interactive trackbars. (The bounding box is square so it might look weird to you, I didn't want to fix it anymore. So, yea.)
- Gaussian blur is applied to achieve the glow effect.
- Bitwise masking extracts the foreground.
- Canny edge detection is used for contouring to highlight edges.
- Place an image named
image1.jpgin the same directory. - Run the script:
python DreamyCutieEffect.py
- Adjust the blur, blend, RGB levels, and contour thickness using the trackbars.
- Press 'd' to exit the script.
This script provides an interactive way to apply artistic effects like glowing and contour enhancement.