Image recognition method, device, electronic device and storage medium

By determining the candidate areas in image recognition and calculating the measurement values ​​of their color and position characteristics, the problem of low image recognition efficiency in the prior art is solved, and rapid and efficient recognition of the focus area in the image is realized.

CN113888742BActive Publication Date: 2025-04-18BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110979344.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-25
Publication Date
2025-04-18
Estimated Expiration
2041-08-25

AI Technical Summary

Technical Problem

In the prior art, image recognition is low efficiency and takes a long time, making it difficult to quickly identify contents in images.

Method used

By determining multiple candidate areas corresponding to multiple elements in the image, the area color and area position of each candidate area are obtained. Based on the degree of color difference between the area color and the reference color and the pixel distance between the area position and the center of the image, the first and second metric values ​​of each candidate region are calculated. Finally, based on these metric values, the target area is determined from the plurality of candidate areas as the focus area of ​​the image.

Benefits of technology

By applying color features and area position features, the rapid recognition of the focus area in the image is achieved, and the efficiency of image recognition is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113888742B_ABST
    Figure CN113888742B_ABST
Patent Text Reader

Abstract

The present disclosure relates to an image recognition method, device, electronic device and storage medium, the method comprising: determining multiple candidate areas corresponding to multiple elements in an image, and obtaining the area color and area position corresponding to each candidate area; obtaining the first measurement value of each candidate area according to the color difference between the area color corresponding to each candidate area and the reference color; obtaining the second measurement value of each candidate area according to the pixel distance between the area position corresponding to each candidate area and the center position of the image; the reference color is a color pre-determined according to the visual effect; and determining the target area from multiple candidate areas as the focus area of ​​the image according to the first measurement value and the second measurement value of each candidate area. The method adopts the color feature and the position feature of different areas in the image, and realizes the rapid recognition of the focus area in the image with less calculation, thereby improving the efficiency of image recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of image processing technology, and in particular to an image recognition method, device, electronic device and storage medium. Background Art

[0002] With the development of computer technology, the number of scenarios that require image processing has gradually increased, and the frequency of image processing has also increased;

[0003] In related technologies, neural network technology is usually used to identify the content in an image. However, this method requires high computing power and is correspondingly time-consuming, resulting in low efficiency in image recognition. Summary of the invention

[0004] The present disclosure provides an image recognition method, device, electronic device and storage medium to at least solve the problem that the efficiency of image recognition in the related art is still low. The technical solution of the present disclosure is as follows:

[0005] According to a first aspect of an embodiment of the present disclosure, there is provided an image recognition method, comprising:

[0006] Determine multiple candidate regions corresponding to multiple elements in the image, and obtain region colors and region positions corresponding to each candidate region;

[0007] According to the color difference between the region color corresponding to each candidate region and the reference color, a first measurement value of each candidate region is obtained; according to the pixel distance between the region position corresponding to each candidate region and the center position of the image, a second measurement value of each candidate region is obtained; the reference color is a color predetermined according to the visual effect;

[0008] According to the first metric value and the second metric value of each candidate area, a target area is determined from the multiple candidate areas as a focus area of ​​the image.

[0009] In an exemplary embodiment, if the image is a color image, before determining a plurality of candidate regions corresponding to a plurality of elements in the image, the method further includes:

[0010] Performing binarization processing on the image to obtain a binarized image;

[0011] A closed figure in the binary image is identified as an edge contour of an element in the image.

[0012] In an exemplary embodiment, obtaining the region color corresponding to each candidate region includes:

[0013] For each candidate area, obtain the proportion of each color in the candidate area;

[0014] The color with the largest proportion is determined as the region color of the candidate region.

[0015] In an exemplary embodiment, obtaining the region position of each candidate region includes:

[0016] For each candidate region, generate a circumscribed geometric figure of the candidate region;

[0017] The geometric center of the circumscribed geometric figure is obtained as the region position of the candidate region.

[0018] In an exemplary embodiment, obtaining the first measurement value of each candidate region according to the degree of color difference between the region color corresponding to each candidate region and the reference color includes:

[0019] For each candidate region, a first metric value of the candidate region is obtained according to the degree of color difference between the region color of the candidate region and the reference color:

[0020] Mapping the regional color and the reference color to a preset color spectrum respectively to obtain a corresponding first spectrum position and a second spectrum position;

[0021] Obtaining a color spectrum distance between the first color spectrum position and the second color spectrum position in the preset color spectrum; the size of the color spectrum distance is positively correlated to the degree of color difference between the area color and the reference color;

[0022] The graph distance is normalized based on a weight value corresponding to the unit graph distance, and the normalized graph distance is used as the first metric value.

[0023] In an exemplary embodiment, obtaining the second metric value of each candidate region according to the pixel distance between the region position corresponding to each candidate region and the center position of the image includes:

[0024] Obtaining the pixel distance between the region position corresponding to each candidate region and the center position of the image in the image;

[0025] The pixel distance is normalized based on a weight value corresponding to the unit pixel distance, and the normalized pixel distance is used as the second metric value.

[0026] In an exemplary embodiment, determining a target area from the plurality of candidate areas as the focus area of ​​the image according to the first metric value and the second metric value of each candidate area includes:

[0027] For each candidate region, a weighted sum of the first metric value and the second metric value of the candidate region is obtained as a target metric value for measuring whether the candidate region is a focal region; the magnitude of the target metric value is negatively correlated with the probability that the candidate region is a focal region;

[0028] The candidate region with the smallest target metric value among the multiple candidate regions is determined as the focus region of the image.

[0029] In an exemplary embodiment, determining a target metric value of the candidate area according to the first metric value and the second metric value of the candidate area includes:

[0030] respectively obtaining a first adjustment coefficient of the first metric value and a second adjustment coefficient of the second metric value; the first adjustment coefficient and the second adjustment coefficient are respectively used to balance the influence of the color difference degree and the pixel distance on the focus area recognition;

[0031] A first product of the first metric value and the first adjustment coefficient and a second product of the second metric value and the second adjustment coefficient are obtained, and a sum of the first product and the second product is used as a target metric value of the candidate area.

[0032] In an exemplary embodiment, the reference color is determined by:

[0033] In response to a triggering operation on a target color area in a preset color display page, obtaining an identifier of the target color area;

[0034] Color information corresponding to the target color area is determined according to the identifier, and the color corresponding to the color information is used as the reference color.

[0035] According to a second aspect of an embodiment of the present disclosure, there is provided an image recognition device, including:

[0036] A candidate region determination unit is configured to determine a plurality of candidate regions corresponding to a plurality of elements in the image, and obtain a region color and a region position corresponding to each candidate region;

[0037] The metric value determination unit is configured to obtain a first metric value of each candidate area according to a color difference between a region color corresponding to each candidate area and a reference color; obtain a second metric value of each candidate area according to a pixel distance between a region position corresponding to each candidate area and a center position of the image; the reference color is a color predetermined according to a visual effect;

[0038] The focus area determination unit is configured to determine a target area from the multiple candidate areas as the focus area of ​​the image according to the first metric value and the second metric value of each candidate area.

[0039] In an exemplary embodiment, if the image is a color image, the candidate area determination unit is further configured to perform binarization processing on the image to obtain a binary image; and identify closed figures in the binary image as edge contours of elements in the image.

[0040] In an exemplary embodiment, the candidate region determination unit is further configured to obtain, for each candidate region, the proportion of various colors in the candidate region; and determine the color with the largest proportion as the region color of the candidate region.

[0041] In an exemplary embodiment, the candidate region determination unit is further configured to generate a circumscribed geometric figure of each candidate region; and obtain a geometric center of the circumscribed geometric figure as the region position of the candidate region.

[0042] In an exemplary embodiment, the metric value determination unit is further configured to obtain, for each candidate area, a first metric value of the candidate area according to the degree of color difference between the area color of the candidate area and a reference color: respectively map the area color and the reference color to a preset color map to obtain a corresponding first map position and second map position; obtain a map distance between the first map position and the second map position in the preset color map; the size of the map distance is positively correlated to the degree of color difference between the area color and the reference color; and normalize the map distance based on a weight value corresponding to a unit map distance, and use the normalized map distance as the first metric value.

[0043] In an exemplary embodiment, the measurement value determination unit is further configured to obtain the pixel distance between the area position corresponding to each candidate area in the image and the center position of the image; normalize the pixel distance based on the weight value corresponding to the unit pixel distance, and use the normalized pixel distance as the second measurement value.

[0044] In an exemplary embodiment, the focus area determination unit is further configured to execute, for each candidate area, obtaining a weighted sum of the first measurement value and the second measurement value of the candidate area as a target measurement value for measuring whether the candidate area is a focus area; there is a negative correlation between the size of the target measurement value and the probability that the candidate area is the focus area; and the candidate area with the smallest target measurement value among the multiple candidate areas is determined as the focus area of ​​the image.

[0045] In an exemplary embodiment, the focus area determination unit is further configured to execute the steps of respectively obtaining a first adjustment coefficient for the first measurement value and obtaining a second adjustment coefficient for the second measurement value; the first adjustment coefficient and the second adjustment coefficient are respectively used to balance the influence of the color difference degree and the pixel distance on the focus area identification; obtaining a first product of the first measurement value and the first adjustment coefficient, and a second product of the second measurement value and the second adjustment coefficient, and taking the sum of the first product and the second product as the target measurement value of the candidate area.

[0046] In an exemplary embodiment, the metric value determination unit is also configured to execute a trigger operation on the target color area in a preset color display page to obtain an identifier of the target color area; determine the color information corresponding to the target color area based on the identifier, and use the color corresponding to the color information as the reference color.

[0047] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the image recognition method described in any one of the embodiments of the first aspect.

[0048] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the image recognition method described in any one of the embodiments of the first aspect.

[0049] According to a fifth aspect of the embodiments of the present disclosure, a computer program product is provided, wherein the computer program product includes instructions, and when the instructions are executed by a processor of an electronic device, the electronic device is able to execute the image recognition method described in any one of the embodiments of the first aspect.

[0050] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:

[0051] By determining multiple candidate areas corresponding to multiple elements in an image, and obtaining the area color and area position corresponding to each candidate area; then obtaining the first measurement value of each candidate area according to the degree of color difference between the area color corresponding to each candidate area and the reference color; obtaining the second measurement value of each candidate area according to the pixel distance between the area position corresponding to each candidate area and the center position of the image; the reference color is a color predetermined according to the visual effect; finally, according to the first measurement value and the second measurement value of each candidate area, determining the target area from the multiple candidate areas as the focus area of ​​the image; in this way, multiple candidate areas are determined from the image through edge contours, and each candidate area is measured accordingly according to the color and position of the candidate area, and the target area is determined according to the obtained measurement value and used as the focus area; the present disclosure applies color features and position features of different areas in the image, and realizes rapid recognition of the focus area in the image with less calculation amount, thereby improving the efficiency of image recognition.

[0052] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.

[0054] Figure 1 The figure is a flow chart of an image recognition method according to an exemplary embodiment.

[0055] Figure 2 The flowchart of the step of obtaining the first metric value of each candidate region according to an exemplary embodiment is shown.

[0056] Figure 3 The figure is a flowchart showing the steps of obtaining the second metric value of each candidate region according to an exemplary embodiment.

[0057] Figure 4 The present invention is a flowchart showing steps of determining a target area from multiple candidate areas and using the target area as a focus area of ​​an image according to an exemplary embodiment.

[0058] Figure 5 The figure is a flowchart of another image recognition method according to an exemplary embodiment.

[0059] Figure 6a The diagram is a schematic diagram showing an edge contour of an element in an image according to an exemplary embodiment.

[0060] Figure 6bThe diagram is a schematic diagram showing a method of obtaining a spectrum distance on a preset color spectrum according to an exemplary embodiment.

[0061] Figure 6c The figure is a schematic diagram showing a pixel distance between a candidate area and a center position of an image according to an exemplary embodiment.

[0062] Figure 7 The figure is a block diagram of an image recognition device according to an exemplary embodiment.

[0063] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0064] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.

[0065] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments are not all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0066] It should also be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.

[0067] In the image recognition method provided by the present disclosure, the terminal determines multiple candidate areas corresponding to multiple elements in the image, and obtains the area color and area position corresponding to each candidate area; the terminal obtains the first measurement value of each candidate area according to the color difference between the area color corresponding to each candidate area and the reference color; the second measurement value of each candidate area is obtained according to the pixel distance between the area position corresponding to each candidate area and the center position of the image; the reference color is a color predetermined according to the visual effect; the terminal determines the target area from the multiple candidate areas according to the first measurement value and the second measurement value of each candidate area as the focus area of ​​the image. Among them, the terminal can be but not limited to various smart phones, tablet computers, laptops or wearable devices, etc.

[0068] Figure 1The present invention is a flowchart of an image recognition method according to an exemplary embodiment. The image recognition method is used in a terminal and includes the following steps:

[0069] In step S110 , multiple candidate regions corresponding to multiple elements in the image are determined, and the region color and region position corresponding to each candidate region are obtained.

[0070] The edge contour refers to a contour feature that can describe the shape of the element and distinguish the element from the background and other elements.

[0071] Among them, the candidate area refers to the area within the image occupied by each independent element; the area color refers to at least one color of the candidate area corresponding to the element or the main color that can represent the candidate area of ​​the element, etc.; the area position refers to the position information that can represent the candidate area corresponding to the element, such as the position of a point on the edge in the image, or the position corresponding to the center point of the figure formed by the edge circle, etc.

[0072] Specifically, the terminal processes the image, identifies at least one element contained in the image; extracts the complete outline of the identified element as the edge outline of each element; determines the candidate area corresponding to each element in the image according to the edge outline of the element; uses the coordinates of the points in each candidate area that can represent the candidate area as the area position; and then determines the color that can represent each candidate area as the area color according to the candidate area and the original color image. The edge outline extraction process can be implemented in a variety of ways, such as first performing a binarization process to convert the image into a black and white binary image, performing an opening operation and a closing operation on the black and white binary image, and eliminating the noise points in the image background area and the candidate area corresponding to each element; performing a sharpening process on the image can compensate for the outline corresponding to each element, and image smoothing can highlight each element in the image, suppress image noise, and improve image quality. Edge detection can be implemented through a variety of detection operators and deep learning methods. For example, the detection operator can use a Sobel operator, an Isotropic Sobel operator, a Roberts operator, a Prewitt operator, etc., which can be adaptively selected according to the characteristics of the image and the distribution of each element.

[0073] In step S120, a first measurement value of each candidate area is obtained according to the degree of color difference between the area color corresponding to each candidate area and the reference color; a second measurement value of each candidate area is obtained according to the pixel distance between the area position corresponding to each candidate area and the center position of the image; the reference color is a color predetermined according to the visual effect.

[0074] Among them, the reference color refers to the standard color used for comparison. For example, in the HSL color system, red can be selected as the reference color. In the visual attention effect mechanism, red is easier to be noticed by the audience, so the visual effect of red is better, and red can be selected as the reference color. In the HSL color system, the closer the color is to red, the easier it is to be noticed, that is, the easier it is to become the visual focus area.

[0075] Among them, the degree of color difference refers to the gap between the regional color and the reference color in a specific color evaluation system; for example, the HSL color system can be presented in the form of a circular spectrum, and each color corresponds to an angle in the circular spectrum; wherein the reference color is 0 degrees; that is, the degree of color difference can be determined based on the difference between the angle corresponding to the regional color and the angle of the straight line where the reference color is located, and the first metric value of the candidate area is obtained after processing.

[0076] The region position corresponding to the candidate region refers to a position point that can represent the overall position of the candidate region, which can be a specific coordinate in the image; specifically, any point on the edge or inside of the candidate region can be taken, or the average value of each point can be calculated, or the center point of the rectangle after obtaining the circumscribed rectangle of the candidate region can be taken as the region position; the method for determining the specific region position is not limited. The center position of the image refers to the position corresponding to the center point of the image, for example, the center of a circular image is the center of the circle, and the center of a rectangular image is the center of the rectangle, etc.

[0077] Specifically, in a specific color evaluation system, the regional color and the reference color are located, and the difference between the two is determined as the degree of color difference based on the positioning result; the first measurement value of the candidate area is determined based on the specific numerical value of the difference; a coordinate system is established with each pixel in the image, and the coordinates of the regional position corresponding to the candidate area are obtained respectively, as well as the coordinates of the center position of the image are determined, and the distance between the two coordinates is marked with pixels to obtain the pixel distance; the second measurement value of the candidate area is obtained based on the pixel distance.

[0078] In step S130, a target area is determined from a plurality of candidate areas according to the first metric value and the second metric value of each candidate area as a focus area of ​​the image.

[0079] The target area refers to a candidate area selected from multiple candidate areas that can be used as a focus area. The focus area refers to an image area that is most likely to attract the audience's attention based on position and color in the image.

[0080] Specifically, weight parameters corresponding to the first metric value and the second metric value are obtained respectively, and the first metric value and the second metric value are weightedly calculated using the weight parameters so that the two metric values ​​are unified for easy comparison; after weight processing, multiple first metric values ​​and second metric values ​​of multiple candidate areas can be compared with each other, that is, one candidate area is selected from the multiple candidate areas as the target area according to the comparison result, and at the same time as the focus area of ​​the image.

[0081] In the above-mentioned image recognition, multiple candidate areas corresponding to multiple elements in the image are determined, and the area color and area position corresponding to each candidate area are obtained; then, the first measurement value of each candidate area is obtained according to the degree of color difference between the area color corresponding to each candidate area and the reference color; the second measurement value of each candidate area is obtained according to the pixel distance between the area position corresponding to each candidate area and the center position of the image; the reference color is a color predetermined according to the visual effect; finally, according to the first measurement value and the second measurement value of each candidate area, a target area is determined from the multiple candidate areas as the focus area of ​​the image; in this way, multiple candidate areas are determined from the image through edge contours, and each candidate area is measured accordingly according to the color and position of the candidate area, and the target area is determined according to the obtained measurement value and used as the focus area; the present disclosure applies color features and position features of different areas in the image, and realizes rapid recognition of the focus area in the image with less calculation amount, thereby improving the efficiency of image recognition.

[0082] In an exemplary embodiment, if the image is a color image, the above step S110, before determining the multiple candidate areas corresponding to the multiple elements in the image, also includes: binarizing the image to obtain a binary image; identifying closed figures in the binary image as edge contours of the elements in the image.

[0083] Among them, binarization processing refers to the process of setting the grayscale value of the pixel points on the color image to 0 or 255, that is, making the entire image present an obvious black and white effect.

[0084] Specifically, for color images, the color images can be converted into black and white images by binarization processing to better identify closed figures in the binary images as the edge contours of elements in the image. First, the image is subjected to black and white binarization processing, and the RGBA information of all pixels of the image is obtained. 128 is used as a preset threshold and compared with the RGBA value of each pixel, that is, the value of pixels below 128 is set to 0, and the value of pixels above 128 is set to 255; after this stage of processing, only black and white colors are retained in the image, and the collective properties of the image are only related to the position of the points with pixel values ​​of 0 or 255, and no longer involve the multi-level values ​​of the pixels, and the intersection of black and white is the edge of the object. It should be noted that the binarization processing of the image is not limited to color images, but can also be grayscale images, etc. After the color image is binarized, it is easier to identify the closed figures in it.

[0085] The technical solution provided by the embodiment of the present disclosure performs binarization processing on a color image so that a closed image in the binary image, that is, the edge contour of an element is easier to identify, thereby improving the efficiency of extracting the edge contours of multiple elements in the image.

[0086] In an exemplary embodiment, in step S110, the regional color corresponding to each candidate area is obtained, which can be specifically achieved through the following steps: for each candidate area, the proportion of various colors in the candidate area is obtained; and the color with the largest proportion is determined as the regional color of the candidate area.

[0087] Among them, the color proportion refers to the ratio between the area occupied by the selected color and the area occupied by all colors in the image; the color proportion can be obtained by calculating the number of pixels, for example, the proportion of color A = the number of color A pixels / the total number of image pixels.

[0088] Specifically, at least one color contained in the candidate area is identified, and the area of ​​the candidate area occupied by the at least one color is calculated to obtain the proportion of the color; the color with the largest proportion is selected from the at least one color as the color that can represent the candidate area, as the area color.

[0089] It is also possible to sum and average the pixel values ​​in the candidate region to obtain an average pixel value, and use the color corresponding to the average pixel value as the region color.

[0090] The technical solution provided by the embodiment of the present disclosure determines the regional color that can represent the candidate area by calculating the proportion of various colors; and utilizes the role of color in the attention mechanism to improve the accuracy of focus area selection.

[0091] In an exemplary embodiment, in step S110, the area position of each candidate area is obtained, which can be specifically achieved through the following steps: for each candidate area, a circumscribed geometric figure of the candidate area is generated; and the geometric center of the circumscribed geometric figure is obtained as the area position of the candidate area.

[0092] Specifically, the circumscribed set of graphics refers to a standard circumscribed graphics, such as a circumscribed rectangle, a circumscribed circle, a circumscribed triangle, etc. The coordinates of the set center of the circumscribed set of graphics in the image are obtained as the region position of the candidate region in the image.

[0093] The technical solution provided by the embodiment of the present disclosure utilizes the relatively standard features of the circumscribed geometric figure, takes the center of the circumscribed geometric figure as the center of the candidate area, and obtains a relatively accurate area position of the candidate area.

[0094] In an exemplary embodiment, if Figure 2 As shown, in step S120, the first metric value of each candidate region is obtained according to the color difference between the region color corresponding to each candidate region and the reference color, which can be specifically achieved by the following steps:

[0095] For each candidate region, a first metric value of the candidate region is obtained according to the degree of color difference between the region color of the candidate region and the reference color:

[0096] In step S210, the regional color and the reference color are respectively mapped to a preset color spectrum to obtain a corresponding first spectrum position and a second spectrum position;

[0097] In step S220, the atlas distance between the first atlas position and the second atlas position in the preset color atlas is obtained; the magnitude of the atlas distance is positively correlated to the degree of color difference between the regional color and the reference color;

[0098] In step S230, the graph distance is normalized based on the weight value corresponding to the unit graph distance, and the normalized graph distance is used as the first metric value.

[0099] Among them, the preset color spectrum contains multiple colors, and the various colors have an order with each other, or have a certain value; therefore, multiple colors can be compared in the preset color spectrum. The spectrum distance refers to the distance between two positions in the spectrum, and the distance can be an angle difference, a length difference, a numerical difference, etc. The weight value refers to the adjustment coefficient corresponding to different unit spectrum distances, so that spectrum distances of different sizes can be in the same numerical range through the calculation of the weight value; for example, the spectrum distance is 10, the weight value is 1; the unit spectrum distance is 5, and the weight value is 0.5. Standardization processing refers to the calculation of the spectrum distance using the unit spectrum distance, so that the spectrum distances using different types of preset color spectra can be compared under the same standard.

[0100] Specifically, by mapping the regional color and the reference color in the preset color map, the positions of the two colors in the preset color map are recorded as the map positions; the distance between the two map positions is obtained as the map distance, which simultaneously characterizes the degree of color difference between the regional color and the reference color, and the map distance is proportional to the magnitude of the color difference; according to the type of the preset color map, the corresponding unit map distance is obtained, and the map distance is standardized using the weight value corresponding to the unit map distance to obtain a first metric value.

[0101] The technical solution provided by the embodiment of the present disclosure utilizes the difference characteristics of colors in a preset color map. While locating different colors in the map, it also determines the degree of color difference between different colors, thereby obtaining corresponding measurement values, thereby improving the accuracy of measurement value determination.

[0102] In an exemplary embodiment, if Figure 3 As shown, in step S120, the second metric value of each candidate region is obtained according to the pixel distance between the region position corresponding to each candidate region and the center position of the image, which can be specifically achieved by the following steps:

[0103] In step S310, the pixel distance between the region position corresponding to each candidate region and the center position of the image is obtained;

[0104] In step S320, the pixel distance is normalized based on the weight value corresponding to the unit pixel distance, and the normalized pixel distance is used as the second metric value.

[0105] The weight value refers to the adjustment coefficient corresponding to different unit pixel distances, so that pixel distances of different sizes can be calculated in the same numerical range through the weight value; for example, if the pixel distance is 10 degrees, the weight value is 1; if the pixel distance is 5 degrees, the weight value is 0.5. Standardization refers to calculating the pixel distance using the unit pixel distance, so that pixel distances of different lengths can be compared under the same standard.

[0106] Specifically, the position of the candidate area in the image and the center position of the image are obtained respectively, and the pixel distance between the two positions is calculated based on pixels; the weight value corresponding to the unit pixel distance is obtained, the pixel distance is calculated, and the pixel distance is standardized, and a second measurement value describing the position of each candidate area in the image is obtained.

[0107] The technical solution provided by the embodiment of the present disclosure obtains the second measurement value by calculating the pixel distance between the regional position and the center position. The data is relatively simple, which improves the data processing speed of identifying the focus area in the image. At the same time, the standardized pixel distance can be compared with the pixel distances of other candidate areas, which improves the accuracy of determining the measurement value.

[0108] In an exemplary embodiment, if Figure 4 As shown, according to the first metric value and the second metric value of each candidate area, a target area is determined from multiple candidate areas as the focus area of ​​the image, which can be specifically achieved by the following steps:

[0109] In step S410, for each candidate region, a weighted sum of the first metric value and the second metric value of the candidate region is obtained as a target metric value for measuring whether the candidate region is a focus region; the size of the target metric value is negatively correlated with the probability that the candidate region is a focus region;

[0110] In step S420, the candidate region with the smallest target metric value among the multiple candidate regions is determined as the focus region of the image.

[0111] Specifically, the first metric value represents the degree of difference between the regional color of the candidate area and the reference color, that is, the smaller the first metric value, the closer the regional color is to the reference color; similarly, the second metric value represents the degree of difference between the regional position of the candidate area and the image center position, that is, the smaller the second metric value, the closer the candidate area is to the image center; therefore, the first metric value and the second metric value are weighted and calculated to measure whether the candidate area is a focus area; that is, the smaller the weighted sum of the first metric value and the second metric value, that is, the smaller the target metric value, the more likely the candidate area is to be a focus area.

[0112] The technical solution provided by the embodiment of the present disclosure uses the weighted sum of the first metric value and the second metric value as the target metric value for measuring whether the candidate area is a focal area. This simplifies data processing and improves the efficiency and accuracy of determining the focal area of ​​the image.

[0113] In an exemplary embodiment, a target measurement value of the candidate area is determined based on the first measurement value and the second measurement value of the candidate area, including: obtaining a first adjustment coefficient of the first measurement value and a second adjustment coefficient of the second measurement value; the first adjustment coefficient and the second adjustment coefficient are respectively used to balance the influence of the color difference degree and the pixel distance on the focus area identification; obtaining a first product of the first measurement value and the first adjustment coefficient, and a second product of the second measurement value and the second adjustment coefficient, and taking the sum of the first product and the second product as the target measurement value of the candidate area.

[0114] The first adjustment coefficient and the second adjustment coefficient are respectively used to adjust the degree of color difference and pixel distance, and the overall impact on the focus area; the first adjustment coefficient and the second adjustment coefficient can be empirical parameters, that is, they are set manually based on experience.

[0115] Specifically, the first metric value is multiplied by the first adjustment coefficient to adjust the first metric value; the second metric value is multiplied by the second adjustment coefficient to adjust the second metric value; the sum of the first product and the second product obtained in this way is adjusted, and the determination of the target metric value is more accurate. It should be noted that the first adjustment coefficient and the second adjustment coefficient may not be applied at the same time, that is, under the premise that any adjustment coefficient can adjust the corresponding metric value and the target metric value can be improved, only one of them or neither of them may be applied, so as to improve the efficiency of determining the target metric value.

[0116] This embodiment uses the first adjustment coefficient and the second adjustment coefficient to adjust the influence of the color difference degree and the pixel distance on the focus area recognition, thereby improving the accuracy of the target measurement value determination process.

[0117] In an exemplary embodiment, the reference color is determined in the following manner: in response to a trigger operation on a target color area in a preset color display page, an identifier of the target color area is obtained; color information corresponding to the target color area is determined according to the identifier, and the color corresponding to the color information is used as the reference color. Specifically, a plurality of colors can be displayed in the preset color display page, and the specific color selected as the reference color can be determined by a trigger operation. In the preset color display page, each color information can be displayed using a visual effect or by an option, such as prompting the object of the operation to select the color that is noticed at the first time from the dynamic display image as the reference color, or providing a plurality of fixed color areas to directly determine the reference color according to the object's selection.

[0118] This embodiment provides a preset color display page to interact with external objects, and determines color information used as a reference color according to the interaction result, thereby achieving accurate acquisition and determination of the reference color.

[0119] Figure 5 is a flowchart of another image recognition method according to an exemplary embodiment, the method is applied to a terminal, and includes the following steps:

[0120] In step S510, the image is binarized to obtain a binarized image; closed figures in the binarized image are identified as edge contours of elements in the image.

[0121] In step S520, multiple candidate areas corresponding to multiple elements in the image are determined; the proportion of various colors in the candidate area is obtained, and the color with the largest proportion is determined as the regional color of the candidate area; a circumscribed geometric figure of the candidate area is generated; and the geometric center of the circumscribed geometric figure is obtained as the regional position of the candidate area.

[0122] In step S530, for each candidate area, a first measurement value of the candidate area is obtained according to the degree of color difference between the regional color of the candidate area and the reference color: the regional color and the reference color are respectively mapped to a preset color map to obtain a corresponding first map position and a second map position; the map distance between the first map position and the second map position in the preset color map is obtained; the size of the map distance is positively correlated to the degree of color difference between the regional color and the reference color; the map distance is normalized based on the weight value corresponding to the unit map distance, and the normalized map distance is used as the first measurement value.

[0123] In step S540, the pixel distance between the area position corresponding to each candidate area in the image and the center position of the image is obtained; the pixel distance is normalized based on the weight value corresponding to the unit pixel distance, and the normalized pixel distance is used as the second metric value.

[0124] In step S550, for each candidate area, a weighted sum of the first measurement value and the second measurement value of the candidate area is obtained as a target measurement value to measure whether the candidate area is a focus area; there is a negative correlation between the size of the target measurement value and the probability that the candidate area is the focus area; the candidate area with the smallest target measurement value among multiple candidate areas is determined as the focus area of ​​the image.

[0125] Specifically, in Figure 6a In the figure, 6a-1 is the image to be subjected to focus area recognition; Figure 6a-1 The image shown is binarized to obtain Figure 6a-2 The binary image shown in FIG. 1 is a binary image; multiple closed figures in the binary image are identified, such as Figure 6a-3As shown, the binary image includes 5 closed image elements, which are marked separately, and the edge of the closed image is the edge contour of the element; the edge contour of each element is restored back to the original image for display, so as to obtain the edge contour of the element in the image.

[0126] like Figure 6b As shown, it is a schematic diagram of the preset color spectrum; it can be seen that in the spectrum, each color is recorded in the form of an angle, for example, red is 0 degrees, and green is 120 degrees; for example, if the reference color is red, then the second spectrum position of the reference position is 0 degrees, if the regional color is orange, then the first spectrum position of the regional color is recorded as orange 30 degrees; the spectrum distance is the difference between the two spectrum positions, that is, the difference between 30 degrees and 0 degrees, and the spectrum distance is recorded as 30 degrees.

[0127] like Figure 6c As shown, taking candidate region 4 as an example, a circumscribed geometric figure of candidate region 4 is generated; the geometric center of the circumscribed geometric figure is obtained as point B, which is used as the region position of candidate region 4; and the center position of the image is obtained as point A. The distance between point A and point B is the pixel distance between candidate region 4 and the center position of the image.

[0128] Through the above method of calculation, it is assumed that the atlas distances of candidate areas 1-5 in the preset color map are: 10 degrees, 14 degrees, 24 degrees, 5 degrees, and 3 degrees; if the weight value corresponding to the unit atlas distance is 1, then after standardization, the first metric values ​​of candidate areas 1-5 are 10, 14, 24, 5, and 3, respectively.

[0129] Assume that the pixel distances from candidate areas 1-5 to the center of the image are: 208PX, 210PX, 282PX, 5PX, 55PX; if the weight value corresponding to the unit pixel distance is 1, then after normalization, the second measurement values ​​of candidate areas 1-5 are 208, 210, 282, 5, 55 respectively.

[0130] The sum of the first metric value and the second metric value of candidate areas 1-5 are obtained as follows: 218, 224, 306, 10, 58 respectively; it can be seen that candidate area 4 is the target candidate area with the smallest sum of the first metric value and the second metric value, and candidate area 4 is determined to be the focus area of ​​the image.

[0131] The technical solution provided by the embodiment of the present disclosure determines multiple candidate areas from the image through edge contours, measures each candidate area according to its color and position, and determines the target area as the focus area based on the obtained measurement value; the present disclosure applies color features and position features of different areas in the image, and achieves rapid identification of the focus area in the image with less calculation amount, thereby improving the efficiency of image recognition.

[0132] It should be understood that although Figure 1 - The steps in the flowchart of FIG. 6 are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1-Figure 5 At least part of the steps may include multiple steps or multiple stages. These steps or stages are not necessarily performed at the same time, but can be performed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed in turn or alternately with other steps or at least part of the steps or stages in other steps.

[0133] It can be understood that the same / similar parts between the various embodiments of the above method in this specification can refer to each other, and each embodiment focuses on the differences from other embodiments. For related points, please refer to the description of other method embodiments.

[0134] Figure 7 is a block diagram of an image recognition device according to an exemplary embodiment. Figure 7 The device includes a candidate area determination unit 702, a measurement value determination unit 704 and a focus area determination unit 706.

[0135] The candidate region determining unit 702 is configured to determine multiple candidate regions corresponding to multiple elements in the image, and obtain region colors and region positions corresponding to each candidate region.

[0136] The measurement value determination unit 704 is configured to obtain a first measurement value of each candidate area according to the degree of color difference between the area color corresponding to each candidate area and a reference color; obtain a second measurement value of each candidate area according to the pixel distance between the area position corresponding to each candidate area and the center position of the image; the reference color is a color predetermined according to the visual effect.

[0137] The focus area determination unit 706 is configured to determine a target area from a plurality of candidate areas as the focus area of ​​the image according to the first metric value and the second metric value of each candidate area.

[0138] In an exemplary embodiment, if the image is a color image, the candidate region determination unit 702 is further configured to perform binarization processing on the image to obtain a binary image; and identify closed figures in the binary image as edge contours of elements in the image.

[0139] In an exemplary embodiment, the candidate region determining unit 702 is further configured to obtain, for each candidate region, the proportion of various colors in the candidate region; and determine the color with the largest proportion as the region color of the candidate region.

[0140] In an exemplary embodiment, the candidate region determination unit 702 is further configured to generate, for each candidate region, a circumscribed geometric figure of the candidate region; and obtain a geometric center of the circumscribed geometric figure as the region position of the candidate region.

[0141] In an exemplary embodiment, the measurement value determination unit 704 is also configured to obtain, for each candidate area, a first measurement value of the candidate area according to the degree of color difference between the regional color of the candidate area and a reference color, and to map the regional color and the reference color to a preset color map, respectively, to obtain a corresponding first map position and a second map position; obtain a map distance between the first map position and the second map position in the preset color map; the size of the map distance is positively correlated to the degree of color difference between the regional color and the reference color; and normalize the map distance based on a weight value corresponding to a unit map distance, and use the normalized map distance as the first measurement value.

[0142] In an exemplary embodiment, the measurement value determination unit 704 is further configured to obtain the pixel distance between the area position corresponding to each candidate area in the image and the center position of the image; normalize the pixel distance based on the weight value corresponding to the unit pixel distance, and use the normalized pixel distance as the second measurement value.

[0143] In an exemplary embodiment, the focus area determination unit 706 is further configured to execute, for each candidate area, obtaining a weighted sum of a first measurement value and a second measurement value of the candidate area as a target measurement value for measuring whether the candidate area is a focus area; there is a negative correlation between the size of the target measurement value and the probability that the candidate area is the focus area; and the candidate area with the smallest target measurement value among multiple candidate areas is determined as the focus area of ​​the image.

[0144] In an exemplary embodiment, the focus area determination unit 706 is further configured to execute the steps of respectively obtaining a first adjustment coefficient for the first measurement value and obtaining a second adjustment coefficient for the second measurement value; the first adjustment coefficient and the second adjustment coefficient are respectively used to balance the influence of the color difference degree and the pixel distance on the focus area recognition; obtaining a first product of the first measurement value and the first adjustment coefficient, and a second product of the second measurement value and the second adjustment coefficient, and taking the sum of the first product and the second product as the target measurement value of the candidate area.

[0145] In an exemplary embodiment, the measurement value determination unit 704 is also configured to execute a trigger operation on the target color area in a preset color display page to obtain an identifier of the target color area; determine the color information corresponding to the target color area based on the identifier, and use the color corresponding to the color information as the reference color.

[0146] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0147] Figure 8 8 is a block diagram of an electronic device 800 for image recognition according to an exemplary embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0148] Reference Figure 8 , the electronic device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0149] The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0150] The memory 804 is configured to store various types of data to support operations on the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, an optical disk, or a graphene memory.

[0151] The power supply component 806 provides power to the various components of the electronic device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.

[0152] The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the electronic device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0153] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the electronic device 800 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting an audio signal.

[0154] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0155] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the electronic device 800. For example, the sensor assembly 814 can detect the open / closed state of the electronic device 800, the relative positioning of the components, such as the display and keypad of the electronic device 800, and the sensor assembly 814 can also detect the position change of the electronic device 800 or the electronic device 800 component, the presence or absence of contact between the user and the electronic device 800, the device 800 orientation or acceleration / deceleration and the temperature change of the electronic device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0156] The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0157] In an exemplary embodiment, the electronic device 800 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0158] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the above instructions can be executed by the processor 820 of the electronic device 800 to complete the above method. For example, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0159] In an exemplary embodiment, a computer program product is further provided. The computer program product includes instructions. The instructions can be executed by the processor 820 of the electronic device 800 to complete the above method.

[0160] It should be noted that the above-mentioned devices, electronic devices, computer-readable storage media, computer program products, etc. may also include other implementation methods according to the description of the method embodiments. The specific implementation methods can refer to the description of the relevant method embodiments, which will not be described one by one here.

[0161] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.

[0162] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. An image recognition method, characterized in that: include: Determine multiple candidate regions corresponding to multiple elements in the image, and obtain region colors and region positions corresponding to each candidate region; The region color is a main body color that can represent the candidate region corresponding to the element; the region position is determined according to the edge contour corresponding to the element; Obtaining a first measurement value of each candidate region according to a color difference between a region color corresponding to each candidate region and a reference color; According to the pixel distance between the region position corresponding to each candidate region and the center position of the image, a second metric value of each candidate region is obtained; the reference color is a color predetermined according to the visual effect; the color difference degree indicates the gap between the region color and the reference color in a specific color evaluation system; the first metric value is determined based on the size of the gap; A target metric value of each candidate area is determined according to a weighted sum of the first metric value and the second metric value of each candidate area; there is a negative correlation between the size of the target metric value and the probability that the candidate area is the focal area; and a target area with the smallest target metric value is determined from the multiple candidate areas as the focal area of ​​the image.

2. The method according to claim 1, characterized in that: If the image is a color image, before determining the multiple candidate regions corresponding to the multiple elements in the image, the method further includes: Performing binarization processing on the image to obtain a binarized image; A closed figure in the binary image is identified as an edge contour of an element in the image.

3. The method according to claim 1, characterized in that: The obtaining of the region color corresponding to each candidate region includes: For each candidate area, obtain the proportion of each color in the candidate area; The color with the largest proportion is determined as the region color of the candidate region.

4. The method according to claim 1, characterized in that: The obtaining of the region position of each candidate region includes: For each candidate region, generate a circumscribed geometric figure of the candidate region; The geometric center of the circumscribed geometric figure is obtained as the region position of the candidate region.

5. The method according to claim 1, characterized in that The obtaining of the first measurement value of each candidate region according to the color difference between the region color corresponding to each candidate region and the reference color includes: For each candidate region, a first metric value of the candidate region is obtained according to the degree of color difference between the region color of the candidate region and the reference color: Mapping the regional color and the reference color to a preset color spectrum respectively to obtain a corresponding first spectrum position and a second spectrum position; Obtaining a color spectrum distance between the first color spectrum position and the second color spectrum position in the preset color spectrum; the size of the color spectrum distance is positively correlated to the degree of color difference between the area color and the reference color; The graph distance is normalized based on a weight value corresponding to the unit graph distance, and the normalized graph distance is used as the first metric value.

6. The method according to claim 1, characterized in that The obtaining, according to the pixel distance between the region position corresponding to each candidate region and the center position of the image, the second metric value of each candidate region comprises: Obtaining the pixel distance between the region position corresponding to each candidate region and the center position of the image in the image; The pixel distance is normalized based on a weight value corresponding to the unit pixel distance, and the normalized pixel distance is used as the second metric value.

7. The method according to claim 1, characterized in that The determining the target metric value of each candidate area according to the weighted sum of the first metric value and the second metric value of each candidate area includes: respectively obtaining a first adjustment coefficient of the first metric value and a second adjustment coefficient of the second metric value; the first adjustment coefficient and the second adjustment coefficient are respectively used to balance the influence of the color difference degree and the pixel distance on the focus area recognition; A first product of the first metric value and the first adjustment coefficient and a second product of the second metric value and the second adjustment coefficient are obtained, and a sum of the first product and the second product is used as a target metric value of the candidate area.

8. The method according to any one of claims 1 to 6, characterized in that: The reference color is determined in the following manner: In response to a triggering operation on a target color area in a preset color display page, obtaining an identifier of the target color area; Color information corresponding to the target color area is determined according to the identifier, and the color corresponding to the color information is used as the reference color.

9. An image recognition device, characterized in that: include: A candidate region determination unit is configured to determine a plurality of candidate regions corresponding to a plurality of elements in the image, and obtain a region color and a region position corresponding to each candidate region; The region color is a main body color that can represent the candidate region corresponding to the element; the region position is determined according to the edge contour corresponding to the element; A metric value determination unit is configured to obtain a first metric value of each candidate region according to a color difference between a region color corresponding to each candidate region and a reference color; According to the pixel distance between the region position corresponding to each candidate region and the center position of the image, a second metric value of each candidate region is obtained; the reference color is a color predetermined according to the visual effect; the color difference degree indicates the gap between the region color and the reference color in a specific color evaluation system; the first metric value is determined based on the size of the gap; The focus area determination unit is configured to determine a target measurement value of each candidate area based on a weighted sum of a first measurement value and a second measurement value of each candidate area; there is a negative correlation between the size of the target measurement value and the probability that the candidate area is the focus area; and a target area is determined from the multiple candidate areas as the focus area of ​​the image.

10. The device according to claim 9, characterized in that If the image is a color image, the candidate region determination unit is further configured to perform binarization processing on the image to obtain a binarized image; and identify closed figures in the binarized image as edge contours of elements in the image.

11. The device according to claim 9, characterized in that The candidate region determination unit is further configured to obtain, for each candidate region, the proportion of various colors in the candidate region; and determine the color with the largest proportion as the region color of the candidate region.

12. The device according to claim 9, characterized in that The candidate region determination unit is further configured to generate a circumscribed geometric figure of each candidate region; and obtain a geometric center of the circumscribed geometric figure as a region position of the candidate region.

13. The device according to claim 9, characterized in that The metric value determination unit is further configured to obtain, for each candidate region, a first metric value of the candidate region according to a degree of color difference between a region color of the candidate region and a reference color: respectively map the region color and the reference color to a preset color spectrum to obtain a corresponding first spectrum position and a second spectrum position; Obtain a spectrum distance between the first spectrum position and the second spectrum position in the preset color spectrum; the size of the spectrum distance is positively correlated to the degree of color difference between the regional color and the reference color; standardize the spectrum distance based on the weight value corresponding to the unit spectrum distance, and use the standardized spectrum distance as the first measurement value.

14. The device according to claim 9, characterized in that The metric value determination unit is further configured to execute obtaining a pixel distance between a region position corresponding to each candidate region and a center position of the image in the image; The pixel distance is normalized based on a weight value corresponding to the unit pixel distance, and the normalized pixel distance is used as the second metric value.

15. The device according to claim 9, characterized in that The focus area determination unit is further configured to execute the steps of respectively obtaining a first adjustment coefficient for the first measurement value and obtaining a second adjustment coefficient for the second measurement value; the first adjustment coefficient and the second adjustment coefficient are respectively used to balance the influence of the color difference degree and the pixel distance on the focus area recognition; obtaining a first product of the first measurement value and the first adjustment coefficient, and a second product of the second measurement value and the second adjustment coefficient, and taking the sum of the first product and the second product as the target measurement value of the candidate area.

16. The device according to any one of claims 9 to 14, characterized in that: The metric value determination unit is also configured to execute a trigger operation on the target color area in a preset color display page to obtain an identifier of the target color area; determine the color information corresponding to the target color area according to the identifier, and use the color corresponding to the color information as the reference color.

17. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image recognition method according to any one of claims 1 to 8.

18. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the image recognition method according to any one of claims 1 to 8.

19. A computer program product, comprising instructions, characterized in that: When the instructions are executed by a processor of an electronic device, the electronic device is enabled to execute the image recognition method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Barrier detection method and apparatus

    CN107169418A

  • Insulator target detection method, system and device based on knowledge graph

    CN110210387A