Icon detection method and device, electronic equipment and storage medium
By partitioning and filtering multiple consecutive frames of images, icons can be directly detected, solving the problems of high computational complexity and complex template library maintenance in existing technologies. This enables flexible icon detection and reduces computational complexity and maintenance costs.
Patent Information
- Application Number
- CN202410243902.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-04
- Publication Date
- 2026-11-24
- Estimated Expiration
- 2044-03-04
AI Technical Summary
Existing technologies for game icon detection are computationally complex and require the construction and maintenance of template libraries, which increases development and maintenance complexity and makes them unsuitable for any scenario.
By acquiring multiple consecutive frames of images and performing at least one level of partitioning and filtering, connected regions in the target image area are extracted, and icons are directly detected, avoiding the establishment of a template library and matching calculations.
It reduces computational complexity, lowers development and maintenance costs, is applicable to icon detection in any scenario, and improves the universality of detection.
Smart Images

Figure CN118196014B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image information technology, and in particular to a method, apparatus, electronic device and storage medium for detecting icons. Background Technology
[0002] With the continuous development of smart terminal technology, game entertainment software has become an important component of terminal applications. For game applications, game icon detection is crucial. Currently, most game icon detection methods employ matching techniques. However, these matching techniques are not only computationally complex but also have a limited set of templates within the required data set, making them inflexible for icon detection in all scenarios. Summary of the Invention
[0003] In view of this, this application provides a method, apparatus, electronic device and storage medium for detecting icons.
[0004] On one hand, embodiments of this application provide an icon detection method, comprising: acquiring multiple consecutive frames of images; the multiple frames of images containing an icon to be detected; performing at least one level of partitioning and filtering processing on each frame of the multiple frames of images to obtain a target image region; wherein, the subsequent level of partitioning and filtering processing is performed on the multiple frame sub-target image regions obtained in the previous level of partitioning and filtering processing; each frame sub-target image region in the multiple frame sub-target image region corresponds to a corresponding frame image in the multiple frames of images and the pixel coordinates contained in different frame sub-target icon regions are the same; the target image region includes the multiple frame sub-target image regions obtained at the last level; extracting connected regions in the target image region, and obtaining the icon to be detected based on the connected regions.
[0005] In the above scheme, the step of performing at least one level of partitioning and filtering on each of the multiple frames of images to obtain the target image region includes: performing a first-level partitioning and filtering on each of the multiple frames of images to obtain multiple first sub-target image regions; performing a second-level partitioning and filtering on the multiple first sub-target image regions to obtain multiple second sub-target image regions; and progressively partitioning and filtering the multiple sub-target image regions obtained by the previous level of partitioning and filtering to obtain the target image region.
[0006] In the above scheme, the step of performing first-level partitioning and filtering on each frame of the multi-frame images to obtain multi-frame first sub-target image regions includes: performing first-level partitioning on each frame of the multi-frame images according to a first rule to obtain multiple first sub-image regions contained in each frame image; and performing filtering on the multiple first sub-image regions according to a first index to select a first sub-target image region from the multiple first sub-image regions, wherein the first index is used to characterize the similarity or difference between sub-image regions located at the same pixel coordinates in the multi-frame images.
[0007] The step of performing second-level partitioning and filtering on multiple frames of first sub-target image regions to obtain second sub-target image regions includes: performing second-level partitioning on multiple frames of first sub-target image regions according to a second rule to obtain multiple second sub-image regions contained in each frame of first sub-target image regions; and performing filtering on the multiple second sub-image regions according to the first index to select second sub-target image regions from the multiple second sub-image regions; wherein the first rule and the second rule are the same or different.
[0008] In the above scheme, the method further includes: determining a weight factor corresponding to each of the plurality of first sub-image regions; determining the similarity or difference between first sub-image regions with the same pixel coordinates in the multi-frame images; obtaining the first index corresponding to the corresponding first sub-image region based on the weight factor corresponding to each first sub-image region and the similarity corresponding to the corresponding first sub-image region; or, determining the first index corresponding to the corresponding first sub-image region based on the weight factor corresponding to each first sub-image region and the difference corresponding to the corresponding first sub-image region.
[0009] In the above scheme, the step of filtering the plurality of first sub-image regions according to the first index and selecting the first sub-target image region from the plurality of first sub-image regions includes: determining the first sub-image region from the plurality of first sub-image regions that satisfies the first preset condition; determining the first sub-target image region according to the first sub-image region that satisfies the first preset condition; wherein, the first preset condition includes one of the following: when the first index represents the similarity between first sub-image regions at the same pixel coordinates, the first index is greater than or equal to a first threshold, or the first sub-image regions corresponding to the first K similarity values are sorted in descending order of similarity; when the first index represents the difference between first sub-image regions at the same pixel coordinates, the first index is less than or equal to a second threshold, or the first sub-image regions corresponding to the last T difference values are sorted in descending order of difference; K and T are integers greater than or equal to 1, and K and T are equal or unequal.
[0010] In the above scheme, determining the first sub-target image region based on the first sub-image region that satisfies the first preset condition according to the first indicator includes: determining the first sub-image region corresponding to the first indicator satisfying the first preset condition as the first sub-target image region; or, increasing the pixel area of the first sub-image region corresponding to the first indicator satisfying the first preset condition; and determining the increased first sub-image region as the first sub-target image region.
[0011] In the above scheme, extracting the connected regions in the target image region includes: segmenting the target image region according to a second index corresponding to the pixels in the target image region; the second index is used to reflect the change of pixel value of the same pixel in the target image region in different frame images; filtering the segmented target image region, wherein the filtering process includes at least one of the following: smoothing processing, morphological operation processing; and extracting the segmented and filtered target image region to obtain the connected regions.
[0012] In the above scheme, the second indicator includes one of the following: the standard deviation of the pixel values of the pixels in the target image region, and the mean absolute deviation of the pixel values of the pixels in the target image region.
[0013] In the above scheme, obtaining the icon to be detected based on the connected region includes: determining the connected region as the icon to be detected; or, filtering out connected regions that meet a second preset condition; and determining the connected region that meets a third preset condition as the icon to be detected.
[0014] In the above scheme, the method further includes: preprocessing each frame of the multi-frame images, wherein the preprocessing includes at least one of the following: smoothing, thresholding, sampling, and grayscale processing.
[0015] On the other hand, embodiments of this application also provide an icon detection device, including:
[0016] The acquisition module is used to acquire multiple consecutive frames of images; the multiple frames of images contain the icon to be detected.
[0017] The partitioning module is used to perform at least one level of partitioning and filtering processing on each frame of the multi-frame images to obtain a target image region; wherein, the subsequent level of partitioning and filtering processing is to partition and filter the multi-frame sub-target image regions obtained by the previous level of partitioning and filtering processing; each frame sub-target image region in the multi-frame sub-target image region corresponds to a corresponding frame image in the multi-frame images and the pixel coordinates contained in different frame sub-target icon regions are the same; the target image region includes the multi-frame sub-target image regions obtained at the last level;
[0018] An extraction module is used to extract connected regions in the target image region and obtain the icon to be detected based on the connected regions.
[0019] In another aspect, embodiments of this application also provide an electronic device, the electronic device comprising: a processor and a memory for storing a computer program capable of running on the processor, wherein the processor, when running the computer program, performs the steps of the above method.
[0020] In another aspect, embodiments of this application also provide a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the above-described method.
[0021] This application provides an icon detection method, apparatus, electronic device, and storage medium. The icon detection method includes: acquiring multiple consecutive frames of images; the multiple frames of images containing an icon to be detected; performing at least one level of partitioning and filtering on each frame of the multiple frames to obtain a target image region; wherein the subsequent level of partitioning and filtering is performed on the multi-frame sub-target image regions obtained from the previous level of partitioning and filtering; each frame sub-target image region corresponds to a corresponding frame in the multiple frames of images, and the pixel coordinates contained in different frame sub-target icon regions are the same; the target image region includes the multi-frame sub-target image regions obtained at the last level; extracting connected regions in the target image region, and obtaining the icon to be detected based on the connected regions. The icon detection method provided by this application, by acquiring multiple consecutive frames of images in real time, and then progressively performing at least one level of partitioning and filtering on the multiple frames of images, and extracting the icon to be detected from the multi-frame sub-target image regions obtained at the last level, eliminates the need for prior construction and maintenance of a template library required for matching, and reduces computational complexity by eliminating the need for extensive matching calculations. The icon detection method described here is applicable to icon detection in any scenario and has good universality. Attached Figure Description
[0022] Figure 1 This is an optional flowchart illustrating the icon detection method provided in the embodiments of this application. Figure 1 ;
[0023] Figure 2 This is a schematic diagram of the process of at least one level of partitioning and filtering provided in the embodiments of this application;
[0024] Figure 3 This is a schematic diagram illustrating the understanding of the two-level partitioning and filtering process provided in the embodiments of this application;
[0025] Figure 4 This is a schematic diagram of a processing flow for steps 1021 and 1022 provided in an embodiment of this application;
[0026] Figure 5 This is a flowchart illustrating a method for determining a first indicator, provided in an embodiment of this application.
[0027] Figure 6 This is an example illustration of three frames of images partitioned according to the same partitioning rules provided in this application embodiment;
[0028] Figure 7 This is a schematic diagram of a process for obtaining a first sub-target image region provided in an embodiment of this application. Figure 1 ;
[0029] Figure 8This is a schematic diagram of a process for obtaining a first sub-target image region provided in an embodiment of this application. Figure 2 ;
[0030] Figure 9 This is an exemplary illustration of an enlarged image region provided in an embodiment of this application;
[0031] Figure 10 This is a schematic diagram of the process for obtaining the icon to be detected based on the extracted connected regions provided in an embodiment of this application;
[0032] Figure 11 This is a schematic diagram of a target image region segmentation process provided in an embodiment of this application;
[0033] Figure 12 This is a schematic diagram of the result of target image region segmentation provided in an embodiment of this application;
[0034] Figure 13 This is a schematic diagram of a process for obtaining an icon to be detected from a connected region, provided in an embodiment of this application;
[0035] Figure 14 This is an optional flowchart illustrating the icon detection method provided in the embodiments of this application. Figure 2 ;
[0036] Figure 15 This is a flowchart illustrating the hierarchical static region segmentation provided in an embodiment of this application;
[0037] Figure 16 This is a schematic diagram of the process for extracting fixed icons (i.e., icons to be detected) provided in the embodiments of this application;
[0038] Figure 17 This is a schematic diagram of the structure of an icon detection device provided in an embodiment of this application. Detailed Implementation
[0039] With the continuous development of smart terminal technology, entertainment applications such as games and video playback have become an important part of terminal applications. In the use of these applications, haptic feedback (or vibration feedback) plays an indispensable role in improving the user experience, especially in games. For games, vibration feedback is an important function for enhancing human-computer interaction and confirming user actions. In practical applications, a key challenge in achieving high-quality vibration feedback is accurately identifying the vibrating object and detecting its state changes. Therefore, the detection of icons (vibrating objects) in games is crucial for achieving high-quality vibration feedback. Typically, game icons represent character skills or scene elements. Accurately detecting and tracking the state changes of icons on the game screen makes vibration feedback more precise and targeted, thereby improving the overall user experience. However, for icon detection, most technologies use template matching, feature matching, or optical character recognition (OCR) matching algorithms. More specifically, in template matching algorithms, the image region that best matches the template icon in the image containing the icon to be detected is directly selected as the icon to be detected. In feature matching algorithms, the main features of the image containing the icon to be detected and the template icon are detected. These features are extracted and used as descriptors for their respective functions. Then, a full-image search is performed in the image containing the icon to be detected based on the main feature descriptors of the template icon to find the feature-matching image region as the icon to be detected. In optical character recognition matching algorithms, the main approach is to match text regions. Image regions with similar optical characters are found as icons to be detected.
[0040] For commonly used icon detection methods, a template library must be built through preprocessing steps before icon detection can begin. This building process requires significant time and resources, especially when dealing with a large number of different icons. Furthermore, the matching scheme needs to be adjusted for different icons, increasing development and maintenance complexity. Additionally, when the game scene or the icons themselves are updated, because the templates in the library are static (limited and pre-stored), scene updates or icon changes may result in the inability to match existing icons in the library, leading to matching failures. In such cases, manual intervention is required to update the template library, further increasing maintenance costs and operational complexity. When using a template library for icon detection, whether it's icon template matching, feature matching, or optical character detection, a large amount of matching computation is required, resulting in high computational complexity.
[0041] Based on this, in order to solve one or more of the above problems, this application provides an icon detection method that does not require the establishment of a template library in advance. It acquires multiple frames of images containing the icon to be detected in real time for analysis and extraction to obtain the icon to be detected for subsequent use.
[0042] Specifically, see Figure 1 This illustrates an optional flowchart of the icon detection method provided in an embodiment of this application. Figure 1 As shown, the detection method for this icon may include:
[0043] Step 101: Acquire multiple consecutive frames of images; the multiple frames of images contain the icon to be detected.
[0044] It should be noted that this icon detection method is applicable to the detection of icons in various types of playable audio / video or game videos. The audio / video content can include, but is not limited to, movies, TV series, live TV broadcasts, and other watchable videos. Game videos can be video footage displayed on the display component during the runtime of a game application, referred to simply as a game. Regardless of the type of video, the steps for icon detection provided in this application embodiment are similar. The implementation of this application embodiment will be described below using the detection of icons in game videos as an example. That is, unless otherwise specified, the videos and icons described below refer to games and icons within games.
[0045] Specifically, the icon can be a fixed icon in the game. For example, in a game video, the icon can be a skill icon, item icon, badge icon, launch icon, control icon, launch icon, etc.
[0046] In practical applications, a video of a certain duration is composed of frames arranged chronologically. In step 101, the "continuous multiple frames" can refer to multiple frames that are sequentially consecutive in a game video. The size of the image can be the size of the display screen of the terminal running the game, or it can be set according to the specific size of the icon to be detected or other conditions. This application does not limit the image size.
[0047] Step 102: Perform at least one level of partitioning and filtering on each frame of the multi-frame images to obtain the target image region; wherein, the subsequent level of partitioning and filtering is to partition and filter the multi-frame sub-target image regions obtained from the previous level of partitioning and filtering; each frame sub-target image region in the multi-frame sub-target image region corresponds to the corresponding frame image in the multi-frame images and the pixel coordinates contained in different frame sub-target icon regions are the same; the target image region includes the multi-frame sub-target image regions obtained at the last level.
[0048] In practical applications, the pixel area of the acquired image may be relatively large. Therefore, it is necessary to perform multiple partitioning and filtering processes step by step to ensure that the target icon occupies a large proportion of the obtained target image region, making the target icon stand out more and easier to extract. Furthermore, multi-level partitioning and filtering can reduce computational load and improve operational efficiency. This step-by-step partitioning and filtering process can also be called hierarchical partitioning and filtering. Each subsequent level of partitioning and filtering involves partitioning and filtering the multi-frame sub-target image regions obtained from the previous level; and each sub-target image region corresponds to a corresponding frame in the multi-frame image, with the pixel coordinates of the sub-target icon regions in different frames being the same.
[0049] Specifically, in some embodiments, such as Figure 2 As shown, step 102 may include:
[0050] Step 1021: Perform first-level partitioning and filtering on each frame of the multi-frame images to obtain the first sub-target image region of the multi-frame images;
[0051] Step 1022: Perform second-level partitioning and filtering on the multi-frame first sub-target image regions to obtain the multi-frame second sub-target image regions;
[0052] Step 1023: Gradually partition and filter the multi-frame sub-target image regions obtained from the previous partitioning and filtering process to obtain the target image regions.
[0053] That is, firstly, each frame of the multi-frame image is partitioned and filtered, then the first sub-target image region of the multi-frame obtained by the first-level partitioning and filtering is partitioned and filtered, and so on, until the last level of multi-frame sub-target image region, that is, the target image region, is obtained.
[0054] For example, such as Figure 3 As shown, that is, for example, Figure 3As shown, assume the multi-frame image includes frame A and frame B. After the first-level partitioning, frame A is divided into four image regions (i.e., multiple image regions corresponding to frame A): A1, A2, A3, and A4. Similarly, frame B is also divided into four image regions (i.e., multiple image regions corresponding to frame B): B1, B2, B3, and B4. The first sub-target image region obtained after filtering includes A1 and B1. The second-level partitioning and filtering process partitions and filters the obtained A1 and B1, assuming A1 is divided into A11, A12, A13, and A14; and B1 is divided into B11, B12, B13, and B14. The second sub-target image region obtained after filtering includes A11 and B11. Assume at least one level of partitioning and filtering includes two levels; that is, the second sub-target image region obtained from the second-level partitioning and filtering process is the final level of multi-frame sub-target image region, which is also the target image region.
[0055] More specifically, in some embodiments, such as Figure 4 As shown, step 1021 may include:
[0056] Step 401: Perform first-level partitioning on each frame of the multi-frame images according to the first rule to obtain multiple first sub-image regions contained in each frame image;
[0057] Step 402: Filter the plurality of first sub-image regions according to the first index, and select the first sub-target image region from the plurality of first sub-image regions, wherein the first index is used to characterize the similarity or difference between sub-image regions with the same pixel coordinates in the multi-frame images;
[0058] Step 1022 may include:
[0059] Step 403: Perform second-level partitioning on the first sub-target image regions of multiple frames according to the second rule to obtain multiple second sub-image regions contained in each frame's first sub-target image region;
[0060] Step 404: Filter the plurality of second sub-image regions according to the first indicator, and select the second sub-target image region from the plurality of second sub-image regions;
[0061] The first rule and the second rule may be the same or different.
[0062] It should be noted that, in general, the process of partitioning and filtering at each level can include: partitioning the sub-target image regions obtained from the previous level or the acquired original multi-frame images according to preset rules (such as the first rule or the second rule); then, filtering out the corresponding sub-target image regions at this level from the partitioned sub-image regions according to the first index, and thus gradually obtaining the target image regions. That is, the steps for partitioning and filtering at each level are similar, only the objects being processed are different. Therefore, the process of partitioning and filtering at the first level will only be described in detail below, and the partitioning and filtering at other levels will follow the same pattern.
[0063] Here, the first rule can be to apply the same partitioning rule to each frame of multiple images, dividing each frame into multiple first sub-image regions. The number of first sub-image regions is the same for different frames, and the size and pixel coordinates of corresponding first sub-image regions in different frames are the same. The size of the image region can be measured by its pixel area. A larger pixel area results in a larger image region, and a smaller pixel area results in a smaller image region. It should be understood that the pixel area can be measured by the number of pixels; the more pixels an image region contains, the larger its pixel area; the fewer pixels an image region contains, the smaller its pixel area. In this application, there are no restrictions on the partitioning method or the number of partitions. That is, the first rule can be any method that partitions the image, as long as the same partitioning rule is applied to each frame.
[0064] For example, see the previous section. Figure 3 As shown, assuming the multi-frame image includes frame A and frame B, the partitioning according to the first rule means that frame A is divided into four equal image regions (i.e., multiple first sub-image regions corresponding to frame A), namely A1, A2, A3, and A4. Similarly, frame B is also divided into four equal image regions (i.e., multiple first sub-image regions corresponding to frame B), namely B1, B2, B3, and B4. Furthermore, A1 and B1, A2 and B2, A3 and B3, and A4 and B4 are first sub-image regions with the same pixel coordinates in different frames, meaning they are sub-image regions with the same pixel coordinates in different frames as described later. Specifically, A1 and B1 have equal pixel areas and the same pixel coordinates; A2 and B2 have equal pixel areas and the same pixel coordinates; A3 and B3 have equal pixel areas and the same pixel coordinates; and A4 and B4 have equal pixel areas and the same pixel coordinates.
[0065] In some embodiments, before performing at least one level of partitioning and filtering on each of the multiple frames of images, the method further includes:
[0066] Each frame of the multi-frame image is preprocessed, wherein the preprocessing includes at least one of the following: smoothing, thresholding, sampling, and grayscale processing.
[0067] It should be noted that, in order to reduce the complexity of subsequent calculations and / or highlight specific regions (which may contain the icons to be detected), after acquiring multiple consecutive frames of images, each frame is pre-processed. This pre-processing includes at least one of the following: smoothing, thresholding, downsampling, and greyscale processing. In other words, each frame can undergo at least one of these processes to simplify subsequent calculations. Smoothing and thresholding can reduce noise in the image to highlight specific regions and simplify subsequent image processing. Downsampling can reduce image resolution to reduce computational complexity. Greyscale processing, also known as greyscale conversion, converts images in red, green, and blue (RGB) or hue, saturation, and value (HSV) modes into greyscale images to reduce the number of color channels and thus reduce computational complexity.
[0068] In some embodiments, step 401 may include: obtaining a first index corresponding to each of the plurality of first sub-image regions; obtaining multiple frames of first sub-target image regions from the plurality of first sub-image regions based on the first index corresponding to each first sub-image region; the first index is used to reflect the degree of similarity or difference between sub-image regions at the same pixel coordinates in the multiple frames of images.
[0069] It should be noted that the first indicator mentioned can also be called the static indicator of pixel regions, which is used to reflect the similarity or difference between sub-image regions at the same pixel coordinates in different frames of images. The sub-image regions at the same pixel coordinates are those mentioned earlier... Figure 2 The first sub-image region with the same pixel coordinates in different frames of the image, such as A1 and B1, A2 and B2, A3 and B3, A4 and B4.
[0070] Regarding the determination of the first indicator, in some embodiments, such as Figure 5 As shown, the method may further include:
[0071] Step 501: Determine the weight factor corresponding to each of the plurality of first sub-image regions;
[0072] Step 502: Determine the similarity or difference between the first sub-image regions with the same pixel coordinates in the multi-frame images;
[0073] Step 503: Obtain the first index corresponding to the corresponding first sub-image region based on the weight factor corresponding to each first sub-image region and the similarity corresponding to the corresponding first sub-image region; or, determine the first index corresponding to the corresponding first sub-image region based on the weight factor corresponding to each first sub-image region and the difference corresponding to the corresponding first sub-image region.
[0074] It should be noted that this weighting factor reflects the probability that the icon to be detected lies within a certain image region. A larger weighting factor indicates a higher probability that the corresponding first sub-image region contains the icon, while a smaller weighting factor indicates a lower probability. In one scenario, the probability of the icon being detected in one of multiple first sub-image regions is roughly equal; in this case, the weighting factor for each first sub-image region can be the same. In another scenario, when the probability of the icon being detected in a particular first sub-image region is high, the weighting factor for that first sub-image region can be set higher, while the weighting factors for the other first sub-image regions can be set relatively lower. For example, in multiplayer online battle arena (MOBA) games, the focus is more on detecting skill icons in the game image. Since skill icons are generally located in the lower right corner of the image, the first sub-image region located in the lower right corner will be assigned a higher weighting factor value, while other first sub-image regions will be assigned lower weighting factor values, thereby reducing the interference of other first sub-image regions on the detection results. Here, the weight factors of sub-image regions at the same pixel coordinates in different frames are the same. For example, the weight factors corresponding to A1 and B1 mentioned above are the same.
[0075] After setting the weight factor corresponding to each first sub-image region, the similarity or difference between the first sub-image regions with the same pixel coordinates in the multi-frame images is determined. Here, the first sub-image regions with the same pixel coordinates, as described above, refer to the first sub-image regions with the same pixel coordinates in different frames. For example, A1 and B1, or A2 and B2, or A3 and B3, or A4 and B4, as described above, all belong to the sub-image regions with the same pixel coordinates.
[0076] In some embodiments, the similarity between sub-image regions at the same pixel coordinates can refer to the similarity between first sub-image regions at the same pixel coordinates in different frame images. For example, the similarity between A1 and B1, the similarity between A2 and B2, the similarity between A3 and B3, and the similarity between A4 and B4.
[0077] In practical applications, the similarity referred to can be the Structural Similarity Index (SSIM) between first sub-image regions with the same pixel coordinates, or the degree of auto-correlation between image regions. It should be noted that since the acquired consecutive multi-frame images can include two or more frames, the calculation of this similarity can be divided into two cases. In one case, the multi-frame images include, for example... Figure 3 In the two images shown, the similarity between the first sub-image regions with the same pixel coordinates can refer to the similarity between the two first sub-image regions. In specific calculations, the SSIM index calculated directly using the SSIM algorithm can reflect the similarity between the first sub-image regions with the same pixel coordinates, or the autocorrelation coefficient calculated using image processing methods such as autocorrelation algorithms can reflect the similarity between the first sub-image regions with the same pixel coordinates. In another case, where the multi-frame image contains more than two frames, the similarity between the first sub-image regions with the same pixel coordinates can refer to the structural similarity index or autocorrelation degree between the first sub-image regions of two consecutive frames after certain operations (such as addition, multiplication, etc.). In other words, when the multi-frame image contains more than two frames, the similarity between the first sub-image regions with the same pixel coordinates is not the SSIM index directly calculated from the two first sub-image regions. It is necessary to calculate the SSIM index or autocorrelation between the two first sub-image regions of all consecutive frames, and then process all the calculated SSIM indexes or autocorrelation values through certain operations to obtain the value of the similarity between the first sub-image regions with the same pixel coordinates.
[0078] See Figure 6 As shown, taking a multi-frame image containing three frames, each frame divided into four image regions, as an example, this illustrates the calculation of similarity between sub-image regions at the same pixel coordinates. Figure 4 As shown, in front Figure 3Based on the above, an additional image C is added, which is divided into four first sub-image regions according to the same partitioning rules: C1, C2, C3, and C4. A1, B1, and C1 are first sub-image regions with the same pixel coordinates; A2, B2, and C2 are first sub-image regions with the same pixel coordinates; A3, B3, and C3 are first sub-image regions with the same pixel coordinates; and A4, B4, and C4 are first sub-image regions with the same pixel coordinates. The calculation of the similarity between A1, B1, and C1 is used as an example. First, the SSIM index (1) between A1 and B1 is calculated; then, the SSIM index (2) between B1 and C1 is calculated; subsequently, one method is to add the SSIM index (1) and the SSIM index (2) and then take the average. This average value is the similarity between A1, B1, and C1. The calculation of the similarity between the remaining sub-image regions with the same pixel coordinates is similar. It should be noted that in the above example of 3 frames, the SSIM index of the first sub-image region with the same pixel coordinates is calculated as follows: calculate the SSIM index between A1 and B1 (1); then calculate the SSIM index between B1 and C1 (2), and then obtain the SSIM index corresponding to the first sub-image region with the same pixel coordinates. In another embodiment, for more than three frames, such as 4 frames, the first sub-image regions with the same pixel coordinates are A1, B1, C1, and D1. In this case, the calculation of the autocorrelation degree of the first sub-image region with the same pixel coordinates can also be done as follows: calculate the SSIM index between A1 and B1 (1); then calculate the SSIM index between C1 and D1 (3), and then obtain the SSIM index between the first sub-image regions with the same pixel coordinates based on the SSIM index (1) and the SSIM index (3).
[0079] After obtaining the similarity between sub-image regions at the same pixel coordinates and the weight factor corresponding to each of the multiple image regions, the first index corresponding to the corresponding image region is determined based on the weight factor and the similarity of each image region. Specifically, the similarity of each image region is multiplied by the weight factor of the corresponding image region, and the product is the first index of that image region. This process is repeated to obtain the first index for each image region. Here, the first index corresponding to the first sub-image regions at the same pixel coordinates is the same. The process of calculating similarity using autocorrelation is similar to that using the SSIM index, and will not be elaborated further here.
[0080] For example, such as Figure 3The two images, frame A and frame B, are divided into four regions according to an equal division rule. After obtaining the similarity between A1 and B1 and their corresponding weight factors, a first index for either A1 or B1 can be obtained; similarly, after obtaining the similarity between A2 and B2 and their corresponding weight factors, a first index for either A2 or B2 can be obtained; similarly, after obtaining the similarity between A3 and B3 and their corresponding weight factors, a first index for either A3 or B3 can be obtained; and similarly, after obtaining the similarity between A4 and B4 and their corresponding weight factors, a first index for either A4 or B4 can be obtained.
[0081] In some embodiments, the degree of difference may refer to the difference between image regions. For example... Figure 3 The diagram illustrates the difference between the first sub-image regions A1 and B1 at the same pixel coordinates in frames A and B. Specifically, this difference can be calculated using image processing techniques such as frame differencing between the first sub-image regions at the same pixel coordinates across multiple frames. Similarly, depending on the number of images contained in the multiple frames, there are two cases. The first case involves multiple frames containing images such as... Figure 3 The two images shown are used to calculate the difference image between the first sub-image regions with the same pixel coordinates. This difference image is then used to evaluate the degree of difference between the first sub-image regions with the same pixel coordinates. Here, the difference image can refer to the image region obtained by calculating the difference between the pixel values of corresponding pixels in the first sub-image regions with the same pixel coordinates in the two images. In the second case, multiple images contain, for example,... Figure 6 For images consisting of two or more frames, multiple difference images are calculated between the first sub-image regions with the same pixel coordinates in the multiple frames. These multiple difference images are used to evaluate the difference between the first sub-image regions with the same pixel coordinates in two consecutive frames. Then, these difference values are processed to obtain the overall difference between the first sub-image regions with the same pixel coordinates in the multiple frames. The "two consecutive frames" can refer to adjacent images or non-adjacent images. The specific selection can be determined based on the actual situation and will not be elaborated further here.
[0082] Next, after obtaining the difference between the first sub-image regions at the same pixel coordinates and the weight factor corresponding to each of the multiple image regions, the corresponding static index of the image region is determined based on the weight factor and the difference of each image region. Specifically, the difference of each image region is multiplied by the weight factor of the corresponding image region, and the product is the static index of that image region. This process is repeated to obtain the static index of each image region. Here, the static index of the first sub-image regions at the same pixel coordinates is the same.
[0083] After determining the first index corresponding to each first sub-image region, one possible implementation for obtaining the first sub-target image region is as follows: Figure 7 As shown, step 503 may include:
[0084] Step 701: Determine the first sub-image region from the plurality of first sub-image regions where the first indicator satisfies the first preset condition;
[0085] Step 702: Determine the first sub-target image region based on the first sub-image region that satisfies the first preset condition according to the first indicator;
[0086] The first preset condition includes one of the following: when the first index represents the similarity between first sub-image regions with the same pixel coordinates, the first index is greater than or equal to a first threshold, or the first sub-image regions corresponding to the first K similarity values are sorted in descending order of similarity; when the first index represents the difference between first sub-image regions with the same pixel coordinates, the first index is less than or equal to a second threshold, or the first sub-image regions corresponding to the last T difference values are sorted in descending order of difference; K and T are integers greater than or equal to 1, and K and T are equal or unequal.
[0087] It should be noted that the first preset condition is a filtering condition set according to the actual situation. That is, based on the first preset condition, first sub-image regions that meet the conditions are filtered from multiple first sub-image regions, and then the first sub-target image region is obtained based on these first sub-image regions that meet the conditions. Specifically, the first preset condition may include: when the first index represents the similarity between first sub-image regions with the same pixel coordinates, the first index is greater than or equal to a first threshold, or the first sub-image regions corresponding to the first K similarity values are sorted in descending order of similarity; furthermore, when the first index represents the difference between first sub-image regions with the same pixel coordinates, the first index is less than or equal to a second threshold, or the first sub-image regions corresponding to the last T difference values are sorted in descending order of difference; K and T are integers greater than or equal to 1, and K and T may be equal or unequal. In other words, since the first indicator can be measured from two aspects, the first preset condition is formulated from two aspects. That is, when the first indicator represents the similarity between first sub-image regions with the same pixel coordinates, the first sub-target image region with the first indicator greater than or equal to the first threshold belongs to the first sub-image region that satisfies the first preset condition; or, the first sub-image regions corresponding to the first K similarity values sorted in descending order of similarity belong to the first sub-image regions that satisfy the first preset condition. In other embodiments, when the first indicator represents the difference between first sub-image regions with the same pixel coordinates, the first sub-target image region with the first indicator less than or equal to the second threshold belongs to the first sub-image region that satisfies the first preset condition; or, the first sub-image regions corresponding to the last T difference values sorted in descending order of difference satisfy the first preset condition.
[0088] After selecting the first sub-image region that meets the criteria, in some embodiments, step 702 may include:
[0089] The first sub-image region corresponding to the first indicator satisfying the first preset condition is determined as the first sub-target image region.
[0090] Alternatively, based on the first sub-image region corresponding to the first indicator satisfying the first preset condition, its pixel area is increased; the increased first sub-image region is determined as the first sub-target image region.
[0091] It should be noted that, for determining the first sub-target image region, one possible approach is to directly use the selected first sub-image regions from multiple frames as the first sub-target image region for those frames. This approach is suitable when the size of the icon to be detected is unknown. Another approach is to analyze the pixel area difference between the icon to be detected and the first sub-image region, and then determine the first sub-target image region based on this pixel area difference.
[0092] For the second scenario, the specific procedure is as follows: Figure 8 As shown, it may include:
[0093] Step 801: Analyze the pixel area difference between the icon to be detected and the first sub-image region;
[0094] Step 802: When the pixel area difference is such that the pixel area of the icon to be detected is less than or equal to the pixel area of the first sub-image region, the first sub-image region corresponding to the first indicator satisfying the first preset condition is determined as the first sub-target image region.
[0095] Step 803: When the pixel area difference is such that the pixel area of the icon to be detected is greater than the pixel area of the first sub-image region, increase the pixel area of the first sub-image region corresponding to the first preset condition of the first indicator; determine the increased first sub-image region as the first sub-target image region.
[0096] It should be noted that this situation applies when the size of the icon to be detected is known. The relationship between image size and pixel area has already been described. When partitioning each frame of the image, the pixel area of the first sub-image region can be determined for each partition. There are two cases regarding the area difference between the icon to be detected and the first sub-image region. One case, as described in step 802, is where the first sub-target image region is also the selected first sub-image region. The other case, as described in step 803, involves increasing the pixel area of the first sub-image region that meets the preset conditions for the first indicator, thus determining the enlarged first sub-target image region as the first sub-target image region. For a detailed understanding, see [link to relevant documentation]. Figure 9 As shown, based on the selected A1, its pixel area is increased to form A1'( Figure 7 The shaded area in the image (A1') is the first sub-target image region.
[0097] Based on the method used to obtain the first sub-target image region, the second sub-target image region is obtained, and then the target image region is obtained. Specific details will not be elaborated further.
[0098] Step 103: Extract the connected regions in the target image region, and obtain the icon to be detected based on the connected regions.
[0099] In some embodiments, such as Figure 10 As shown, step 103, extracting the connected regions in the target image region, may include:
[0100] Step 1001: Segment the target image region according to the second index corresponding to the pixel in the target image region; the second index is used to reflect the change of pixel value of the same pixel in the target image region in different frame images;
[0101] Step 1002: Filter the segmented target image region, wherein the filtering process includes at least one of the following: smoothing process, morphological operation process;
[0102] Step 1003: Extract the segmented and filtered target image region to obtain the connected region.
[0103] Here, for step 1001, as Figure 11 As shown, the segmentation process of the target image region based on the second index corresponding to the pixels in the target image region may include:
[0104] Step 1101: Classify the pixels in the target image region according to the second index to form a first pixel set and a second pixel set; wherein, the first pixel set includes pixels in the target image region whose second index satisfies a third preset condition; the second pixel set includes pixels in the target image region whose second index satisfies a fourth preset condition;
[0105] Step 1102: Binarize the first pixel set and the second pixel set in the target image region to segment the target image region.
[0106] The third preset condition may include a second indicator being less than or equal to a third threshold. The fourth preset condition may include a second indicator being greater than the third threshold. That is, pixels in the target image region are classified according to the second indicator, forming a first set of pixels (pixel set) where the second indicator is less than or equal to the third threshold, and a second set of pixels (pixel set) where the second indicator is greater than the third threshold. Here, the third threshold can be set according to the actual situation.
[0107] Here, the second indicator can refer to the change of the same pixel in the target image region across different frames, also known as the static pixel indicator. This static pixel indicator can be used to determine whether the position of the same pixel in the target image region has changed across different frames. For example, if the second indicator of a pixel in the target image region is less than or equal to the third threshold, it is determined that the pixel's position has not changed across multiple frames, and it can be called a static pixel. Here, all static pixels in the target image region form the first pixel set. If the second indicator of a pixel in the target image region is greater than the third threshold, it is determined that the pixel's position has changed across multiple frames, and it can be called a dynamic pixel. Here, all dynamic pixels in the target image region form the second pixel set. In other words, static and dynamic pixels in the target image region are distinguished based on the second indicator.
[0108] Then, binarization is used to assign different values to the pixels in the first pixel set and the pixels in the second pixel set in the target image region, so that the first pixel set and the second pixel set are displayed in different colors, thereby segmenting the target image region.
[0109] For specific understanding, such as Figure 12 As shown, in a certain target image region, all pixels in the first pixel set are assigned the value "1", and all pixels in the second pixel set are assigned the value "0", so that the regions in the first pixel set and the regions in the second pixel set of the target image region are displayed with different colors.
[0110] In practical applications, the second indicator includes one of the following: the standard deviation of pixel values in the target image region, and the mean absolute deviation of pixel values in the target image region.
[0111] In other words, a second indicator reflecting whether the pixel value of a pixel in a target image region has changed can be the standard deviation of the pixel value of the same pixel in multiple frames of images or the average absolute deviation of the pixel value of the same pixel in multiple frames of images.
[0112] In some embodiments, the method for determining a second index for a specific pixel in a target image region may further include:
[0113] Determine the average pixel value of a first pixel in the target image region across the multi-frame images; the first pixel can be any pixel in the target image region.
[0114] The standard deviation or mean absolute deviation of the first pixel is obtained based on the average pixel value and the pixel value of the first pixel in the target image region of each of the multi-frame images.
[0115] It should be noted that the first pixel is any pixel in the target image region. The above-described process for determining the second indicator is the process for determining the standard deviation of a certain pixel in the target pixel region; the determination of the remaining pixels can refer to the aforementioned process.
[0116] Specifically, the standard deviation corresponding to the first pixel can be calculated using the following formula:
[0117]
[0118] Where Std(x,y) represents the standard deviation of pixel (x,y); I i (x,y) represents the pixel value of pixel (x,y) in the i-th frame of the image; Std(x,y) represents the average pixel value of pixel (x,y) across multiple frames of an image. A smaller Std(x,y) indicates a smaller variation in pixel value at pixel (x,y), while a larger Std(x,y) indicates a larger variation in pixel value at pixel (x,y).
[0119] Specifically, the calculation of the mean absolute deviation corresponding to the first pixel can be referenced as follows:
[0120]
[0121] Wherein, is the average absolute deviation of pixel (x,y) in Mtd(x,y).
[0122] Here, to better extract connected regions in the target image region, the segmented target image region is filtered to reduce noise. The smoothing process mentioned here can include, but is not limited to, Gaussian smoothing and median smoothing. The morphological operations mentioned include, but are not limited to, erosion, dilation, opening, and closing. Opening is used to remove small noisy pixels in the image while preserving the shape and size of larger objects. Closing aims to fill small holes in the connected region image while preserving the shape and size of large holes and objects in the connected region image. The morphological operations described above can be implemented using the `morphologyEx` module of OpenCV in image processing.
[0123] In practical applications, whether extracting from filtered target image regions or directly from previously obtained target image regions, connected component analysis (CBI) techniques can be used. Specifically, extraction can be achieved through the connected components module in OpenCV. This module can use different algorithms such as Spaghetti, BBDT, or SAUF to label and locate connected components.
[0124] After obtaining the connected components, such as Figure 13 As shown, in some embodiments, obtaining the icon to be detected based on the connected region may include:
[0125] Step 1301: Determine the connected region as the icon to be detected; or, filter out connected regions that meet the second preset condition; and determine the connected region that meets the third preset condition as the icon to be detected.
[0126] It should be noted that, depending on different needs, the icon to be detected can be obtained based on the connected region, and the connected region can be directly identified as the icon to be detected; alternatively, the connected region can be filtered to select connected regions that meet a second preset condition, and the connected regions that meet the second preset condition can be identified as the icon to be detected. The second preset condition may include, but is not limited to, using pixel area thresholding, filtering connected regions that meet the condition by using preset maximum and minimum pixel area thresholds; aspect ratio filtering, if the target fixed icon in a specific scene has a clear shape, connected regions can be filtered by aspect ratio; circularity filtering, if the target fixed icon in a specific scene has circular features, connected regions can be filtered by circularity; and color / intensity filtering, if the target fixed icon in a specific scene has a clear color range or brightness range, connected regions can be filtered by color / intensity and other basic image information.
[0127] For example, in MOBA mobile games, if you want to locate the hero skill icon of the current hero, and most hero skill icons are circular with a fixed pixel area range, you can combine area threshold and circularity filtering to obtain the predicted fixed game icon result (i.e. the icon to be detected).
[0128] In order to understand this application, Figures 14 to 16 The detection process for the icon to be detected is described below. Figures 14 to 16 In this process, the acquired multi-frame images include N frames; each frame is a full-screen image. Based on this, the specific detection process can be as follows: Figure 14 As shown, it includes:
[0129] 1. Obtain n consecutive frames of images from the target game application video, and call these n consecutive frames a processing unit, and perform corresponding pre-processing on each frame.
[0130] Specifically, preprocessing includes at least one of the following:
[0131] A) Including but not limited to conventional image processing techniques such as smoothing and thresholding, the above preprocessing methods are used to reduce noise in the image and highlight specific areas to simplify image processing tasks.
[0132] B) Including but not limited to down-sampling, used to reduce image resolution to reduce computational complexity.
[0133] C) Including but not limited to grayscale conversion, converting RGB or HSV images to grayscale images, reducing the number of color channels, thereby reducing computational complexity.
[0134] It should be noted that n is greater than or equal to 2.
[0135] 2. Hierarchical Static Region Segmentation. Since the content of a fixed game icon (i.e., the icon to be detected) usually does not change within a certain number of consecutive frames, this characteristic is used to hierarchically detect static regions (i.e., the region where the first set of pixels is located) in multiple frames, and finally perform hierarchical static region segmentation. For example, in MOBA games, static regions are mostly fixed game icons (such as hero skill icons, health icons, basic settings icons, etc.).
[0136] like Figure 15 As shown, the specific steps of hierarchical static region segmentation are as follows: 1. Full-screen image segmentation; 2. Calculation of static indexes for pixel regions; 3. Preliminary screening of static regions; 4. Calculation of static indexes for pixels in the screened sub-regions; 5. Static region segmentation based on pixel static indexes. The obtained multi-frame images undergo multi-level partitioning and screening processing a preset number of times (which can be set according to actual conditions). Steps 1 to 3 correspond to the first-level partitioning and screening processing in step 102 above. The processes for the remaining levels of partitioning and screening are similar to steps 1 to 3, only the processing objects are different. This has been explained in detail above and will not be repeated here.
[0137] The first-level partitioning and filtering process is described in detail below:
[0138] 1. Full-screen image partitioning: For certain game icons, the area in which they appear may be relatively fixed, or can be personalized within a certain range. We first partition the full-screen image and assign different weights (i.e., weight factors) to different sub-regions (i.e., image areas) to better adapt to the application scenario.
[0139] Suppose we partition the full-screen image R into regions, and represent each region as {a1, a2, ..., a...} n}, and assign weight factors {w1, w2, ..., w} to each image region according to the specific task. n}, where R = a1 + a2 + ... + a n ,w1+w2+…+w n =1.
[0140] For example, in MOBA games, we focus more on the detection of skill icons. We can give higher weight to the sub-image region located in the lower right corner of the terminal screen and lower weight to other sub-image regions that are more likely to cause interference (such as the minimap in the upper left corner), thereby reducing the interference to the detection results when static areas also appear in other areas.
[0141] 2. Calculation of Static Indicators for Pixel Regions. Unlike the calculation of static indicators for individual pixels, the static indicators for pixel regions here can use more intuitive and generalized metrics to measure similarity. One implementation involves calculating the structural similarity index between each sub-region (i.e., image region) in different frames of the image for each sub-region, thereby obtaining the similarity results (i.e., similarity scores): {S1, S2, ..., S...} n The final pixel region index (i.e., the first index) is calculated by multiplying the similarity result between each image sub-region by an assigned weight factor to obtain the final static pixel region index result: {S1*w1,S2*w2,…,S n *w n}
[0142] 3. Preliminary (hierarchical) screening of static regions. For each sub-image interval, we use a thresholding method based on the calculated pixel region static index to screen out the sub-image intervals that meet the conditions. From this step onwards, we only process the screened sub-image intervals. One embodiment is that from the above region static index results {S1*w1,S2*w2,…,S…} n *w n In the above, we select the three sub-image regions with the larger numerical ranking as the target static sub-interval (i.e., the first sub-target image region).
[0143] Steps 4 and 5 correspond to steps 1001 and 1002. Specifically,
[0144] 4. Calculation of Static Indicators for Each Pixel. Typically, to compare the differences between each pixel coordinate within consecutive image frames, it's necessary to segment the target static sub-region at the pixel level. The calculation methods include, but are not limited to, calculating the standard deviation of each pixel within the target static sub-region. The standard deviation can also be used to detect differences in pixel variations. The calculation of the standard deviation is as follows:
[0145]
[0146] Where Std(x,y) represents the standard deviation of the pixel coordinates (x,y), I i (x,y) represents the pixel value at coordinates (x,y) within the i-th frame of the image. Std(x,y) represents the average pixel value at coordinates (x,y) within n frames of the image. A smaller Std(x,y) indicates a smaller variation in pixel value at coordinates (x,y). This explanation uses the standard deviation as an example.
[0147] 5. Target Static Region Segmentation. Based on the above pixel static index results, determine whether the pixels in the target static region are static or dynamic pixels. The region containing all static pixels (i.e., the first pixel set) is classified as a static region, and the region containing all dynamic pixels (i.e., the second pixel set) is classified as a dynamic region (or dynamic background), thus separating the static region and the dynamic background. Finally, binarization is used to segment the static region and the dynamic background to complete the segmentation of the target static region. Static pixels are those whose static index in the target static region is less than a certain threshold; dynamic pixels are those whose static index in the target static region is greater than a certain threshold.
[0148] 3. Fixed icon detection. For example... Figure 16 As shown, the process can include: 1. Preprocessing the target static intervals before connected component extraction; 2. Connected component extraction; 3. Filtering all connected components after extraction. The specific steps can be as follows:
[0149] 1. Before extracting connected components, the target static region (a binarized image) is preprocessed. Filtering operations on the target static region aim to reduce noise and facilitate subsequent connected component extraction. Two types of filtering operations for the segmented binarized image are given below: Filtering operations for binarized images include, but are not limited to, smoothing operations, such as Gaussian smoothing and median smoothing. Filtering operations also include, but are not limited to, morphological operations, such as erosion, dilation, opening, and closing. Specifically, for the binarized image after static region segmentation (i.e., the target static region), we first perform an opening operation to remove small noisy pixels while preserving the shape and size of larger objects. Then, we perform a closing operation to fill small holes in the connected component image while preserving the shape and size of large holes and objects. These morphological operations can be implemented using OpenCV's morphologyEx module.
[0150] 2. Connected Component Extraction. Connected component analysis can be used to extract connected components, specifically through the `connected Components` module in OpenCV. This module can use different algorithms such as Spaghetti, BBDT, or SAUF to label and locate connected components.
[0151] 3. Obtain the icon to be detected. The extracted connected regions can be directly used as the prediction result for the fixed icon (i.e., the icon to be detected), or the extracted connected regions can be further filtered, and the filtered result can be used as the prediction result for the fixed icon. Specifically, we filter the extracted connected regions according to the specific application scenario to obtain the final prediction result for the fixed icon. Examples of filtering methods are as follows: Connected region filtering methods include, but are not limited to, using area thresholding. Connected regions that meet the conditions are filtered using preset maximum and minimum area thresholds. Connected region filtering methods include, but are not limited to, aspect ratio filtering. If the target fixed icon in a specific scene has a clear shape, connected regions can be filtered by aspect ratio. Connected region filtering methods include, but are not limited to, circularity filtering. If the target fixed icon in a specific scene has circular features, connected regions can be filtered by circularity. Connected region filtering methods include, but are not limited to, color / intensity filtering. If the target fixed icon in a specific scene has a clear color range or brightness range, connected regions can be filtered using basic image information such as color / intensity.
[0152] For example, in MOBA mobile games, if we want to locate the hero skill icon of the current hero, and hero skill icons are mostly circular and have a fixed range of pixel area conditions, we combine two filtering methods, pixel area threshold and circularity filtering, to obtain the predicted fixed game icon result.
[0153] This application also provides an icon detection device, such as... Figure 17 As shown, the device 170 may include:
[0154] The acquisition module 1701 is used to acquire multiple consecutive frames of images; the multiple frames of images contain icons to be detected.
[0155] The processing module 1702 is used to perform at least one level of partitioning and filtering processing on each frame of the multi-frame images to obtain a target image region; wherein, the subsequent level of partitioning and filtering processing is to partition and filter the multi-frame sub-target image regions obtained by the previous level of partitioning and filtering processing; each frame sub-target image region in the multi-frame sub-target image region corresponds to a corresponding frame image in the multi-frame images and the pixel coordinates contained in different frame sub-target icon regions are the same; the target image region includes the multi-frame sub-target image regions obtained at the last level;
[0156] Extraction module 1703 is used to extract connected regions in the target image region and obtain the icon to be detected based on the connected regions.
[0157] In some embodiments, the apparatus further includes a preprocessing module for preprocessing each frame of the multi-frame images, wherein the preprocessing includes at least one of the following: smoothing, thresholding, sampling, and grayscale processing.
[0158] In some embodiments, the processing module is further configured to: perform a first-level partitioning and filtering process on each frame of the multi-frame images to obtain a multi-frame first sub-target image region; perform a second-level partitioning and filtering process on the multi-frame first sub-target image region to obtain a multi-frame second sub-target image region; and progressively partition and filter the multi-frame sub-target image regions obtained by the previous-level partitioning and filtering process to obtain the target image region.
[0159] In some embodiments, the processing module is further configured to: perform a first-level partitioning process on each frame of the multi-frame images according to a first rule to obtain a plurality of first sub-image regions contained in each frame image; perform a filtering process on the plurality of first sub-image regions according to a first index to filter out a first sub-target image region from the plurality of first sub-image regions, wherein the first index is used to characterize the similarity or difference between sub-image regions at the same pixel coordinates in the multi-frame images; perform a second-level partitioning process on the multi-frame first sub-target image regions according to a second rule to obtain a plurality of second sub-image regions contained in each frame first sub-target image region; and perform a filtering process on the plurality of second sub-image regions according to the first index to filter out a second sub-target image region from the plurality of second sub-image regions; wherein the first rule and the second rule are the same or different.
[0160] In some embodiments, the apparatus further includes a determining module, configured to: determine a weight factor corresponding to each of the plurality of first sub-image regions; determine the similarity or difference between first sub-image regions at the same pixel coordinates in the multi-frame images; obtain the first index corresponding to the corresponding first sub-image region based on the weight factor corresponding to each first sub-image region and the similarity corresponding to the corresponding first sub-image region; or, determine the first index corresponding to the corresponding first sub-image region based on the weight factor corresponding to each first sub-image region and the difference corresponding to the corresponding first sub-image region.
[0161] In some embodiments, the processing module is further configured to determine, from the plurality of first sub-image regions, a first sub-image region whose first indicator satisfies a first preset condition; and to determine a first sub-target image region based on the first sub-image region whose first indicator satisfies the first preset condition; wherein, the first preset condition includes one of the following: when the first indicator represents the similarity between first sub-image regions at the same pixel coordinates, the first indicator is greater than or equal to a first threshold, or the first sub-image regions corresponding to the first K similarity values are sorted in descending order of similarity; when the first indicator represents the difference between first sub-image regions at the same pixel coordinates, the first indicator is less than or equal to a second threshold, or the first sub-image regions corresponding to the last T difference values are sorted in descending order of difference; K and T are integers greater than or equal to 1, and K and T are equal or unequal.
[0162] In some embodiments, the processing module is further configured to: determine the first sub-image region corresponding to the first indicator satisfying the first preset condition as the first sub-target image region; or, based on the first sub-image region corresponding to the first indicator satisfying the first preset condition, increase its pixel area; and determine the increased first sub-image region as the first sub-target image region.
[0163] In some embodiments, the extraction module is configured to segment the target image region according to a second index corresponding to a pixel in the target image region; the second index is used to reflect the change in the pixel value of the same pixel in the target image region in different frame images; to filter the segmented target image region, wherein the filtering process includes at least one of the following: smoothing processing, morphological operation processing; and to extract the segmented and filtered target image region to obtain the connected region.
[0164] In some embodiments, the extraction module is further configured to: determine the connected region as the icon to be detected; or, filter out connected regions that meet a second preset condition; and determine the connected region that meets a third preset condition as the icon to be detected.
[0165] It should be noted that the description of the apparatus in this application embodiment is similar to the description of the method embodiment described above, and has similar beneficial effects as the method embodiment; therefore, it will not be repeated. For technical details not disclosed in this apparatus embodiment, please refer to the description of the method embodiment of this application for understanding.
[0166] It should be noted that, in the embodiments of this application, if the above-mentioned icon detection method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the related technology, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a terminal to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0167] This application also provides an electronic device, which includes a processor and a memory for storing a computer program that can run on the processor, wherein the processor executes the steps of the above method when running the computer program.
[0168] It should be noted that the electronic device includes at least: a memory for storing computer programs that can run on a processor, and a processor. The memory stores computer programs that can run on the processor, and the processor typically controls the overall operation of the electronic device. The memory is configured to store instructions and applications executable by the processor, and may also cache data to be processed or processed by various modules in the processor and the electronic device. This can be implemented using flash memory or random access memory (RAM).
[0169] This application provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the above-described method.
[0170] In other words, the computer-readable storage medium stores executable instructions, i.e., computer programs. When the computer program is executed by the processor, it will cause the processor to execute the vibration control method provided in the embodiments of this application.
[0171] In some embodiments, the storage medium may be a computer-readable storage medium, such as a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), flash memory, magnetic surface memory, optical disc, or a compact disk-read-only memory (CD-ROM); or it may be a device that includes one or any combination of the above-mentioned memories.
[0172] In some embodiments, executable instructions may take the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a standalone program or as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0173] As an example, executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or more scripts within a Hyper Text Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple co-located files (e.g., files storing one or more modules, subroutines, or code sections). As an example, executable instructions may be deployed to execute on a single computing device, or on multiple computing devices located in one location, or on multiple computing devices distributed across multiple locations and interconnected via a communication network.
[0174] It should be noted that the technical features described in the embodiments of this application can be combined arbitrarily without conflict.
[0175] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, phrases such as "in some embodiments" or "in one embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0176] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components may be combined, or integrated into another system, or some features may be ignored or not performed. The above descriptions are merely embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of protection of the claims.
Claims
1. A method for detecting icons, characterized in that, include: A series of consecutive frames of images are acquired; each of the frames contains an icon to be detected; and each frame of the multiple frames is subjected to at least two levels of partitioning and filtering to obtain a target image region; wherein, the subsequent level of partitioning and filtering is performed on the multi-frame sub-target image regions obtained from the previous level of partitioning and filtering; and connected regions are extracted from the target image region, and the icon to be detected is obtained based on the connected regions; wherein each frame sub-target image region in the multi-frame sub-target image region corresponds to a corresponding frame image in the multiple frames of images, and the pixel coordinates contained in different frame sub-target icon regions are the same; the target image region includes the multi-frame sub-target image region obtained at the last level; The partitioning and filtering process at each level includes: partitioning the multi-frame image or multi-frame sub-target image region corresponding to the current level to obtain multiple sub-image regions; filtering the multiple sub-image regions according to a first index; the first index is used to characterize the similarity or difference between sub-image regions with the same pixel coordinates in the multi-frame image; the filtering process includes: determining the sub-image regions from the multiple sub-image regions whose first index satisfies a first preset condition; the first preset condition includes one of the following: when the first index characterizes the similarity between first sub-image regions with the same pixel coordinates, the first index is greater than or equal to a first threshold, or the first sub-image regions corresponding to the first K similarity values are sorted in descending order of similarity; when the first index characterizes the difference between first sub-image regions with the same pixel coordinates, the first index is less than or equal to a second threshold, or the first sub-image regions corresponding to the last T difference values are sorted in descending order of difference; K and T are integers greater than or equal to 1, and K and T are equal or unequal.
2. The method according to claim 1, characterized in that, The step of performing at least one level of partitioning and filtering on each of the multiple image frames to obtain the target image region includes: Each frame of the multi-frame images is subjected to first-level partitioning and filtering to obtain the first sub-target image region of the multi-frame images; The first sub-target image regions of the multiple frames are subjected to a second-level partitioning and filtering process to obtain the second sub-target image regions of the multiple frames. The target image region is obtained by progressively partitioning and filtering the multi-frame sub-target image regions obtained from the previous partitioning and filtering process.
3. The method according to claim 2, characterized in that, The step of performing first-level partitioning and filtering on each frame of the multi-frame images to obtain the first sub-target image region of the multi-frame images includes: Each frame of the multi-frame images is partitioned according to a first rule to obtain multiple first sub-image regions contained in each frame image; The plurality of first sub-image regions are filtered according to the first index to select a first sub-target image region from the plurality of first sub-image regions; The step of performing a second-level partitioning and filtering process on the multi-frame first sub-target image regions to obtain the second sub-target image regions includes: The first sub-target image regions of multiple frames are partitioned according to the second rule to obtain multiple second sub-image regions contained in each frame's first sub-target image region; Based on the first indicator, the plurality of second sub-image regions are filtered to select a second sub-target image region from the plurality of second sub-image regions; The first rule and the second rule may be the same or different.
4. The method according to claim 3, characterized in that, The method further includes: Determine the weight factor corresponding to each of the plurality of first sub-image regions; Determine the similarity or difference between the first sub-image regions that are at the same pixel coordinates in the multi-frame images; The first index corresponding to the corresponding first sub-image region is obtained based on the weight factor corresponding to each first sub-image region and the similarity corresponding to the corresponding first sub-image region; or, the first index corresponding to the corresponding first sub-image region is determined based on the weight factor corresponding to each first sub-image region and the difference corresponding to the corresponding first sub-image region.
5. The method according to claim 3, characterized in that, The step of filtering the plurality of first sub-image regions according to a first indicator, and selecting a first sub-target image region from the plurality of first sub-image regions, includes: From the plurality of first sub-image regions, determine the first sub-image region where the first indicator satisfies the first preset condition; The first sub-target image region is determined based on the first sub-image region that satisfies the first preset condition according to the first indicator.
6. The method according to claim 5, characterized in that, Determining the first sub-target image region based on the first sub-image region that satisfies the first preset condition according to the first indicator includes: The first sub-image region corresponding to the first indicator satisfying the first preset condition is determined as the first sub-target image region. Alternatively, based on the first sub-image region corresponding to the first indicator satisfying the first preset condition, its pixel area is increased; the increased first sub-image region is determined as the first sub-target image region.
7. The method according to claim 1, characterized in that, Extracting the connected regions in the target image region includes: The target image region is segmented based on a second index corresponding to the pixels in the target image region; the second index is used to reflect the change in the pixel value of the same pixel in the target image region in different frame images. The segmented target image region is filtered, wherein the filtering process includes at least one of the following: smoothing processing and morphological operation processing; The segmented and filtered target image region is extracted to obtain the connected region.
8. The method according to claim 7, characterized in that, The second metric includes one of the following: the standard deviation of pixel values in the target image region, and the mean absolute deviation of pixel values in the target image region.
9. The method according to claim 1, characterized in that, The step of obtaining the icon to be detected based on the connected region includes: The connected region is identified as the icon to be detected; Alternatively, connectable regions that meet the second preset condition are selected; and connectable regions that meet the third preset condition are identified as the icons to be detected.
10. The method according to claim 1, characterized in that, The method further includes: Each frame of the multi-frame image is preprocessed, wherein the preprocessing includes at least one of the following: smoothing, thresholding, sampling, and grayscale processing.
11. An icon detection device, characterized in that, include: The acquisition module is used to acquire multiple consecutive frames of images; the multiple frames of images contain the icon to be detected. The processing module is configured to perform at least two levels of partitioning and filtering processing on each frame of the multi-frame images to obtain a target image region. Each subsequent level of partitioning and filtering processing involves partitioning and filtering the multi-frame sub-target image regions obtained from the previous level of partitioning and filtering. Each sub-target image region corresponds to a corresponding frame in the multi-frame images, and the pixel coordinates of different frame sub-target icon regions are the same. The target image region includes the multi-frame sub-target image regions obtained at the last level. Each level of partitioning and filtering processing includes: partitioning the current level's corresponding multi-frame image or multi-frame sub-target image region to obtain multiple sub-image regions; and filtering the multiple sub-image regions according to a first index. The first index is used to characterize the pixels in the multi-frame images that are at the same pixel level. The similarity or difference between sub-image regions with the same pixel coordinates; wherein, the filtering process includes: determining sub-image regions from the plurality of sub-image regions whose first index satisfies a first preset condition; the first preset condition includes one of the following: when the first index represents the similarity between first sub-image regions with the same pixel coordinates, the first index is greater than or equal to a first threshold, or the first sub-image regions corresponding to the first K similarity values are sorted in descending order of similarity; when the first index represents the difference between first sub-image regions with the same pixel coordinates, the first index is less than or equal to a second threshold, or the first sub-image regions corresponding to the last T difference values are sorted in descending order of difference; K and T are integers greater than or equal to 1, and K and T are equal or unequal; An extraction module is used to extract connected regions in the target image region and obtain the icon to be detected based on the connected regions.
12. An electronic device, characterized in that, The electronic device includes: a processor and a memory for storing a computer program capable of running on the processor, wherein, when the processor runs the computer program, it performs the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Image screening method and device, storage medium and electronic device
CN112925937A
Object identification device, object identification method, and, program for object identification
JP2007241372A
