Project Report - Second Eye
Project Report - Second Eye
Ayman Rasheed
Abstract
The app has the potential to greatly improve the quality of life for
those affected by colour blindness, by providing them with a tool to
help them navigate their day-to-day lives
With ‘Second Eye’, individuals with colour blindness can gain a better
understanding of the world around them and make their lives easier.
Introduction
Artificial Intelligence (AI) refers to the simulation of human intelligence
in computers.
It's different from existing programs and tools for colourblind people
as it uses computer vision to detect colours and provide real-time
feedback
Computer vision is a field of study within computer science and
artificial intelligence that focuses on enabling computers to
interpret and understand visual information from the world in the
same way that humans do. The goal of computer vision research is to
develop algorithms and models that can automatically analyze digital
images and videos.
1. The code starts by importing the required libraries, cv2 and numpy.
We will use OpenCV (cv2) for capturing the webcam and processing the images, and
Numpy for manipulating arrays and performing mathematical operations.
These arrays define the lower and upper bounds for each color in the HSV format. The
values in the arrays are the Hue, Saturation, and Value values, respectively.
The VideoCapture function from OpenCV captures the webcam and returns a
VideoCapture object, which is stored in the cap variable. The argument 0 tells
OpenCV to use the default camera (usually the built-in webcam).
4. Start a loop to continuously capture the webcam and capture the
frame from the webcam:
The read method of the cap VideoCapture object returns the return value 'ret' and the
captured frame frame. The 'ret' value is a Boolean indicating whether the frame was
captured successfully.
This loop will run continuously until we press the q key, which will break the loop and
end the program.
The cvtColor function from OpenCV converts the captured frame from the BGR format
to the HSV format. This allows us to easily compare the color values in the frame with
our color boundaries.
This line gets the 10 pixels in the middle of the frame in the HSV format. It does this by
slicing the 'hsv' array with the indices hsv.shape[0]//2-5:hsv.shape[0]//2+5 and
hsv.shape[1]//2-5:hsv.shape[1]//2+5. The 'shape' method returns the dimensions of the
hsv array, and the '//' operator performs integer division to get the middle row and
column of the frame.
7.Get the average color of the middle pixels:
The np.mean function is used to calculate the average color of the middle
pixels. The axis argument is used to specify the axis along which the
mean should be calculated. In this case, the mean is calculated along
both the row and column axes.
8. Check color:
The code checks if the average color falls within the bounds of the color
boundaries for blue, red, or green. If the average color falls within the bounds,
the color is set to "BLUE", "RED", or "GREEN". If the average color does not fall
within the bounds, the color is set to "UNKNOWN".
9. Put the color information on the frame and display the frame:
The code uses the putText function from the OpenCV library to put the color
information on the frame. The first argument is the frame, the second argument is
the color information, the third argument is the position of the text, the fourth
argument is the font, the fifth argument is the font scale, the sixth argument is the
color of the text, and the seventh argument is the thickness of the text.
The code uses the imshow function from the OpenCV library to display the frame
with the color information on the top left corner.
10. Break the loop, release the webcam and close all windows:
Evaluation
The future of the project will depend on the feedback received from users, the
advancements in computer vision and assistive technology, and the goals and
priorities of the development team. The program will be maintained and
updated regularly to fix bugs and improve the accuracy and performance of the
program. The feedback from users should be considered and used to improve
the program. The key is to continually evolve and improve the program to
better meet the needs of the colourblind community.