Image recognition methods, devices, electronic equipment and storage media
By performing binarization and morphological operations on images in the brightness feature dimension, reflective areas are automatically identified, solving the problem of reflective noise in image capture, improving recognition accuracy and efficiency, and reducing manual review costs.
Patent Information
- Application Number
- CN202311195689.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-15
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2043-09-15
AI Technical Summary
In existing technologies, reflective noise during image capture leads to a decrease in image quality, and manual review is inefficient and costly, making it impossible to identify reflective phenomena in a timely manner.
The image to be reviewed is binarized in terms of brightness features. The connected components of the image are obtained through morphological erosion and dilation operations. The target connected components that meet the preset conditions are selected, and the reflective areas are automatically identified.
It achieves high-precision and stable reflective image recognition with low resource consumption, saving labor costs and improving review efficiency.
Smart Images

Figure CN117292109B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an image recognition method, apparatus, electronic device and storage medium. Background Technology
[0002] When shooting images in a shooting scene, if there is light interference, it will cause the captured images to have reflective noise, which will affect the image quality.
[0003] For images that require reflection detection, the current common practice is to manually review the images to identify whether there is a reflection.
[0004] Using manual review for image reflection recognition is costly; moreover, due to the low efficiency of manual review, it is impossible to review images in a timely manner. Summary of the Invention
[0005] In view of the above problems, embodiments of this application provide an image recognition method, apparatus, electronic device, and storage medium that overcomes or at least partially solves the above problems.
[0006] In a first aspect, embodiments of this application provide an image recognition method, including:
[0007] In terms of brightness features, the image to be reviewed is binarized to obtain a binarized image;
[0008] The binarized image is subjected to morphological erosion and morphological dilation operations in sequence to obtain at least one image connected component corresponding to the binarized image, wherein the image connected component includes reflective pixels.
[0009] Based on the pixel information corresponding to the image connected components, a target image connected component whose pixel information satisfies a preset condition is determined in the at least one image connected component.
[0010] If the number of connected components in the target image region corresponding to the image to be reviewed meets the limiting condition, the image to be reviewed is determined to be a reflective image, and the target image region includes the content of the image to be reviewed.
[0011] Secondly, embodiments of this application provide an image recognition device, comprising:
[0012] The first acquisition module is used to perform binarization processing on the image to be reviewed in the dimension of brightness features to obtain a binarized image;
[0013] The second acquisition module is used to sequentially perform morphological erosion and morphological dilation operations on the binarized image to acquire at least one image connected component corresponding to the binarized image, wherein the image connected component includes reflective pixels.
[0014] The first determining module is used to determine, based on the pixel information corresponding to the image connected component, a target image connected component whose pixel information satisfies a preset condition in the at least one image connected component.
[0015] The second determining module is used to determine that the image to be reviewed is a reflective image when the number of connected components of the target image region corresponding to the target image region of the image to be reviewed meets the limiting condition, wherein the target image region includes the content of the image to be reviewed.
[0016] Thirdly, embodiments of this application provide an electronic device, including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the image recognition method as described in the first aspect above.
[0017] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the image recognition method described in the first aspect above.
[0018] The technical solution of this application embodiment performs binarization processing on the image to be reviewed in the brightness feature dimension to obtain a binarized image. Then, morphological operations are performed on the binarized image to obtain at least one image connected component. Based on pixel information, a target image connected component is selected from the at least one image connected component. According to the inclusion of the target image connected component in the target image region of the image to be reviewed, it is determined whether the image to be reviewed is a reflective image. It can automatically identify reflective images with less resource consumption and has the characteristics of high recognition accuracy and recognition stability. At the same time, it can effectively save manpower review costs and improve review efficiency. Attached Figure Description
[0019] Figure 1 A schematic diagram illustrating the image recognition method provided in an embodiment of this application;
[0020] Figure 2 A schematic diagram illustrating the image of a business license forming a reflective area provided in an embodiment of this application;
[0021] Figure 3 This is a flowchart illustrating the overall implementation of the image recognition method provided in the embodiments of this application.
[0022] Figure 4 This is a schematic diagram illustrating the image recognition device provided in an embodiment of this application;
[0023] Figure 5 This is a schematic diagram of the electronic device structure provided in the embodiments of this application. Detailed Implementation
[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0025] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Multiple embodiments in this application may include two or more.
[0026] In the various embodiments of this application, it should be understood that the sequence number of each process described below does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0027] This application provides an image recognition method for performing reflection recognition on images to be reviewed. The images to be reviewed can be images uploaded by users to a platform and requiring platform authentication, such as document images (including personal identification images, business licenses, etc.); or images randomly taken by users that require reflection recognition. This application utilizes computer vision technology and the characteristics of reflection images to perform automated reflection recognition on images, which can improve review efficiency, reduce review costs, and improve recognition accuracy.
[0028] The image recognition method provided in the embodiments of this application is described below. See also... Figure 1 As shown, the method includes the following steps:
[0029] Step 101: In the brightness feature dimension, perform binarization processing on the image to be reviewed to obtain a binarized image.
[0030] When performing reflectivity recognition on images to be reviewed, it is necessary to binarize the image in terms of brightness features to obtain a corresponding binarized image. The image to be reviewed is in RGB image format. Before binarization, the RGB image format needs to be converted to HSV image format. Since HSV image format can represent pixels in three dimensions—chroma (H), saturation (S), and luminance (V)—binarization can be performed on the HSV image in terms of brightness features to obtain a binarized image.
[0031] In this binary image, there are two brightness values, and these two brightness values are two brightness values with a large difference in brightness, usually two extreme brightness values; therefore, for each pixel in the binary image, it corresponds to the maximum brightness value or the minimum brightness value.
[0032] Step 102: Perform morphological erosion and morphological dilation operations on the binarized image in sequence to obtain at least one image connected component corresponding to the binarized image, wherein the image connected component includes reflective pixels.
[0033] After binarizing the brightness feature dimension and obtaining the corresponding binarized image, morphological operations can be performed on the binarized image. When performing morphological operations on the binarized image, the actual operation is performed on the pixel point corresponding to the maximum brightness value in the binarized image.
[0034] In morphological operations, morphological erosion and morphological dilation are performed sequentially on the binarized image. The essence of morphological operations is to change the shape of the object. By performing morphological erosion on the pixels corresponding to the maximum brightness value in the binarized image, small areas of noise can be removed. These noise points can be considered as isolated pixels or sets of isolated pixels corresponding to the maximum brightness value (these sets occupy a small area and the pixels corresponding to the maximum brightness value within the set are not connected). After noise removal through morphological erosion, morphological dilation is performed on the remaining pixels corresponding to the maximum brightness value. This morphological dilation creates connected components in the image. Generally, after morphological dilation, all pixels in the connected components correspond to the maximum brightness value, and the reflective pixels included in the connected components are those corresponding to the maximum brightness value.
[0035] Since morphological erosion operations may result in errors in noise identification and the removal of non-noise pixels, morphological dilation operations can be performed to control the appropriate expansion of pixels corresponding to the maximum brightness value, thereby eliminating isolated pixels corresponding to the minimum brightness value in the same region. This allows pixels corresponding to the maximum brightness value in the same region to be connected together, thus obtaining at least one connected region of the binarized image. At the same time, it can also repair the situation where non-noise pixels have been removed.
[0036] Step 103: Based on the pixel information corresponding to the image connected components, determine the target image connected component whose pixel information satisfies the preset conditions in the at least one image connected component.
[0037] After obtaining at least one connected component of the image corresponding to the binarized image through morphological operations, the connected component whose pixel information meets the preset conditions can be selected from the at least one connected component based on the pixel information corresponding to each connected component, and the selected connected component is determined as the target connected component.
[0038] The preset conditions here are related to the pixel information corresponding to the connected components of the image, specifically the number of pixels corresponding to each connected component. The number of target connected components that meet the preset conditions can be at least one, or at least one target connected component can be absent. The target connected components serve as the basis for determining reflective areas. If at least one target connected component is absent, the image to be reviewed is determined to not contain reflective areas, and the reflective recognition process for the image ends. If at least one target connected component exists, subsequent processing continues.
[0039] Step 104: If the number of connected components of the target image corresponding to the target image region of the image to be reviewed meets the limiting condition, the image to be reviewed is determined to be a reflective image, and the target image region includes the content of the image to be reviewed.
[0040] After identifying the target image connected components that meet the preset conditions, it is detected whether the target image region of the image to be reviewed includes the target image connected components. If the number of target image connected components corresponding to the target image region meets the restriction conditions, the image to be reviewed is determined to be a reflective image.
[0041] The image to be reviewed includes the target image region and a non-reviewed region distinct from the target image region. The target image region includes the content to be reviewed, and the non-reviewed region includes non-reviewed content, such as edge areas or blank areas. For example, see [link to relevant documentation]. Figure 2As shown, the image to be reviewed is a business license image. The non-license content area of the business license image is the non-review area, and the business license content area corresponding to the business license image is the target image area.
[0042] Since the non-review area of the image to be reviewed does not include the content of the image to be reviewed, whether the non-review area is reflective or not has little impact. This application embodiment determines whether the image to be reviewed is a reflective image based on the reflectivity detection of the target image area. By determining the target image area of the image to be reviewed and detecting the inclusion of connected components within the target image area, it is possible to identify whether the effective area (target image area) of the image to be reviewed contains a reflective area, thereby determining whether the image to be reviewed is a reflective image based on the reflectivity of the effective area.
[0043] The above-described implementation scheme of this application performs binarization processing on the image to be reviewed in the brightness feature dimension to obtain a binarized image, performs morphological operations on the binarized image to obtain at least one image connected component, filters out the target image connected component in the at least one image connected component based on pixel information, and determines whether the image to be reviewed is a reflective image based on the inclusion of the target image connected component in the target image region of the image to be reviewed. It can automatically identify reflective images with less resource consumption, and has the characteristics of high recognition accuracy and recognition stability. At the same time, it can effectively save manpower review costs and improve review efficiency.
[0044] The following describes the process of obtaining the binarized image corresponding to the image to be reviewed. In the brightness feature dimension, the image to be reviewed is binarized. Obtaining the binarized image includes:
[0045] The image to be reviewed is converted from RGB space to HSV space to obtain the HSV channel image corresponding to the image to be reviewed. Each pixel of the HSV channel image corresponds to the channel chroma value, channel saturation value and channel brightness value.
[0046] In terms of brightness features, the HSV channel image is binarized based on the channel brightness threshold to obtain the corresponding binarized image.
[0047] In this embodiment, the image to be reviewed is in RGB image format. When performing binarization on the image to be reviewed, it is necessary to convert the image from RGB space to HSV space to obtain the corresponding HSV channel image. Specifically, during the conversion, each pixel in the image to be reviewed needs to be decomposed into channel chroma (H) value, channel saturation (S) value, and channel luminance (V) value to convert the image to HSV space and obtain the HSV channel image.
[0048] After obtaining the HSV channel image corresponding to the image to be reviewed, the HSV channel image can be binarized according to the channel brightness threshold in the brightness feature dimension. Based on the comparison between the channel brightness value corresponding to the pixel in the HSV channel image and the channel brightness threshold, the binarization result corresponding to the pixel is determined. Based on the binarization result corresponding to each pixel, the binarized image corresponding to the HSV channel image is obtained.
[0049] The channel brightness threshold mentioned above can be a set default threshold, which is within a range and can be adjusted within that range; the channel brightness threshold can also be calculated using a specific method.
[0050] For a binary image, each pixel typically corresponds to either the maximum or minimum brightness value; that is, the binarization result of a pixel is either the maximum or minimum brightness value.
[0051] Specifically, the binarization processing of the HSV channel image based on the channel brightness threshold in the brightness feature dimension includes:
[0052] Brightness features are extracted from the HSV channel image to obtain the brightness channel;
[0053] Based on the brightness channel, determine the brightness threshold of the channel;
[0054] For each pixel in the HSV channel image, a binarized brightness value is determined based on the relationship between the channel brightness value corresponding to the pixel and the channel brightness threshold. The binarized brightness value corresponding to the pixel is either a first brightness value or a second brightness value. Pixels with channel brightness values greater than or equal to the channel brightness threshold correspond to the first brightness value, and pixels with channel brightness values less than the channel brightness threshold correspond to the second brightness value.
[0055] When performing binarization based on channel brightness thresholds, brightness features are extracted from the HSV channel image to obtain the brightness channel. The channel brightness threshold used for binarization is determined based on the brightness channel, and then the pixels in the HSV channel image are binarized based on the channel brightness threshold.
[0056] When acquiring the luminance channel, the HSV channel image can be separated into the V channel using a function. When determining the channel luminance threshold, the average, maximum, and minimum values of the luminance channel can be calculated, and the channel luminance threshold is determined using a preset formula based on these values. Furthermore, to filter out pixels with higher luminance values based on the channel luminance threshold for more accurate reflection recognition, the determined channel luminance threshold needs to be within a relatively high luminance value range. Therefore, the maximum value carries a larger weight when determining the channel luminance threshold. If the channel luminance threshold determined based on the average, maximum, and minimum values is not within the corresponding range, the proportion of the average, maximum, and minimum values in the calculation process can be adjusted to ensure that the channel luminance threshold falls within that range.
[0057] The process of binarizing pixels in an HSV channel image based on a channel brightness threshold is as follows: The channel brightness value corresponding to each pixel in the HSV channel image is compared with the channel brightness threshold. Based on the comparison results, the pixels in the HSV channel image are divided into pixels with channel brightness values greater than or equal to the channel brightness threshold, and pixels with channel brightness values less than the channel brightness threshold. For example, if the channel brightness threshold is 250, then pixels with channel brightness values greater than or equal to 250 are divided into pixels with channel brightness values less than 250.
[0058] For pixels whose channel brightness value is greater than or equal to the channel brightness threshold, they are determined to correspond to a first brightness value; that is, the binarized brightness value corresponding to this pixel is the first brightness value. For pixels whose channel brightness value is less than the channel brightness threshold, they are determined to correspond to a second brightness value; that is, the binarized brightness value corresponding to this pixel is the second brightness value. The first brightness value is greater than the second brightness value, and the first brightness value is usually set to the maximum brightness value (255), while the second brightness value is usually set to the minimum brightness value (0), so that the binarized image presents a clear black and white visual effect.
[0059] The above-described implementation scheme of this application obtains an HSV channel image by converting the image to be reviewed into a format, determines the channel brightness threshold based on the brightness channel corresponding to the HSV channel image, and performs binarization processing on the pixels based on the relationship between the channel brightness threshold and the channel brightness value corresponding to each pixel in the HSV channel image, thereby obtaining a binarized image, which is then used for subsequent reflection recognition based on the binarized image.
[0060] The process of obtaining connected components of an image is described below. This involves sequentially performing morphological erosion and morphological dilation operations on the binarized image to obtain at least one connected component corresponding to the binarized image, including:
[0061] Morphological erosion is performed on the pixels corresponding to the first brightness value in the binarized image to obtain an intermediate image with noise removed from the region.
[0062] Perform morphological dilation on the pixels in the intermediate image corresponding to the first brightness value to obtain at least one connected component of the binarized image;
[0063] In the binarized image, the pixels correspond to a first brightness value or a second brightness value, and the first brightness value is greater than the second brightness value.
[0064] Since each pixel in a binarized image corresponds to either a first brightness value (maximum brightness value) or a second brightness value (minimum brightness value), after obtaining the binarized image through binarization processing, morphological erosion can be performed on the pixels corresponding to the first brightness value. The essence of morphological erosion on pixels corresponding to the first brightness value is to "slim down" the pixels. By performing morphological erosion, isolated pixels and sets of isolated pixels corresponding to the first brightness value can be quickly identified (these sets occupy a small area and the pixels corresponding to the first brightness value within the set are not connected). Based on the identified pixels and sets of pixels, regional noise is determined, and regional noise in the binarized image is removed to obtain an intermediate image.
[0065] It should be noted that, in the embodiments of this application, if the proportion (e.g., the proportion of number or the proportion of area) of pixels corresponding to the first brightness value in a certain area is greater than a set value (e.g., 90%), it can be determined that the pixels corresponding to the first brightness value in that area are connected to form a sheet.
[0066] After obtaining an intermediate image through morphological erosion, a morphological dilation operation is performed on the pixels corresponding to the first brightness value in the intermediate image. Essentially, this morphological dilation operation "fattens" the pixels. By performing this operation, the pixels corresponding to the first brightness value can be appropriately expanded outwards, thereby eliminating isolated pixels with a second brightness value within the same region, making the pixels corresponding to the first brightness value within the same region connected. After the morphological dilation operation, at least one connected region of the image is formed. Generally speaking, after the morphological dilation operation, for any connected region, the pixels corresponding to the first brightness value are the reflective pixels.
[0067] Furthermore, since morphological erosion operations may result in errors in noise identification and the removal of non-noise pixels, morphological dilation operations can be performed to control the appropriate expansion of pixels corresponding to the maximum brightness value, thereby correcting erroneous removals.
[0068] The above-described implementation scheme of this application can remove regional noise in the binarized image by performing morphological erosion operation on the binarized image. After removing the regional noise, a morphological dilation operation can be performed to control the appropriate expansion of the pixel corresponding to the first brightness value to form at least one image connected region, and then the reflection recognition of the image can be performed based on the image connected region.
[0069] The process of filtering target image connected components is described below. Based on the pixel information corresponding to the image connected components, determining the target image connected components whose pixel information satisfies preset conditions within the at least one image connected component includes:
[0070] For each connected component of the image, obtain the number of first pixels corresponding to the connected component of the image, the number of second pixels corresponding to the minimum bounding rectangle of the connected component of the image, and obtain the first ratio value corresponding to the ratio of the number of first pixels to the number of second pixels.
[0071] In the at least one image connected component, image connected components with a corresponding first pixel count greater than a first threshold and a corresponding first ratio greater than a second threshold are selected, and the selected image connected components are determined as target image connected components whose pixel information satisfies preset conditions.
[0072] After determining at least one connected component of an image through morphological operations, target connected components that meet preset conditions are selected from the determined connected components based on the pixel information corresponding to the connected components. Here, pixel information refers to the number of pixels. When selecting target connected components from the determined connected components, each connected component needs to be detected to determine whether its corresponding pixel information meets the preset conditions. If the preset conditions are met, it is determined as a target connected component.
[0073] When detecting connected components in an image, it is necessary to obtain the number of first pixels corresponding to the connected component, determine the minimum bounding rectangle corresponding to the connected component, obtain the number of second pixels corresponding to the minimum bounding rectangle, and calculate a first ratio corresponding to the ratio of the number of first pixels to the number of second pixels. Then, it is checked whether the number of first pixels corresponding to the connected component is greater than a first threshold and whether the first ratio corresponding to the connected component is greater than a second threshold. If the number of first pixels is greater than the first threshold and the first ratio is greater than the second threshold, then the connected component is determined to meet the preset conditions and is the target connected component.
[0074] Specifically, when the number of first pixels corresponding to a connected component in the image is greater than a first threshold, it indicates that the size of the region corresponding to the connected component meets the condition. When the first ratio corresponding to a connected component in the image is greater than a second threshold, it indicates that the ratio of the region occupied by the connected component to the region occupied by the minimum bounding rectangle meets the condition. The shape of the connected component is approximately circular or elliptical, and the shape is relatively regular. Since reflective points on the image to be reviewed usually form circular regions or reflective regions with a circular center (see...), the condition is not strictly defined. Figure 2 As shown in the figure, therefore, we can further verify whether the image connected region is the target image connected region based on the shape corresponding to the image connected region.
[0075] It should be noted that when detecting connected components in an image, the number of the first pixel can be detected first. If the number of the first pixel meets the requirements, the first ratio can be detected next. This simplifies the detection process and avoids unnecessary detection by first detecting the size of the region corresponding to the connected component and then detecting the shape of the connected component.
[0076] The first threshold and the second threshold mentioned above are preset thresholds. For example, if the first threshold is 300 and the second threshold is 0.8, then when the number of first pixels corresponding to the connected component of the image is greater than 300 and the first ratio corresponding to the connected component of the image is greater than 0.8, the connected component of the image is determined to be the target connected component of the image.
[0077] The above-described implementation scheme of this application detects the size of the region corresponding to the image connected region based on the number of first pixels corresponding to the image connected region, and detects the shape of the image connected region based on the ratio of the number of first pixels corresponding to the image connected region to the number of second pixels corresponding to the minimum bounding rectangle of the image connected region. When both the size and shape of the region corresponding to the image connected region meet the conditions, it is determined that the image connected region belongs to the target image connected region, thereby realizing the identification of the target image connected region at both the size and shape levels.
[0078] As an optional embodiment, the method further includes: determining a target image region in the image to be reviewed that includes the content of the image to be reviewed; detecting whether the target image region includes the target image connected component; wherein, if the target image region includes at least one of the target image connected components, it is determined that the limiting condition is met.
[0079] Since the reflectivity of the non-reviewed areas of an image to be reviewed has little impact on determining its reflectivity, this application's embodiments determine whether an image to be reviewed is a reflective image based on the reflectivity detection results of the target image region. Therefore, it is necessary to determine the corresponding target image region for the image to be reviewed, such as by using a detection model to extract the target image region from the image to be reviewed.
[0080] After determining the target image region and the target image connected components, it is detected whether the target image region includes the target image connected components. If the target image region includes at least one target image connected component, it is determined that the number of target image connected components corresponding to the target image region meets the constraint condition. At this time, it can be determined that the image to be reviewed is a reflective image.
[0081] The method further includes, after determining that the image to be reviewed is a reflective image, marking the reflective areas in the image to be reviewed and / or setting a reflective label on the image to be reviewed, and feeding back to the receiver.
[0082] If the image to be reviewed is determined to be a reflective image, at least one of the following processes can be performed on the image: a reflective label is added to the image, or reflective areas in the image are marked. The processed image is then fed back to the recipient (e.g., a user), who obtains the reflective recognition result based on the feedback image. Furthermore, by marking reflective areas, the recipient can understand the reflective areas in the image while obtaining the reflective recognition result, thus avoiding this situation in subsequent shooting.
[0083] The above-described implementation scheme of this application, by determining the target image region of the image to be reviewed and detecting whether the target image region includes the target image connected domain, realizes reflective image recognition based on the inclusion of the target image connected domain within the effective region; by setting reflective labels and / or marking reflective areas and feeding back to the receiver, the receiver can be informed of the reflective recognition status in a timely manner.
[0084] The image recognition method provided in this application embodiment is described below through an overall implementation process. (See also...) Figure 3 As shown, it includes the following steps:
[0085] Step 301: Convert the image to be reviewed from RGB space to HSV space and obtain the HSV channel image corresponding to the image to be reviewed.
[0086] Step 302: Extract brightness features from the HSV channel image to obtain the brightness channel, and determine the brightness threshold of the channel based on the brightness channel.
[0087] Step 303: For each pixel in the HSV channel image, determine the binarized brightness value corresponding to the pixel based on the relationship between the channel brightness value corresponding to the pixel and the channel brightness threshold, so as to obtain the binarized image corresponding to the HSV channel image.
[0088] Step 304: Perform morphological erosion on the pixels corresponding to the first brightness value in the binarized image to obtain an intermediate image with noise removed from the region. Perform morphological dilation on the pixels corresponding to the first brightness value in the intermediate image to obtain at least one or more connected image components corresponding to the binarized image.
[0089] Step 305: Based on the number of first pixels corresponding to the connected components of the image and the number of second pixels corresponding to the minimum bounding rectangle of the connected components of the image, filter out the target connected components in at least one connected component of the image.
[0090] Step 306: After determining the target image region and the connected components of the target image, if the number of connected components of the target image region meets the constraint conditions, the image to be reviewed is determined to be a reflective image.
[0091] Step 307: Mark the reflective areas in the image to be reviewed and / or set reflective labels on the image to be reviewed, and provide feedback to the recipient.
[0092] The above implementation process utilizes computer vision technology and the characteristics of reflective images to identify whether the image to be reviewed contains reflective noise based on image morphology methods, which can achieve high recall of reflective images with low resource consumption.
[0093] The above is the overall implementation scheme of the image recognition method provided in this application. After binarizing the image to be reviewed in the dimension of brightness feature to obtain a binarized image, morphological operations are performed on the binarized image to obtain at least one image connected component. Based on pixel information, a target image connected component is selected from the at least one image connected component. According to the inclusion of the target image connected component in the target image region of the image to be reviewed, it is determined whether the image to be reviewed is a reflective image. It can automatically identify reflective images with less resource consumption and has the characteristics of high recognition accuracy and recognition stability. At the same time, it can effectively save manpower review costs and improve review efficiency.
[0094] Furthermore, by detecting the size of the region corresponding to the image connected component based on the number of first pixels corresponding to the image connected component, and by detecting the shape of the image connected component based on the ratio of the number of first pixels corresponding to the image connected component to the number of second pixels corresponding to the minimum bounding rectangle of the image connected component, the target image connected component can be identified at both the size and shape levels. By determining the target image region of the image to be reviewed and detecting whether the target image region includes the target image connected component, reflective image recognition can be performed based on the inclusion status of the target image connected component within the effective region. By setting reflective labels and / or marking reflective areas and feeding back to the receiver, the receiver can be informed of the reflective recognition status in a timely manner.
[0095] This application provides an image recognition device, see [link to relevant documentation]. Figure 4 As shown, the device includes:
[0096] The first acquisition module 401 is used to perform binarization processing on the image to be reviewed in the brightness feature dimension to obtain a binarized image;
[0097] The second acquisition module 402 is used to sequentially perform morphological erosion and morphological dilation operations on the binarized image to acquire at least one image connected component corresponding to the binarized image, wherein the image connected component includes reflective pixels.
[0098] The first determining module 403 is used to determine, based on the pixel information corresponding to the image connected region, a target image connected region whose pixel information satisfies a preset condition in the at least one image connected region.
[0099] The second determining module 404 is used to determine that the image to be reviewed is a reflective image when the number of connected components of the target image region corresponding to the target image region of the image to be reviewed meets the limiting condition, wherein the target image region includes the content of the image to be reviewed.
[0100] Optionally, the first acquisition module includes:
[0101] The first acquisition submodule is used to convert the image to be reviewed from RGB space to HSV space and acquire the HSV channel image corresponding to the image to be reviewed. Each pixel of the HSV channel image corresponds to the channel chroma value, channel saturation value and channel brightness value.
[0102] The second acquisition submodule is used to perform binarization processing on the HSV channel image based on the channel brightness threshold in the brightness feature dimension, and obtain the binarized image corresponding to the HSV channel image.
[0103] Optionally, the second acquisition submodule includes:
[0104] The acquisition unit is used to extract brightness features based on the HSV channel image to acquire the brightness channel;
[0105] The first determining unit is used to determine the brightness threshold of the brightness channel based on the brightness channel;
[0106] The second determining unit is used to determine the binarized brightness value corresponding to each pixel in the HSV channel image based on the relationship between the channel brightness value corresponding to the pixel and the channel brightness threshold.
[0107] Wherein, the binarized brightness value corresponding to the pixel is a first brightness value or a second brightness value, the pixel with a channel brightness value greater than or equal to the channel brightness threshold corresponds to the first brightness value, and the pixel with a channel brightness value less than the channel brightness threshold corresponds to the second brightness value.
[0108] Optionally, the second acquisition module includes:
[0109] The third acquisition submodule is used to perform morphological erosion operation on the pixels corresponding to the first brightness value in the binarized image to obtain an intermediate image with noise removed from the region.
[0110] The fourth acquisition submodule is used to perform morphological dilation operation on the pixels in the intermediate image corresponding to the first brightness value to obtain at least one image connected component corresponding to the binarized image.
[0111] In the binarized image, the pixels correspond to a first brightness value or a second brightness value, and the first brightness value is greater than the second brightness value.
[0112] Optionally, the first determining module includes:
[0113] The fifth acquisition submodule is used to acquire, for each image connected component, the number of first pixels corresponding to the image connected component, the number of second pixels corresponding to the minimum bounding rectangle of the image connected component, and the first ratio corresponding to the ratio of the number of first pixels to the number of second pixels.
[0114] The filtering and determination submodule is used to filter out image connected regions in the at least one image connected region where the number of corresponding first pixels is greater than a first threshold and the corresponding first ratio is greater than a second threshold, and to determine the filtered image connected regions as target image connected regions where the pixel information satisfies preset conditions.
[0115] Optionally, the device further includes:
[0116] The third determining module is used to determine the target image region in the image to be reviewed that includes the content of the image to be reviewed.
[0117] The detection module is used to detect whether the target image region includes the connected components of the target image;
[0118] Specifically, if the target image region includes at least one of the target image connected components, then the constraint condition is determined to be satisfied.
[0119] Optionally, the device further includes:
[0120] The processing module is used to mark the reflective areas in the image to be reviewed and / or set reflective labels on the image to be reviewed after the second determining module determines that the image to be reviewed is a reflective image, and then feed this information back to the receiver.
[0121] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0122] This application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the various processes of the above-described image recognition method embodiments and achieves the same technical effect. To avoid repetition, it will not be described again here.
[0123] For example, Figure 5 A schematic diagram of the physical structure of an electronic device is shown. (For example...) Figure 5 As shown, the electronic device may include a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other through the communication bus 540. The processor 510 can call logical instructions in the memory 530 to perform the following steps: Binarizing the image to be reviewed in the brightness feature dimension to obtain a binarized image; sequentially performing morphological erosion and morphological dilation operations on the binarized image to obtain at least one image connected component corresponding to the binarized image, the image connected component including reflective pixels; based on the pixel information corresponding to the image connected component, determining a target image connected component in the at least one image connected component whose pixel information meets preset conditions; if the number of target image connected components corresponding to the target image region of the image to be reviewed meets the limiting condition, determining that the image to be reviewed is a reflective image, the target image region including the content of the image to be reviewed. The processor 510 may also execute other schemes in the embodiments of this application, which will not be further described here.
[0124] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application.
[0125] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it implements the various processes of the above-described image recognition method embodiments and achieves the same technical effects. To avoid repetition, it will not be described again here. The computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0126] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0127] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0128] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
[0129] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0130] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0131] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0132] The units described as separate components may or may not be physically separate. 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 the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0133] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0134] If the aforementioned functions are implemented as 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 this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.
[0135] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An image recognition method, characterized in that, include: In terms of brightness features, the image to be reviewed is binarized to obtain a binarized image; The binarized image is subjected to morphological erosion and morphological dilation operations in sequence to obtain at least one image connected component corresponding to the binarized image. The pixels in the image connected component are all reflective pixels corresponding to the maximum brightness value. Based on the pixel information corresponding to the image connected components, a target image connected component whose pixel information satisfies a preset condition is determined in the at least one image connected component. If the number of connected components of the target image corresponding to the target image region of the image to be reviewed meets the limiting condition, the image to be reviewed is determined to be a reflective image, and the target image region includes the content of the image to be reviewed. The step of sequentially performing morphological erosion and morphological dilation operations on the binarized image to obtain at least one connected component corresponding to the binarized image includes: Morphological erosion is performed on the pixels corresponding to the first brightness value in the binarized image to obtain an intermediate image with noise removed from the region. Perform morphological dilation on the pixels in the intermediate image corresponding to the first brightness value to obtain at least one connected component of the binarized image; In the binarized image, the pixels correspond to a first brightness value or a second brightness value, and the first brightness value is greater than the second brightness value. The reflective pixels included in the connected components of the image are the pixels corresponding to the first brightness value. The step of determining a target image connected region whose pixel information satisfies preset conditions in at least one image connected region based on the pixel information corresponding to the image connected region includes: For each connected component of the image, obtain the number of first pixels corresponding to the connected component of the image, the number of second pixels corresponding to the minimum bounding rectangle of the connected component of the image, and obtain the first ratio between the number of first pixels and the number of second pixels. In the at least one image connected component, image connected components with a corresponding first pixel count greater than a first threshold and a corresponding first ratio greater than a second threshold are selected, and the selected image connected components are determined as target image connected components whose pixel information satisfies preset conditions.
2. The method according to claim 1, characterized in that, The step of binarizing the image to be reviewed in the brightness feature dimension to obtain a binarized image includes: The image to be reviewed is converted from RGB space to HSV space to obtain the HSV channel image corresponding to the image to be reviewed. Each pixel of the HSV channel image corresponds to the channel chroma value, channel saturation value and channel brightness value. In terms of brightness features, the HSV channel image is binarized based on the channel brightness threshold to obtain the corresponding binarized image.
3. The method according to claim 2, characterized in that, The step of binarizing the HSV channel image based on a channel brightness threshold in the brightness feature dimension includes: Brightness features are extracted from the HSV channel image to obtain the brightness channel; Based on the brightness channel, determine the brightness threshold of the channel; For each pixel in the HSV channel image, the binarized brightness value corresponding to the pixel is determined based on the relationship between the channel brightness value corresponding to the pixel and the channel brightness threshold. Wherein, the binarized brightness value corresponding to the pixel is a first brightness value or a second brightness value, the pixel with a channel brightness value greater than or equal to the channel brightness threshold corresponds to the first brightness value, and the pixel with a channel brightness value less than the channel brightness threshold corresponds to the second brightness value.
4. The method according to claim 1, characterized in that, The method further includes: Identify the target image region within the image to be reviewed that contains the content of the image to be reviewed; Detect whether the target image region includes the target image connected components; Specifically, if the target image region includes at least one of the target image connected components, then the constraint condition is determined to be satisfied.
5. The method according to claim 1, characterized in that, After determining that the image to be reviewed is a reflective image, the method further includes: Mark the reflective areas in the image to be reviewed and / or set reflective labels on the image to be reviewed, and then send the feedback to the recipient.
6. An image recognition device, characterized in that, include: The first acquisition module is used to perform binarization processing on the image to be reviewed in the dimension of brightness features to obtain a binarized image; The second acquisition module is used to sequentially perform morphological erosion and morphological dilation operations on the binarized image to acquire at least one image connected component corresponding to the binarized image, wherein the pixels in the image connected component are all reflective pixels corresponding to the maximum brightness value. The first determining module is used to determine, based on the pixel information corresponding to the image connected component, a target image connected component whose pixel information satisfies a preset condition in the at least one image connected component. The second determining module is used to determine that the image to be reviewed is a reflective image when the number of connected components of the target image region corresponding to the target image region of the image to be reviewed meets the limiting condition, wherein the target image region includes the content of the image to be reviewed. The second acquisition module includes: The third acquisition submodule is used to perform morphological erosion operation on the pixels corresponding to the first brightness value in the binarized image to obtain an intermediate image with noise removed from the region. The fourth acquisition submodule is used to perform morphological dilation operation on the pixels in the intermediate image corresponding to the first brightness value to obtain at least one image connected component corresponding to the binarized image. In the binarized image, the pixels correspond to a first brightness value or a second brightness value, and the first brightness value is greater than the second brightness value. The reflective pixels included in the connected components of the image are the pixels corresponding to the first brightness value. The first determining module includes: The fifth acquisition submodule is used to acquire, for each image connected component, the number of first pixels corresponding to the image connected component, the number of second pixels corresponding to the minimum bounding rectangle of the image connected component, and to acquire the first ratio between the number of first pixels and the number of second pixels. The filtering and determination submodule is used to filter out image connected regions in the at least one image connected region where the number of corresponding first pixels is greater than a first threshold and the corresponding first ratio is greater than a second threshold, and to determine the filtered image connected regions as target image connected regions where the pixel information satisfies preset conditions.
7. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the image recognition method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the steps of the image recognition method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Strong light reflection detection method and device of image
CN106650743A
Reflective stripe detection method and device
CN114298987A