Camera video stream real-time display method based on face detection
Through real-time face detection and video stream processing, the display position of the camera video stream is adjusted to solve the problem of inconsistency between the video stream resolution ratio and the control aspect ratio, achieving a reasonable and beautiful display of the video stream and the smoothness of the interface design, improving Improved on-site service quality.
Patent Information
- Application Number
- CN202410732735.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-09-06
AI Technical Summary
When the existing technology is difficult to effectively display the camera video stream, the video stream resolution ratio is inconsistent with the width and height ratio of the display video control, resulting in an unsightly interface layout. Especially in multi-screen scenarios, it is difficult to ensure reasonable display of the video stream.
By defining the video interception module, the camera video stream is received in real time. According to the aspect ratio of the video display control and the face detection results, the video stream is intercepted in real time, and the display position is calculated and adjusted to ensure that the video stream does not deviate within the effective display area and avoid frequent Adjust to ensure that the resolution ratio of the video stream matches the aspect ratio of the control.
It achieves a reasonable and beautiful display of camera video streams, highlights passenger location information, improves on-site service quality, reduces developers' restrictions on video stream proportions, and ensures the smoothness and beauty of UI interactive interface design.
Smart Images

Figure CN118609022A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video playback, and in particular to a real-time display method of camera video streams based on face detection. Background Art
[0002] With the development of AI, face recognition technology has been widely used in the field of computer vision. In recent years, it has been widely used in some terminal application scenarios, such as airports, border inspections, stations, docks, schools, hospitals, scenic spots and other places. By comparing the facial image of the passenger with the ID photo, the passenger's identity can be quickly verified, the waiting time in queues can be reduced, security measures can be strengthened, and the travel efficiency can be improved.
[0003] The general process of existing identity verification is: the camera is pointed at the passenger, and then the passenger gives the ID to the staff. The staff reads the ID information through the on-site business software, and then uses the ID number to check the ticket and the ID photo to verify the identity. Finally, the software makes a pass judgment.
[0004] Depending on the usage scenario, the aspect ratio of the camera's video stream has two resolutions: 9:16 vertically or 16:9 horizontally. For the real-time display of the camera video stream, the resolution ratio of the camera video stream should be considered frequently to design the UI interaction interface. If the resolution ratio of the camera video stream is not considered for the overall application display effect, the camera video stream of the interface may be stretched or compressed up and down. If the implementation plan is to ensure that the video stream resolution ratio remains unchanged, the video stream display control will have black edges on the left and right or up and down, affecting the overall layout of the customer application software UI. In particular, in some application scenarios, there are two screens, one passenger screen and one staff screen. Generally, the passenger screen is vertical, and the staff screen is horizontal because it needs to display more information. At this time, whether the video stream resolution ratio is vertical or horizontal, how to ensure the UI display effect for the video streams on both sides will be a big problem.
[0005] It can be seen that when the camera video stream resolution ratio is inconsistent with the aspect ratio of the display video control, how to display the video stream is a trade-off problem that needs to be comprehensively considered. Neither readjusting the software UI layout nor ignoring display anomalies and only caring about the overall interface layout is a good solution. Therefore, how to enable business software to effectively display the camera video stream is a technical problem to be solved by the present invention. In view of this, the present invention is deeply conceived to address the many deficiencies and inconveniences caused by the imperfection of the display problem of the existing camera video stream, and actively researches and improves the trial production to develop the present invention. Summary of the invention
[0006] The purpose of the present invention is to provide a real-time display method of camera video stream based on face detection, which can solve the problem of inconsistency between the resolution ratio of camera video stream and the aspect ratio of display video control.
[0007] In order to achieve the above object, the solution of the present invention is: A method for real-time display of camera video based on face detection, firstly defining a video capture module, receiving the video stream acquired by the camera in real time, then capturing the corresponding video stream according to the aspect ratio of one or more registered video display controls, and distributing it to the corresponding video control display thread; the video capture module mainly supports two properties, one is recording the default display position when no face appears; the other is capturing the display position in real time when a person appears, the real-time captured display position uses the effective capture area, that is, defining the effective display area ROI, when a person approaches, as long as the detection result position is within the display area ROI, the video stream capture position will not be switched; The process of video capture module processing data stream includes the following steps: Step A: Obtain the read video stream in real time and divide it into two processing video streams; Step B: One of the video streams is used as real-time face detection to detect whether there is face information, and the detection result and the corresponding video frame time are recorded in a cache list; Step C, another video stream obtains the estimated face detection result from the cache list according to the current video frame time; When there is no detection result for the current video frame time obtained, the default display position is intercepted and sent to the corresponding video control display thread; When the current video frame time is detected, the position of the video stream to be intercepted is adjusted in real time, the video stream showing the current face position is intercepted, and the real-time intercepted display position is sent to the corresponding video control display thread; Step D, end.
[0008] Furthermore, during the operation of the camera, the middle position of each passenger when using it on site is recorded based on the location of the camera and the height of the passengers. The people at both ends who are too tall and too short are removed, and the average position of 80% of the people is taken as the middle position.
[0009] Furthermore, in step C, the camera operation process generates a cache list in real time, obtains short-term detection results from the current moment, and generates the detection results of the current frame according to the change trend.
[0010] Furthermore, face detection is performed synchronously with the acquisition of the real-time position of the step, and the current position is estimated based on the video frame time.
[0011] After adopting the above structure, the present invention is a method for real-time display of camera video based on face detection. It comprehensively considers the current situation and business process. When a passenger enters the camera video screen from far to near, the display area is recalculated according to the camera video stream resolution, the aspect ratio of the video display control, the passenger's location information, and the historical display location information. The display video screen of the corresponding area is intercepted and reported to the video control display thread. The video control display thread continues to smoothly render the video screen on the specified video display control according to the reported video information. The present invention calculates the position of the video stream display in real time based on face detection or pedestrian detection, combined with the video stream and the aspect ratio of the control. The acquisition of the display position intercepted in real time by the present invention is to synchronously perform face detection and the acquisition of the real-time position, and estimate the current position according to the video frame time. The calculation of the display position intercepted in real time is not to display the detection result in the center, but according to the effective display area ROI, as long as the result does not deviate from the area, the display is not adjusted in real time.
[0012] Compared with the prior art, the present invention has the following advantages: For the application of business software, the present invention ensures the display effect of the camera video stream display control, making the interface more reasonable and beautiful; for on-site passengers, before the present invention is used, the camera video screen range seen is generally large according to the position of the camera, and the present invention can highlight the location information of the passengers, and when multiple people appear at the same time, it can also effectively remind the current passengers; for on-site staff, because the screen effectively focuses on the passengers, they can clearly pay attention to the on-site passenger information and improve the quality of on-site services; the present invention allows developers to focus more on the implementation of business software UI interaction without being limited by the camera video stream ratio. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] Figure 1 This is a schematic diagram of the data flow used in the present invention.
[0014] Figure 2 The flowchart of the processing data flow of the video capture module of the present invention. DETAILED DESCRIPTION
[0015] In order to further explain the technical solution of the present invention, the present invention is described in detail below through specific embodiments.
[0016] like Figure 1 and Figure 2As shown, the present invention discloses a method for real-time display of camera video based on face detection, firstly, a video capture module is defined, the video stream acquired by the camera is received in real time, then the corresponding video stream is captured according to the aspect ratio of one or more registered video display controls, and the video stream is distributed to the corresponding video control display thread; the video capture module mainly supports two properties, one is to record the default display position when no face appears; the other is to capture the display position in real time when a person appears, the real-time captured display position uses the effective capture area, that is, defines the effective display area ROI (region of interest), when the person is approaching, as long as the detection result position is within the display area ROI, the video stream capture position will not be switched; like Figure 2 As shown, the process of the video capture module processing the data stream includes the following steps: Step A: Obtain the read video stream in real time and divide it into two processing video streams; Step B: One of the video streams is used as real-time face detection to detect whether there is face position information, and the detection result and the corresponding video frame time are recorded in a cache list; Step C, another video stream obtains the estimated face detection result from the cache list according to the current video frame time; When there is no detection result for the current video frame time obtained, the default display position is intercepted and sent to the corresponding video control display thread; When the current video frame time is detected, the position of the video stream to be intercepted is adjusted in real time, the video stream that can display the current face position is intercepted, that is, the display position intercepted in real time, and the display position intercepted in real time is sent to the corresponding video control display thread; Step D, end.
[0017] The present invention comprehensively considers the current situation and business processes. When a passenger enters the camera video screen from far to near, the display area is recalculated according to the camera video stream resolution, the video display control aspect ratio, the passenger's location information, and the historical display location information, and the display video screen of the corresponding area is intercepted and reported to the video control display thread. The video control display thread continues to smoothly render the video screen on the specified video display control according to the reported video information. The present invention calculates the position of the video stream display in real time based on face detection or pedestrian detection, combined with the video stream and the control aspect ratio. The acquisition of the display position intercepted in real time by the present invention is to synchronously perform face detection and the acquisition of the real-time position, and estimate the current position according to the video frame time. The calculation of the display position intercepted in real time is not to display the detection result in the center, but according to the effective display area ROI, as long as the result does not deviate from the area, the display is not adjusted in real time.
[0018] In order to reduce the frequent adjustment of the video display position, the default display position is designed to have the ability to adjust in real time, record the position displayed when there are people, and calculate the optimal default display position. The real-time captured display position is not designed to be displayed according to the strategy of centering the detection frame. In this way, the video display position will keep switching when the person approaches. Even if the person stops, if the detection position is offset by several pixels, the video window will shake. The present invention defines the effective display area ROI of the video display area. As long as the human figure is within the display area ROI, the picture will not switch.
[0019] A good video display position when no one is around can effectively reduce the switching of video display positions. Depending on the location of the on-site camera and the height of the passengers, the best position for on-site display is not necessarily in the middle. During operation, record the middle position of each passenger when using the on-site video, remove the passengers who are too tall or too short, and take the average position of 80% of the passengers as the middle position.
[0020] Since the camera video stream is real-time, but each video frame needs to be detected for face, the algorithm detection result is delayed relative to the video display, that is, the position of the video frame cannot be detected and returned in real time, which involves how to estimate the position of the current frame from the cached detection results in real time. The specific method is to generate a cache list in real time during the camera operation process, obtain short-term detection results from the current moment, and generate the detection result of the current frame according to the change trend, that is, record the historical display results and estimate the detection result of the current frame.
[0021] When the input video stream has no face position information, the default video information is displayed at the position where there is no face. When the input video stream has face position information, the video information is not directly displayed according to the real-time human position, because in this way, the video screen will always shake. When people approach the video screen, they usually walk from the middle, and their position will change slightly. Define the effective position ROI of the video display area. As long as the human figure is in the effective position ROI, the screen will not switch.
[0022] The present invention provides a method for enabling business software (video display control) to effectively display camera video streams. After the business software UI interactive interface is designed, the video display control can obtain the corresponding video stream display according to its own aspect ratio. The present invention can ensure that the obtained video stream resolution ratio is consistent with the aspect ratio of the video display control, and the video stream can fill the control without deformation. For business software with multiple video windows, the method supports the implementation of multiple controls, each of which is independent, ensuring the final display effect. The present invention allows developers to focus on the implementation of designing business and provides a more reasonable and beautiful UI interactive interface.
[0023] The above embodiments and drawings do not limit the product form and style of the present invention. Any appropriate changes or modifications made by ordinary technicians in the relevant technical field should be deemed to be within the patent scope of the present invention.
Claims
1. A method for real-time display of camera video based on face detection, characterized in that: First, define the video capture module to receive the video stream obtained by the camera in real time, and then capture the corresponding video stream according to the aspect ratio of one or more registered video display controls, and distribute it to the corresponding video control display thread; the video capture module mainly supports two properties, one is to record the default display position when no face appears; the other is to capture the display position in real time when someone appears. The real-time captured display position uses the effective capture area, that is, defines the effective display area ROI. When a person approaches, as long as the detection result position is within the display area ROI, the video stream capture position will not be switched; The process of video capture module processing data stream includes the following steps: Step A: Obtain the read video stream in real time and divide it into two processing video streams; Step B: One of the video streams is used as real-time face detection to detect whether there is face information, and the detection result and the corresponding video frame time are recorded in a cache list; Step C, another video stream obtains the estimated face detection result from the cache list according to the current video frame time; When there is no detection result for the current video frame time obtained, the default display position is intercepted and sent to the corresponding video control display thread; When the current video frame time is detected, the position of the video stream to be intercepted is adjusted in real time, the video stream showing the current face position is intercepted, and the real-time intercepted display position is sent to the corresponding video control display thread; Step D, end.
2. A method for real-time display of camera video stream based on face detection as claimed in claim 1, characterized in that: During the operation of the camera, the middle position of each passenger when using it on site is recorded based on the location of the camera and the height of the passengers. The people at both ends who are too tall and too short are removed, and the average position of 80% of the people is taken as the middle position.
3. A method for real-time display of camera video stream based on face detection as claimed in claim 1, characterized in that: In step C, the camera generates a cache list in real time during operation, obtains short-term detection results from the current moment, and generates the detection results of the current frame based on the change trend.
4. A method for real-time display of camera video stream based on face detection as claimed in claim 1, characterized in that: Face detection is performed synchronously with the acquisition of the real-time position of the step, and the current position is estimated based on the video frame time.
