Automatic correction method for video equipment and related equipment
By performing edge and line detection on images captured by recording equipment, the system automatically judges and corrects their deviation state, solving the problem of poor video recording quality caused by the tilt of the recording equipment, improving detection efficiency and accuracy, and reducing costs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- GUANGZHOU KINDLINK SOFTWARE TECHNOLOGY CO LTD
- Filing Date
- 2025-12-11
- Publication Date
- 2026-04-28
AI Technical Summary
Existing video recording equipment may be installed crookedly, resulting in poor video recording quality, low efficiency and high cost of manual inspection.
By performing edge detection and line detection on the target image captured by the recording device, line segments of a specified type are selected, and the computer equipment automatically determines the deflection state of the recording device and performs automatic correction.
It enables automatic correction of video recording equipment, improves detection efficiency and accuracy, reduces detection costs, and eliminates human error.
Smart Images

Figure CN121940642A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video recording technology, and in particular to an automatic correction method and related equipment for video recording devices. Background Technology
[0002] Recording teachers' lectures to create video recordings can break the limitations of time and space, enabling remote teaching and resource sharing.
[0003] The viewing angle of the recording equipment directly determines the content of the recorded video, affecting its professionalism. Therefore, the recording equipment needs to be installed and fixed in the optimal position according to actual business needs. For example, installing the recording equipment horizontally in the center of the back wall of the classroom, directly facing the podium. After installation, the recording equipment may be tilted due to external forces, causing it to be crooked. A crooked recording equipment will capture an uneven video image, resulting in poor video recording quality.
[0004] To ensure video recording quality, manual inspections can be conducted periodically to check if the recording equipment is tilted, and any tilted equipment can be corrected promptly. However, manual inspections are inefficient and costly. Summary of the Invention
[0005] This application provides an automatic correction method and related equipment for video recording devices, which can solve the problems of low efficiency and high cost of manual inspection. To achieve the above objectives, the technical solution provided by this application is as follows: In a first aspect, embodiments of this application provide an automatic correction method for a video recording device, comprising: Edge detection is performed on the target image captured by the recording device to obtain the set of edge lines corresponding to the target image; Perform line detection on the set of edge lines to obtain a set of edge line segments; Extract line segments of a specified type from the set of edge line segments to obtain a set of specified line segments; wherein, the specified type is approximately horizontal lines and / or approximately vertical lines; Determine the deflection state of the recording device based on the tilt degree of each line segment in the specified line segment set; The deflection angle of the recording device is corrected based on the deflection status.
[0006] Secondly, embodiments of this application provide a computer device, including: a processor and a memory; wherein the memory stores a computer program, the computer program being adapted to be loaded by the processor and executed as described in the first aspect of the automatic correction method for video recording devices.
[0007] Thirdly, embodiments of this application provide a non-volatile computer-readable storage medium, characterized in that the storage medium stores a plurality of instructions, the instructions being adapted to be loaded by a processor and executed as described in the first aspect of the automatic correction method for a recording device.
[0008] In this embodiment, edge detection and line detection are performed on the target image captured by the recording device to obtain the corresponding line segments. From these, line segments of a specified type are selected to obtain a specified line segment set. Based on the tilt degree of each line segment in the specified line segment set, the deflection state of the recording device is determined. In this way, computer equipment can be used to automatically inspect each recording device, quickly determine whether the recording device is deflected, and automatically correct the deflection. Compared with manual inspection, the embodiments of this application can eliminate human error, improve detection efficiency and accuracy, and significantly reduce detection costs.
[0009] Alternatively, the vanishing point of the horizon can be determined using an approximate horizontal line, and then the pitch angle can be calculated using the vanishing point and the camera's focal length. This allows for an accurate determination of the vertical deflection angle of the recording equipment.
[0010] In addition, the vanishing point of a vertical line can be found using an approximate vertical line, and then the yaw angle can be calculated using the vanishing point and the camera's focal length. This allows for an accurate determination of the left and right yaw angle of the recording equipment.
[0011] Furthermore, after filtering out line segments with tilt angles less than the first preset tilt angle threshold and obtaining a specified set of line segments, tilt angle outliers can be removed, which can avoid nonlinear interference and ensure the accuracy and reliability of the deflection detection of the recording device.
[0012] Furthermore, it can retain only the longer line segments, filtering out short, irrelevant segments and avoiding false positives. At the same time, it reduces the amount of data and improves computational efficiency. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 A flowchart illustrating an automatic correction method for a video recording device provided in an embodiment of this application; Figure 2 A schematic diagram of a target image captured by a video recording device according to an embodiment of this application; Figure 3 for Figure 2 The image shown corresponds to the grayscale bitmap. Figure 4for Figure 3 The edge detection image corresponding to the image shown; Figure 5 Based on Figure 4 The image shown is a schematic diagram of the edge line segments extracted from it. Figure 6 From Figure 5 A schematic diagram of the edge segments of the approximate horizontal line extracted from the edge segments shown; Figure 7 This is a schematic diagram of the structure of an automatic correction device for a video recording device provided in an embodiment of this application; Figure 8 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0015] With the widespread use of personal computers, mobile phones and other display devices, video recording and playback technologies have been developed in various industries.
[0016] For example, in the field of education, recording equipment can be used to record teachers' lectures, resulting in recorded course videos. This can break the limitations of time and space, enabling remote teaching and resource sharing.
[0017] For example, in the field of video conferencing, recording equipment can be used to record the meeting process of participants in the conference room, resulting in a recorded video of the meeting. This can record key meeting content, enable cross-regional collaboration, and improve work efficiency.
[0018] For example, in the field of security monitoring, video recording equipment is used to record the monitored area, which enables real-time monitoring and playback, allowing for an understanding of the on-site situation in the monitored area.
[0019] The viewing angle of recording equipment such as cameras, camcorders, and video cameras directly determines the content of the recorded video and affects its professionalism. Therefore, it is necessary to install and fix the recording equipment in the optimal position according to actual business needs. For example, the recording equipment can be installed horizontally in the center of the back wall of a classroom, directly facing the podium. Another example is to install the recording equipment horizontally on the back wall of a conference room, directly facing the conference screen.
[0020] During installation, improper operation by the installer may cause the recording equipment to tilt. After installation, the equipment may also be deflected by external forces, resulting in further tilting. Video footage captured by tilted equipment will show significant distortion of key figures or objects, resulting in poor video recording quality.
[0021] To ensure video recording quality, manual inspections can be conducted periodically to check if the recording equipment is tilted, and any tilted equipment can be corrected promptly. However, manual inspections are inefficient and costly.
[0022] Furthermore, when multiple recording devices are deployed at various video recording locations, workers need to patrol between these locations to determine the deflection of each device. This patrol process is time-consuming and energy-intensive, and workers often rely on visual observation and subjective feelings to judge camera deflection, resulting in low accuracy of manual inspections.
[0023] Based on this, this application provides an automatic correction method for video recording devices. This method uses video footage captured by the recording device to determine the device's deviation state. The method includes: performing edge detection and line detection on the target image captured by the recording device to obtain line segments corresponding to the target image; selecting line segments of a specified type from these line segments to obtain a specified set of line segments; and determining the deviation state of the recording device based on the tilt degree of each line segment in the specified set. This allows for automatic inspection of each recording device using computer equipment, quickly determining whether a recording device is deviated, and automatically correcting the deviation. Compared to manual inspection, the embodiments of this application can eliminate human error, improve detection efficiency and accuracy, and significantly reduce detection costs.
[0024] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0025] It should be understood that the described embodiments are merely some, not all, of the embodiments in this application. All other embodiments obtained by those skilled in the art based on the embodiments in this application without inventive effort are within the scope of protection of this application.
[0026] In the following description, when referring to the accompanying drawings, the same numbers in different drawings denote the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0027] In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances. Furthermore, in the description of this application, unless otherwise stated, "multiple" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.
[0028] See Figure 1 This application provides an automatic correction method for video recording equipment, which can be applied to any computer device. The following will use the detection of the deflection state of a classroom camera as an example to describe in detail the automatic correction method for video recording equipment provided in this application. This method may include the following steps.
[0029] S102, perform edge detection on the target image captured by the recording device to obtain the set of edge lines corresponding to the target image.
[0030] For ease of description, any single frame of a still image acquired by a computer device can be referred to as the target image.
[0031] In practice, cameras typically encode the captured data and store it as video data in any format, such as mp4 or avi. Video data can be understood as a series of consecutive still images (or video frames). Computer devices can communicate wirelessly or wiredly with the camera to acquire the video data captured by the camera. Furthermore, the computer device can extract a still image from the most recently recorded video by the camera.
[0032] Frame extraction can be performed according to pre-set frame extraction rules, and this application does not impose restrictions on the frame extraction rules. For example, the last static image in the video data can be extracted as the target image. Another example is extracting a static image where the content of the scene has changed significantly (e.g., an object moves or appears) as the target image. Yet another example is extracting a static image as the target image at fixed time intervals.
[0033] For example, one can acquire video clips captured in real-time by a classroom camera, extract the last frame of that video clip, and obtain, for instance, a result such as... Figure 2 The bitmap image shown is the target image (which can be denoted as raw).
[0034] In another embodiment, the camera can capture and store image data in any format such as JPEG, PNG, or RAW. In this case, the computer device can communicate wirelessly or wiredly with the camera to obtain the latest image data captured by the camera and identify that image data as the target image.
[0035] In practice, to ensure the clarity of the recorded video, high resolution is typically used for video capture and storage. This results in large target image sizes, consuming significant computational resources for subsequent processing. To reduce the computational load, the target image can be normalized, reducing various large images to the same specified size. This significantly reduces the image size, saves subsequent computational resources, and improves the efficiency of camera deflection detection.
[0036] Different cameras may capture images with different aspect ratios. For example, one camera may capture video frames with an aspect ratio of 1:2, while another camera may capture video frames with an aspect ratio of 9:16.
[0037] In one embodiment, the target image can be scaled proportionally to its original aspect ratio. For example, a target image with an original size of 2400px * 1200px can be reduced to 960px * 480px. That is, a target image with a length of 2400 pixels and a width of 1200 pixels is reduced to an image with a length of 960 pixels and a width of 480 pixels. Before and after normalization, the aspect ratio of the target image remains at 1:2. This avoids image distortion (e.g., the image being stretched or flattened) caused by inconsistent scaling ratios, ensuring image consistency.
[0038] In another embodiment, for applications where high computational precision is not required, the original aspect ratio of the target image and the aspect ratio of the normalized image can also be different. That is, regardless of the original aspect ratio of the target image, it is scaled to a uniform specified size. Alternatively, the original target image can be cropped and scaled to achieve the specified size.
[0039] In one embodiment, the target image can also be processed to grayscale to obtain, for example... Figure 3 The image shown is a grayscale bitmap. This grayscale bitmap is considered the target image for subsequent calculations. It can be understood that, compared to a color image containing three channels (red, green, and blue), a grayscale bitmap only contains brightness information (i.e., a single channel). Performing subsequent calculations based on the grayscale bitmap reduces computational complexity and improves processing efficiency.
[0040] Furthermore, the Canny algorithm can be used to calculate the edge lines of a grayscale bitmap, resulting in a set of edge lines (denoted as edges). See also Figure 4After performing edge detection processing on the target image, a black-and-white binary image can be obtained, which is the edge detection image corresponding to the target image. The lines represented by white pixels constitute the aforementioned set of edge lines.
[0041] It is worth mentioning that edge detection algorithms such as Prewitt, Sobel, and Laplacian can also be used to perform edge detection on the target image. This application does not limit the type of edge detection algorithm. The specific steps of various edge detection algorithms are not described in detail here.
[0042] In another embodiment, the processing prior to step S102 may further include: acquiring video data collected by the recording device according to a preset detection cycle, and extracting the target image from the video data.
[0043] In practice, a detection cycle can be preset, and the camera's deflection can be periodically inspected according to the preset detection cycle to save computing resources.
[0044] It should be noted that the preset detection cycle can be set and adjusted according to the actual application scenario and business needs, and this application does not limit its value. For example, if the detection cycle of one or more cameras in a school is set to 1 day, and the first detection time is set to 9:00, then a deflection detection will be performed on each camera once a day at 9:00 am.
[0045] It is worth mentioning that the computer device can perform camera deflection detection based on the data recently collected by the camera, or it can request real-time data collection from the camera to perform camera deflection detection; this application does not impose any restrictions on this.
[0046] S104, perform straight line detection on the edge line set to obtain the edge line segment set.
[0047] In practice, the Hough transform can be used to detect straight line segments in the edge line set `edges`, resulting in the edge segment set (which can be denoted as L). For example, the edge segment set... any one of the line segments Can be recorded as , representing a line segment The starting point coordinates and the ending point coordinates are respectively and .
[0048] S106: Extract line segments of a specified type from the edge line segment set to obtain the specified line segment set.
[0049] The specified type is either an approximate horizontal line or an approximate vertical line. In other words, the specified type can be either an approximate horizontal line, an approximate vertical line, or a combination of both.
[0050] In one embodiment, the specified type is approximately horizontal line, and the specified line segment set includes an approximately horizontal line set. Accordingly, the specific processing of step S106 may include: obtaining the inclination angle of each line segment in the edge line segment set, classifying line segments with inclination angles less than a first preset inclination angle threshold as approximately horizontal lines, and obtaining an approximately horizontal line set.
[0051] In implementation, taking a classroom as an example, the scene contains various objects such as desks, blackboards, podiums, curtains, and walls. The edges of these objects are identified by edge detection algorithms. If the camera is tilted, the approximately horizontal lines in the edge segment set L corresponding to the image captured by the tilted camera will also have a significant horizontal tilt angle. Therefore, based on the tilt angle of the approximately horizontal lines, the degree of camera deflection can be quickly determined. Thus, for the line segments in the edge segment set L, only lines that are nearly horizontal can be retained. A tilt angle threshold can be preset to filter approximately horizontal lines. For ease of description, this tilt angle threshold can be called the first preset tilt angle threshold, denoted as θ_threshold. When the absolute value of the tilt angle of a line segment in the edge segment set L is less than the first preset tilt angle threshold, i.e., |θ| < θ_threshold, the line segment is determined to be an approximately horizontal line.
[0052] In one embodiment, for any line segment in the set L of edge line segments... It can be based on the coordinates of its two endpoints. Use trigonometric functions to calculate the line segment The angle between the horizontal line and the horizontal line.
[0053] It's worth noting that angles have periodicity, for example, a period of 360°. If the angle range is [-180°, 180°], a line segment with an angle of 1° represents a 1° counterclockwise tilt, and a line segment with an angle of -1° represents a 1° clockwise tilt. Although they tilt in different directions, the degree of tilt is the same. Therefore, line segments can be used... The relationship between the absolute value of the angle of inclination |θ| between the line segment and the horizontal line and the first preset angle threshold θ_threshold is used to determine whether the line segment belongs to the approximate horizontal line. For example, if the first preset angle threshold θ_threshold is 45°, then the line segments in the edge line segment set L with a horizontal angle in the range of (-45°, 45°) are classified as approximate horizontal lines, and the other line segments in the edge line segment set L are removed to obtain the approximate horizontal line set L', which is the specified line segment set.
[0054] See also Figure 5 In the set of approximately horizontal lines L', each line segment is marked with a red line. The numbers on each line segment represent the calculated angle of inclination and the length of the line segment. For example, -0.99 / 404 means that the angle of inclination of the line segment is -0.99° and the length of the line segment is 404 pixels.
[0055] It should be noted that the first preset tilt angle threshold θ_threshold can be set and adjusted according to the actual application scenario and business needs, and this application does not restrict its value.
[0056] In one embodiment, after filtering out line segments with inclination angles less than a first preset inclination angle threshold to obtain a specified line segment set, the method further includes: determining the outlier values of the inclination angles of each line segment in the specified line segment set; and removing the line segments corresponding to the outlier values from the specified line segment set.
[0057] During implementation, outlier angle values are removed to avoid nonlinear interference. This ensures the accuracy and reliability of camera deflection detection.
[0058] In one embodiment, outliers of the inclination angle can be determined by combining the median (denoted as θ_median) and standard deviation (denoted as σ) of the inclination angles (denoted as θ_i) of each segment in a specified set of segments. Here, the median of the inclination angle θ_median = median({θ_i}), and the standard deviation σ = std({θ_i}).
[0059] Furthermore, it is possible to calculate the line segments in a specified set of line segments. The angle difference (denoted as θ_i) between the inclination angle (which can be denoted as θ_i) and the median above is determined if Δθ_i ≤ k × σ. The angle of inclination is within the normal range; otherwise, the line segment is determined. The tilt angle is the outlier. Here, k is the standard deviation multiple, which can be set to 2. The value of k can be set and adjusted according to the actual application scenario and business needs; this application does not impose any restrictions on this.
[0060] It's worth noting that the difference between two angles doesn't directly represent the angle between two line segments. For example, 179° and -179°. Their direct difference is 358°, i.e., 179 - (-179) = 358, but in reality, these two angles differ by only 2° on a circle. Therefore, when calculating the angle difference, the ±180° boundary can be handled. Calculate Δθ_i = min(|θ_i - θ_median|, 360° - |θ_i - θ_median|) to obtain the line segment... The tilt angle is the actual minimum angle difference Δθ_i between the median θ_median and the tilt angle.
[0061] In one embodiment, the processing after filtering out line segments with an inclination angle less than a first preset inclination angle threshold and obtaining a specified line segment set may further include: obtaining the length of each line segment in the specified line segment set and determining whether the length reaches a preset length threshold; removing line segments whose length does not reach the preset length threshold from the specified line segment set.
[0062] In implementation, for any one line segment in the specified set of line segments... Based on Coordinates of the two endpoints The line segment was calculated using the Pythagorean theorem. The length of the line segment (which can be denoted as L_i). In the i-th line segment... If the length L_i reaches a preset length threshold (which can be denoted as L_threshold), that is, when L_i ≥ L_threshold, then the line segment is... Keep it in the specified set of line segments; otherwise, leave the line segment in the specified set. Remove from the specified set of line segments.
[0063] By retaining only the longer line segments, we can filter out short, irrelevant segments and avoid false positives. On the other hand, we can reduce the amount of data and improve computational efficiency.
[0064] S108, determine the deflection state of the recording device based on the tilt degree of each line segment in the specified line segment set.
[0065] In this embodiment, the set of line segments is designated as the set of approximately horizontal lines L', which contains line segments that are all approximately horizontal lines. When the tilt angle of the approximately horizontal line reaches a certain value, it can be determined that the camera has deflected. The larger the tilt angle of the approximately horizontal line, the greater the degree of camera deflection.
[0066] In one embodiment, the set of line segments is designated as the set of approximately horizontal lines L'. The processing of step S108 may specifically include: obtaining the median from the tilt angle of each line segment in the set of approximately horizontal lines, and determining whether the median exceeds a second preset tilt angle threshold; if the median exceeds the second preset tilt angle threshold, determining that the recording device has deflected.
[0067] In implementation, a tilt angle threshold can be preset to determine the camera's deflection state. For ease of description, this tilt angle threshold can be called the second preset tilt angle threshold, denoted as P. This is achieved by reading the line segments from the approximately horizontal line set L'. The tilt angle θ_i can be used to obtain the median X. If the median X is greater than the second preset tilt angle threshold, i.e., X > P, then it is determined that the camera has tilted; otherwise, it is determined that the camera has not tilted.
[0068] In one embodiment, the specified type is an approximate horizontal line, and the specified set of line segments includes an approximate horizontal line set L'. Based on the approximate horizontal line set L', the perspective of the target image can be estimated, and then the camera's deflection state can be determined based on the perspective of objects in the target image. Accordingly, the processing in step S108 may further include: calculating the vanishing point of the horizontal line segments in the approximate horizontal line set; and calculating the pitch angle of the recording device based on the degree of offset of the vanishing point of the horizontal line.
[0069] In one embodiment, the specified type is approximately vertical line, and the specified line segment set includes an approximately vertical line set. The corresponding step S106 may include: obtaining the tilt angle of each line segment in the edge line segment set, classifying line segments with tilt angles greater than a first preset tilt angle threshold as approximately vertical lines, thus obtaining an approximately vertical line set. Furthermore, step S106 may include: calculating the vertical vanishing point of the line segments in the approximately vertical line set; and calculating the yaw angle of the recording device based on the offset degree of the vertical vanishing point.
[0070] In another embodiment, the specified type may also include two categories: approximately horizontal lines and approximately vertical lines, and the corresponding specified line segment set may include both an approximately horizontal line subset and an approximately vertical line subset.
[0071] It is worth mentioning that a set of parallel straight lines in the three-dimensional world will intersect at a common point when projected onto a two-dimensional image plane; this point is called the vanishing point. Specifically, the point where lines parallel to the ground (e.g., in the front-back or left-right direction) converge at a distance is called the horizontal vanishing point, and the point where lines parallel to or perpendicular to the ground (e.g., in the up-down direction) converge at a distance is called the vertical vanishing point.
[0072] In practice, spatial perspective can be used to calculate the pitch and / or yaw angles. The pitch angle describes the angle at which the camera tilts up or down, such as when the camera tilts up or down; the yaw angle describes the angle at which the camera tilts left or right, such as when the camera rotates left or right.
[0073] Specifically, the approximate horizontal and / or approximate vertical lines extracted in the previous steps can be solved using the least squares method to calculate the horizontal and vertical vanishing points.
[0074] Then, the difference between the horizontal vanishing point and the image center (denoted as dy) is calculated. Based on the difference dy and the physical focal length of the camera lens (denoted as focal_length), the camera's pitch angle Pitch = arctan(dy / focal_length) can be calculated. The physical focal length of the lens can be obtained by reading camera parameters, by using a camera calibration algorithm, or by using the pixel width of the edge detection image as an estimate of the focal length.
[0075] The calculation process for the yaw angle is similar to that for the pitch angle. The difference between the vertical vanishing point and the image center (denoted as dx) can be calculated. Based on the difference dx and the physical focal length of the camera lens (focal_length), the camera's yaw angle (Yaw = arctan(dy / focal_length)) can be calculated.
[0076] S110, corrects the deflection angle of the recording device according to the deflection state of the recording device.
[0077] In one embodiment, after determining that the recording device has been misaligned, the computer device can promptly notify maintenance personnel to correct the misaligned recording device. For example, the computer device can issue a graphic or textual prompt via the monitor or an audio prompt via the speaker.
[0078] In another embodiment, after determining that the recording device has deflected, the computer device can also automatically correct the deflection angle of the recording device based on the deflection state of the recording device.
[0079] In implementation, for various embodiments that determine the deflection state of the recording device based on the median X of the tilt angles of each line segment in a specified set of line segments, if the median X is greater than a second preset tilt angle threshold (i.e., X > P), the computer device determines that the camera has deflected. Furthermore, the computer device can generate a corresponding control command based on the median X and send the control command to the corresponding recording device, thereby controlling the corresponding recording device to correct its own deflection angle.
[0080] For example, if the median X is 30°, it means that a line segment that should have been horizontal in the target image has rotated 30° counterclockwise. Therefore, the recording device, which should have been horizontal, has been deflected 30° clockwise. To correct this deflection, the computer can generate a control command to rotate 30° counterclockwise and send it to the recording device. The device will then execute the command, rotating its mechanism 30° counterclockwise, thus returning the lens to its correct position and ensuring the captured image is now straight. This achieves automatic correction of the recording device without manual intervention.
[0081] In implementation, for various embodiments that calculate the pitch angle and / or yaw angle of the recording device based on the vanishing points of the horizontal and / or vertical lines of each line segment in a specified set of line segments, the computer device can generate corresponding control commands based on the pitch angle and / or yaw angle, and send the control commands to the recording device to control the recording device to correct its own yaw angle.
[0082] For example, a pitch angle of 30° and a yaw angle of 20° indicate that the recording device is tilted upwards by 30° and yawed to the right by 20°. To correct the yaw angle of the recording device, the computer can generate a control command to rotate downwards by 30° and yaw to the left by 20°, and send this control command to the recording device. The recording device will then execute the control command, causing its rotation mechanism to rotate downwards by 30° and yaw to the left by 20°, thus returning the recording device's lens to its normal position and ensuring that the image captured by the recording device is now straight, achieving automatic skew correction.
[0083] It is worth mentioning that the rotation mechanism of the recording device can be a built-in rotation mechanism or a pan-tilt unit connected to the recording device. This rotation mechanism can provide one or more degrees of rotational freedom. For example, rotation about the lens yaw axis (i.e., rotation in the left and right direction), rotation about the lens pitch axis (i.e., rotation in the up and down direction), and rotation about the lens roll axis (i.e., rotation about the lens optical axis). The type of recording device can be selected according to the actual application scenario and business needs, and this application does not limit it.
[0084] It should be noted that, due to space limitations, this application specification does not exhaustively list all possible implementation methods. Those skilled in the art should be able to conceive after reading this application specification that, as long as the technical features do not contradict each other, any combination of technical features can constitute an optional implementation method.
[0085] The following are embodiments of the apparatus described in this application, which can be used to execute the embodiments of the method described in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the method described in this application.
[0086] Based on the same technical concept, this application also provides an automatic correction device for video recording equipment, see [link to relevant documentation]. Figure 7 ,include: The edge detection module is used to perform edge detection on the target image captured by the recording device to obtain a set of edge lines corresponding to the target image; The line detection module is used to perform line detection on the set of edge lines to obtain a set of edge line segments; A line segment filtering module is used to extract line segments of a specified type from the edge line segment set to obtain a specified line segment set; wherein, the specified type is an approximately horizontal line and / or an approximately vertical line; The deflection determination module is used to determine the deflection state of the recording device based on the degree of inclination of each line segment in the specified line segment set. The deflection correction module is used to correct the deflection angle of the recording device based on the deflection status.
[0087] Optionally, the specified type is an approximate horizontal line, and the specified line segment set includes an approximate horizontal line set; the line segment filtering module is further configured to: Obtain the inclination angle of each line segment in the edge line segment set, classify the line segments with inclination angles less than a first preset inclination angle threshold as approximately horizontal lines, and obtain an approximately horizontal line set.
[0088] Optionally, the deflection determination module is also used for: The median is obtained from the inclination angle of each line segment in the set of approximately horizontal lines, and it is determined whether the median exceeds the second preset inclination angle threshold. If the median exceeds the second preset tilt angle threshold, it is determined that the recording device has deflected.
[0089] Optionally, the deflection determination module is also used for: Calculate the vanishing point of the horizontal line segments in the approximate set of horizontal lines; The pitch angle of the recording device is calculated based on the degree of offset of the vanishing point of the horizontal line.
[0090] Optionally, the specified type is an approximate vertical line, and the specified line segment set includes an approximate vertical line set; the line segment filtering module is further configured to: Obtain the inclination angle of each line segment in the edge line segment set, classify the line segments with inclination angles greater than the first preset inclination angle threshold as approximately vertical lines, and obtain an approximately vertical line set; The deflection determination module is also used for: Calculate the vanishing point of the vertical line segments in the approximate set of vertical lines; The yaw angle of the recording device is calculated based on the degree of offset of the vanishing point of the vertical line.
[0091] Optionally, the line segment filtering module is also used for: Determine the outlier values of the inclination angle of each line segment in the specified set of line segments; Remove the line segment corresponding to the outlier from the specified line segment set.
[0092] Optionally, the line segment filtering module is also used for: Obtain the length of each line segment in the specified line segment set, and determine whether the length reaches a preset length threshold; Remove line segments whose length does not reach the preset length threshold from the specified line segment set.
[0093] Optionally, the edge detection module is also used for: The video data collected by the recording device is acquired according to a preset detection cycle, and the target image is extracted from the video data.
[0094] Based on the same technical concept, this application also provides a computer device, see [link to relevant documentation]. Figure 8 The system includes a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any of the above embodiments for automatic correction of video recording devices.
[0095] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. The software product for automatic correction of the recording device can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including storing several instructions to cause a computer device to execute the methods described in various embodiments or some parts of the embodiments.
[0096] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. An automatic correction method for a video recording device, characterized in that, include: Edge detection is performed on the target image captured by the recording device to obtain a set of edge lines corresponding to the target image; Perform straight line detection on the set of edge lines to obtain a set of edge line segments; Extract line segments of a specified type from the set of edge line segments to obtain a set of specified line segments; wherein, the specified type is an approximately horizontal line and / or an approximately vertical line; The deflection state of the recording device is determined based on the degree of inclination of each line segment in the specified line segment set; The deflection angle of the recording device is corrected based on the deflection state.
2. The method as described in claim 1, characterized in that, The specified type is an approximate horizontal line, and the specified line segment set includes the approximate horizontal line set; The step of extracting line segments of a specified type from the set of edge line segments to obtain a specified set of line segments includes: Obtain the inclination angle of each line segment in the edge line segment set, classify the line segments with inclination angles less than a first preset inclination angle threshold as approximately horizontal lines, and obtain an approximately horizontal line set.
3. The method as described in claim 2, characterized in that, Determining the deflection state of the recording device based on the tilt degree of each line segment in the specified line segment set includes: The median is obtained from the inclination angle of each line segment in the set of approximately horizontal lines, and it is determined whether the median exceeds the second preset inclination angle threshold. If the median exceeds the second preset tilt angle threshold, it is determined that the recording device has deflected.
4. The method as described in claim 2, characterized in that, Determining the deflection state of the recording device based on the tilt degree of each line segment in the specified line segment set includes: Calculate the vanishing point of the horizontal line segments in the approximate set of horizontal lines; The pitch angle of the recording device is calculated based on the degree of offset of the vanishing point of the horizontal line.
5. The method as described in claim 1, characterized in that, The specified type is an approximate vertical line, and the specified line segment set includes the approximate vertical line set. The step of extracting line segments of a specified type from the set of edge line segments to obtain a specified set of line segments includes: Obtain the inclination angle of each line segment in the edge line segment set, classify the line segments with inclination angles greater than the first preset inclination angle threshold as approximately vertical lines, and obtain an approximately vertical line set; Determining the deflection state of the recording device based on the tilt degree of each line segment in the specified line segment set includes: Calculate the vanishing point of the vertical line segments in the approximate set of vertical lines; The yaw angle of the recording device is calculated based on the degree of offset of the vanishing point of the vertical line.
6. The method according to any one of claims 2-5, characterized in that, After filtering out line segments with an inclination angle less than the first preset inclination angle threshold to obtain the specified set of line segments, the method further includes: Determine the outlier values of the inclination angle of each line segment in the specified set of line segments; Remove the line segment corresponding to the outlier from the specified line segment set.
7. The method according to any one of claims 2-5, characterized in that, After filtering out line segments with an inclination angle less than the first preset inclination angle threshold to obtain the specified set of line segments, the method further includes: Obtain the length of each line segment in the specified line segment set, and determine whether the length reaches a preset length threshold; Remove line segments whose length does not reach the preset length threshold from the specified line segment set.
8. The method according to any one of claims 2-5, characterized in that, Before performing edge detection on the target image, the method further includes: The video data collected by the recording device is acquired according to a preset detection cycle, and the target image is extracted from the video data.
9. A computer device, characterized in that, include: A processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and executed as described in any one of claims 1-8.
10. A non-volatile computer-readable storage medium, characterized in that, The storage medium stores multiple instructions, which are adapted to be loaded by a processor and executed as described in any one of claims 1-8 for automatic correction of video recording equipment.