Disclosure of Invention
In view of the above problems, an object of the present invention is to provide a logo detection method, which can detect whether a logo in a video image display screen is effectively displayed or not in real time.
According to an aspect of the present invention, there is provided a logo detection method including:
acquiring a gray level image of a current display picture;
Acquiring pixel brightness of each characteristic point of at least two groups of characteristic points according to the gray level image;
judging whether the feature points are standard feature points or not according to the pixel brightness of each feature point and the corresponding preset brightness value interval;
And judging whether the target logo is displayed on the current display picture according to the number of the standard feature points and the total number of the at least two groups of feature points.
Optionally, the step of determining whether the target logo is displayed on the current display screen according to the number of standard feature points and the total number of the at least two groups of feature points includes:
And judging that the target logo is displayed on the current display picture under the condition that the difference value between the number of the standard feature points and the total number of the at least two groups of feature points is smaller than or equal to an error threshold value.
Optionally also comprises
And obtaining the at least two groups of characteristic points according to the shape of the target logo.
Optionally, the method further comprises:
And obtaining at least two groups of preset brightness value intervals according to the gray scale range of the display picture, wherein the brightness value intervals correspond to each group of characteristic points of the at least two groups of characteristic points one by one.
Optionally, the step of obtaining the at least two sets of feature points according to the shape of the target logo comprises:
Acquiring a display picture comprising a target logo;
acquiring a gray level image of the display picture;
selecting a plurality of characteristic points in the gray level image according to the shape of the target logo;
obtaining brightness values of the plurality of feature points;
And grouping the plurality of feature points according to the brightness values of the plurality of feature points to obtain the at least two groups of feature points.
Optionally, the step of obtaining at least two preset groups of the brightness value intervals according to the gray scale range of the display screen includes:
and obtaining a preset brightness value interval according to the obtained pixel brightness of each characteristic point of the at least two groups of characteristic points and the gray scale range of the gray scale image of the display picture comprising the target logo.
Optionally, the position of the target logo in the display picture and the brightness of each pixel point are fixed, and the outline of the target logo is fixed.
According to the logo detection method provided by the invention, the pixel brightness of each characteristic point of at least two groups of characteristic points is obtained according to the gray level image of the current display picture, whether the characteristic point is a standard characteristic point or not is judged according to the pixel brightness of each characteristic point and the corresponding preset brightness value interval, whether the current display picture displays a target logo or not is judged according to the number of the standard characteristic points and the total number of the at least two groups of characteristic points, the detection and judgment steps are simple and effective, and whether the current display picture effectively displays the target logo or not can be judged rapidly in real time.
And an error threshold is set, so that erroneous judgment is avoided, and the reliability of detection is improved.
The preset brightness value interval is determined according to the gray scale range of the gray scale image of the display picture, so that the method can be suitable for logo detection of the display picture with any gray scale standard, and the practicability of the logo detection method is improved.
Detailed Description
Various embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. The same reference numbers will be used throughout the drawings to refer to the same or like parts. For clarity, the various features of the drawings are not drawn to scale.
The following describes in further detail the embodiments of the present invention with reference to the drawings and examples.
Fig. 1A and 1B show a schematic diagram of feature point selection of a logo detection method according to an embodiment of the present invention. The pixel values in fig. 1A and fig. 1B are inverted to each other so as to mark the selected feature points, where, to clearly display the pixel points of the present invention, the area in each indication box in fig. 1B corresponds to one pixel point, and the line frames correspond to the intervals between the pixel points.
As shown in fig. 1A and 1B, in this embodiment, taking a logo "BTV" as an example, 14 feature points are selected according to the outline of the logo, where the feature points are divided into two groups according to the gray values of the feature points, the first group includes pixel points 1,3, 5, 8, 9, and 14, the second group includes pixel points 2,4,6, 7, 10, 11, 12, and 13, and with fig. 1A as gray scale reference, the brightness interval of the pixel points of the first group is [0,120], the brightness interval of the pixel points of the second group is [230,255], the second group is located in the logo range, the first group is located outside the logo range, and each feature point is located at the vertex or inflection point of the logo pattern.
The feature points are selected adaptively according to the actual shape of the target logo, and meanwhile, the feature points are selected according to display errors possibly occurring in the target logo, so that the detection accuracy is guaranteed. The present embodiment takes a logo in the form of letters as an example, but the present invention is not particularly limited in shape and can be applied to a target logo in any shape.
Fig. 2 shows a feature point selection flowchart of a logo detection method according to an embodiment of the present invention.
As shown in fig. 2, a feature point selection flow of the logo detection method according to the embodiment of the present invention includes:
and S101, obtaining a logo picture.
And obtaining a display picture displayed with the target logo.
And S102, extracting the obtained gray level image of the logo picture.
And converting the obtained logo picture into a gray level image, and obtaining the gray level image of the logo picture so as to carry out subsequent processing according to the brightness value of each pixel point in the image.
And step S103, selecting N characteristic points.
And selecting N characteristic points according to the outline of the target logo and the position of the target logo in the image, wherein N is more than or equal to 3.
And step S104, obtaining the brightness value of the characteristic point.
And obtaining the brightness values of the N characteristic points according to the obtained gray level image and the positions of the N selected characteristic points.
Step S105, grouping the characteristic points according to the brightness values.
The feature points are divided into two groups according to brightness values of the feature points, the grouping standard of the feature points takes the gray scale range of an image as a reference, for example, the gray scale range is [0,255], the brightness difference between the pixel points used for displaying the logo and other pixel points is generally larger, the feature points can be selected to be grouped by taking the gray scale 200 as a threshold value to obtain a first group of feature points and a second group of feature points, the brightness of the pixel points of the first group of feature points is smaller than 200 and corresponds to the pixel points outside the logo, the brightness of the pixel points of the second group of feature points is larger than 200 and corresponds to the pixel points in the logo.
Step S106, determining brightness value interval of each packet.
And obtaining a first brightness value interval of each pixel point of the first group of feature points and a second brightness value interval of each pixel point of the second group of feature points according to the brightness of each pixel point of the first group of feature points and the second group of feature points. The brightness value interval is used for judging the characteristic points of the actual logo detection, wherein the first group takes the highest brightness to 0 as an interval, and the second group takes the lowest brightness to 255 as an interval. The brightness value interval determined in this way can be adjusted according to the gray scale range of the display picture, so that the method is convenient for being applied to the display pictures with various brightnesses, and improves the universality of the logo detection method.
Step S107, determining the number of feature points of which the logo detection is allowed to have errors
And setting and confirming an error threshold E which is allowed to appear according to the number of the selected characteristic points, wherein E < N is more than or equal to 0 and is less than or equal to 3, and N is the total number of the selected characteristic points.
Fig. 3 shows a detection flow chart of a logo detection method according to an embodiment of the invention.
As shown in fig. 3, the logo detection method in the embodiment of the invention includes:
and S210, extracting a gray level image.
And extracting a gray level image of the display image.
And S220, extracting the brightness of the pixel of the characteristic point.
And extracting the brightness of the pixel points at each characteristic point position according to the characteristic point positions determined by the target logo.
Step S230, judging whether the brightness value is in the grouping brightness interval.
And judging whether the brightness value of the pixel point at each characteristic point position is in the brightness value interval of the corresponding group according to the preset brightness value interval.
According to the judgment of step S230, it is determined that the feature point is a standard feature point in the luminance value interval of the corresponding group in step S231, and that the feature point is not a standard feature point in the luminance value interval of the corresponding group in step S232.
For example, the second luminance interval is [235,255], the first luminance interval is [0,120] and judges whether the luminance value of the first group of feature points is in 235-255, the second group of feature points is in 0-120, and the feature points with luminance values conforming to the respective interval are judged as standard feature points.
Step S240, judging whether the characteristic point traversal is completed.
And judging whether all the characteristic points are judged completely, if not, returning to the step S220, extracting the pixel brightness of the next characteristic point, judging until all the characteristic points are detected and judged completely.
Step S250, judging whether the number of the feature points which do not meet the standard is smaller than a threshold value. The step S251 is executed to determine whether it is a logo or the step S252 is executed to determine whether it is a logo according to the determination result.
And judging whether the logo displayed by the currently detected display image is a target logo or not according to the number of the judged standard feature points and the set threshold value. The threshold value is a preset error threshold value E, and when the number of feature points which do not meet the standard is less than or equal to the error threshold value E, taking fig. 1A and 1B as an example, the pixel brightness of the pixels 1, 3, 5, 8, 9, 14 corresponding to the first group of feature points is dark, the pixel brightness of the pixels 2,4, 6, 7, 10, 11, 12, 13 of the second group of feature points is bright, the bright pixel is lighted, the dark pixel is dark, and the combined image effectively displays the target logo "BTV".
Wherein, the feature points 7,10 and 11 determine the vertex area of the bright display area of the T, the feature points 8 and 9 define the turning point area of the T, and the T is defined in combination, the feature points 10, 12 and 13 determine the bright display area of the V approximately, the dark area of the feature point 14 determines the turning point of the V, and the correct display of the V and the confirmation of other logo patterns can be determined under the condition that the brightness of the pixels of each feature point meets the standard.
The logo detection method provided by the invention selects the first group of dark and bright characteristic points and the second group of characteristic points according to the outline of the target logo, confirms the standard brightness interval of each group of characteristic points, judges the number of characteristic points meeting the standard according to whether the brightness of the pixel points of the first group of characteristic points and the second group of characteristic points in the display image fall within the corresponding standard brightness interval, and further judges whether the brightness of the characteristic pixel points of the logo display area in the current display picture is normally combined according to the requirement, so as to judge whether the displayed logo is the target logo or whether the logo is displayed. And the data processing amount is small.
In this embodiment, two sets of feature points are set, and for a logo with multi-gradient brightness, or a color logo, the feature points may be divided into multiple sets according to the display features of the target logo, multiple sets of brightness intervals are divided according to the pixel brightness of each set of feature points, and the final judgment only needs to judge the number of feature points meeting the standard or not meeting the standard and the size of the corresponding threshold value, so as to judge whether the logo display of the current display picture is qualified.
Embodiments in accordance with the present invention, as described above, are not intended to be exhaustive or to limit the invention to the precise embodiments disclosed. Obviously, many modifications and variations are possible in light of the above teaching. The embodiments were chosen and described in order to best explain the principles of the invention and the practical application, to thereby enable others skilled in the art to best utilize the invention and various modifications as are suited to the particular use contemplated. The invention is limited only by the claims and the full scope and equivalents thereof.