A program which finds and highlights the edges in an image using differences in colour values.
The function which processes the images, find_edges
accepts a variety of modes listed below.
Original | Gradient Black (grad_black) |
---|---|
Original | Gradient White (on_white) |
Original | Gradient Overlayed on Original (overlay) |
Example using grad_black:
- Find image using tkinter dialog, open using Pillow (PIL).
- Create blank image (black background) with same width and height as original image.
- Split bounds of image into quarters, create 4 worker threads which asyncronously perform
compare_pixels
function on each quarter; Creates 4 image objects (one per quarter). compare_pixels
function sums RGB values of a pixel and subtracts the sum of the next pixel's RGB values (to the right). If thedifference
is greater than thethreshold
(specified by user), colour the corresponding pixel on the quarter image. The RGB values of the corresponding pixel is (difference
,difference
,difference
).compare_pixels
repeats the same method, comparing pixels vertically (pixel vs. pixel below).- Each quarter image is pasted onto the output image. The output image is then saved (with optional
name
specified by user).
- Pillow Image Library - Used to open, modify, and save images.
- ThreadPool - Used to divide image among worker threads to speed up image processing.
- tkinter - Used to open native file dialog to select image.
This project is licensed under the MIT License - see the LICENSE file for details