Question
Please help with this homework problem in OpenCV using C++ coding languge. Imaging devices have infiltrated every corner of modern life. They are omnipresent in
Please help with this homework problem in OpenCV using C++ coding languge.
Imaging devices have infiltrated every corner of modern life. They are omnipresent in multiple forms such as photographic cameras, security cameras, and mobile phones. Not only do these devices digitally document the life of the user, they also capture other individuals nearby. People can feel uncomfortable about losing control over their pictures, and there are serious privacy implications due to the massive publication of private pictures and other information along with them. Many face recognition systems have been built to automatically identify the face region on an image. However, none of them can achieve one hundred percent accuracy, especially when the face region has very low resolution or the image has poor quality. So to make sure privacy protection, it still requires necessary users manual input. For example, the Google street view, it still requires users editing to block all the passengers face.
In this project, you will implement an efficient and easy-to-use software tool to mask peoples face from camera video streams. The details about this software prototype are as follows:
Steps
(1) Load video from your laptop webcam by using OpenCV.
(2) The program allows user to select a target region via mouse button-down, dragging, and button up operations. The position where the mouse left button down occurs is recorded as the first corner of the rectangle region. Then the user holds the button and drags the mouse to a new location. During the dragging, user can see a dynamic rectangle (e.g red color) rendered on the video, indicating user's selection (see Figure 1). After the user releases the left button, mosaic effect is generated permanently based on the user's selected rectangle region. The two diagonal corners of the rectangle region should locate at the positions where user's left-button-down and left-button up occur (see Figure 2).
Figure 1: during mouse dragging Figure 2: after mouse left button up
(3) Pixels inside the rectangular region that defined by the user should be blurred with Mosaic effect. The level of blur depends on the user specified value. For example, you can use an integer variable to store it:
int blur_degree = 5
Here blur_degree defines the length of each Mosaic unit square. By default it is 5 pixels in length. So the bigger of the blur_degree, the more blur of the selected region. Figure 3 shows a big value for the "blur_degree":
Figure 3. result of setting large value to the blur_degree.
(4) User can increase the blur level by hitting the keyboard key i or I and decrease the blur level by hitting the keyboard key d or D. The way of increasing or decreasing blur level follows the rule below:
a) Increasing Case: when blur_degree is less than 5, it increases by 1 each time when the key i or I is hit; when blur_degree is equal to or greater than 5, it increases by 5 each time when the key i or I is hit;
b) Decreasing Case: when the blur_degree is equal to or less than 5 but greater than 1, it decreases by 1 each time when the key d or D is hit; when blur_degree is greater than 5, it decreases by 5 each time when the key d or D is hit;
(5) During editing, user can remove the blur effect at any time by hitting the key r or R, just in case the region is not selected properly. Or user can also remove it by a single clicking left button.
(6) After the user finishes editing, the result image should be saved to a local drive with whatever filename by hitting the s or S key.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started