Video clarity and brightness detection method based on data annotation learning mechanism

By introducing the data annotation learning mechanism and the graphical interface developed by Qt into the video stream detection system, the parameters of the detection algorithm are adaptively adjusted, which solves the problem of limited detection effects in the existing technology and achieves efficient definition and brightness detection of the video stream. Visual display.

CN114399487BActive Publication Date: 2024-09-10SHANDONG UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210030420.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-12
Publication Date
2024-09-10
Estimated Expiration
2042-01-12

AI Technical Summary

Technical Problem

Existing video stream imaging quality detection methods fail to effectively utilize past detection records for learning and optimization, resulting in limited detection results and inability to accurately identify people and scene information in video streams.

Method used

Adopt a video definition and brightness detection method based on the data annotation learning mechanism, perform video stream acquisition, frame skip collection, definition detection, and brightness detection through a real-time video monitoring system, and use Qt for visual display and record storage, combined with data annotation learning The mechanism adaptively adjusts the threshold parameters in the algorithm to improve the detection effect.

Benefits of technology

It realizes the visual display and local storage of the definition and brightness detection of video streams, optimizes the detection effect through the data annotation learning mechanism, and improves the accuracy and efficiency of detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114399487B
    Figure CN114399487B
Patent Text Reader

Abstract

The video definition and brightness detection method based on the data annotation learning mechanism belongs to the field of video detection technology. The method comprises the following steps: the real-time monitoring video stream transmitted to the computer terminal is captured by the video stream acquisition module, and the playback parameters are set; the frame skipping acquisition module is used to perform frame skipping acquisition on the video stream at a fixed time interval to obtain the frame image to be detected; the definition detection module and the brightness detection module are used to perform definition and brightness detection on the frame image, and the detection results are output to the interface display module and the record storage module, and the visual display and local storage are realized in combination with the Qt development platform; the local detection record file is read and annotated by the data annotation learning module, and the parameter threshold in the definition and brightness detection algorithm is adaptively adjusted according to the data annotation learning mechanism to optimize the detection effect. The present invention can accurately and efficiently perform picture definition and brightness detection for real-time video monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a video clarity and brightness detection method based on a data annotation learning mechanism, and belongs to the technical field of video detection. Background Art

[0002] With the rapid development and widespread application of video surveillance in various fields of society, people are paying more and more attention to the imaging quality of real-time monitoring video streams, and hope to conduct fast and accurate analysis and judgment through effective technical means.

[0003] There are many factors that cause video stream imaging quality problems, such as camera out of focus, hardware aging, transmission line failure, improper shooting scene layout, etc., which will significantly affect the video clarity and brightness, making it difficult to identify the person scene information in the video stream and unable to effectively analyze the picture content. Therefore, imaging quality detection of video streams is one of the research focuses of video surveillance.

[0004] In recent years, many literatures have studied methods for detecting the imaging quality of video streams, but most of them have not used past detection records to learn and optimize the algorithms, and only rely on pre-set parameters to perform detection, without the ability to learn from experience. For example, in the patent with patent number CN202010584013.3, inventor Lai Fangmin, and invention name "A video quality detection method, storage device and mobile terminal based on image processing", the image clarity is calculated by convolution, and the standard image and the video stream frame image are used for clarity comparison to determine whether the clarity of the frame image meets the standard. This detection method not only requires the acquisition of standard reference images in advance, but also cannot use past detection records to optimize the detection effect, and has certain limitations. Summary of the invention

[0005] In order to overcome the shortcomings of the prior art, the present invention proposes a video clarity and brightness detection method based on a data annotation learning mechanism to realize clarity, brightness detection and visual display of monitoring video streams, and improve the detection effect through a data annotation learning mechanism.

[0006] The technical solution adopted by the present invention is as follows:

[0007] A video clarity and brightness detection method based on a data annotation learning mechanism is implemented by a real-time video monitoring system, the system comprising a video stream acquisition module, a frame skipping acquisition module, a clarity detection module, a brightness detection module, an interface display module, a recording storage module and a data annotation learning module; the video stream acquisition module is connected to the frame skipping acquisition module to capture the real-time video stream shot by a camera and extract the frame image to be detected, wherein the video stream is transmitted to a computer via a USB interface; the output end of the frame skipping acquisition module is connected to the clarity detection module and the brightness detection module to respectively perform clarity and brightness detection on the frame image; the output ends of the clarity detection module and the brightness detection module They are all connected to the interface display module and the record storage module. By using Qt for visual interface development, the QtXlsxWriter library is called to operate Excel files to achieve visual display and local storage of detection results; the record storage module is connected to the data annotation learning module, manual annotation is performed according to the annotation rules, and the QtXlsxWriter library is called to operate Excel files to achieve reading and annotation of local detection record files; the output end of the data annotation learning module is connected to the clarity detection module and the brightness detection module, and the threshold parameters in the algorithm are adaptively adjusted through the data annotation learning mechanism to improve the detection effect. The specific steps of this method are as follows:

[0008] 1) Video stream acquisition

[0009] Use the camera to monitor and shoot the specified scene in real time, and transmit the video stream to the computer through the USB interface. In the video stream acquisition module, call the video processing function in the OpenCV library to capture the real-time video stream, and set the picture size and shooting frame rate according to the camera factory parameters;

[0010] 2) Skip frames to collect the image of the frame to be detected

[0011] In order to reduce the amount of system operations and improve detection efficiency, it is necessary to perform frame skipping on the video stream at a fixed time interval, and obtain the frame image F to be detected through the frame skipping acquisition module; combined with real-time detection requirements and operation efficiency, the frame skipping interval t gap The calculation formula is expressed as:

[0012]

[0013] Among them, f video The frame rate of the current video stream, in frames per second;

[0014] 3) Video clarity detection

[0015] a. The clarity detection module performs grayscale transformation on the frame image F to be detected to obtain a grayscale image X to be tested;

[0016] b. Perform Gaussian filtering on the image to be tested X, set the filter template size to 7×7 pixels, the mean to 0, and the variance to 4, and obtain the reference image Y;

[0017] c. Use the Sobel operator to perform gradient calculation on the image to be tested X and the reference image Y to obtain the corresponding gradient image to be tested X' and the reference gradient image Y'. The calculation formula is as follows:

[0018]

[0019]

[0020] Among them, "*" represents the convolution operation, "abs()" represents the operation of taking the absolute value of all elements in the matrix, and the symbol "[]" is used to represent a two-dimensional matrix;

[0021] d. Divide the images X, Y, X' and Y' into M 8×8 pixel blocks using the same sliding block method. The sliding step between blocks is set to 8 pixels. The corresponding image block is denoted by x k ,y k 、x k ' and y k ', where k = 1, 2, ..., M;

[0022] e. Calculate the image blocks x separately k ,y k 、x k ' and y k The mean of ' is calculated as:

[0023]

[0024]

[0025]

[0026]

[0027] in, and They are image blocks x k ,y k 、x k ' and y k 'The mean value;

[0028] f. Calculate the image blocks x separately k ' and y k The variance of ' and the covariance between image blocks are calculated as follows:

[0029]

[0030]

[0031]

[0032] in, and They are image blocks x k ',y k ''s variance, and the covariance between the two;

[0033] g. Calculate image block x k and k The brightness comparison value L(x k ,y k ), the formula is as follows:

[0034]

[0035] Among them, C 1 is the brightness constant;

[0036] h. Calculate image block x k ' and y k ' Gradient contrast comparison value C g (x k ',y k '), the formula is as follows:

[0037]

[0038] Among them, C 2 is the gradient contrast constant;

[0039] i. Calculate the image block x k ' and y k 'The gradient structure information comparison value S g (x k ',y k '), the formula is as follows:

[0040]

[0041] Among them, C 3 is the gradient structure information constant;

[0042] j. Calculate image block x k and k The gradient structure similarity GSSIM(x k ,y k ), the formula is as follows:

[0043] GSSIM(x k ,y k )=[L(x k ,y k)] α [C g (x k ',y k ')] β [S g (x k ',y k ')] γ

[0044] Among them, α, β and γ are the weight coefficients corresponding to the brightness comparison value, gradient contrast comparison value and gradient structure information comparison value respectively;

[0045] Let α=β=γ=1, C 3 =C 2 / 2, we get the simplified formula of gradient structure similarity, which is expressed as:

[0046]

[0047] k. Calculate the average gradient structural similarity MGSSIM(X,Y) of the image to be tested X and the reference image Y. The formula is as follows:

[0048]

[0049] l. Set the clarity detection threshold Th sharpness , if MGSSIM(X,Y)<Th sharpness , determine whether the clarity of the frame image F to be detected meets the standard; if MGSSIM(X,Y)≥Th sharpness , it is determined that the clarity of the frame image F to be detected does not meet the standard;

[0050] 4) Video brightness detection

[0051] a. The brightness detection module converts the frame image F to be detected from the red, green, and blue color mode to the chroma, saturation, and brightness color mode, and extracts the pixel value corresponding to the V channel, that is, the brightness value corresponding to the pixel point in the image;

[0052] b. Calculate the average brightness μ of the frame image F to be detected V , the formula is as follows:

[0053]

[0054] Where m and n are the number of pixel rows and columns of image F, respectively; V(i,j) is the brightness value corresponding to the pixel located in the i-th row and j-th column of image F;

[0055] c. Set the brightness detection upper limit threshold Th up and the lower threshold Th down , if Th down <μ V <Thup , determine that the brightness of the frame image F to be detected meets the standard; if μ V ≤Th down , determine that the brightness of the frame image F to be detected is too low; if μ V ≥Th up , determine that the brightness of the frame image F to be detected is too high;

[0056] 5) Use Qt for visual interface development

[0057] a. Using the multi-thread mechanism in Qt through the interface display module, design the video stream playback and acquisition sub-thread PlayerThread to achieve video stream acquisition and parameter setting, and realize frame skipping acquisition of the frame image to be detected;

[0058] b. Design the video clarity detection sub-thread SharpnessThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, perform clarity detection, and present the detection results to the visual interface;

[0059] c. Design the video brightness detection sub-thread BrightnessThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, perform brightness detection, and present the detection results to the visual interface;

[0060] d. Design the detection record storage sub-thread SaveThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, and at the same time receive the clarity and brightness detection results sent by the SharpnessThread sub-thread and the BrightnessThread sub-thread, as the detection record of the current video stream, and store it in the local folder in the form of an Excel file;

[0061] e. Design the data annotation learning sub-thread LearnThread to read the local detection record Excel file with data annotation, and combine the data annotation learning mechanism to realize the clarity detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down Adaptive adjustment of

[0062] f. Use QtCreator to draw a visual graphical interface, set the video stream playback window, clarity and brightness detection result display frame, and realize real-time playback of the video stream and display of detection results;

[0063] 6) Test record storage

[0064] a. Use the QXlsx::Document function provided by the QtXlsxWriter library in the record storage module to create an Excel file in a local folder, using today's date as the file name;

[0065] b. Use the QXlsx::write function provided by the QtXlsxWriter library to create three columns of items in the Excel table, namely "Frame Image", "Clarity Detection Result" and "Brightness Detection Result";

[0066] c. Use the QXlsx::insertImage function provided by the QtXlsxWriter library to insert the frame image F to be detected into the column where the form item "Frame Image" is located;

[0067] d. Use the QXlsx::write function provided by the QtXlsxWriter library to insert the clarity and brightness detection results of the frame image F to be detected into the columns where the form items "clarity detection result" and "brightness detection result" are located respectively;

[0068] e. Take a frame image F to be detected and its corresponding clarity and brightness detection results as a detection record, and use the QXlsx::saveAs function provided by the QtXlsxWriter library to save all detection records inserted into the Excel table;

[0069] 7) Data annotation learning

[0070] a. Use the data annotation learning module to set the clarity annotation rules for the test records stored in the local Excel file: "TU", the clarity test results meet the standard, but the actual visual evaluation does not meet the standard; "FN", the clarity test results do not meet the standard, but the actual visual evaluation meets the standard;

[0071] b. Set the brightness labeling rules: "TL", the brightness test result meets the standard, but the actual visual assessment is too dark; "TH", the brightness test result meets the standard, but the actual visual assessment is too bright; "LT", the brightness test result is too dark, but the actual visual assessment meets the standard; "HT", the brightness test result is too bright, but the actual visual assessment meets the standard;

[0072] c. Open the generated local Excel file and add two columns of items in the Excel table, namely "clarity labeling" and "brightness labeling";

[0073] d. Perform manual visual evaluation on each test record in the Excel table, add annotation symbols to the columns of "clarity annotation" and "brightness annotation" in the form items according to the clarity and brightness annotation rules, and save the annotated Excel file;

[0074] e. Use the QXlsx::Document function provided by the QtXlsxWriter library to read the marked Excel file;

[0075] f. Use the QXlsx::Cell function provided by the QtXlsxWriter library to count the number of each annotation symbol ("TU", "FN", "TL", "TH", "LT", "HT") in the columns where the form items "clarity annotation" and "brightness annotation" are located;

[0076] g. Use the SQL control in Qt to create a database form LearnTable and set the form items "Sharpness", "Brightness_Up" and "Brightness_Down" to store the sharpness detection tag values ​​Tab respectively. sharpness , Brightness detection upper limit mark value Tab up and lower limit tag value Tab down , the calculation formula is as follows:

[0077] Tab sharpness =N FN -N TU

[0078] Tab up =N HT -N TH

[0079] Tab down =N TL -N LT

[0080] Among them, N FN 、N TU 、N HT 、N TH 、N TL 、N LT The statistical quantities marked with symbols “FN”, “TU”, “HT”, “TH”, “TL” and “LT” respectively;

[0081] h. Adaptively adjust and update the definition detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down , the update method is as follows:

[0082]

[0083]

[0084]

[0085] Wherein, “:=” is the update iteration operator, and R is the tag coefficient, which is used to adjust the weight of the tag value;

[0086] i. Update the clarity detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down Applied to the clarity and brightness detection of the current video stream.

[0087] The OpenCV is a cross-platform computer vision and machine learning software library released under the Apache 2.0 license (open source), and can run on Linux, Windows, Android, and Mac OS operating systems.

[0088] The Qt described above is a cross-platform C++ graphical user interface application development framework developed by QT Company in 1991, which can be used to develop GUI programs.

[0089] The QtXlsxWriter library is an open source program runtime library that can cooperate with Qt to implement operations such as reading / writing, creating / deleting Excel files.

[0090] The beneficial effects of the present invention are: providing a video clarity and brightness detection method based on a data annotation learning mechanism, which uses Qt to develop a graphical interface, performs clarity and brightness detection on a monitoring video stream, realizes a visual display of the detection results, and adaptively updates and adjusts algorithm parameters through a data annotation learning mechanism, thereby further optimizing the detection effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0091] Figure 1 Schematic diagram of system connection of the method of the present invention. DETAILED DESCRIPTION

[0092] The present invention will be further described below with reference to the accompanying drawings and embodiments, but is not limited thereto.

[0093] Example:

[0094] A video clarity and brightness detection method based on data annotation learning mechanism is implemented by a real-time video monitoring system, such as Figure 1As shown, the system includes a video stream acquisition module, a frame skipping acquisition module, a clarity detection module, a brightness detection module, an interface display module, a record storage module and a data annotation learning module; the video stream acquisition module is connected to the frame skipping acquisition module to capture the real-time video stream shot by the camera and extract the frame image to be detected, wherein the video stream is transmitted to the computer through the USB interface; the output end of the frame skipping acquisition module is connected to the clarity detection module and the brightness detection module, and the clarity and brightness of the frame image are detected respectively; the output ends of the clarity detection module and the brightness detection module are connected to the interface display module and the record storage module, and the visual interface is developed by using Qt, and the QtXlsxWriter library is called to operate the Excel file to realize the visual display and local storage of the detection results; the record storage module is connected to the data annotation learning module, and manual annotation is performed through the annotation rules, and the QtXlsxWriter library is called to operate the Excel file to realize the reading and annotation of the local detection record file; the output end of the data annotation learning module is connected to the clarity detection module and the brightness detection module, and the threshold parameters in the algorithm are adaptively adjusted through the data annotation learning mechanism to improve the detection effect. The specific steps of the method are as follows:

[0095] 1) Video stream acquisition

[0096] Use the camera to monitor and shoot the specified scene in real time, and transmit the video stream to the computer through the USB interface. In the video stream acquisition module, call the video processing function in the OpenCV library to capture the real-time video stream, and set the picture size and shooting frame rate according to the camera factory parameters;

[0097] 2) Skip frames to collect the image of the frame to be detected

[0098] In order to reduce the amount of system operations and improve detection efficiency, it is necessary to perform frame skipping on the video stream at a fixed time interval, and obtain the frame image F to be detected through the frame skipping acquisition module; combined with real-time detection requirements and operation efficiency, the frame skipping interval t gap The calculation formula is expressed as:

[0099]

[0100] Among them, f video The frame rate of the current video stream, in frames per second;

[0101] 3) Video clarity detection

[0102] a. The clarity detection module performs grayscale transformation on the frame image F to be detected to obtain a grayscale image X to be tested;

[0103] b. Perform Gaussian filtering on the image to be tested X, set the filter template size to 7×7 pixels, the mean to 0, and the variance to 4, and obtain the reference image Y;

[0104] c. Use the Sobel operator to perform gradient calculation on the image to be tested X and the reference image Y to obtain the corresponding gradient image to be tested X' and the reference gradient image Y'. The calculation formula is as follows:

[0105]

[0106]

[0107] Among them, "*" represents the convolution operation, "abs()" represents the operation of taking the absolute value of all elements in the matrix, and the symbol "[]" is used to represent a two-dimensional matrix;

[0108] d. Divide the images X, Y, X' and Y' into M 8×8 pixel blocks using the same sliding block method. The sliding step between blocks is set to 8 pixels. The corresponding image block is denoted by x k ,y k 、x k ' and y k ', where k = 1, 2, ..., M;

[0109] e. Calculate the image blocks x separately k ,y k 、x k ' and y k The mean of ' is calculated as:

[0110]

[0111]

[0112]

[0113]

[0114] in, and They are image blocks x k ,y k 、x k ' and y k 'The mean value;

[0115] f. Calculate the image blocks x separately k ' and y k The variance of ' and the covariance between image blocks are calculated as follows:

[0116]

[0117]

[0118]

[0119] in, and They are image blocks x k ',y k ''s variance, and the covariance between the two;

[0120] g. Calculate image block x k and k The brightness comparison value L(x k ,y k ), the formula is as follows:

[0121]

[0122] Among them, C 1 is the brightness constant;

[0123] h. Calculate image block x k ' and y k ' Gradient contrast comparison value C g (x k ',y k '), the formula is as follows:

[0124]

[0125] Among them, C 2 is the gradient contrast constant;

[0126] i. Calculate the image block x k ' and y k 'The gradient structure information comparison value S g (x k ',y k '), the formula is as follows:

[0127]

[0128] Among them, C 3 is the gradient structure information constant;

[0129] j. Calculate image block x k and k The gradient structure similarity GSSIM(x k ,y k ), the formula is as follows:

[0130] GSSIM(x k ,y k )=[L(x k ,y k )] α [C g (x k ',yk ')] β [S g (x k ',y k ')] γ

[0131] Among them, α, β and γ are the weight coefficients corresponding to the brightness comparison value, gradient contrast comparison value and gradient structure information comparison value respectively;

[0132] Let α=β=γ=1, C 3 =C 2 / 2, we get the simplified formula of gradient structure similarity, which is expressed as:

[0133]

[0134] k. Calculate the average gradient structural similarity MGSSIM(X,Y) of the image to be tested X and the reference image Y. The formula is as follows:

[0135]

[0136] l. Set the clarity detection threshold Th sharpness , if MGSSIM(X,Y)<Th sharpness , determine whether the clarity of the frame image F to be detected meets the standard; if MGSSIM(X,Y)≥Th sharpness , it is determined that the clarity of the frame image F to be detected does not meet the standard;

[0137] 4) Video brightness detection

[0138] a. The brightness detection module converts the frame image F to be detected from the red, green, and blue color mode to the chroma, saturation, and brightness color mode, and extracts the pixel value corresponding to the V channel, that is, the brightness value corresponding to the pixel point in the image;

[0139] b. Calculate the average brightness μ of the frame image F to be detected V , the formula is as follows:

[0140]

[0141] Where m and n are the number of pixel rows and columns of image F, respectively; V(i,j) is the brightness value corresponding to the pixel located in the i-th row and j-th column of image F;

[0142] c. Set the brightness detection upper limit threshold Th up and the lower threshold Th down , if Th d o wn <μ V <Th up , determine that the brightness of the frame image F to be detected meets the standard; if μV ≤Th down , determine that the brightness of the frame image F to be detected is too low; if μ V ≥Th up , determine that the brightness of the frame image F to be detected is too high;

[0143] 5) Use Qt for visual interface development

[0144] a. Using the multi-thread mechanism in Qt through the interface display module, design the video stream playback and acquisition sub-thread PlayerThread to achieve video stream acquisition and parameter setting, and realize frame skipping acquisition of the frame image to be detected;

[0145] b. Design the video clarity detection sub-thread SharpnessThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, perform clarity detection, and present the detection results to the visual interface;

[0146] c. Design the video brightness detection sub-thread BrightnessThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, perform brightness detection, and present the detection results to the visual interface;

[0147] d. Design the detection record storage sub-thread SaveThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, and at the same time receive the clarity and brightness detection results sent by the SharpnessThread sub-thread and the BrightnessThread sub-thread, as the detection record of the current video stream, and store it in the local folder in the form of an Excel file;

[0148] e. Design the data annotation learning sub-thread LearnThread to read the local detection record Excel file with data annotation, and combine the data annotation learning mechanism to realize the clarity detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down Adaptive adjustment of

[0149] f. Use QtCreator to draw a visual graphical interface, set the video stream playback window, clarity and brightness detection result display frame, and realize real-time playback of the video stream and display of detection results;

[0150] 6) Test record storage

[0151] a. Use the QXlsx::Document function provided by the QtXlsxWriter library in the record storage module to create an Excel file in a local folder, using today's date as the file name;

[0152] b. Use the QXlsx::write function provided by the QtXlsxWriter library to create three columns of items in the Excel table, namely "Frame Image", "Clarity Detection Result" and "Brightness Detection Result";

[0153] c. Use the QXlsx::insertImage function provided by the QtXlsxWriter library to insert the frame image F to be detected into the column where the form item "Frame Image" is located;

[0154] d. Use the QXlsx::write function provided by the QtXlsxWriter library to insert the clarity and brightness detection results of the frame image F to be detected into the columns where the form items "clarity detection result" and "brightness detection result" are located respectively;

[0155] e. Take a frame image F to be detected and its corresponding clarity and brightness detection results as a detection record, and use the QXlsx::saveAs function provided by the QtXlsxWriter library to save all detection records inserted into the Excel table;

[0156] 7) Data annotation learning

[0157] a. Use the data annotation learning module to set the clarity annotation rules for the test records stored in the local Excel file: "TU", the clarity test results meet the standard, but the actual visual evaluation does not meet the standard; "FN", the clarity test results do not meet the standard, but the actual visual evaluation meets the standard;

[0158] b. Set the brightness labeling rules: "TL", the brightness test result meets the standard, but the actual visual assessment is too dark; "TH", the brightness test result meets the standard, but the actual visual assessment is too bright; "LT", the brightness test result is too dark, but the actual visual assessment meets the standard; "HT", the brightness test result is too bright, but the actual visual assessment meets the standard;

[0159] c. Open the generated local Excel file and add two columns of items in the Excel table, namely "clarity labeling" and "brightness labeling";

[0160] d. Perform manual visual evaluation on each test record in the Excel table, add annotation symbols to the columns of "clarity annotation" and "brightness annotation" in the form items according to the clarity and brightness annotation rules, and save the annotated Excel file;

[0161] e. Use the QXlsx::Document function provided by the QtXlsxWriter library to read the marked Excel file;

[0162] f. Use the QXlsx::Cell function provided by the QtXlsxWriter library to count the number of each annotation symbol ("TU", "FN", "TL", "TH", "LT", "HT") in the columns where the form items "clarity annotation" and "brightness annotation" are located;

[0163] g. Use the SQL control in Qt to create a database form LearnTable and set the form items "Sharpness", "Brightness_Up" and "Brightness_Down" to store the sharpness detection tag values ​​Tab respectively. sharpness , Brightness detection upper limit mark value Tab up and lower limit tag value Tab down , the calculation formula is as follows:

[0164] Tab sharpness =N FN -N TU

[0165] Tab up =N HT -N TH

[0166] Tab down =N TL -N LT

[0167] Among them, N FN 、N TU 、N HT 、N TH 、N TL 、N LT The statistical quantities marked with symbols “FN”, “TU”, “HT”, “TH”, “TL” and “LT” respectively;

[0168] h. Adaptively adjust and update the definition detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down , the update method is as follows:

[0169]

[0170]

[0171]

[0172] Wherein, “:=” is the update iteration operator, and R is the tag coefficient, which is used to adjust the weight of the tag value;

[0173] i. Update the clarity detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down Applied to the clarity and brightness detection of the current video stream.

Claims

1. A video clarity and brightness detection method based on a data annotation learning mechanism is implemented by a real-time video monitoring system, which includes a video stream acquisition module, a frame skipping acquisition module, a clarity detection module, a brightness detection module, an interface display module, a recording storage module and a data annotation learning module; The video stream acquisition module is connected to the frame skipping acquisition module to capture the real-time video stream shot by the camera and extract the frame image to be detected, wherein the video stream is transmitted to the computer end through the USB interface; The output end of the frame skipping acquisition module is connected to the clarity detection module and the brightness detection module to respectively detect the clarity and brightness of the frame image; The output ends of the clarity detection module and the brightness detection module are connected to the interface display module and the record storage module. By using Qt for visual interface development, the QtXlsxWriter library is called to operate Excel files to achieve visual display and local storage of detection results; the record storage module is connected to the data annotation learning module, and manual annotation is performed according to the annotation rules. The QtXlsxWriter library is called to operate Excel files to achieve reading and annotation of local detection record files; the output end of the data annotation learning module is connected to the clarity detection module and the brightness detection module, and the threshold parameters in the algorithm are adaptively adjusted through the data annotation learning mechanism to improve the detection effect. The specific steps of this method are as follows: 1) Video stream acquisition Use the camera to monitor and shoot the specified scene in real time, and transmit the video stream to the computer through the USB interface. In the video stream acquisition module, call the video processing function in the OpenCV library to capture the real-time video stream, and set the picture size and shooting frame rate according to the camera factory parameters; 2) Skip frames to collect the image of the frame to be detected The video stream is frame-skipped at a fixed time interval, and the frame image F to be detected is obtained by the frame-skipping acquisition module. In combination with the real-time detection requirements and operation efficiency, the frame-skipping interval t gap The calculation formula is expressed as: Among them, f video The frame rate of the current video stream, in frames per second; 3) Video clarity detection a. The clarity detection module performs grayscale transformation on the frame image F to be detected to obtain a grayscale image X to be tested; b. Perform Gaussian filtering on the image to be tested X, set the filter template size to 7×7 pixels, the mean to 0, and the variance to 4, and obtain the reference image Y; c. Use the Sobel operator to perform gradient calculation on the image to be tested X and the reference image Y to obtain the corresponding gradient image to be tested X' and the reference gradient image Y'. The calculation formula is as follows: Among them, "*" represents the convolution operation, "abs()" represents the operation of taking the absolute value of all elements in the matrix, and the symbol "[]" is used to represent a two-dimensional matrix; d. Divide the images X, Y, X' and Y' into M 8×8 pixel blocks using the same sliding block method. The sliding step between blocks is set to 8 pixels. The corresponding image block is denoted by x k ,y k 、x k ' and y k ', where k = 1, 2, ..., M; e. Calculate the image blocks x separately k ,y k 、x k ' and y k The mean of ' is calculated as: in, and They are image blocks x k ,y k 、x k ' and y k 'The mean value; f. Calculate the image blocks x separately k ' and y k The variance of ' and the covariance between image blocks are calculated as follows: in, and They are image blocks x k ',y k ', and the covariance between the two; g. Calculate image block x k and k The brightness comparison value L(x k ,y k ), the formula is as follows: Where C1 is the brightness constant; h. Calculate image block x k ' and y k ' Gradient contrast comparison value C g (x k ',y k '), the formula is as follows: Where C2 is the gradient contrast constant; i. Calculate the image block x k ' and y k 'The gradient structure information comparison value S g (x k ',y k '), the formula is as follows: Among them, C3 is the gradient structure information constant; j. Calculate image block x k and k The gradient structure similarity GSSIM(x k ,y k ), the formula is as follows: GSSIM(x k ,y k )=[L(x k ,y k )] α [C g (x k ',y k ')] β [S g (x k ',y k ')] γ Among them, α, β and γ are the weight coefficients corresponding to the brightness comparison value, gradient contrast comparison value and gradient structure information comparison value respectively; Let α=β=γ=1, C3=C2 / 2, and we can get the simplified formula of gradient structure similarity, which is expressed as: k. Calculate the average gradient structural similarity MGSSIM(X,Y) of the image to be tested X and the reference image Y. The formula is as follows: l. Set the clarity detection threshold Th sharpness , if MGSSIM(X, Y)<Th sharpness , determine whether the clarity of the frame image F to be detected meets the standard; if MGSSIM(X,Y)≥Th sharpness , it is determined that the clarity of the frame image F to be detected does not meet the standard; 4) Video brightness detection a. The brightness detection module converts the frame image F to be detected from the red, green, and blue color mode to the chroma, saturation, and brightness color mode, and extracts the pixel value corresponding to the V channel, that is, the brightness value corresponding to the pixel point in the image; b. Calculate the average brightness μ of the frame image F to be detected V , the formula is as follows: Where m and n are the number of pixel rows and columns of image F, respectively; V(i,j) is the brightness value corresponding to the pixel located in the i-th row and j-th column of image F; c. Set the brightness detection upper limit threshold Th up and the lower threshold Th down , if Th down <μ V <Th up , determine that the brightness of the frame image F to be detected meets the standard; if μ V ≤Th down , determine that the brightness of the frame image F to be detected is too low; if μ V ≥Th up , it is determined that the brightness of the frame image F to be detected is too high; 5) Use Qt for visual interface development a. Using the multi-thread mechanism in Qt through the interface display module, design the video stream playback and acquisition sub-thread PlayerThread to achieve video stream acquisition and parameter setting, and realize frame skipping acquisition of the frame image to be detected; b. Design the video clarity detection sub-thread SharpnessThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, perform clarity detection, and present the detection results to the visual interface; c. Design the video brightness detection sub-thread BrightnessThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, perform brightness detection, and present the detection results to the visual interface; d. Design the detection record storage sub-thread SaveThread, which is used to receive the frame image to be detected sent by the PlayerThread sub-thread, and at the same time receive the clarity and brightness detection results sent by the SharpnessThread sub-thread and the BrightnessThread sub-thread, as the detection record of the current video stream, and store it in the local folder in the form of an Excel file; e. Design the data annotation learning sub-thread LearnThread to read the local detection record Excel file with data annotation, and combine the data annotation learning mechanism to realize the clarity detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down Adaptive adjustment of f. Use QtCreator to draw a visual graphical interface, set the video stream playback window, clarity and brightness detection result display frame, and realize real-time playback of the video stream and display of detection results; 6) Test record storage a. Use the QXlsx::Document function provided by the QtXlsxWriter library in the record storage module to create an Excel file in a local folder, using today's date as the file name; b. Use the QXlsx::write function provided by the QtXlsxWriter library to create three columns of items in the Excel table, namely "frame image", "clarity detection result" and "brightness detection result"; c. Use the QXlsx::insertImage function provided by the QtXlsxWriter library to insert the frame image F to be detected into the column where the form item "Frame Image" is located; d. Use the QXlsx::write function provided by the QtXlsxWriter library to insert the clarity and brightness detection results of the frame image F to be detected into the columns where the form items "clarity detection results" and "brightness detection results" are located; e. Take a frame image F to be detected and its corresponding clarity and brightness detection results as a detection record, and use the QXlsx::saveAs function provided by the QtXlsxWriter library to save all detection records inserted into the Excel table; 7) Data annotation learning a. Use the data annotation learning module to set the clarity annotation rules for the test records stored in the local Excel file: "TU", the clarity test results meet the standard, but the actual visual evaluation does not meet the standard; "FN", the clarity test results do not meet the standard, but the actual visual evaluation meets the standard; b. Set the brightness labeling rules: "TL", the brightness test result meets the standard, but the actual visual assessment is too dark; "TH", the brightness test result meets the standard, but the actual visual assessment is too bright; "LT", the brightness test result is too dark, but the actual visual assessment meets the standard; "HT", the brightness test result is too bright, but the actual visual assessment meets the standard; c. Open the generated local Excel file and add two columns of items in the Excel table, namely "clarity labeling" and "brightness labeling"; d. Perform manual visual evaluation on each test record in the Excel table, add annotation symbols to the columns of "clarity annotation" and "brightness annotation" in the form items according to the clarity and brightness annotation rules, and save the annotated Excel file; e. Use the QXlsx::Document function provided by the QtXlsxWriter library to read the marked Excel file; f. Use the QXlsx::Cell function provided by the QtXlsxWriter library to count the number of each annotation symbol "TU", "FN", "TL", "TH", "LT", and "HT" in the columns where the form items "clarity annotation" and "brightness annotation" are located; g. Use the SQL control in Qt to create a database form LearnTable and set the form items "Sharpness", "Brightness_Up" and "Brightness_Down" to store the sharpness detection tag values ​​Tab respectively. sharpness , Brightness detection upper limit mark value Tab up and lower limit tag value Tab down , the calculation formula is as follows: Tab sharpness =N FN -N TU Tab up =N HT -N TH Tab down =N TL -N LT Among them, N FN 、N TU 、N HT 、N TH 、N TL 、N LT The statistical quantities are marked with symbols "FN", "TU", "HT", "TH", "TL", and "LT" respectively; h. Adaptively adjust and update the definition detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down , the update method is as follows: Among them, ":=" is the update iteration operator, and R is the marking coefficient, which is used to adjust the weight of the marking value; i. Update the clarity detection threshold Th sharpness , brightness detection upper limit threshold Th up and the lower threshold Th down Applied to the clarity and brightness detection of the current video stream.