Image detection method, system, terminal device and storage medium
By traversing the image pixels and determining the existence of rectangular edges, the problem of low accuracy in detecting distorted images in existing technologies is solved, and efficient recognition of distorted images is achieved.
Patent Information
- Application Number
- CN202210385623.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-13
- Publication Date
- 2025-12-23
- Estimated Expiration
- 2042-04-13
AI Technical Summary
Existing technologies cannot effectively identify images with distorted images where the pixel values are not significantly different from the surrounding pixels, or where the entire image has regular distorted noise, resulting in low detection accuracy.
By traversing the pixels of the image to be detected, it is determined whether there are rectangular edges parallel or perpendicular to the image border, and the image is judged to be a distorted image based on the coordinate set.
It improves the accuracy of screen distortion detection, effectively identifies full-screen and half-screen distorted images, and simplifies the detection process.
Smart Images

Figure CN114820482B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of image processing, and in particular to an image detection method and system, a terminal device and a storage medium. BACKGROUND
[0002] Currently, cloud games, cloud videos and the like collect video pictures through a cloud server, compress the video pictures and then transmit the compressed video pictures to a client through a network, and the client displays the video pictures after decoding the received video frame data. However, the video pictures may be lost during transmission due to network transmission fluctuations and the like, which may cause the phenomenon of instantaneous screen flashing of the client, thereby affecting the display effect of the video pictures. Currently, the screen flashing is mainly identified by detecting pixels in an image and comparing the detected pixels with the difference values of adjacent pixels or the difference values of normal pixels. However, when the difference between the detected pixels and the surrounding pixels is small or the entire image is a regular screen flashing dot, the screen flashing cannot be correctly identified. SUMMARY
[0003] The main purpose of the embodiments of the present application is to provide an image detection method and system, a terminal device and a storage medium, which determine whether there is a rectangular edge parallel or perpendicular to the edge frame of a to-be-detected image by traversing the pixel points of the to-be-detected image, and then determine whether the to-be-detected image is a screen flashing image based on the determination result, thereby effectively identifying the screen flashing image and improving the detection accuracy of the screen flashing.
[0004] To achieve the above purpose, the embodiments of the present application provide an image detection method, which comprises:
[0005] obtaining a to-be-detected image;
[0006] traversing the pixel points of the to-be-detected image to obtain a coordinate set;
[0007] determining whether there is a rectangular edge parallel or perpendicular to the edge frame of the to-be-detected image based on the coordinate set, and determining whether the to-be-detected image is a screen flashing image according to the determination result.
[0008] Optionally, the step of traversing the pixel points of the to-be-detected image to obtain a coordinate set comprises:
[0009] determining a first pixel point based on the to-be-detected image;
[0010] traversing from the first pixel point to determine a second pixel point, a third pixel point and a fourth pixel point according to a preset rule, wherein the preset rule is generated based on the continuity of pixel values;
[0011] updating the second pixel point, the third pixel point and the fourth pixel point to the first pixel point in sequence, and returning to the step of traversing from the first pixel point, determining a second pixel point, a third pixel point and a fourth pixel point according to a preset rule; and repeating the above steps until there is no pixel point meeting the preset rule, stopping the loop and obtaining a pixel point set;
[0012] obtaining the coordinate set based on the pixel point set.
[0013] Optionally, the step of traversing from the first pixel point and determining a second pixel point, a third pixel point and a fourth pixel point according to a preset rule comprises:
[0014] traversing from a first preset direction of the first pixel point until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, and recording the next pixel point of the first pixel point as the second pixel point;
[0015] traversing from a second preset direction of the first pixel point until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, and recording the next pixel point of the first pixel point as the third pixel point;
[0016] traversing from a third preset direction of the third pixel point until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, and recording the next pixel point of the first pixel point as the fourth pixel point;
[0017] wherein the first preset direction and the second preset direction are perpendicular to each other, and the first preset direction and the third preset direction are parallel to each other.
[0018] Optionally, the step of determining whether there is a rectangular edge parallel or perpendicular to the edge frame of the to-be-detected image based on the coordinate set comprises:
[0019] if there is a rectangular edge parallel or perpendicular to the edge frame of the to-be-detected image, determining the actual number of rectangles in the to-be-detected image based on the coordinate set, and determining whether the to-be-detected image is a snow image according to the actual number.
[0020] Optionally, the step of determining the actual number of rectangles in the to-be-detected image comprises:
[0021] calculating a first theoretical number of rectangles in the to-be-detected image according to a preset formula;
[0022] calculating an accuracy rate and a second theoretical number set based on the first theoretical number;
[0023] if the accuracy rate does not converge, adjusting parameters of the preset formula based on the second set of the theoretical number, and returning to the step of calculating the first theoretical number of the rectangle in the image to be detected according to the preset formula;
[0024] when the accuracy rate converges, terminating the loop, and taking the first theoretical number when the accuracy rate converges as the preset number;
[0025] if the actual number is greater than the preset number, determining that the image to be detected is a snow image.
[0026] Optionally, the step of determining that the image to be detected is a snow image if the actual number is greater than the preset number comprises:
[0027] if the actual number is greater than the preset number, detecting pixel values of the image to be detected;
[0028] if at least one of the pixel values of the image to be detected is not equal, determining that the image to be detected is a snow image.
[0029] Optionally, the step of determining that the image to be detected is a snow image if the actual number is greater than the preset number further comprises:
[0030] if the actual number is greater than the preset number, detecting horizontal lines, vertical lines, and mosaic pixel blocks of the image to be detected that exist in the image to be detected;
[0031] calculating the number of intersection points of the horizontal lines and the vertical lines;
[0032] calculating the number of intersection points of each row of the mosaic pixel blocks based on the number of intersection points of the horizontal lines and the vertical lines;
[0033] if the number of intersection points of each row of the mosaic pixel blocks is not equal, determining that the image to be detected is a snow image.
[0034] In addition, to achieve the above object, the application further provides an image detection system, which comprises:
[0035] an acquisition module, configured to acquire an image to be detected;
[0036] a traversal module, configured to traverse pixel points of the image to be detected to obtain a coordinate set;
[0037] a determination module, configured to determine, based on the coordinate set, whether a rectangle edge parallel or perpendicular to a frame of the image to be detected exists in the image to be detected, and determine whether the image to be detected is a snow image according to a result of the determination.
[0038] In addition, to achieve the above object, the present application also provides a terminal device, comprising a memory, a processor, and an image detection method stored in the memory and executable on the processor, wherein the program of the image detection method, when executed by the processor, implements the steps of the image detection method as described above.
[0039] In addition, to achieve the above object, the present application also provides a computer readable storage medium, wherein the computer readable storage medium stores an image detection program, and the image detection program, when executed by a processor, implements the steps of the image detection method as described above.
[0040] The image detection method, system, terminal device and storage medium provided by the embodiments of the present application obtain a to-be-detected image, traverse the pixel points of the to-be-detected image to obtain a coordinate set, judge whether there is a rectangular edge parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image based on the coordinate set, and determine whether the to-be-detected image is a snow image according to the result of the judgment. In the above manner, the embodiments of the present application traverse the pixel points of the to-be-detected image to determine whether there is a rectangular edge parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image, and then determine whether the to-be-detected image is a snow image based on the result of the judgment, so that the snow image is effectively identified and the detection accuracy of the snow image is improved. BRIEF DESCRIPTION OF DRAWINGS
[0041] Figure 1 FIG. 1 is a functional module schematic diagram of a terminal device to which the image detection device of the present application belongs;
[0042] Figure 2 FIG. 2 is a flowchart of a first embodiment of the image detection method of the present application;
[0043] Figure 3 FIG. 3 is a flowchart of a second embodiment of the image detection method of the present application;
[0044] Figure 4 FIG. 4 is a flowchart of a third embodiment of the image detection method of the present application;
[0045] Figure 5 FIG. 5 is a flowchart of a fourth embodiment of the image detection method of the present application;
[0046] Figure 6 FIG. 6 is a functional module schematic diagram of the image detection system of the present application.
[0047] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION
[0048] It should be understood that the specific embodiments described herein are merely intended to explain the present application, and are not intended to limit the present application.
[0049] The main solution of the embodiment of the present application is: obtaining a to-be-detected image; traversing pixel points of the to-be-detected image to obtain a coordinate set; judging whether a rectangular edge parallel or perpendicular to a frame of the to-be-detected image exists in the to-be-detected image based on the coordinate set; and determining whether the to-be-detected image is a snow image according to a result of the judgment.
[0050] The technical terms involved in the embodiment of the present application are as follows:
[0051] RGB: (red green blue, color system), the RGB color mode is a color standard in the industry, which is obtained by changing and superimposing three color channels of red (R), green (G) and blue (B) and their mutual between them. RGB is a color representing the three channels of red, green and blue. This standard almost includes all colors that can be perceived by human vision, and is one of the most widely used color systems.
[0052] Hough: Hough transform is a feature detection (feature extraction) widely used in image analysis (image analysis), computer vision (computer vision) and digital image processing (digital image processing). Hough transform is used to identify and find features in objects, such as lines.
[0053] At present, cloud games, cloud videos and other technologies collect video pictures through cloud servers, then compress and transmit them to the client through the network. The client decodes and displays the received video frame data. However, during the transmission of the video picture, the network transmission fluctuation and other factors may cause the loss of transmission data, which may cause the phenomenon of instantaneous snow screen of the client picture, thereby affecting the display effect of the video picture. At present, the snow screen in the image is mainly detected by comparing the detected pixels with the difference value of the adjacent pixels or the difference value of the normal pixels to identify the snow screen in the image. However, when the difference between the detected pixels and the surrounding pixels is not large, or the entire image is a regular snow screen dot, the snow screen cannot be correctly identified.
[0054] The present application provides a solution, which traverses the pixel points of the to-be-detected image to determine whether there is a rectangular edge parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image; and then determines whether the to-be-detected image is a snow image based on the judgment result, thereby effectively identifying the snow image and improving the detection accuracy of the snow screen.
[0055] Specifically, refer to Figure 1 , Figure 1is a functional module schematic diagram of a terminal device to which the image detection device of the present application belongs. The image detection device can be a device independent of the terminal device, capable of picture processing and network model training, which can be carried on the terminal device in the form of hardware or software. The terminal device can be a smart mobile terminal such as a mobile phone and a tablet computer having a data processing function, and can also be a fixed terminal device or a server having a data processing function.
[0056] In the present embodiment, the terminal device to which the image detection device belongs at least includes an output module 110, a processor 120, a memory 130 and a communication module 140.
[0057] The memory 130 stores an operation method and an image detection program; the output module 110 can be a display screen and the like. The communication module 140 can include a WIFI module, a mobile communication module and a Bluetooth module and the like, and communicates with external devices or servers through the communication module 140.
[0058] When the image detection program in the memory 130 is executed by the processor, the following steps are realized:
[0059] An image to be detected is acquired;
[0060] The pixel points of the image to be detected are traversed to obtain a coordinate set;
[0061] Based on the coordinate set, it is determined whether there is a rectangular edge in the image to be detected which is parallel or perpendicular to the frame of the image to be detected; and it is determined whether the image to be detected is a flower screen image according to the determination result.
[0062] Further, when the image detection program in the memory 130 is executed by the processor, the following steps are also realized:
[0063] Based on the image to be detected, a first pixel point is determined;
[0064] From the first pixel point, a second pixel point, a third pixel point and a fourth pixel point are determined according to a preset rule, wherein the preset rule is generated based on the continuity of pixel values;
[0065] The second pixel point, the third pixel point and the fourth pixel point are updated to the first pixel point in turn, and the step of traversing from the first pixel point and determining the second pixel point, the third pixel point and the fourth pixel point according to the preset rule is returned to be executed; and the cycle is repeated until there is no pixel point satisfying the preset rule, the cycle is stopped, and a pixel point set is obtained;
[0066] Based on the pixel point set, the coordinate set is obtained.
[0067] Further, the image detection program in the memory 130, when executed by the processor, further implements the following steps:
[0068] traversing from a first preset direction of the first pixel point until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, recording the next pixel point of the first pixel point as the second pixel point;
[0069] traversing from a second preset direction of the first pixel point until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, recording the next pixel point of the first pixel point as the third pixel point;
[0070] traversing from a third preset direction of the third pixel point until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, recording the next pixel point of the first pixel point as the fourth pixel point;
[0071] The first preset direction and the second preset direction are perpendicular to each other, and the first preset direction and the third preset direction are parallel to each other.
[0072] Further, the image detection program in the memory 130, when executed by the processor, further implements the following steps:
[0073] If there is a rectangular side in the to-be-detected image that is parallel or perpendicular to the frame of the to-be-detected image, then based on the coordinate set, the actual number of rectangles in the to-be-detected image is determined, and whether the to-be-detected image is a snowflake image is determined according to the actual number.
[0074] Further, the image detection program in the memory 130, when executed by the processor, further implements the following steps:
[0075] The first theoretical number of rectangles in the to-be-detected image is calculated according to a preset formula;
[0076] Based on the first theoretical number, the accuracy, and a second theoretical number set are calculated;
[0077] If the accuracy does not converge, then based on the second theoretical number set, the parameters of the preset formula are adjusted, and the step of calculating the first theoretical number of rectangles in the to-be-detected image according to the preset formula is returned to be executed;
[0078] When the accuracy converges, the loop is terminated, and the first theoretical number when the accuracy converges is taken as a preset number;
[0079] If the actual number is greater than the preset number, then it is determined that the to-be-detected image is a snowflake image.
[0080] Further, the image detection program in the memory 130, when executed by the processor, further implements the following steps:
[0081] If the actual number is greater than the preset number, detecting pixel values of the image to be detected;
[0082] If the pixel values of the image to be detected are not equal at least one, determining that the image to be detected is a screen image.
[0083] Further, the image detection program in the memory 130, when executed by the processor, further implements the following steps:
[0084] If the actual number is greater than the preset number, detecting horizontal lines, vertical lines, and the mosaic pixel blocks of the image to be detected in the image to be detected;
[0085] Calculating the intersection number of the horizontal lines and the vertical lines;
[0086] Based on the intersection number of the horizontal lines and the vertical lines, calculating the intersection number of each row of the mosaic pixel blocks;
[0087] If the intersection number of each row of the mosaic pixel blocks is not equal, determining that the image to be detected is a screen image.
[0088] The embodiment obtains the image to be detected, traverses the pixel points of the image to be detected to obtain a coordinate set, judges whether there is a rectangular edge parallel or perpendicular to the frame of the image to be detected in the image to be detected based on the coordinate set, and determines whether the image to be detected is a screen image according to the result of the judgment. The present application determines whether there is a rectangular edge parallel or perpendicular to the frame of the image to be detected in the image to be detected by traversing the pixel points of the image to be detected, and further determines whether the image to be detected is a screen image based on the judgment result, thereby effectively identifying the screen image and improving the detection accuracy of the screen.
[0089] Based on the terminal device architecture but not limited to the above-mentioned architecture, the method embodiment of the present application is proposed.
[0090] Reference Figure 2 , Figure 2 The flowchart of the first embodiment of the image detection method of the present application is shown. The image detection method comprises:
[0091] Step S101, obtaining an image to be detected.
[0092] Step S102, traversing the pixel points of the image to be detected to obtain a coordinate set.
[0093] The execution subject of the method in the embodiment can be an image detection device, an image detection terminal device or a server. The embodiment is exemplified by an image detection device, which can be integrated in a terminal device such as a smart phone, a tablet computer or the like having a data processing function.
[0094] In order to effectively identify the screen, improve the detection accuracy of the screen and improve the detection efficiency of the screen, the to-be-detected image needs to be acquired, and the pixel points of the to-be-detected image are traversed to obtain a coordinate set.
[0095] Specifically, the to-be-detected image is acquired, the pixel points of the to-be-detected image are traversed according to a preset rule to obtain a pixel point set, and the coordinates of the pixel point set are recorded to obtain a coordinate set, wherein the preset rule is set according to the pixel value of the pixel point.
[0096] Therefore, by traversing the pixel points of the to-be-detected image, a coordinate set composed of the coordinates of the potential screen pixel points is obtained, so that the screen image library does not need to be matched, and whether the pixel points in the coordinate set can form a closed rectangle can be determined according to the coordinates of the pixel points.
[0097] In step S103, whether a rectangular edge parallel or perpendicular to the frame of the to-be-detected image exists in the to-be-detected image is determined based on the coordinate set, and whether the to-be-detected image is a screen image is determined according to the determination result.
[0098] In the embodiment, whether a rectangular edge parallel or perpendicular to the frame of the to-be-detected image exists in the to-be-detected image is determined based on the coordinate set. If no rectangular edge parallel or perpendicular to the frame of the to-be-detected image exists in the to-be-detected image, it is determined that the to-be-detected image is not a screen image. If a rectangular edge parallel or perpendicular to the frame of the to-be-detected image exists in the to-be-detected image, since the rectangular edge does not necessarily form a closed rectangle, it is necessary to further determine whether a rectangle exists in the to-be-detected image.
[0099] If no rectangle exists in the to-be-detected image, it is determined that the to-be-detected image is not a screen image. If a rectangle exists in the to-be-detected image, the actual number of rectangles in the to-be-detected image is determined.
[0100] Further, the preset number of rectangles in the to-be-detected image is calculated. If the actual number is not greater than the preset number, it is determined that the to-be-detected image is not a screen image. If the actual number is greater than the preset number, it is determined that the to-be-detected image is a screen image.
[0101] Thus, based on the coordinate set, it is determined whether the to-be-detected image contains a rectangle, and further, according to the number of the rectangle, it is determined whether the to-be-detected image is a snow screen image, and then, according to the disposal strategy of the snow screen image, corresponding processing measures are given. The embodiment combines the snow screen features of large stripes, can detect full-screen and half-screen snow screen images, is more simple and effective, and can improve the detection accuracy.
[0102] In the embodiment, the to-be-detected image is acquired, the pixel points of the to-be-detected image are traversed to obtain a coordinate set, whether there is a rectangular side parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image is judged based on the coordinate set, and whether the to-be-detected image is a snow screen image is determined according to the judgment result. The present application aims to solve the detection problem of snow screen, combines the snow screen features of large stripes, can detect full-screen and half-screen snow screen images, is more simple and effective, and can improve the detection accuracy.
[0103] Reference Figure 3 , Figure 3 The flowchart of the second embodiment of the image detection method of the present application is shown. Based on the above Figure 2 In the embodiment, the step S102 of traversing the pixel points of the to-be-detected image to obtain a coordinate set includes:
[0104] In the step S1021, a first pixel point is determined based on the to-be-detected image.
[0105] In the step S1022, a second pixel point, a third pixel point and a fourth pixel point are determined according to a preset rule by traversing from the first pixel point, wherein the preset rule is generated based on the continuity of pixel values.
[0106] Since the snow screen image with large stripes generally contains a rectangular pixel block, the detection of the snow screen with large stripes can be realized by judging whether the pixel contains a rectangular pixel block with pure color and parallel to the picture frame.
[0107] In the embodiment, first, a first pixel point is determined based on the to-be-detected image, and a second pixel point, a third pixel point and a fourth pixel point are determined according to a preset rule by traversing from the first pixel point.
[0108] Specifically, starting from the top left corner of the to-be-detected image, the pixel points of the to-be-detected image are traversed in a loop to obtain a current pixel point as the first pixel point. The first pixel point is traversed from a first preset direction, and until the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, the next pixel point of the first pixel point is recorded as the second pixel point, wherein the first preset direction is a direction parallel to the lower frame of the to-be-detected image.
[0109] More specifically, starting from the top-left corner of the image to be detected, the pixels of the image to be detected are traversed in a loop to obtain a current pixel. The current pixel is traversed in a direction parallel to the lower border of the image to be detected, and when the pixel value of the next pixel is equal to the pixel value of the current pixel, the accumulator is increased by a preset unit value. If the pixel value of the next pixel is different from the pixel value of the current pixel, the accumulator stops counting, and the value of the accumulator is recorded as count. Until a continuous and parallel lower border of the image to be detected is found, the pixel point to the left of the border is taken as a first pixel point, and the pixel point to the right of the border is taken as a second pixel point. The coordinates of the first pixel point are (x, y), and the coordinates of the second pixel point are (x+count, y). The value of the preset unit can be a real number such as 1 or 2.
[0110] Thus, by traversing the image to be detected in a loop, two pixels continuous and parallel to the lower border of the image to be detected are obtained, and the remaining pixels are obtained by continuing to traverse based on the two pixels.
[0111] The first pixel point is traversed in a second preset direction, wherein the second preset direction is a direction perpendicular to the lower border of the image to be detected.
[0112] When the pixel value of the first pixel point is equal to the pixel value of the next pixel point of the first pixel point, the accumulator is increased by a preset unit value. When the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, the accumulator stops counting, and the next pixel point of the first pixel point is recorded as a third pixel point. The value of the preset unit can be a real number such as 1 or 2.
[0113] For example, the coordinates of the first pixel point are (x, y), and the first pixel point is traversed in a direction perpendicular to the lower border of the image to be detected. When the pixel value of the first pixel point is equal to the pixel value of the next pixel point of the first pixel point, the accumulator is increased by 1. When the pixel value of the first pixel point is not equal to the pixel value of the next pixel point of the first pixel point, the accumulator stops counting, and the third pixel point is obtained. Let the value of the accumulator be count1, and the coordinates of the third pixel point are (x, y+count1).
[0114] Thus, by traversing the image to be detected, the coordinates of the top-left corner of the rectangle are determined, and the traversal in the first preset direction is continued based thereon to obtain the coordinates of the bottom-left corner of the potential pattern image of the image to be detected.
[0115] The third pixel point is traversed in a third preset direction, wherein the third preset direction is a direction parallel to the lower border of the image to be detected.
[0116] When the pixel value of the third pixel point is equal to the pixel value of the next pixel point of the third pixel point, the accumulator increases by a preset unit value; when the pixel value of the third pixel point is not equal to the pixel value of the next pixel point of the third pixel point, the accumulator stops counting, and the next pixel point of the third pixel point is recorded as the fourth pixel point; wherein the preset unit value can be 1, 2, etc.
[0117] For example, starting from the third pixel point, traversal is performed in a direction parallel to the lower edge of the image to be detected; when the pixel value of the third pixel point is equal to the pixel value of the next pixel point of the third pixel point, the accumulator increases by 1; when the pixel value of the third pixel point is not equal to the pixel value of the next pixel point of the third pixel point, the accumulator stops counting, and the fourth pixel point is obtained. Let the value of the accumulator be count2, and the coordinates of the fourth pixel point are (x+count2, y+count1).
[0118] In step S1023, the second pixel point, the third pixel point, and the fourth pixel point are updated to the first pixel point in sequence.
[0119] In step S1024, it is determined whether a first loop termination condition is met.
[0120] If the first loop termination condition is not met, the process returns to step S1022, in which traversal is performed from the first pixel point, and the second pixel point, the third pixel point, and the fourth pixel point are determined according to a preset rule, wherein the preset rule is generated based on the continuity of pixel values. If the first loop termination condition is met, the loop is stopped, and step S1025 is performed to obtain a pixel point set.
[0121] In step S1026, the coordinate set is obtained based on the pixel point set.
[0122] In this embodiment, the second pixel point, the third pixel point, and the fourth pixel point are updated to the first pixel point in sequence, and it is determined whether the first loop termination condition is met at this time. If the first loop termination condition is not met, the process returns to step S1022, in which traversal is performed from the first pixel point, and the second pixel point, the third pixel point, and the fourth pixel point are determined according to a preset rule, wherein the preset rule is generated based on the continuity of pixel values. If the first loop termination condition is met, the loop is stopped, and a pixel point set is obtained. Based on the pixel point set, a coordinate set is obtained; wherein a pixel point that does not meet the preset rule is taken as the above-mentioned first loop termination condition.
[0123] Specifically, the first pixel point, the second pixel point, the third pixel point, and the fourth pixel point are taken as a first sub-set, the second pixel point is updated to a new second pixel point obtained from the first pixel point, the third pixel point, and the fourth pixel point are taken as a second sub-set, and the like is taken until there is no pixel point satisfying the preset rule, and the loop is terminated. Based on all the sub-sets, a pixel point set is obtained, and based on the pixel point set, a coordinate set is obtained.
[0124] For example, based on the first pixel point, the second pixel point, the third pixel point, and the fourth pixel point, a first sub-set is obtained, and elements in a coordinate set corresponding to the first sub-set include (x, y), (x+count, y), (x, y+count1), and (x+count2, y+count1).
[0125] Therefore, in combination with the screen flicker feature of the large stripe, the to-be-detected image is iterated, the continuity of the frame in the to-be-detected image is judged, the coordinate set is obtained, whether a rectangle can be formed according to the coordinates in the coordinate set is judged, whether the to-be-detected image is a screen flicker image is judged, and the detection accuracy of the screen flicker is improved.
[0126] The embodiment obtains the to-be-detected image, iterates the pixel points of the to-be-detected image to obtain a coordinate set, judges whether there is a rectangular side parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image based on the coordinate set, and determines whether the to-be-detected image is a screen flicker image according to the judgment result. The present application combines the screen flicker feature of the large stripe, iterates the to-be-detected image, judges the continuity of the frame in the to-be-detected image, obtains the coordinate set, judges whether a rectangle can be formed according to the coordinates in the coordinate set, further judges whether the to-be-detected image is a screen flicker image, and improves the detection accuracy of the screen flicker.
[0127] Reference Figure 4 , Figure 4 The figure is a flowchart of a third embodiment of the image detection method. Based on the above Figure 3 embodiment, in the present embodiment, after step S103: judging whether there is a rectangular side parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image based on the coordinate set, the step includes:
[0128] In step S1031, if there is a rectangular side parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image, the actual number of rectangles in the to-be-detected image is determined based on the coordinate set, and whether the to-be-detected image is a screen flicker image is determined according to the actual number.
[0129] As an implementation form, in the embodiment, if there is a rectangular side parallel or perpendicular to the frame of the image to be detected in the image to be detected, the actual number of rectangles in the image to be detected is determined based on the coordinate set, so as to determine whether the image to be detected is a snow image according to the actual number; if there is no rectangular side parallel or perpendicular to the frame of the image to be detected in the image to be detected, it is determined that the image to be detected is not a snow image.
[0130] The step S1031 comprises:
[0131] In step A1, a coordinate difference set is calculated based on any two coordinates in the coordinate set.
[0132] In step A2, it is determined whether the coordinate difference set satisfies a preset threshold value, wherein the preset threshold value comprises a preset accumulated value and a preset element threshold value.
[0133] As an implementation form, in the embodiment, a coordinate difference set is calculated based on any two coordinates in the coordinate set. For example, the difference between the horizontal coordinate of the top-right corner vertex and the horizontal coordinate of the bottom-right corner vertex, and the coordinate difference between each vertex and the top-left vertex in each sub-set are taken as a coordinate difference sub-set, and all the coordinate difference sub-sets constitute the coordinate difference set.
[0134] Further, it is determined whether the coordinate difference set satisfies a preset threshold value; wherein the preset threshold value comprises a preset accumulated value and a preset element threshold value; the preset accumulated value is 0, and the preset element threshold value is k, which can be set according to actual conditions.
[0135] For example, if the difference between the horizontal coordinate of the top-right corner vertex and the horizontal coordinate of the bottom-right corner vertex satisfies the preset accumulated value, and the coordinate difference between each vertex and the top-left vertex satisfies the preset element threshold value, it is determined that a rectangle can be constructed based on the coordinate set.
[0136] If the difference between the horizontal coordinate of the top-right corner vertex and the horizontal coordinate of the bottom-right corner vertex does not satisfy the preset accumulated value, or the coordinate difference between each vertex and the top-left vertex does not satisfy the preset element threshold value, it is determined that a rectangle cannot be constructed based on the coordinate set.
[0137] For example, the coordinates of the coordinate difference sub-set comprise:
[0138] The coordinates of the top-left corner vertex: (x, y), the coordinates of the top-right corner vertex: (x+count, y), the coordinates of the bottom-left corner vertex: (x, y+count1), and the coordinates of the bottom-right corner vertex: (x+count2, y+count1).
[0139] The difference between the horizontal coordinate of the top-right corner vertex and the horizontal coordinate of the bottom-right corner vertex: (count2-count).
[0140] The coordinate difference of each vertex and the coordinate of the top-left vertex: count, count1, count2.
[0141] When (count2-count) satisfies the preset accumulated value 0, and count, count1, count2 are all not less than the preset element threshold, it is determined that a rectangle can be formed based on the coordinate set.
[0142] When (count2-count) does not satisfy the preset accumulated value 0, or count, count1, count2 are less than the preset element threshold, it is determined that a rectangle cannot be formed based on the coordinate set.
[0143] Therefore, when count=count2, a rectangle can be formed, indicating that the to-be-detected image contains a rectangular pixel block, and it is determined that a rectangle can be formed based on the coordinate set. When count, count1, count2 are less than the element threshold k, it indicates that only smaller pixel blocks appear in the to-be-detected image, and a rectangle is not formed at this time. According to the number of coordinate difference subsets in the coordinate difference set that can form a rectangle, the number of rectangles in the to-be-detected image can be determined.
[0144] The embodiment verifies the coordinates of the pixel points obtained by traversal, further judges whether a closed rectangle with a certain size can be formed, so as to improve the accuracy of verifying whether a rectangle can be formed, simplify the identification method of the mura, and improve the detection efficiency of the mura.
[0145] Referring to Figure 5 , Figure 5 FIG. 4 is a flowchart of a fourth embodiment of the image detection method. Figure 4 Based on the embodiment shown in FIG. 3, in the embodiment, after step S1031: if there is a rectangular side parallel or perpendicular to the frame of the to-be-detected image in the to-be-detected image, determining the actual number of rectangles in the to-be-detected image based on the coordinate set, and determining whether the to-be-detected image is a mura image according to the actual number, the following steps are included.
[0146] Step S10321: calculating a first theoretical number of rectangles in the to-be-detected image according to a preset formula.
[0147] Step S10322: calculating an accuracy rate and a second theoretical number set based on the first theoretical number.
[0148] Step S10323: if the accuracy rate does not converge, adjusting the parameters of the preset formula based on the second theoretical number set.
[0149] In step S10324, it is judged whether the second loop termination condition is met. If the second loop termination condition is not met, the step S10321 is returned to execute, i.e., the first theoretical number of the rectangle in the image to be detected is calculated according to the preset formula. If the second loop termination condition is met, the step S10325 is executed, i.e., the first theoretical number when the accuracy converges is taken as the preset number.
[0150] In step S10326, if the actual number is greater than the preset number, it is determined that the image to be detected is a screen image.
[0151] Based on the above Figure 5 The fifth embodiment of the image detection method of the present application is provided according to the above-mentioned embodiment. In this embodiment, the step S10325 includes:
[0152] The first mode includes:
[0153] In step S103251, if the actual number is greater than the preset number, the pixel value of the image to be detected is detected.
[0154] In step S103252, if the pixel value of the image to be detected is not equal to at least one, it is determined that the image to be detected is a screen image.
[0155] In this embodiment, if the actual number is not greater than the preset number, it is determined that the image to be detected is not a screen image. Thus, by limiting the preset number, the false detection of the large stripe screen image is avoided.
[0156] Specifically, if the actual number is not greater than the preset number, and count=count2=width of the image to be detected, it is determined that the image to be detected is not a screen image, and the picture frame of the image to be detected is a rectangle.
[0157] If the actual number is greater than the preset number, it is judged whether the image to be detected meets the preset condition. The preset condition includes: the pixel value of the image to be detected is equal; and the intersection number of each row of the mosaic pixel block in the image to be detected is equal.
[0158] Further, the pixel value of the image to be detected is detected. If the pixel value of the image to be detected is equal, it is determined that the image to be detected is not a screen image. If the pixel value of the image to be detected is not equal to at least one, it is determined that the image to be detected is a screen image.
[0159] Specifically, all pixel values of the to-be-detected image are detected, if all pixel values (R, G, B) of the to-be-detected image are equal, it is determined that the pixel values of the to-be-detected image are equal, and it is determined that the to-be-detected image is not a screen image; at this time, the to-be-detected image is a solid color picture; if at least one pixel value of the to-be-detected image is not equal, it is determined that the to-be-detected image is a screen image.
[0160] The second mode is:
[0161] In step S103253, if the actual number is greater than the preset number, horizontal lines, vertical lines, and mosaic pixel blocks in the to-be-detected image are detected.
[0162] In step S103254, the intersection numbers of the horizontal lines and the vertical lines are calculated.
[0163] In step S103255, based on the intersection numbers of the horizontal lines and the vertical lines, the intersection numbers of each row of mosaic pixel blocks are calculated.
[0164] In step S103256, if the intersection numbers of each row of mosaic pixel blocks are not equal, it is determined that the to-be-detected image is a screen image.
[0165] In this embodiment, if the actual number is greater than the preset number, horizontal lines, vertical lines, and mosaic pixel blocks in the to-be-detected image are detected; the intersection numbers of the horizontal lines and the vertical lines are calculated; based on the intersection numbers of the horizontal lines and the vertical lines, the intersection numbers of each row of mosaic pixel blocks are calculated; if the intersection numbers of each row of mosaic pixel blocks are equal, it is determined that the to-be-detected image is not a screen image; if the intersection numbers of each row of mosaic pixel blocks are not equal, it is determined that the to-be-detected image is a screen image.
[0166] Specifically, edge extraction is performed on the to-be-detected image, hough transformation is used to detect horizontal lines and vertical lines respectively, and the intersection of the horizontal lines and the vertical lines is calculated; based on the intersection of the horizontal lines and the vertical lines, the intersection numbers of each row of mosaic pixel blocks are calculated; if the intersection numbers of each row of pixel blocks are equal, the to-be-detected image is a mosaic picture; if the intersection numbers of each row of mosaic pixel blocks are not equal, it is determined that the to-be-detected image is a screen image.
[0167] The above scheme is used in this embodiment to further exclude solid color, solid color frame, mosaic picture and the like, reduce the case that the to-be-detected image is mistakenly detected as a screen image with stripes, and improve the detection efficiency and accuracy of the screen.
[0168] Based on the above Figure 2 The sixth embodiment of the image detection method is provided according to the above
[0169] Firstly, an image to be detected is acquired, and edge detection is performed on the image to be detected to obtain a gray image, wherein the gray image is composed of a large number of rectangular blocks, and it is judged whether each pixel point in the gray image can form a square with a preset side length. If not, continue to traverse, if yes, the length of the preset side length is increased by 1, and the traversal is continued to obtain the side length of the largest square contained in the image to be detected; wherein the preset side length starts from 3 and is increased by 1 successively, and ends at 30, and the judgment rule of the square can adopt the following rule (1 represents the current pixel, and 0 represents the adjacent pixel):
[0170] As shown in Table 1, the eight-point judgment method: selecting eight points adjacent to the pixels in the square to judge, if the selected eight points all satisfy the condition of forming a square, it is considered that the square exists.
[0171]
[0172] Table 1
[0173] As shown in Table 2, the four-point judgment method: selecting four points of the pixels in the square to judge, if the selected four points all satisfy the condition of forming a square, it is considered that the square exists.
[0174]
[0175] Table 2
[0176] Thus, by traversing the image to be detected, the side length of the largest square contained in the image to be detected is obtained.
[0177] If the square cannot be formed, it is determined that the image to be detected is not a screen flower image; if the square can be formed, the actual number of squares in the image to be detected is further determined.
[0178] Further, the preset number of squares in the image to be detected is calculated. If the actual number is not greater than the preset number, it is determined that the image to be detected is not a screen flower image; if the actual number is greater than the preset number, it is determined that the image to be detected is a screen flower image.
[0179] Thus, according to the actual number and the preset number of squares, it is determined whether the image to be detected is a screen flower image, so that corresponding processing measures are given according to the disposal strategy of the screen flower image. The embodiment combines the screen flower characteristics of the large stripe, can detect the screen flower image of full screen and half screen, and is more simple and effective, and can improve the detection accuracy.
[0180] Reference Figure 6 , Figure 6 is a schematic diagram of a function module of an image detection system of the application. The image detection system comprises:
[0181] An acquisition module 10 is configured to acquire an image to be detected.
[0182] The traversal module 20 is configured to traverse the pixel points of the image to be detected to obtain a coordinate set.
[0183] The determination module 30 is configured to determine whether the rectangular edge parallel or perpendicular to the frame of the image to be detected exists in the image to be detected based on the coordinate set, and determine whether the image to be detected is a snow image according to the determination result.
[0184] The principle and implementation process of the image detection are achieved in the embodiment, and details are not described herein again.
[0185] In addition, the embodiment of the present application further provides a terminal device, which comprises a memory, a processor, and an image detection program stored in the memory and executable on the processor. When the image detection program is executed by the processor, the steps of the image detection method described above are implemented.
[0186] Since the image detection program is executed by the processor, all the technical solutions of all the embodiments described above are adopted, and all the beneficial effects brought by all the technical solutions of all the embodiments described above are at least achieved, and details are not described herein again.
[0187] In addition, the embodiment of the present application further provides a computer readable storage medium, which stores an image detection program. When the image detection program is executed by the processor, the steps of the image detection method described above are implemented.
[0188] Since the image detection program is executed by the processor, all the technical solutions of all the embodiments described above are adopted, and all the beneficial effects brought by all the technical solutions of all the embodiments described above are at least achieved, and details are not described herein again.
[0189] Compared with the prior art, the image detection method, system, terminal device and storage medium provided by the present application can obtain an image to be detected, traverse the pixel points of the image to be detected to obtain a coordinate set, determine whether the rectangular edge parallel or perpendicular to the frame of the image to be detected exists in the image to be detected based on the coordinate set, and determine whether the image to be detected is a snow image according to the determination result. The present application can determine whether the rectangular edge parallel or perpendicular to the frame of the image to be detected exists in the image to be detected by traversing the pixel points of the image to be detected, and further determine whether the image to be detected is a snow image based on the determination result, so as to effectively identify the snow image and improve the detection accuracy of the snow image.
[0190] It should be noted that in this document, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus that comprises the recited element.
[0191] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0192] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and the necessary general hardware platform, of course, they can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk) and includes a number of instructions for making a terminal device (which can be a mobile phone, a computer, a server, a controlled terminal, or a network device) execute the method of each embodiment of the present application.
[0193] The above is only the preferred embodiment of the present application, and does not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, which is made by using the content of the specification and drawings of the present application, is also included in the patent protection scope of the present application.
Claims
1. An image detection method, characterized in that, The method includes the following steps: Acquire the image to be detected; The coordinate set is obtained by traversing the pixels of the image to be detected; Based on the coordinate set, determine whether there is a rectangular edge in the image to be detected that is parallel or perpendicular to the border of the image to be detected; If there are rectangular edges in the image to be detected that are parallel or perpendicular to the border of the image to be detected, then the actual number of rectangles in the image to be detected is determined based on the coordinate set. The first theoretical number of rectangles in the image to be detected is calculated according to a preset formula; Based on the first number of theories, calculate the accuracy and the second set of theories; If the accuracy does not converge, then based on the second theoretical number set, adjust the parameters of the preset formula and return to the execution step: calculate the first theoretical number of rectangles in the image to be detected according to the preset formula; When the accuracy converges, the loop terminates, and the first theoretical number when the accuracy converges is taken as the preset number. If the actual number is greater than the preset number, then the image to be detected is determined to be a distorted image; The step of traversing the pixels of the image to be detected to obtain the coordinate set includes: Based on the image to be detected, the first pixel is determined; Traverse along the x-axis and y-axis from the first pixel point, and determine the second, third, and fourth pixel points according to a preset rule. The preset rule is generated based on the continuity of pixel values, and the pixel values of the first pixel point, the second pixel point, and the third pixel point are not equal, and the pixel values of the third pixel point and the fourth pixel point are not equal. The second pixel, the third pixel, and the fourth pixel are updated to the first pixel in sequence, and the execution steps are returned: traverse from the first pixel, determine the second pixel, the third pixel, and the fourth pixel according to a preset rule; repeat this process until there are no pixels that satisfy the preset rule, stop the loop, and obtain a set of pixels; The coordinate set is obtained based on the set of pixels.
2. The image detection method according to claim 1, characterized in that, The step of traversing from the first pixel and determining the second, third, and fourth pixels according to a preset rule includes: Traverse along the x-axis from the first pixel until the pixel value of the first pixel is not equal to the pixel value of the subsequent pixels of the first pixel. Then record the subsequent pixels of the first pixel as the second pixel. Traverse along the y-axis from the first pixel until the pixel value of the first pixel is not equal to the pixel value of the subsequent pixels of the first pixel. Then record the subsequent pixels of the first pixel as the third pixel. Traverse along the x-axis from the third pixel until the pixel value of the first pixel is not equal to the pixel value of the subsequent pixels of the first pixel. Then record the subsequent pixels of the first pixel as the fourth pixel.
3. The image detection method as described in claim 1, characterized in that, The step of determining that the image to be detected is a distorted image if the actual number is greater than the preset number includes: If the actual number is greater than the preset number, then the pixel value of the image to be detected is detected; If at least one pixel value of the image to be detected is not equal, then the image to be detected is determined to be a distorted image.
4. The image detection method as described in claim 1, characterized in that, The step of determining that the image to be detected is a distorted image if the actual number is greater than the preset number further includes: If the actual number is greater than the preset number, then the horizontal lines, vertical lines, and mosaic pixel blocks of the image to be detected are detected. Calculate the number of intersections between the horizontal line and the vertical line; Based on the number of intersections of the horizontal line and the vertical line, calculate the number of intersections of each row of mosaic pixel blocks; If the number of intersection points of each row of mosaic pixel blocks is not equal, then the image to be detected is determined to be a distorted image.
5. An image detection system, characterized in that, include: The acquisition module is used to acquire the image to be detected; The traversal module is used to traverse the pixels of the image to be detected and obtain the coordinate set; The traversal module is further configured to: determine a first pixel based on the image to be detected; traverse along the x-axis and y-axis from the first pixel, and determine a second, third, and fourth pixel according to a preset rule, wherein the preset rule is generated based on the continuity of pixel values, the pixel values of the first pixel are not equal to those of the second and third pixels, and the pixel values of the third and fourth pixels are not equal; update the second, third, and fourth pixels to the first pixel in sequence, and return to the execution step: traversing from the first pixel and determining the second, third, and fourth pixels according to the preset rule; repeating this process until no pixel satisfies the preset rule, stopping the loop, and obtaining a set of pixels; and obtaining the coordinate set based on the set of pixels. The determination module is used to determine, based on the coordinate set, whether there are rectangular edges in the image to be detected that are parallel or perpendicular to the border of the image to be detected; if there are rectangular edges in the image to be detected that are parallel or perpendicular to the border of the image to be detected, then based on the coordinate set, determine the actual number of rectangles in the image to be detected; calculate the first theoretical number of rectangles in the image to be detected according to a preset formula; calculate the accuracy and a second theoretical number set based on the first theoretical number; if the accuracy does not converge, then based on the second theoretical number set, adjust the parameters of the preset formula and return to the execution step: calculate the first theoretical number of rectangles in the image to be detected according to the preset formula; when the accuracy converges, terminate the loop and take the first theoretical number when the accuracy converges as the preset number; if the actual number is greater than the preset number, then determine that the image to be detected is a distorted image.
6. A terminal device, characterized in that, The terminal device includes a memory, a processor, and an image detection method stored in the memory and executable on the processor. When the image detection program is executed by the processor, it implements the steps of the image detection method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores an image detection program, which, when executed by a processor, implements the steps of the image detection method as described in any one of claims 1-4.
Citation Information
Patent Citations
Method and system for detecting quality of video
CN103281559A
Identification method and device of seal in image, processing equipment and storage medium
CN113255686A
Goods shelf positioning map generation method
CN114332298A