Picture quality detection method and device, electronic equipment, storage medium and product
By determining the lens scene categories of surveillance equipment and performing grayscale processing, combined with genetic algorithm and Fourier transform technology, the problem of low accuracy in picture quality assessment of surveillance equipment in different scenarios is solved, and it is realized in general knowledge scenarios. Efficient picture quality detection.
Patent Information
- Application Number
- CN202410905553.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-10-08
AI Technical Summary
In the existing technology, the picture quality assessment of monitoring equipment is easily interfered by changes in different scenes, resulting in low detection accuracy, making it difficult to achieve accurate imaging picture quality detection in general-purpose scenarios.
By obtaining the current frame lens image of the camera to be detected, the lens scene category is determined, and grayscale processing is performed based on the grayscale parameters of the category. Then the grayscale image is inspected for image quality, and a genetic algorithm is used to optimize the weighted coefficient combination. Combined with two-dimensional discrete Fourier transform, centering and high-pass filtering processing, the average amplitude of the inverse transformed image is calculated to judge the picture quality.
It achieves accurate detection of surveillance imaging picture quality in general-purpose scenarios, improves detection efficiency and accuracy, avoids the interference of different scene changes, and can determine picture abnormalities by relying only on a single frame of image.
Smart Images

Figure CN118747747A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a picture quality detection method, device, electronic equipment, storage medium and product. Background Art
[0002] With the popularization of monitoring equipment, the daily maintenance and management of large quantities of monitoring equipment has become a major problem plaguing the industry. In public governance scenarios, monitoring equipment is mostly deployed in outdoor street scenes. Cameras in such scenes are prone to problems such as spider webs, leaf occlusions, and malicious human occlusions. For such problems, manual inspections are usually used to troubleshoot, but with the popularization of visual algorithms, such problems can be detected through image quality assessment algorithms.
[0003] However, the image quality assessment of monitoring equipment in multiple scenes will be affected by the changes in different scenes. The monitoring environment of different scenes has different light conditions, background noise and scene characteristics. Therefore, how to detect the image quality of monitoring imaging in general scenes is an urgent problem to be solved. Summary of the invention
[0004] The present invention provides a picture quality detection method, device, electronic device, storage medium and product, which are used to solve the defect in the prior art that picture quality assessment may be disturbed by the changes of different scenes, resulting in low detection accuracy, and realize accurate detection of monitoring imaging picture quality of general scenes.
[0005] The present invention provides a picture quality detection method, comprising: Obtaining a current frame lens image of the camera to be detected, and determining a lens scene category of the current frame lens image; According to the grayscale parameters corresponding to the lens scene category of the current frame lens image, the current frame lens image is grayscaled to obtain a grayscale image corresponding to the current frame lens image; An image quality detection is performed on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera.
[0006] According to a picture quality detection method provided by the present invention, the step of determining the shot scene category of the current frame shot image comprises: Get the lens label and lens name of the camera; If the shot tag contains a specified shot scene category, determining the specified scene category as the shot scene category of the current frame shot image; If the lens tag does not contain a designated lens scene category, the lens name is subjected to text scene classification, the current frame lens image is subjected to image scene classification, and the lens scene category of the current frame lens image is determined according to the text scene classification result and the image scene classification result.
[0007] According to a picture quality detection method provided by the present invention, the grayscale parameter corresponding to each shot scene category is determined by the following method: For real lens images under each lens scene category, a plurality of individuals are randomly generated to obtain an initial population; the individuals are weighted coefficient combinations of a plurality of color components; Iteration is started by taking the initial population as the current population, and a genetic operation is performed on the current population to obtain a next generation population, until the accuracy of the image obtained by each weighted coefficient combination in the next generation population reaches an accuracy threshold, and the iteration is stopped and the optimal weighted coefficient combination is determined, and the optimal weighted coefficient combination is used as the grayscale parameter corresponding to the lens scene category.
[0008] According to a picture quality detection method provided by the present invention, the step of performing a genetic operation on the current population to obtain a next generation population includes: According to the real lens image, the accuracy of the image obtained by combining each weighted coefficient in the current population is calculated to obtain the fitness of each individual; Based on the fitness of each individual, performing a selection operation on the current population; Perform crossover and mutation operations on the population after the selection operation to obtain the next generation population.
[0009] According to a picture quality detection method provided by the present invention, the image quality detection is performed on the grayscale image corresponding to the current frame lens image to determine the picture quality detection result of the camera, including: Perform a two-dimensional discrete Fourier transform on the grayscale image corresponding to the current frame lens image to obtain a spectrum diagram; Centralizing the spectrum graph to obtain a centralized spectrum graph; Performing high-pass filtering on the centralized spectrum graph to obtain a filtered spectrum graph; Performing inverse Fourier transform on the filtered spectrum to obtain an inverse transform image; The picture quality detection result of the camera is determined according to the average amplitude of the inverse transformed image.
[0010] According to a picture quality detection method provided by the present invention, determining the picture quality detection result of the camera according to the average amplitude of the inverse transformation image includes: Calculating the frequency amplitude value of each position of the inverse transformation image according to the real part and the imaginary part of the inverse transformation image; Calculating the average amplitude of the inverse transformation image according to the frequency amplitude value of each position of the inverse transformation image; If the average amplitude is greater than a preset amplitude threshold, it is determined that the image quality detection result of the camera is normal; If the average amplitude is less than or equal to the preset amplitude threshold, it is determined that the image quality detection result of the camera is abnormal.
[0011] The present invention also provides a picture quality detection device, comprising: An acquisition module is used to acquire a current frame lens image of the camera to be detected and determine a lens scene category of the current frame lens image; A grayscale module, used to perform grayscale processing on the current frame lens image according to the grayscale parameters corresponding to the lens scene category of the current frame lens image, so as to obtain a grayscale image corresponding to the current frame lens image; The detection module is used to perform image quality detection on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera.
[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned picture quality detection methods is implemented.
[0013] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the image quality detection method described in any one of the above is implemented.
[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned picture quality detection methods.
[0015] The picture quality detection method, device, electronic device, storage medium and product provided by the present invention can determine the picture quality detection result of the camera by determining the lens scene category of the current frame lens image, graying the current frame lens image according to the graying parameters corresponding to the lens scene category of the current frame lens image, obtaining the gray image corresponding to the current frame lens image, and performing image quality detection on the gray image corresponding to the current frame lens image. Compared with the related art method of judging whether the lens picture is abnormal by changing the image state of multiple frames, the present invention only relies on a single frame image to judge whether the lens picture is abnormal, is not affected by the changes of different scenes, is suitable for detecting the imaging picture quality of general scenes, and is conducive to improving the efficiency and accuracy of picture quality detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 This is one of the flow charts of the picture quality detection method provided by the embodiment of the present invention.
[0018] Figure 2 It is a schematic diagram of an image processing flow provided by an embodiment of the present invention.
[0019] Figure 3 It is a schematic diagram of determining a shot scene category provided by an embodiment of the present invention.
[0020] Figure 4 This is one of the flowcharts of determining grayscale parameters corresponding to a shot scene category provided by an embodiment of the present invention.
[0021] Figure 5 This is the second flowchart of determining the grayscale parameters corresponding to the lens scene category provided by the embodiment of the present invention.
[0022] Figure 6 It is a schematic diagram of the process of image quality detection provided by an embodiment of the present invention.
[0023] Figure 7 This is the second flow chart of the picture quality detection method provided by the embodiment of the present invention.
[0024] Figure 8 It is a structural schematic diagram of a picture quality detection device provided by an embodiment of the present invention.
[0025] Fig. 9 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0027] Regarding the issue of whether the surveillance imaging screen is blocked, the current technical solutions are usually based on machine learning and deep learning classification models. Through artificial feature screening and convolutional network adaptive feature extraction, the classifier is trained to classify natural scene images into two categories: whether they are blocked or not. In addition, classic algorithms can also be used for judgment, such as using a threshold segmentation algorithm to calculate a large area of connected domains to determine whether the screen is blocked.
[0028] However, deep learning algorithms have high requirements for sample data volume and sample scene range. Since judging whether an image is occluded is not just classifying a single target or a single feature in the image, and occluders do not have uniform features, deep networks usually only perform well on training sets, but will generate a large number of false positives during actual use, which is the common overfitting phenomenon. In addition, deep learning has low hardware requirements for high-performance graphics processing units (GPUs) and the number of frames per second (FPS) of the detection image. Faced with the polling of hundreds of thousands of cameras on the video platform, it often consumes a lot of resources to meet the real-time requirements of detection.
[0029] Due to the premise of artificial features, classic algorithms often need to predict possible occlusion situations and summarize the common points when various occlusion situations occur. The sole use of the proportion of the connected domain of the picture to determine whether the picture is obscured works well in outdoor street scenes, but it is impossible to determine whether occlusion occurs when the indoor camera is aimed at a corridor wall, a lake, or an asphalt road on a highway viaduct.
[0030] In response to the above problems, the embodiments of the present invention only rely on a single frame image to determine whether there is an abnormality in the lens image, and are not affected by changes in different scenes. It is suitable for detecting the imaging picture quality of general scenes, which is beneficial to improving the efficiency and accuracy of picture quality detection.
[0031] Figure 1 FIG. 1 is a flow chart of a method for detecting image quality according to an embodiment of the present invention. Figure 1 The embodiment of the present invention provides a method for detecting picture quality, which may specifically include the following steps: Step 110: obtain a current frame lens image of the camera to be detected, and determine a lens scene category of the current frame lens image.
[0032] It should be noted that the execution subject of the picture quality detection method provided in the embodiment of the present invention may be an electronic device, a component in an electronic device, an integrated circuit or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a personal digital assistant (PDA), etc., and the non-mobile electronic device may be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present invention. The following embodiment of the present invention is described with the server as the execution subject.
[0033] Please refer to Figure 2 , Figure 2 It is a schematic diagram of an image processing flow provided by an embodiment of the present invention.
[0034] In an embodiment of the present invention, when a picture quality detection task is triggered, a stream pulling request can be initiated to pull the code stream of the camera to be detected, obtain video frames from the code stream for decoding, obtain original image frames, and scale the original image frames to adjust the image scale to a scale that can be used for image quality detection.
[0035] Specifically, the stream of the polled camera can be pulled from the media platform through the stream pulling service to obtain the image sequence F1, F2, ..., F n , n is the camera line. For the pictures in the image sequence, each picture can be scaled by the following formula: (1); Among them, I target (x`, y`) represents the pixel value in the target image (i.e. the scaled image), I orig (x, y) represents the pixel value in the original image (i.e., the image before scaling), W(x, y, x`, y`) represents the weight of the pixel (x, y) in the original image to the pixel (x`, y`) in the target image, and S represents the set of all pixels in the original image that may contribute to the pixel in the target image. The sum of all weights can be used for normalization.
[0036] At present, it is usually judged whether the lens picture is abnormal through the image state change of multiple frames, but such solutions require the system to keep the state of the camera picture when it is normal. In an embodiment of the present invention, after obtaining the zoomed image, the frame is cut through the frame cutting service, and the current frame lens image of the camera to be detected is obtained for grayscale and image quality detection, so that only a single frame image is needed to judge whether the lens picture taken by the camera is abnormal, without retaining the information that the camera picture is normal, and it can be deployed on the central processing unit (CPU) server, and the reasoning time of a single image is within 10 milliseconds, which can be transplanted to the low-computing chip at the edge of the camera.
[0037] In the embodiment of the present invention, after obtaining the current frame lens image of the camera to be detected, the lens information of the camera to be detected can be queried from the lens information database, so as to determine the lens scene category of the current frame lens image according to the lens information. The lens scene category may include kitchen lens, street view lens, indoor lens, high altitude lens, low resolution lens, etc.
[0038] Step 120 , grayscale processing is performed on the current frame lens image according to the grayscale parameters corresponding to the lens scene category of the current frame lens image to obtain a grayscale image corresponding to the current frame lens image.
[0039] Different lens scene categories correspond to different grayscale parameters. In the embodiment of the present invention, corresponding optimal grayscale parameters can be formulated in advance according to different lens scene categories. After determining the lens scene category of the current frame lens image, the corresponding optimal grayscale parameters are queried and the current frame lens image is grayscaled, so as to adjust the color space of the image to a color space that can be used for image quality detection, and obtain a grayscale image.
[0040] Step 130, performing image quality detection on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera.
[0041] The image quality detection results may include abnormal image results and normal image results. Among them, the abnormal image results may refer to abnormal problems such as the camera lens being blocked by foreign objects, the lens being out of focus, the lens being fogged, the lens being blurred by strong light, the lens being distorted, the screen being gray or black.
[0042] In the embodiment of the present invention, by performing image quality detection on the grayscale image corresponding to the single-frame lens image, it can be determined whether the image of the camera is abnormal.
[0043] After obtaining the current frame lens image of the camera to be detected, the embodiment of the present invention determines the lens scene category of the current frame lens image, performs grayscale processing on the current frame lens image according to the grayscale parameter corresponding to the lens scene category of the current frame lens image, obtains the grayscale image corresponding to the current frame lens image, and performs image quality detection on the grayscale image corresponding to the current frame lens image, so as to determine the image quality detection result of the camera. Compared with the related art method of judging whether the lens image is abnormal by changing the image state of multiple frames, the present invention only relies on a single frame image to judge whether the lens image is abnormal, is not affected by the changes of different scenes, is suitable for detecting the imaging image quality of general scenes, and is conducive to improving the efficiency and accuracy of image quality detection.
[0044] Based on any of the above embodiments, determining the shot scene category of the current frame shot image may specifically include: Step 111, obtaining the lens label and lens name of the camera; Step 112: if the shot tag contains a designated shot scene category, the designated scene category is determined as the shot scene category of the current frame shot image; Step 113, if the shot tag does not contain a designated shot scene category, text scene classification is performed on the shot name, image scene classification is performed on the current frame shot image, and the shot scene category of the current frame shot image is determined according to the text scene classification result and the image scene classification result.
[0045] Please refer to Figure 3 , Figure 3 It is a schematic diagram of determining a shot scene category provided by an embodiment of the present invention.
[0046] In an embodiment of the present invention, the server can extract structured data such as the lens name and lens tag corresponding to the lens ID from the lens information database according to the lens identification (ID) of the camera, and determine the lens scene category of the current frame lens image obtained through the frame capture service according to the lens tag and lens name. The lens tag can be determined according to the registration data submitted by the user when registering.
[0047] Specifically, it can be determined whether the lens tag contains one of the specified lens scenes such as kitchen lens, street view lens, indoor lens, high-altitude lens, low-resolution lens, etc. If the lens tag contains the specified lens scene category, the specified lens scene category is determined as the lens scene category of the current frame lens image.
[0048] If the shot tag does not contain the target shot scene category, a lightweight text scene classifier is used to perform language analysis on the shot name to obtain a text scene classification result, that is, a first confidence ranking result of various shot scene categories; a lightweight image scene classifier is used to perform image analysis on the current frame shot image to obtain an image scene classification result, that is, a second confidence ranking result of various shot scene categories. If the second confidences of various shot scene categories are similar, for example, the difference between the second confidences of two adjacently ranked shot scene categories is less than the first difference threshold, the first confidence and the second confidence of various shot scene categories can be weighted to obtain a final confidence score, and the shot scene category with the highest final confidence score is determined as the shot scene category of the current frame shot image. If the difference between the second confidences of the highest-ranked and second-highest-ranked shot scene categories is greater than the second difference threshold, the image scene classification result is used as the main factor, and the shot scene category with the highest second confidence ranking is determined as the shot scene category of the current frame shot image.
[0049] The image understanding and text understanding capabilities of the embodiments of the present invention do not need to use manual labeling to classify the lens scenes of images, which can avoid the problem of inconsistency between some cameras and the initial online scenes due to lens offset and reuse, and realize real-time updating of lens scene categories without being disturbed by changes in different scenes. It is suitable for detecting the imaging picture quality of general scenes, which is beneficial to improving the efficiency and accuracy of picture quality detection.
[0050] Figure 4 is one of the flow charts of determining the grayscale parameters corresponding to the lens scene category provided by the embodiment of the present invention. Based on any of the above embodiments, refer to Figure 4 , the grayscale parameters corresponding to each lens scene category can be determined by the following steps: Step 410, for each real lens image under each lens scene category, a plurality of individuals are randomly generated to obtain an initial population; the individuals are weighted coefficient combinations of a plurality of color components; Step 420, starting iteration with the initial population as the current population, performing genetic operations on the current population to obtain the next generation population, until the accuracy of the image obtained by each weighted coefficient combination in the next generation population reaches the accuracy threshold, stopping iteration and determining the optimal weighted coefficient combination, and using the optimal weighted coefficient combination as the grayscale parameter corresponding to the lens scene category.
[0051] Different lens scene categories have different corresponding optimal grayscale parameters. In the embodiment of the present invention, the optimal grayscale parameters corresponding to each lens scene category can be searched and determined in advance, so that after the current frame lens image of the camera to be detected is intercepted in real time, the corresponding optimal grayscale parameters can be directly determined according to the lens scene category of the current frame lens image, thereby shortening the reasoning time of a single frame image, which is conducive to improving the efficiency of picture quality detection.
[0052] Specifically, after obtaining a large number of real lens images under each lens scene category, the optimal solution of the following function can be solved: Y=a×R+b×G+c×B. Among them, Y is the calculated grayscale value, R, G, B are the values of the red, green and blue components respectively, and a, b, c correspond to the weighting coefficients of the red, green and blue components respectively. Under normal circumstances, the values of a, b, and c are based on the human visual perception sensitivity to different colors, and the default values are a=0.229, b=0.587, and c=0.114. In an embodiment of the present invention, in order to find grayscale parameters suitable for different scenes, an optimization algorithm genetic algorithm can be used to find the optimal weighting coefficient combination under different lens scene categories.
[0053] Please refer to Figure 5 , Figure 5 This is the second flow chart of determining the grayscale parameters corresponding to the lens scene category provided by the embodiment of the present invention.
[0054] In the embodiment of the present invention, a+b+c=1 can be limited, and n groups of weighted coefficient combinations consisting of a, b, and c can be initialized to randomly generate n individuals i1(a1, b1, c1), i2(a2, b2, c2), ..., i n (a n , b n , c n ) to obtain the initial population. The initial population can be used as the current population to start iteration, and the genetic operation can be performed on the current population to obtain the next generation population. When the accuracy of the image obtained by each weighted coefficient combination in the next generation population reaches the accuracy threshold, the iteration is stopped and the optimal weighted coefficient combination is determined, and the optimal weighted coefficient combination is used as the optimal grayscale parameter corresponding to the lens scene category. After completing the search using the optimization algorithm genetic algorithm, the optimal grayscale parameters corresponding to each lens scene category can be obtained as follows: Scene 1: A1, B1, C1; Scene 2: A2, B2, C2; ...; Scene n: A n , B n , C n .
[0055] In the related technologies for grayscale processing of images, the default "human eye" optimal parameters are usually used. However, grayscale is actually a color space mapping of the image. The grayscale parameters that are comfortable for the human eye cannot adapt to the models of all methods because the image features that the model focuses on are different from those of the human eye. The embodiment of the present invention uses an optimization algorithm genetic algorithm to adaptively search for the optimal grayscale parameters for different lens scene categories. Compared with the method of using the optimal parameters of the human eye to grayscale the image, it is beneficial to enhance the accuracy of single-frame image blur detection in general scenarios.
[0056] Based on any of the above embodiments, performing a genetic operation on the current population to obtain a next generation population may specifically include: Step 421, based on the real lens image, calculate the accuracy of the image obtained by combining each weighted coefficient in the current population to obtain the fitness of each individual; Step 422, performing a selection operation on the current population based on the fitness of each individual; Step 423, performing crossover operation and mutation operation on the population after the selection operation to obtain the next generation population.
[0057] Please continue to refer to Figure 5 , after obtaining n individuals i1(a1, b1, c1), i2(a2, b2, c2), ..., i n (a n , b n , c n ), the weighting coefficient of the real lens image can be adjusted based on each weighting coefficient combination to obtain a grayscale image obtained by each weighting coefficient combination. After obtaining the grayscale image obtained by each weighting coefficient combination, the image quality detector can be used to calculate the accuracy of the image obtained by each weighting coefficient combination in the current population compared to the real lens image, as the individual fitness f(i n ).
[0058] In an embodiment of the present invention, a roulette wheel selection method can be used to perform a selection operation on the current population. According to the fitness of each individual in the current population, a parent individual whose fitness is greater than a fitness threshold is selected from the current population to retain individuals with higher fitness. After performing the selection operation, a crossover operation can be performed to randomly perform multi-point crossover on individuals in the population so that the offspring individuals inherit multiple parent individual parameters. After performing the crossover operation, a mutation operation can be performed to randomly select graying parameters of some individuals in the population to change to obtain the next generation population.
[0059] After obtaining the next generation population, it is possible to detect whether the accuracy of the image obtained by each weighted coefficient combination in the next generation population reaches the accuracy threshold. If not, the iteration continues; if it reaches, the iteration stops, and the optimal weighted coefficient combination is determined as the grayscale parameter corresponding to the lens scene category.
[0060] Based on any of the above embodiments, the performing of image quality detection on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera may specifically include: Step 131, performing a two-dimensional discrete Fourier transform on the grayscale image corresponding to the current frame lens image to obtain a frequency spectrum; Step 132, performing centralization processing on the spectrum graph to obtain a centralized spectrum graph; Step 133, performing high-pass filtering on the centralized spectrum graph to obtain a filtered spectrum graph; Step 134, performing an inverse Fourier transform on the filtered spectrum to obtain an inverse transformed image; Step 135: Determine the image quality detection result of the camera according to the average amplitude of the inverse transformed image.
[0061] In the embodiment of the present invention, after grayscale processing is performed on the current frame lens image according to the optimal grayscale parameter corresponding to the lens scene category of the current frame lens image to obtain the corresponding grayscale image, image quality detection can be performed based on the grayscale image.
[0062] Please refer to Figure 6 , Figure 6 It is a schematic diagram of the process of image quality detection provided by an embodiment of the present invention.
[0063] Specifically, the grayscale image corresponding to the current frame lens image can be mapped from the spatial domain to the frequency domain through a two-dimensional discrete Fourier transform, so as to convert the image matrix corresponding to the grayscale image into a complex matrix to obtain a spectrum diagram, i.e., the Fourier transform result. The conversion formula can be as follows: (2); Among them, F(u, v) is a complex value in the frequency domain, which can represent the component of the image at the frequency (u, v); f(u, v) is the pixel value at the image coordinate (x, y) in the spatial domain; M and N are the horizontal and vertical dimensions of the image respectively; e is the natural logarithm, and i is the imaginary unit.
[0064] The spectrum diagram can be used to describe the amplitude and phase information of the signal at different frequency components (i.e., frequency domain amplitude and phase information). After obtaining the spectrum diagram, the spectrum diagram can be centered by rearranging the quadrants of the Fast Fourier Transform (FFT) result so that the low-frequency components (usually located in the corners in the FFT output) are moved to the center of the spectrum. The coordinate transformation formula is: (3); Among them, F centered (u`, v`) represents the frequency domain data after centering, F(u, v) is the original FFT result, u`=(uM / 2) mod M and v`=(vN / 2) mod N are the coordinates after centering. By centering, the low-frequency components (representing the overall trend of the image) are located in the center, and the high-frequency components (representing the details of the image) are distributed around.
[0065] After the spectrum is centered, the centered frequency domain can be high-pass filtered to remove low-frequency information (such as smooth areas) in the image and retain high-frequency details (such as edges). Specifically, high-pass filtering can be achieved by setting zeros in the central area of the frequency domain.
[0066] After removing the low-frequency components, the remaining components can be transformed from the frequency domain to the spatial domain using the inverse FFT transform (i.e., inverse centering) to obtain the inverse transformed image. The conversion formula is as follows: (4); Among them, f(x, y) is the pixel value in the spatial domain after inverse transformation, F(u, v) is the complex value in the frequency domain, M and N are the image sizes, e is the base of the natural logarithm, and i is the imaginary unit. Through the inverse FFT transform, the image processed in the frequency domain can be restored to its spatial domain form.
[0067] After performing inverse FFT transformation to obtain an inverse transformed image, the average amplitude of the inverse transformed image may be calculated, and the picture quality detection result of the camera may be determined according to the average amplitude of the inverse transformed image.
[0068] In the related art, some rely on deep learning methods to make image quality classifiers. However, this method requires the collection of a large amount of labeled sample data for classification, and deep learning has high requirements for scene limitations. The algorithm trained in a single scene often cannot be reused in a new scene, resulting in a lack of robustness in the method. The embodiment of the present invention relies on scene data to obtain the adaptive grayscale parameters corresponding to different lens scene categories, and then extracts image smoothing features through frequency domain transformation. Starting from the general features of abnormal situations such as blur, it is not limited to scenes and data, and can achieve universal quality detection.
[0069] The embodiment of the present invention not only uses the classic Fourier transform algorithm, but also further improves the accuracy of image quality detection through operations such as spectrum centering and low-frequency area zeroing, and can better adapt to picture quality detection in different scenarios and realize universal quality detection.
[0070] Based on any of the above embodiments, determining the picture quality detection result of the camera according to the average amplitude of the inverse transformation image may specifically include: Step 1351, calculating the frequency amplitude value of each position of the inverse transformation image according to the real part and the imaginary part of the inverse transformation image; Step 1352, calculating the average amplitude of the inverse transformation image according to the frequency amplitude value of each position of the inverse transformation image; Step 1353, if the average amplitude is greater than a preset amplitude threshold, determining that the image quality detection result of the camera is normal; Step 1354: If the average amplitude is less than or equal to the preset amplitude threshold, it is determined that the image quality detection result of the camera is abnormal.
[0071] Please continue to refer to Figure 6 After the inverse FFT transformation, the amplitude spectrum can be calculated for the inverse transformed image. The amplitude spectrum provides the intensity information of the frequency component of each point in the image. Specifically, the frequency amplitude value of each position of the inverse transformed image can be calculated based on the real part and imaginary part of the inverse transformed image. The formula can be as follows: (5); Among them, M(x, y) represents the amplitude value at the position (x, y), f`(x, y) is the image after inverse FFT, Re[f`(x, y)] and Im[f`(x, y)] represent the real part and imaginary part of f`(x, y), respectively.
[0072] After obtaining the frequency-amplitude spectrum of each pixel, the average amplitude of the inverse transformed image can be calculated. The formula can be as follows: (6); in, Represents the average amplitude of the image. M(x, y) is the amplitude value at position (x, y), and M and N are the width and height of the image, respectively. By calculating the average amplitude, you can get the overall information about the frequency content of the image, and compare the average amplitude of the image with the preset amplitude threshold. Based on the comparison result, you can determine whether there is any abnormality in the single-frame lens image.
[0073] If the average amplitude of the image is greater than the preset amplitude threshold, it means that the image is clear, and the camera's picture quality detection result is determined to be normal; if the average amplitude of the image is less than or equal to the preset amplitude threshold, it means that the image is blurred or has other problems, and the camera's picture quality detection result is determined to be abnormal.
[0074] The embodiment of the present invention measures the quality of an image by using the average amplitude value of the image in the frequency domain, maps the low-frequency components of the smooth area of the image represented by the spatial domain to the frequency domain, and performs correlation calculations with the high-frequency components representing the image details, and finally obtains a score that can measure the image quality to determine the picture quality detection result of the camera, thereby realizing clear and blurred classification of the image.
[0075] Figure 7 This is a second flow chart of the picture quality detection method provided by an embodiment of the present invention. Figure 7 When the image quality detection task is triggered, a streaming request can be raised from the monitoring media platform, and the image can be adjusted to a color space and scale that can be accepted by the frequency domain conversion through the preprocessing task. Subsequently, the image can be converted and processed in the frequency domain to obtain the spectrum result, and the inverse transformation result can be obtained by inverse centering, and the average amplitude of the image can be calculated to obtain the energy representation value that can reflect the high-frequency area, so as to judge the loss of image details and edge information based on the average amplitude of the image, and to judge whether the image has abnormal conditions such as occlusion and blur.
[0076] In an embodiment of the present invention, the code stream of the camera to be detected can be first pulled, and the video frame can be extracted from the code stream and decoded to obtain the original image frame, and the original image frame can be scaled and pre-processed and gray-scaled to adjust the image scale to a color space and scale that can be used for image quality detection, thereby completing image processing.
[0077] After obtaining a single-frame grayscale image, the grayscale image can be mapped from the spatial domain to the frequency domain to analyze the image according to the frequency domain. Specifically, the grayscale image can be spectrally centered, the spectrum quadrants can be exchanged to rearrange the quadrants of the FFT result, and then high-pass filtering can be performed to zero out the low-frequency area, and finally an inverse FFT transform (i.e., inverse centering) can be performed to visualize the amplitude spectrum to obtain an inversely transformed image, thereby completing the frequency domain conversion and processing of the single-frame grayscale image.
[0078] After obtaining the inverse transformed image, the amplitude spectrum can be calculated according to the inverse transform result, and the average amplitude of the image can be calculated, and the average amplitude of the image can be compared with a preset amplitude threshold, and whether there is any abnormality in the single-frame lens image can be determined according to the comparison result.
[0079] The picture quality detection device provided by the present invention is described below. The picture quality detection device described below and the picture quality detection method described above can be referred to each other.
[0080] Figure 8 Schematic diagram of the structure of the picture quality detection device provided by the embodiment of the present invention. Figure 8 The embodiment of the present invention provides a picture quality detection device, which may specifically include the following modules: The acquisition module 810 is used to acquire the current frame lens image of the camera to be detected and determine the lens scene category of the current frame lens image; A grayscale module 820, configured to perform grayscale processing on the current frame lens image according to a grayscale parameter corresponding to the lens scene category of the current frame lens image, to obtain a grayscale image corresponding to the current frame lens image; The detection module 830 is used to perform image quality detection on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera.
[0081] Based on any of the above embodiments, the acquisition module is specifically used for: Get the lens label and lens name of the camera; If the shot tag contains a specified shot scene category, determining the specified scene category as the shot scene category of the current frame shot image; If the lens tag does not contain a designated lens scene category, the lens name is subjected to text scene classification, the current frame lens image is subjected to image scene classification, and the lens scene category of the current frame lens image is determined according to the text scene classification result and the image scene classification result.
[0082] Based on any of the above embodiments, the grayscale parameters corresponding to each lens scene category are determined by the following modules: A generation module, for randomly generating a plurality of individuals to obtain an initial population for a real lens image under each lens scene category; the individuals are weighted coefficient combinations of a plurality of color components; The iteration module is used to start iteration with the initial population as the current population, perform genetic operations on the current population to obtain the next generation population, until the accuracy of the image obtained by each weighted coefficient combination in the next generation population reaches the accuracy threshold, stop iteration and determine the optimal weighted coefficient combination, and use the optimal weighted coefficient combination as the grayscale parameter corresponding to the lens scene category.
[0083] Based on any of the above embodiments, the iteration module is specifically used for: According to the real lens image, the accuracy of the image obtained by combining each weighted coefficient in the current population is calculated to obtain the fitness of each individual; Based on the fitness of each individual, performing a selection operation on the current population; Perform crossover and mutation operations on the population after the selection operation to obtain the next generation population.
[0084] Based on any of the above embodiments, the detection module is specifically used for: Perform a two-dimensional discrete Fourier transform on the grayscale image corresponding to the current frame lens image to obtain a spectrum diagram; Centralizing the spectrum graph to obtain a centralized spectrum graph; Performing high-pass filtering on the centralized spectrum graph to obtain a filtered spectrum graph; Performing inverse Fourier transform on the filtered spectrum to obtain an inverse transform image; The picture quality detection result of the camera is determined according to the average amplitude of the inverse transformed image.
[0085] Based on any of the above embodiments, the detection module is specifically used for: Calculating the frequency amplitude value of each position of the inverse transformation image according to the real part and the imaginary part of the inverse transformation image; Calculating the average amplitude of the inverse transformation image according to the frequency amplitude value of each position of the inverse transformation image; If the average amplitude is greater than a preset amplitude threshold, it is determined that the image quality detection result of the camera is normal; If the average amplitude is less than or equal to the preset amplitude threshold, it is determined that the image quality detection result of the camera is abnormal.
[0086] After obtaining the current frame lens image of the camera to be detected, the embodiment of the present invention determines the lens scene category of the current frame lens image, performs grayscale processing on the current frame lens image according to the grayscale parameter corresponding to the lens scene category of the current frame lens image, obtains the grayscale image corresponding to the current frame lens image, and performs image quality detection on the grayscale image corresponding to the current frame lens image, so as to determine the image quality detection result of the camera. Compared with the related art method of judging whether the lens image is abnormal by changing the image state of multiple frames, the present invention only relies on a single frame image to judge whether the lens image is abnormal, is not affected by the changes of different scenes, is suitable for detecting the imaging image quality of general scenes, and is conducive to improving the efficiency and accuracy of image quality detection.
[0087] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Fig. 9As shown, the electronic device may include: a processor 910, a communication interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communication interface 920 and the memory 930 communicate with each other through the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the picture quality detection method, which includes: obtaining the current frame lens image of the camera to be detected, and determining the lens scene category of the current frame lens image; graying the current frame lens image according to the graying parameter corresponding to the lens scene category of the current frame lens image to obtain the gray image corresponding to the current frame lens image; performing image quality detection on the gray image corresponding to the current frame lens image to determine the picture quality detection result of the camera.
[0088] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0089] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the picture quality detection method provided by the above methods, which includes: obtaining a current frame lens image of the camera to be detected, and determining the lens scene category of the current frame lens image; performing grayscale processing on the current frame lens image according to the grayscale parameters corresponding to the lens scene category of the current frame lens image to obtain a grayscale image corresponding to the current frame lens image; performing image quality detection on the grayscale image corresponding to the current frame lens image to determine the picture quality detection result of the camera.
[0090] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the picture quality detection method provided by the above-mentioned methods, the method comprising: obtaining a current frame lens image of the camera to be detected, and determining the lens scene category of the current frame lens image; performing grayscale processing on the current frame lens image according to the grayscale parameters corresponding to the lens scene category of the current frame lens image to obtain a grayscale image corresponding to the current frame lens image; performing image quality detection on the grayscale image corresponding to the current frame lens image to determine the picture quality detection result of the camera.
[0091] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0092] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting picture quality, characterized in that: include: Obtaining a current frame lens image of the camera to be detected, and determining a lens scene category of the current frame lens image; According to the grayscale parameters corresponding to the lens scene category of the current frame lens image, the current frame lens image is grayscaled to obtain a grayscale image corresponding to the current frame lens image; An image quality detection is performed on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera.
2. The image quality detection method according to claim 1, characterized in that: The determining of the shot scene category of the current frame shot image comprises: Get the lens label and lens name of the camera; If the shot tag contains a specified shot scene category, determining the specified scene category as the shot scene category of the current frame shot image; If the lens tag does not contain a designated lens scene category, the lens name is subjected to text scene classification, the current frame lens image is subjected to image scene classification, and the lens scene category of the current frame lens image is determined according to the text scene classification result and the image scene classification result.
3. The image quality detection method according to claim 1, characterized in that: The grayscale parameters corresponding to each lens scene category are determined in the following way: For real lens images under each lens scene category, a plurality of individuals are randomly generated to obtain an initial population; the individuals are weighted coefficient combinations of a plurality of color components; Iteration is started by taking the initial population as the current population, and a genetic operation is performed on the current population to obtain a next generation population, until the accuracy of the image obtained by each weighted coefficient combination in the next generation population reaches an accuracy threshold, and the iteration is stopped and the optimal weighted coefficient combination is determined, and the optimal weighted coefficient combination is used as the grayscale parameter corresponding to the lens scene category.
4. The image quality detection method according to claim 3, characterized in that: The performing of genetic operations on the current population to obtain the next generation population includes: According to the real lens image, the accuracy of the image obtained by combining each weighted coefficient in the current population is calculated to obtain the fitness of each individual; Based on the fitness of each individual, performing a selection operation on the current population; Perform crossover and mutation operations on the population after the selection operation to obtain the next generation population.
5. The image quality detection method according to claim 1, characterized in that: The performing image quality detection on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera includes: Perform a two-dimensional discrete Fourier transform on the grayscale image corresponding to the current frame lens image to obtain a spectrum diagram; Centralizing the spectrum graph to obtain a centralized spectrum graph; Performing high-pass filtering on the centralized spectrum graph to obtain a filtered spectrum graph; Performing inverse Fourier transform on the filtered spectrum to obtain an inverse transform image; The picture quality detection result of the camera is determined according to the average amplitude of the inverse transformed image.
6. The image quality detection method according to claim 5, characterized in that: Determining the picture quality detection result of the camera according to the average amplitude of the inverse transformation image includes: Calculating the frequency amplitude value of each position of the inverse transformation image according to the real part and the imaginary part of the inverse transformation image; Calculating the average amplitude of the inverse transformation image according to the frequency amplitude value of each position of the inverse transformation image; If the average amplitude is greater than a preset amplitude threshold, it is determined that the image quality detection result of the camera is normal; If the average amplitude is less than or equal to the preset amplitude threshold, it is determined that the image quality detection result of the camera is abnormal.
7. A picture quality detection device, characterized in that: include: An acquisition module is used to acquire a current frame lens image of the camera to be detected and determine a lens scene category of the current frame lens image; A grayscale module, used to perform grayscale processing on the current frame lens image according to the grayscale parameters corresponding to the lens scene category of the current frame lens image, so as to obtain a grayscale image corresponding to the current frame lens image; The detection module is used to perform image quality detection on the grayscale image corresponding to the current frame lens image to determine the image quality detection result of the camera.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the picture quality detection method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the picture quality detection method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the picture quality detection method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Image quality detection method, device and equipment and storage medium
CN111340749A
Video flicker determination method and device, equipment and storage medium
CN114202519A
Grayscale image generation method and device, electronic equipment and storage medium
CN117197267A
Method and device for detecting shielding of monitoring camera lens and storage medium
CN118134838A
State detection method and apparatus for camera lens, device and storage medium
WO2022088620A1
Cited By
Lens picture quality analysis method based on video image
CN120298416A
A method for analyzing lens image quality based on video images
CN120298416B
