Task:- Creating a virtual drawing pad which will track a object referred to as a "stylus" and sketch out its motion.
- Use camera to capture the frames.
- Create trackbars to find the lower and higher HSV range of the stylus.
- Convert the frame from BGR to HSV.
- Create an array of the HSV values obtained.
- Make a mask which sees the lower and the higher HSV values of the stylus.
- Create a drawing space.
- Use camera to capture the frames.
- Flip the frames horizontally to avoid lateral inversion.
- Convert the frames from BGR to HSV.
- Put the values of the lower and higher HSV values obtained in part A.
- Create a mask using the values in point 5
- Convert the mask from BGR to Grayscale and apply thresholding accordingly.
- Applying closing on the mask to remove the noise present in the frames being captured.
- Dilation is applied after closing to remove the dark areas in the mask and it is applied multiple times to get a consistent shade.
- The contour of the image obtained after dilation is found.
- Find the contour with the largest area and note down its index.
- Find the moment and the centroid of the largest contour.
- Allot an inital and a final condition to start the loop.
- The centroid of the contour is tracked to draw the line.
- Display the sheet and the frame.
- If 'esc' is pressed, destroy all the windows.
https://drive.google.com/file/d/1PaArVuIqjXC8khxeT2jn3UaTfO9aaeIU/view?usp=sharing