Map color detection method and apparatus, device, and storage medium

By splitting and generating four-channel maps, an efficient solution for multi-channel map solid color detection is achieved, solving the traditional method's lack of detection efficiency and accuracy, and is suitable for high-specific gravity four-channel maps in games resource.

WO2024230274A1PCT designated stage expired Publication Date: 2024-11-14NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 9 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/078396
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-05-09
Filing Date
2024-02-23
Publication Date
2024-11-14

AI Technical Summary

Technical Problem

The existing technology is difficult to quickly and effectively detect whether the four-channel map is solid color. Traditional methods have shortcomings in detection efficiency and accuracy, especially when the proportion of the four-channel maps is getting higher and higher in the game, which affects the size of the game's package and Performance optimization.

Method used

By splitting the four-channel map to be detected, at least two sub-maps are generated, each sub-map includes three channel spaces, and at least one different channel space is included in different sub-maps. Grayscale maps are generated based on the sub-map and grayscale through The picture performs color detection to determine whether the map is solid.

Benefits of technology

It improves the efficiency of detection of solid color for multi-channel maps, avoids error problems in point collection method, and is better than the mean method in detection efficiency, and is suitable for rapid detection of a large number of map resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024078396_14112024_PF_FP_ABST
    Figure CN2024078396_14112024_PF_FP_ABST
Patent Text Reader

Abstract

A map color detection method and apparatus, a device, and a storage medium. The method comprises: obtaining a map waiting for detection, wherein the number of channel spaces of the map waiting for detection is equal to four; splitting the channel spaces of the map waiting for detection to obtain at least two sub-maps, wherein each sub-map comprises three channel spaces of the map waiting for detection, and different sub-maps comprise at least one different channel space; generating, according to the at least two sub-maps, a gray-scale map corresponding to the map waiting for detection; and performing, according to the gray-scale map, color detection on the map waiting for detection to obtain a color detection result, wherein the color detection result is used for indicating whether the map waiting for detection is a pure-color map.
Need to check novelty before this filing date? Find Prior Art

Description

Map color detection method, device, equipment and storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] The present disclosure claims priority to Chinese patent application number 202310519651.0 filed on May 9, 2023, entitled “Map color detection method, device, equipment and storage medium”, the entire contents of which are incorporated herein by reference. Technical Field

[0003] The present disclosure relates to the field of image processing technology, and in particular to a method, device, equipment and storage medium for detecting color of a map. Background Art

[0004] As the amount of art resources in the game continues to increase, in order to optimize art resources, it is necessary to optimize the size of a large number of solid color texture resources, so as to achieve the effect of optimizing the game package size and game performance.

[0005] Currently, traditional methods for detecting whether a texture is pure color mostly target single-channel or three-channel textures. However, the proportion of four-channel textures in game texture resources is increasing, so there is an urgent need to implement fast pure color detection for four-channel textures.

[0006] Summary of the Invention

[0007] In view of this, embodiments of the present disclosure provide a texture color detection method, apparatus, device, and storage medium to detect whether a multi-channel texture is a pure color.

[0008] In a first aspect, an embodiment of the present disclosure provides a method for detecting color of an image, comprising:

[0009] Obtaining a map to be detected, where the number of channel spaces of the map to be detected is equal to four;

[0010] Splitting the channel space of the to-be-detected map to obtain at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space;

[0011] Generating a grayscale image corresponding to the to-be-detected image based on the at least two sub-images;

[0012] According to the grayscale image, color detection is performed on the image to be detected to obtain a color detection result, where the color detection result is used to indicate whether the image to be detected is a pure color image.

[0013] In a second aspect, the present disclosure also provides a device for detecting color of a map, including:

[0014] An acquisition module is configured to acquire a map to be detected, wherein the number of channel spaces of the map to be detected is equal to four;

[0015] a splitting module configured to split the channel space of the to-be-detected map to obtain at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space;

[0016] A generating module is configured to generate a grayscale image corresponding to the to-be-detected image based on the at least two sub-images;

[0017] The detection module is configured to perform color detection on the image to be detected based on the grayscale image to obtain a color detection result, where the color detection result is used to indicate whether the image to be detected is a pure color image.

[0018] In a third aspect, an embodiment of the present disclosure further provides an electronic device, comprising: a processor, a memory, and a bus, wherein the memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to execute the map color detection method described in any one of the first aspects.

[0019] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the method for detecting the color of the map described in any one of the first aspects is executed.

[0020] The present disclosure provides a method, apparatus, device, and storage medium for detecting the color of a texture. The method includes: obtaining a texture to be detected, wherein the number of channel spaces of the texture to be detected is equal to four; splitting the channel space of the texture to be detected to obtain at least two sub-textures, each sub-texture including three channel spaces of the texture to be detected, and different sub-textures including at least one different channel space; generating a grayscale image corresponding to the texture to be detected based on the at least two sub-textures; performing color detection on the texture to be detected based on the grayscale image to obtain a color detection result, wherein the color detection result is used to indicate whether the texture to be detected is a solid color texture. This method realizes the detection of whether a multi-channel texture is a solid color, and the detection efficiency is high.

[0021] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.

[0023] FIG1 is a flow chart of a method for detecting color of a map provided by one of the embodiments of the present disclosure;

[0024] FIG2 is a schematic diagram of a four-channel map provided by one of the embodiments of the present disclosure;

[0025] FIG3 is a schematic diagram of a first sub-map provided in one embodiment of the present disclosure;

[0026] FIG4 is a schematic diagram of a second sub-map provided in one embodiment of the present disclosure;

[0027] FIG5 is a second flow chart of a method for detecting color of a sticker provided by one of the embodiments of the present disclosure;

[0028] FIG6 is a third flow chart of a method for detecting color of a sticker provided in one embodiment of the present disclosure;

[0029] FIG7 is a fourth flow chart of a method for detecting color of a sticker provided in one embodiment of the present disclosure;

[0030] FIG8 is a fifth flow chart of a method for detecting color of a sticker provided by one of the embodiments of the present disclosure;

[0031] FIG9 is a schematic structural diagram of a device for detecting color of a map provided by one of the embodiments of the present disclosure;

[0032] FIG10 is a schematic structural diagram of an electronic device provided in one of the embodiments of the present disclosure. DETAILED DESCRIPTION

[0033] In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings herein can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the disclosure for which protection is sought, but merely represents selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present disclosure.

[0034] Currently, the detection of whether a texture is pure color mostly targets single-channel or three-channel textures. Traditional detection methods mostly use the point sampling method or the mean method. The point sampling method is probabilistic and inevitably has errors. The mean method solves the error problem, but the detection efficiency is too low for large textures and cannot quickly complete the detection of a large number of texture resources.

[0035] The above method cannot be effectively applied to four-channel textures. However, in games, the proportion of four-channel textures is getting higher and higher. As the amount of art resources continues to increase, it is necessary to optimize the size of pure color texture resources to reduce the size of the game package. Based on this, the present disclosure provides a texture color detection method that can detect whether a multi-channel texture is a pure color. It not only solves the error problem in the sampling method, but also effectively improves the detection efficiency compared to the mean method.

[0036] The following describes the image color detection method provided by the present disclosure in conjunction with several specific embodiments.

[0037] FIG1 is a flow chart of a method for detecting color of a sticker provided by an embodiment of the present disclosure. The execution subject of this embodiment may be an electronic device, such as a terminal, a server, etc.

[0038] As shown in FIG1 , the method may include:

[0039] S101: Obtain a map to be detected.

[0040] The number of channel spaces of the map to be detected is equal to four. Taking a four-channel space as an example, the four-channel space can be RGBA, where R represents Red, G represents Green, B represents Blue, and A represents Alpha.

[0041] FIG2 is a schematic diagram of a four-channel map provided by an embodiment of the present disclosure. As shown in FIG2 , a checkerboard is used as the background. As can be seen from FIG2 , the four-channel map has a transparency effect.

[0042] It is worth noting that the texture to be detected can be a game texture. The method of this solution can be used to detect whether the texture to be detected is a solid color. If the texture to be detected is a solid color, the size of the texture to be detected can be optimized. For example, a 1000*1000 pixel texture to be detected can be reduced to 4*4, so that the game package size can be reduced.

[0043] S102 : Split the channel space of the map to be detected to obtain at least two sub-maps.

[0044] Each sub-map includes three channel spaces of the map to be detected, and different sub-maps include at least one different channel space, that is, different sub-maps include two identical channel spaces, wherein the channel spaces of at least two sub-maps include all the channel spaces of the map to be detected, and the channel value of the channel space of each sub-map is the channel value of the channel space in the map to be detected.

[0045] For example, the map to be detected has a four-channel space RGBA. The channel space of the map to be detected is split to obtain a first sub-map, a second sub-map, a third sub-map and a fourth sub-map, wherein the first sub-map includes three channel spaces of RGB, the second sub-map includes three channel spaces of GBA, the third sub-map includes three channel spaces of BAR, and the fourth sub-map includes three channel spaces of ARG.

[0046] Based on Figure 2, the map to be detected is split into a first sub-map and a second sub-map. Figure 3 is a schematic diagram of the first sub-map provided by an embodiment of the present disclosure, and Figure 4 is a schematic diagram of the second sub-map provided by an embodiment of the present disclosure. As shown in Figures 3 and 4, the first sub-map includes three RGB channel spaces, the second sub-map includes three GBA channel spaces, and the second sub-map has a transparency effect.

[0047] S103: Generate a grayscale image corresponding to the image to be detected based on the at least two sub-images.

[0048] Among them, any color is composed of the three primary colors of red, green, and blue, and the channel values ​​of the grayscale image in the three RGB channel spaces are the same, so only one channel space needs to be stored when storing. Therefore, the grayscale image can also be called a single-channel grayscale image. The grayscale image has 256 grayscale values, 255 represents full white, 0 represents full black, and the values ​​between 0 and 255 represent various degrees of gray between white and black.

[0049] After splitting the to-be-detected texture into at least two sub-textures, a grayscale image of each sub-texture can be generated for each sub-texture. Then, based on the grayscale images of the at least two sub-textures, a grayscale image corresponding to the to-be-detected texture is generated. The grayscale value of each pixel in the grayscale image corresponding to the to-be-detected texture can be determined by averaging the grayscale values ​​of corresponding pixels in the grayscale images of the at least two sub-textures.

[0050] S104 , performing color detection on the image to be detected according to the grayscale image to obtain a color detection result.

[0051] By performing color detection on the grayscale image, the color detection of the detection map is performed to obtain a color detection result. The color detection result is used to indicate whether the detection map is a solid color map. If the grayscale image is a solid color, for example, it is completely white, completely black, or a grayscale image of the same level, then the detection map is determined to be a solid color.

[0052] It is worth noting that when performing color detection on a grayscale image, a judgment can be made based on the grayscale value of each pixel in the grayscale image. If the difference in the grayscale value of each two pixel points in the grayscale image does not exceed the preset threshold, the grayscale image is determined to be a pure color image. If the difference in the grayscale value of each two pixel points in the grayscale image exceeds the preset threshold, the grayscale image is determined to be not a pure color image.

[0053] In the tile color detection method of this embodiment, the channel space of the tile to be detected is split into at least two sub-tiles. Each sub-tile contains the three channel spaces of the tile to be detected, and different sub-tiles contain at least one different channel space. Based on the at least two sub-tiles, a grayscale image corresponding to the tile to be detected is generated. Based on the grayscale image, the tile to be detected is color-detected to obtain a color detection result. The color detection result is used to indicate whether the tile to be detected is a solid color tile. This method realizes the detection of whether a multi-channel tile is solid color with high detection efficiency.

[0054] FIG5 is a second flow chart of a method for detecting color of a texture provided by an embodiment of the present disclosure. As shown in FIG5 , in an optional embodiment, step S102 of splitting the channel space of the texture to be detected to obtain at least two sub-textures may include:

[0055] S201 , splitting the channel space of the map to be detected to obtain at least two groups of channel spaces.

[0056] The map to be detected is a multi-channel map, and the number of channel spaces is equal to four. The channel space of the map to be detected is split to obtain at least two groups of channel spaces, each group of channel spaces includes: three channel spaces of the map to be detected, different groups of channel spaces include at least one different channel space, and the channel spaces of at least two groups of channel spaces include all the channel spaces of the map to be detected. For example, the four-channel space RGBA is split to obtain a first channel space RGB, a second channel space GBA, a third channel space BAR, and a fourth channel space ARG.

[0057] S202: Generate at least two sub-maps according to at least two groups of channel spaces.

[0058] Among them, one group of channel spaces corresponds to one sub-map, and at least two sub-maps are generated according to at least two groups of channel spaces. The channel value of the channel space of each sub-map is the channel value of the channel space in the map to be detected.

[0059] In this embodiment of the texture color detection method, the channel space of the texture to be detected is split into at least two groups of channel spaces. At least two sub-textures are generated from each of the at least two groups of channel spaces. This sub-texture generation facilitates subsequent color detection of the multi-channel texture based on the sub-textures to determine if it is a pure color. Compared to related technologies, this method optimizes the detection process and effectively improves detection efficiency.

[0060] FIG6 is a third flow chart of a method for detecting color of a texture provided by an embodiment of the present disclosure. As shown in FIG6 , in an optional embodiment, step S103 of generating a grayscale image corresponding to the texture to be detected based on at least two sub-textures may include:

[0061] S301. Calculate the brightness values ​​of at least two sub-maps respectively according to the channel values ​​of at least two sub-maps.

[0062] Each sub-map includes three channel spaces of the map to be detected. According to the channel values ​​of the three channel spaces of each sub-map, the brightness value of each sub-map, that is, the brightness value of each sub-map, can be calculated.

[0063] Among them, the brightness value of each sub-map can be calculated according to the preset coefficients of the three channel spaces of each sub-map and the channel values ​​of the three channel spaces. The preset coefficients of the three channel spaces can be, for example, 0.59, 0.29, and 0.12. Taking the first sub-map and the second sub-map as examples, the brightness value of the first sub-map is: L1 = R×0.29+G×0.59+B×0.12, and the brightness value of the second sub-map is: L1 = G×0.29+B×0.59+A×0.12. The preset coefficients are used to indicate the degree of contribution of the channel space to the brightness value of the map.

[0064] It is worth noting that, grayscale images of at least two sub-maps can also be generated based on the brightness values ​​of at least two sub-maps. Taking the first sub-map and the second sub-map as an example, the channel values ​​of the three channel spaces of the first sub-map are all set to L1 to generate the grayscale image of the first sub-map, and the channel values ​​of the three channels of the second sub-map are all set to L2 to generate the grayscale image of the second sub-map. Figure 5 is the grayscale image of the first sub-map provided by an embodiment of the present disclosure, and Figure 6 is the grayscale image of the second sub-map provided by an embodiment of the present disclosure.

[0065] S302: Generate a grayscale image according to the brightness values ​​of at least two sub-images.

[0066] A weighted average of the brightness values ​​can be calculated based on the brightness values ​​of at least two sub-maps, and then the weighted average is used as the channel value of the single-channel grayscale image. Based on the channel value, a grayscale image corresponding to the map to be detected is generated.

[0067] In an optional embodiment, step S301, respectively calculating the brightness values ​​of at least two sub-maps based on the channel values ​​of the at least two sub-maps, may include: respectively calculating the brightness values ​​of the pixels of the at least two sub-maps based on the channel values ​​of the pixels of the at least two sub-maps.

[0068] According to the channel value of each pixel point in the map to be detected, the channel value of the pixel point in at least two sub-maps is obtained respectively, wherein the pixel point of each sub-map includes three channel spaces, and the channel value of each pixel point in the sub-map in the channel space is the channel value of the corresponding pixel point in the map to be detected in the corresponding channel space.

[0069] Then, according to the channel values ​​of the pixels of each sub-map in the three channel spaces, the brightness value of the pixels of each sub-map is calculated. For example, the first sub-map includes 512*512 pixels. According to the above brightness calculation formula, the brightness value of each pixel of the first sub-map can be calculated.

[0070] Accordingly, step S302, generating a grayscale image according to the brightness values ​​of at least two sub-maps, may include: generating a grayscale image according to the brightness values ​​of pixels of at least two sub-maps.

[0071] Based on the brightness values ​​of the pixels of at least two sub-maps, the channel values ​​of the corresponding pixels in the single-channel grayscale image can be calculated, and based on the channel values ​​of each pixel, the grayscale image corresponding to the map to be detected is generated, wherein the channel value of the pixel in the single-channel grayscale image can be the weighted average of the channel values ​​of the pixel of at least two sub-maps.

[0072] For example, if the first sub-map and the second sub-map both include 512*512 pixels, then the grayscale image corresponding to the map to be detected also includes 512*512 pixels. According to the brightness value of the first pixel in the first sub-map and the brightness value of the first pixel in the second sub-map, the weighted average of the first pixel can be calculated, and the same goes for other pixels until the weighted average of 512*512 pixels is obtained. Then the weighted average of each pixel is used as the channel value of each pixel in the single-channel grayscale image, and the grayscale image corresponding to the map to be detected is generated.

[0073] In this embodiment of the texture color detection method, the luminance values ​​of at least two sub-textures are calculated based on their channel values, and a grayscale image is generated based on the luminance values ​​of the at least two sub-textures. This converts the color detection of a multi-channel texture into color detection of a grayscale image based on luminance values, effectively improving detection efficiency.

[0074] FIG7 is a fourth flow chart of a method for detecting texture color according to an embodiment of the present disclosure. As shown in FIG7 , in an optional embodiment, step S302 of generating a grayscale image according to the brightness values ​​of at least two sub-textures may include:

[0075] S401. Calculate a brightness mean according to the brightness values ​​of at least two sub-maps.

[0076] S402: Determine the brightness mean as the grayscale value and generate a grayscale image.

[0077] According to the luminance values ​​of at least two sub-maps, the luminance mean is calculated, the luminance mean is used as the grayscale value of the single-channel grayscale image, and a grayscale image corresponding to the map to be detected is generated. Specifically, the luminance mean of each pixel can be calculated according to the luminance value of each pixel of the at least two sub-maps, and then the luminance mean of each pixel is determined as the grayscale value of each pixel, and the grayscale image is generated according to the grayscale value of each pixel.

[0078] For example, the average brightness of each pixel is: L1 is the brightness value of the pixel in the first sub-map, and L2 is the brightness value of the pixel in the second sub-map.

[0079] In this embodiment of the texture color method, the average luminance value is calculated based on the luminance values ​​of at least two sub-textures, the average luminance value is determined as a grayscale value, and a grayscale image is generated. This converts the color detection of the multi-channel texture into color detection of the grayscale image based on the average luminance value, effectively improving detection efficiency and generating a highly accurate grayscale image.

[0080] FIG8 is a fifth flow chart of a method for detecting color of a texture provided by an embodiment of the present disclosure. As shown in FIG8 , in an optional embodiment, step S104, performing color detection on the texture to be detected based on the grayscale image to obtain a color detection result, may include:

[0081] S501: Obtain grayscale values ​​of multiple pixels in a grayscale image.

[0082] S502: Perform color detection on the image to be detected according to the grayscale values ​​of the plurality of pixels to obtain a color detection result.

[0083] Get the grayscale values ​​of multiple pixels in the grayscale image. The grayscale value refers to the brightness value of the pixel in the grayscale image. The brightness value of the pixel in the grayscale image is calculated based on the channel values ​​of the corresponding pixels in at least two sub-maps. The multiple pixels can be all the pixels in the grayscale image.

[0084] Based on the grayscale values ​​of multiple pixels, determine whether the difference in the grayscale values ​​of any two pixels exceeds a preset threshold. If it does not exceed the threshold, the grayscale image is determined to be a pure color image, that is, the grayscale image is all white, all black, or a grayscale image of the same level. If it exceeds the threshold, the grayscale image is determined to be a non-pure color image, for example, a black and white image.

[0085] By color detection of whether the grayscale image is a pure color, a color detection result is obtained by color detection of whether the map to be detected is a pure color. If the grayscale image is a pure color, the color detection result indicates that the map to be detected is a pure color map; if the grayscale image is a non-pure color image, the color detection result indicates that the map to be detected is a non-pure color map.

[0086] It's worth noting that grayscale values ​​refer to the brightness of each pixel in a grayscale image, typically represented by integers from 0 to 255. In a grayscale image, the grayscale value of each pixel represents the brightness of that pixel. Larger grayscale values ​​indicate higher brightness, while smaller grayscale values ​​indicate lower brightness. For example, a grayscale value of 0 represents black, and a grayscale value of 255 represents white. Grayscale values ​​between 0 and 255 represent different grayscale levels.

[0087] In an optional embodiment, step S502, performing color detection on the image to be detected based on the grayscale values ​​of multiple pixels to obtain a color detection result, may include:

[0088] A maximum grayscale value and a minimum grayscale value are determined from the grayscale values ​​of multiple pixels; and color detection is performed on the image to be detected based on the maximum grayscale value and the minimum grayscale value to obtain a color detection result.

[0089] The maximum grayscale value and the minimum grayscale value are determined from the grayscale values ​​of multiple pixels in the grayscale image, and then the difference between the maximum grayscale value and the minimum grayscale value is calculated. If the difference does not exceed the preset threshold, the grayscale image is determined to be a pure color, and the color detection result of the image to be detected indicates that the image to be detected is a pure color image. If the difference exceeds the preset threshold, the grayscale image is determined to be a non-pure color image, and the color detection result of the image to be detected indicates that the image to be detected is a non-pure color image.

[0090] Among them, the grayscale image is represented by V gray , the custom threshold is represented by V th , the maximum value in the single-channel grayscale image is represented by V gMax , the minimum value is expressed as V gMin If the difference between the maximum grayscale value and the minimum grayscale value is less than the threshold V th , then the image to be detected is a pure color image. If it is greater than the threshold, then the image to be detected is a non-pure color image. V gMax -V gMin ≤V th

[0091] For example, the maximum grayscale value V in the grayscale image finally obtained in the example image is gMax The minimum grayscale value is 0.694, and the minimum grayscale value is 0.035. The difference is large, so the map to be detected is a non-pure color map.

[0092] By comparing the relative sizes of the maximum grayscale value and the minimum grayscale value in the grayscale image, it is possible to determine whether the image to be detected is a pure color image, thereby further improving the detection efficiency.

[0093] In this embodiment of the texture color detection method, the grayscale values ​​of multiple pixels in a grayscale image are obtained. Based on these values, the texture to be detected is subjected to color detection to obtain a color detection result. This method, based on the grayscale values ​​of the pixels in the grayscale image, avoids accidental errors compared to the point sampling method. Furthermore, compared to the mean value method, this method effectively improves detection efficiency by optimizing the detection process.

[0094] Based on the same inventive concept, the embodiment of the present disclosure also provides a map color detection device corresponding to the map color detection method. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned map color detection method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0095] FIG9 is a schematic diagram of the structure of a device for detecting color of a map provided by an embodiment of the present disclosure, which can be integrated into an electronic device. As shown in FIG9 , the device may include:

[0096] An acquisition module 601 is used to acquire a map to be detected, where the number of channel spaces of the map to be detected is equal to four;

[0097] A splitting module 602 is configured to split the channel space of the to-be-detected map into at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space;

[0098] A generating module 603 is configured to generate a grayscale image corresponding to the to-be-detected image based on at least two sub-images;

[0099] The detection module 604 is used to perform color detection on the image to be detected based on the grayscale image to obtain a color detection result. The color detection result is used to indicate whether the image to be detected is a pure color image.

[0100] In an optional implementation, the splitting module 602 is specifically configured to:

[0101] Splitting the channel space of the to-be-detected map to obtain at least two groups of channel spaces, each group of channel spaces including: three channel spaces of the to-be-detected map, and different groups of channel spaces including at least one different channel space;

[0102] At least two sub-maps are generated according to at least two groups of channel spaces.

[0103] In an optional implementation, the generating module 603 is specifically configured to:

[0104] Calculate the brightness values ​​of the at least two sub-maps respectively according to the channel values ​​of the at least two sub-maps;

[0105] Generate a grayscale image based on the brightness values ​​of at least two sub-maps.

[0106] In an optional implementation, the generating module 603 is specifically configured to:

[0107] Calculate the brightness mean according to the brightness values ​​of at least two sub-maps;

[0108] Determine the brightness mean as the grayscale value and generate a grayscale image.

[0109] In an optional implementation, the generating module 603 is specifically configured to:

[0110] Calculating brightness values ​​of the pixels of the at least two sub-maps respectively according to the channel values ​​of the pixels of the at least two sub-maps;

[0111] Generate a grayscale image based on the brightness values ​​of at least two sub-maps, including:

[0112] Generate a grayscale image according to the brightness values ​​of pixels of at least two sub-maps.

[0113] In an optional implementation, the detection module 604 is specifically configured to:

[0114] Get the grayscale values ​​of multiple pixels in the grayscale image;

[0115] According to the grayscale values ​​of multiple pixels, color detection is performed on the image to be detected to obtain a color detection result.

[0116] In an optional implementation, the detection module 604 is specifically configured to:

[0117] Determining a maximum grayscale value and a minimum grayscale value from the grayscale values ​​of the plurality of pixels;

[0118] According to the maximum grayscale value and the minimum grayscale value, color detection is performed on the image to be detected to obtain a color detection result.

[0119] In the texture color detection device of this embodiment, an acquisition module is used to acquire a texture to be detected, where the number of channel spaces of the texture to be detected is equal to four. A splitting module is used to split the channel space of the texture to be detected to obtain at least two sub-textures, each sub-texture including three channel spaces of the texture to be detected, and different sub-textures include at least one different channel space. A generation module is used to generate a grayscale image corresponding to the texture to be detected based on the at least two sub-textures. A detection module is used to perform color detection on the texture to be detected based on the grayscale image to obtain a color detection result, which is used to indicate whether the texture to be detected is a solid color texture. This device can detect whether a multi-channel texture is solid color with high detection efficiency.

[0120] FIG10 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. As shown in FIG10 , the device may include: a processor 701, a memory 702, and a bus 703. The memory 702 stores machine-readable instructions executable by the processor 701. When the electronic device is running, the processor 701 communicates with the memory 702 via the bus 703. The processor 701 executes the machine-readable instructions to perform the following steps:

[0121] Obtain a map to be detected, where the number of channel spaces of the map to be detected is equal to four;

[0122] Split the channel space of the to-be-detected map to obtain at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space;

[0123] Generate a grayscale image corresponding to the to-be-detected image based on at least two sub-images;

[0124] According to the grayscale image, color detection is performed on the map to be detected to obtain a color detection result. The color detection result is used to indicate whether the map to be detected is a pure color map.

[0125] In an optional embodiment, the channel space of the map to be detected is split to obtain at least two sub-maps, including:

[0126] Splitting the channel space of the to-be-detected map to obtain at least two groups of channel spaces, each group of channel spaces including: three channel spaces of the to-be-detected map, and different groups of channel spaces including at least one different channel space;

[0127] At least two sub-maps are generated according to at least two groups of channel spaces.

[0128] In an optional embodiment, generating a grayscale image corresponding to the to-be-detected image based on at least two sub-images includes:

[0129] Calculate the brightness values ​​of the at least two sub-maps respectively according to the channel values ​​of the at least two sub-maps;

[0130] Generate a grayscale image based on the brightness values ​​of at least two sub-maps.

[0131] In an optional embodiment, generating a grayscale image according to the brightness values ​​of at least two sub-images includes:

[0132] Calculate the brightness mean according to the brightness values ​​of at least two sub-maps;

[0133] Determine the brightness mean as the grayscale value and generate a grayscale image.

[0134] In an optional embodiment, calculating the brightness values ​​of the at least two sub-maps according to the channel values ​​of the at least two sub-maps respectively includes:

[0135] Calculating brightness values ​​of the pixels of the at least two sub-maps respectively according to the channel values ​​of the pixels of the at least two sub-maps;

[0136] Generate a grayscale image based on the brightness values ​​of at least two sub-maps, including:

[0137] Generate a grayscale image according to the brightness values ​​of pixels of at least two sub-maps.

[0138] In an optional embodiment, color detection is performed on the image to be detected based on the grayscale image to obtain a color detection result, including:

[0139] Get the grayscale values ​​of multiple pixels in the grayscale image;

[0140] According to the grayscale values ​​of multiple pixels, color detection is performed on the image to be detected to obtain a color detection result.

[0141] In an optional embodiment, color detection is performed on the image to be detected based on the grayscale values ​​of multiple pixels to obtain a color detection result, including:

[0142] Determining a maximum grayscale value and a minimum grayscale value from the grayscale values ​​of the plurality of pixels;

[0143] According to the maximum grayscale value and the minimum grayscale value, color detection is performed on the image to be detected to obtain a color detection result.

[0144] In the electronic device of this embodiment, when the electronic device is running, the processor executes to obtain a to-be-detected tile, where the number of channel spaces of the to-be-detected tile is equal to four. The channel space of the to-be-detected tile is split into at least two sub-tiles, each sub-tile including three channel spaces of the to-be-detected tile, with different sub-tiles including at least one different channel space. A grayscale image corresponding to the to-be-detected tile is generated based on the at least two sub-tiles. Based on the grayscale image, a color detection is performed on the to-be-detected tile to obtain a color detection result. The color detection result is used to indicate whether the to-be-detected tile is a solid color tile. This method realizes the detection of whether a multi-channel tile is a solid color, and the detection efficiency is high.

[0145] The present disclosure also provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the processor performs the following steps:

[0146] Obtain a map to be detected, where the number of channel spaces of the map to be detected is equal to four;

[0147] Split the channel space of the to-be-detected map to obtain at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space;

[0148] Generate a grayscale image corresponding to the to-be-detected image based on at least two sub-images;

[0149] According to the grayscale image, color detection is performed on the map to be detected to obtain a color detection result. The color detection result is used to indicate whether the map to be detected is a pure color map.

[0150] In an optional embodiment, the channel space of the map to be detected is split to obtain at least two sub-maps, including:

[0151] Splitting the channel space of the to-be-detected map to obtain at least two groups of channel spaces, each group of channel spaces including: three channel spaces of the to-be-detected map, and different groups of channel spaces including at least one different channel space;

[0152] At least two sub-maps are generated according to at least two groups of channel spaces.

[0153] In an optional embodiment, generating a grayscale image corresponding to the to-be-detected image based on at least two sub-images includes:

[0154] Calculate the brightness values ​​of the at least two sub-maps respectively according to the channel values ​​of the at least two sub-maps;

[0155] Generate a grayscale image based on the brightness values ​​of at least two sub-maps.

[0156] In an optional embodiment, generating a grayscale image according to the brightness values ​​of at least two sub-images includes:

[0157] Calculate the brightness mean according to the brightness values ​​of at least two sub-maps;

[0158] Determine the brightness mean as the grayscale value and generate a grayscale image.

[0159] In an optional embodiment, calculating the brightness values ​​of the at least two sub-maps according to the channel values ​​of the at least two sub-maps respectively includes:

[0160] Calculating brightness values ​​of the pixels of the at least two sub-maps respectively according to the channel values ​​of the pixels of the at least two sub-maps;

[0161] Generate a grayscale image based on the brightness values ​​of at least two sub-maps, including:

[0162] Generate a grayscale image according to the brightness values ​​of pixels of at least two sub-maps.

[0163] In an optional embodiment, color detection is performed on the image to be detected based on the grayscale image to obtain a color detection result, including:

[0164] Get the grayscale values ​​of multiple pixels in the grayscale image;

[0165] According to the grayscale values ​​of multiple pixels, color detection is performed on the image to be detected to obtain a color detection result.

[0166] In an optional embodiment, color detection is performed on the image to be detected based on the grayscale values ​​of multiple pixels to obtain a color detection result, including:

[0167] Determining a maximum grayscale value and a minimum grayscale value from the grayscale values ​​of the plurality of pixels;

[0168] According to the maximum grayscale value and the minimum grayscale value, color detection is performed on the image to be detected to obtain a color detection result.

[0169] In the computer-readable storage medium of this embodiment, a computer program is executed by a processor when running to obtain a to-be-detected tile, wherein the number of channel spaces of the to-be-detected tile is equal to four. The channel space of the to-be-detected tile is split into at least two sub-tiles, each sub-tile including three channel spaces of the to-be-detected tile, with different sub-tiles including at least one different channel space. A grayscale image corresponding to the to-be-detected tile is generated based on the at least two sub-tiles. Based on the grayscale image, a color detection is performed on the to-be-detected tile to obtain a color detection result, which is used to indicate whether the to-be-detected tile is a solid color tile. This method realizes the detection of whether a multi-channel tile is a solid color, and has high detection efficiency.

[0170] In the embodiments of the present disclosure, the computer program can also execute other machine-readable instructions when run by the processor to execute methods as described in other embodiments. For the specific execution method steps and principles, please refer to the description of the embodiments and will not be repeated here.

[0171] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is merely a logical function division. There may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed may be through some communication interface, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

[0172] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0173] In addition, each functional unit in the embodiments provided in the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0174] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the relevant technology or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0175] It should be noted that similar numbers and letters represent similar items in the following figures. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. In addition, the terms "first", "second", "third", etc. are only used to distinguish the description and are not to be understood as indicating or implying relative importance.

[0176] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The scope of protection of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the above-described embodiments, those skilled in the art should understand that any person skilled in the art can modify or easily conceive of changes to the technical solutions described in the above-described embodiments within the technical scope disclosed in the present disclosure, or make equivalent replacements for some of the technical features therein. However, these modifications, changes, or replacements do not deviate from the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present disclosure. They should all be included in the scope of protection of the present disclosure. Therefore, the scope of protection of the present disclosure should be based on the scope of protection of the claims.

Claims

1. A method for detecting color of a map, comprising: Obtain a map to be detected, wherein the number of channel spaces of the map to be detected is equal to four; Splitting the channel space of the to-be-detected map to obtain at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space; Generating a grayscale image corresponding to the to-be-detected image according to the at least two sub-images; According to the grayscale image, the to-be-detected map is subjected to color-to-color detection to obtain a color detection result, and the color detection result is used to indicate whether the to-be-detected map is a pure color map.

2. The method according to claim 1, wherein: The step of splitting the channel space of the to-be-detected map to obtain at least two sub-maps includes: Splitting the channel space of the to-be-detected map to obtain at least two groups of channel spaces, each group of channel spaces including: three channel spaces of the to-be-detected map, and different groups of channel spaces including at least one different channel space; The at least two sub-maps are generated respectively according to the at least two groups of channel spaces.

3. The method according to claim 1, wherein: The step of generating a grayscale image corresponding to the to-be-detected image according to the at least two sub-images includes: Calculating the brightness values ​​of the at least two sub-maps respectively according to the channel values ​​of the at least two sub-maps; The grayscale image is generated according to the brightness values ​​of the at least two sub-images.

4. The method according to claim 3, wherein: Generating the grayscale image according to the brightness values ​​of the at least two sub-images includes: Calculating a brightness mean value according to the brightness values ​​of the at least two sub-maps; The brightness mean is determined as a grayscale value, and the grayscale image is generated.

5. The method according to claim 3, wherein: The calculating the brightness values ​​of the at least two sub-maps respectively according to the channel values ​​of the at least two sub-maps comprises: Calculating brightness values ​​of the pixels of the at least two sub-maps respectively according to the channel values ​​of the pixels of the at least two sub-maps; Generating the grayscale image according to the brightness values ​​of the at least two sub-images includes: The grayscale image is generated according to the brightness values ​​of the pixels of the at least two sub-images.

6. The method according to claim 1, wherein: The step of performing color detection on the to-be-detected map according to the grayscale image to obtain a color detection result includes: Obtaining grayscale values ​​of multiple pixels in the grayscale image; According to the grayscale values ​​of the multiple pixels, color detection is performed on the map to be detected to obtain the color detection result.

7. The method according to claim 6, wherein: The step of performing color detection on the to-be-detected map according to the grayscale values ​​of the plurality of pixels to obtain the color detection result includes: Determine a maximum grayscale value and a minimum grayscale value from the grayscale values ​​of the plurality of pixels; According to the maximum grayscale value and the minimum grayscale value, color detection is performed on the image to be detected to obtain the color detection result.

8. A map color detection device, comprising: An acquisition module is configured to acquire a map to be detected, wherein the number of channel spaces of the map to be detected is equal to four; A splitting module is configured to split the channel space of the to-be-detected map to obtain at least two sub-maps, each sub-map including three channel spaces of the to-be-detected map, and different sub-maps including at least one different channel space; A generating module is configured to generate a grayscale image corresponding to the to-be-detected image based on the at least two sub-images; The detection module is configured to perform color detection on the to-be-detected map according to the grayscale image to obtain a color detection result, wherein the color detection result is used to indicate whether the to-be-detected map is a pure color map.

9. An electronic device, comprising: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the memory via the bus, and the processor executes the machine-readable instructions to execute the map color detection method according to any one of claims 1 to 7.

10. A computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to execute the map color detection method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Picture color identification method and system

    CN106651966A

  • Color recognition method and device, and computer readable storage medium

    CN111222506A

  • Color identification method and device, terminal equipment and storage medium

    CN112070096A

  • Texture image processing method and device, electronic equipment and storage medium

    CN113470155A

  • Image processing optimization method and device, electronic equipment and readable storage medium

    CN114693559A