Halo effect correction method and system

By binarizing, cutting and graying the image of thermoplastic granular resin, the halo effect area is determined, which solves the problem of halo effect interference detection results and improves the detection accuracy.

CN120013841APending Publication Date: 2025-05-16PETROCHINA CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311523142.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-11-15
Publication Date
2025-05-16

AI Technical Summary

Technical Problem

During the detection of thermoplastic granular resin, the halo effect will interfere with image recognition, resulting in inaccurate detection results, and the prior art has failed to effectively solve this problem.

Method used

By performing binarization of the initial image, multiple sub-images containing heterochromatic parts are obtained, the halo effect areas of each sub-image are determined, and the initial image is grayed out to determine whether there is a real heterochromatic.

Benefits of technology

The halo effect correction of the image is achieved, the detection accuracy is improved, and the color interference caused by the halo effect is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120013841A_ABST
    Figure CN120013841A_ABST
Patent Text Reader

Abstract

The invention provides a halo effect correction method and system, and the method comprises the steps: collecting an image of a target object as an initial image; performing binarization processing on the initial image to obtain a binarized image; cutting the binarized image to obtain a plurality of sub-images containing different-color parts; determining a halo effect region of each sub-image in the plurality of sub-images containing the heterochromatic parts; performing graying processing on the initial image based on the halo effect region of each sub-image, and determining a processed image; and according to the processed image, determining whether real different colors exist in the initial image. According to the scheme, the technical problem that efficient and accurate halo effect correction cannot be performed on the image in the prior art is solved, and the technical effect of simply and efficiently performing halo effect correction on the image so as to improve the detection accuracy is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of image processing technology, and in particular, relates to a halo effect correction method and system. Background Art

[0002] Thermoplastic granular resins are widely used in all aspects of human life and work because of their good mechanical properties and chemical corrosion resistance, higher operating temperature, high strength and hardness, mechanical properties (excellent fracture toughness and damage tolerance), excellent fatigue resistance, ability to be molded into complex geometries and structures, adjustable thermal conductivity, recyclability, good stability in harsh environments, repeatable molding, welding and repairability, etc.

[0003] In actual applications, in addition to normal standard color particles, there are other abnormal particles in thermoplastic granular resins, such as black particles, black speckled particles, color particles, etc. Thermoplastic granular resins are often directly displayed in their original colors to users. In order to ensure that the content of impurities in the particles is reduced, the resin particles need to be tested and screened.

[0004] In the process of detecting and screening thermoplastic granular resins based on image acquisition equipment, corresponding color image data can be obtained by capturing images of thermoplastic granular resins. Subsequent detection will be analyzed and processed based on these color images, and the color information will be used to determine whether it is a different color. However, not only will the color of the particles themselves contain the true color of non-resin particles, but the halo effect will also be presented in the color image data, interfering with the detection results.

[0005] As to how to effectively detect the halo effect to improve the accuracy of image recognition, no effective solution has been proposed so far. Summary of the invention

[0006] The purpose of the present application is to provide a halo effect correction method and system, which can realize simple and efficient halo effect correction for images to improve the detection accuracy.

[0007] The present application provides a halo effect correction method and system which is implemented as follows:

[0008] A halo effect correction method, the method comprising:

[0009] Acquire an image of the target object as an initial image;

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

[0011] From the binary image, a plurality of sub-images containing different-color parts are obtained by cutting out;

[0012] determining a halo effect region of each sub-image among a plurality of sub-images including heterochromatic portions;

[0013] grayscale the initial image based on the halo effect area of ​​each sub-image to determine a processed image;

[0014] According to the processed image, it is determined whether there is real heterochromaticity in the initial image.

[0015] In one embodiment, determining the halo effect area of ​​each sub-image among a plurality of sub-images including heterochromatic portions includes:

[0016] Perform HSL channel decomposition on the current sub-image to obtain hue sub-image and saturation sub-image;

[0017] Binarize the hue image to obtain a red color difference area and a green color difference area;

[0018] Binarization is performed on the saturation image to obtain a saturation area that meets the preset saturation requirement;

[0019] Performing gradient calculation on the initial image to obtain a gradient image containing edge information, and performing Gaussian blur on the gradient image to obtain a Gaussian blurred image;

[0020] Taking the intersection of the red color difference region and the saturation region that meets the preset saturation requirement to obtain a first result, taking the intersection of the green color difference region and the saturation region that meets the preset saturation requirement to obtain a second result, and taking the union of the first result and the second result as the third result;

[0021] The intersection of the third result and the Gaussian blurred image is obtained as the halo effect area of ​​the current sub-image.

[0022] In one embodiment, determining whether there is real heterochromaticity in the initial image according to the processed image includes:

[0023] Binarizing the processed image based on a given HSL threshold to determine whether there is a heterochromatic area in the processed image;

[0024] In the case where there are still heterochromatic areas in the processed image, determining that there are real heterochromatic areas in the initial image;

[0025] In the case that there is no heterochromatic region in the processed image, it is determined that there is no real heterochromatic region in the initial image.

[0026] In one embodiment, a plurality of sub-images containing different-color parts are obtained by cutting out from the binary image, including:

[0027] Performing contour extraction on the binary image to acquire multiple contours containing different-color parts in the binary image and contour information of each contour, wherein the contour information includes: contour center information, contour length, and contour width;

[0028] Based on the contour information of each contour, multiple sub-images containing different-color parts are cut out.

[0029] In one embodiment, a plurality of sub-images containing different-color parts are obtained by cutting out from the binary image, including:

[0030] According to the rule that the value of the heterochromatic part is 255 and the value of the non-heterchromatic part is 0, the binary image is cropped to obtain multiple sub-images containing heterochromatic parts.

[0031] In one embodiment, the target object is a thermoplastic granular resin.

[0032] A halo effect correction system, the method comprising:

[0033] An acquisition module, used for acquiring an image of a target object as an initial image;

[0034] A processing module, used for performing binarization processing on the initial image to obtain a binarized image;

[0035] A cropping module, used for cropping the binary image to obtain a plurality of sub-images containing different-color parts;

[0036] A first determination module is used to determine the halo effect area of ​​each sub-image among a plurality of sub-images containing different-color parts;

[0037] A grayscale module, used for performing grayscale processing on the initial image based on the halo effect area of ​​each sub-image to determine a processed image;

[0038] The second determination module is used to determine whether there is real heterochromaticity in the initial image according to the processed image.

[0039] In one embodiment, the first determining module includes:

[0040] A decomposition module is used to perform HSL channel decomposition on the current sub-image to obtain a hue sub-image and a saturation sub-image;

[0041] The first processing unit is used to perform binarization processing on the hue image to obtain a red color difference area and a green color difference area;

[0042] The second processing unit is used to perform binarization processing on the saturation sub-image to obtain a saturation area that meets a preset saturation requirement;

[0043] A gradient processing unit, configured to perform gradient calculation on the initial image to obtain a gradient image containing edge information, and perform Gaussian blur on the gradient image to obtain a Gaussian blurred image;

[0044] An intersection processing unit is used to obtain a first result by taking an intersection of the red color difference region and the saturation region that meets the preset saturation requirement, and obtain a second result by taking an intersection of the green color difference region and the saturation region that meets the preset saturation requirement, and taking the union of the first result and the second result as a third result;

[0045] The obtaining unit is used to obtain the intersection of the third result and the Gaussian blurred image as the halo effect area of ​​the current sub-image.

[0046] An electronic device comprises a processor and a memory for storing instructions executable by the processor, wherein the steps of the above method are implemented when the processor executes the instructions.

[0047] A computer-readable storage medium stores a computer program / instruction, which implements the steps of the above method when executed by a processor.

[0048] The halo effect correction method provided by the present application performs binarization processing on the initial image to obtain a binarized image, then cuts out multiple sub-images containing heterochromatic parts from the binarized image, and determines the halo effect area of ​​each sub-image in the multiple sub-images containing heterochromatic parts, and then performs grayscale processing on the initial image based on the halo effect area of ​​each sub-image to determine whether there is real heterochromatic in the initial image, thereby achieving halo effect correction of the initial image. The above scheme solves the existing technical problem of being unable to perform efficient and accurate halo effect correction on images, and achieves the technical effect of simply and efficiently performing halo effect correction on images to improve detection accuracy. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0050] Figure 1 This is a schematic diagram of the halo effect produced when the surface of the object provided by the present application is uneven or the object vibrates;

[0051] Figure 2This is a schematic diagram of the halo effect produced when external interference factors such as angle rotation occur provided by the present application;

[0052] Figure 3 is a method flow chart of an embodiment of the halo effect correction method provided by the present application;

[0053] Figure 4 It is a method flow chart of the halo effect correction method in particle heterochromatic detection provided by the present application;

[0054] Figure 5 It is a schematic diagram of comparison between the recognition result of the standard recognition process without adding the present method and the recognition result of the present application provided by the present application;

[0055] Figure 6 It is a hardware structure block diagram of an electronic device for a halo effect correction method provided by the present application;

[0056] Figure 7 It is a schematic diagram of the module structure of an embodiment of the halo effect correction system provided by the present application. DETAILED DESCRIPTION

[0057] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.

[0058] The halo effect is called a distortion of the image dimension. It usually appears as a false color at the edge of the object or in the high-contrast area of ​​the image. When a multi-line color line scan camera (three-line or four-line) captures an object, each line on the sensor has a different focal length and focal plane for the same position of the target. When the reflected light of the object is obtained according to the line scan sequence of the camera, such as Figure 1 As shown in the figure, if the surface of the subject is uneven or the subject is vibrating, or if Figure 2 As shown in the figure, when the angle rotates, external interference factors will appear, which will cause the "halo effect". This is because the light rays obtained by each line of the camera are not at the same position or angle of the subject or on the same shooting plane. The halo effect will reduce the clarity of the object's outline, cause color stripes, and cause imaging distortion.

[0059] Furthermore, the high contrast between the black mixed color in the particles and the true color of the particles (white or milky white) is most likely to cause the halo effect, which often occurs in the detection process of true color thermoplastic granular resins. The halo effect generally presents mixed colors such as red, green, and purple, and appears in high-contrast areas where there are different colors. According to the set color screening rules, these colors will not only be misjudged as different colors, but will even interfere with the original real different color recognition results, which does not meet the original intention of the detection operator.

[0060] For example, during the heterochromatic detection process, operators usually set the heterochromatic classification to black spots and color spots based on preset standards; when collecting statistics, the size and area of ​​the heterochromaticity also need to be measured in the test results. When the halo effect occurs, a colored halo will appear around the black spots, which may be misjudged as color spots. At the same time, when calculating the heterochromatic area, the abnormal halo area will also be counted as the heterochromatic / black spot area, which interferes with subsequent data analysis. For this reason, a halo effect correction method is provided in this example.

[0061] Figure 3 It is a method flow chart of an embodiment of the halo effect correction method provided by the present application. Although the present application provides method operation steps or system structures as shown in the following embodiments or drawings, more or fewer operation steps or module units may be included in the method or system based on routine or no creative labor. In the steps or structures that do not logically have a necessary causal relationship, the execution order of these steps or the module structure of the system is not limited to the execution order or module structure described in the embodiments of the present application and shown in the drawings. When the method or module structure is applied in an actual device or terminal product, it can be connected according to the method or module structure shown in the embodiments or drawings for sequential execution or parallel execution (for example, a parallel processor or a multi-threaded processing environment, or even a distributed processing environment).

[0062] Specifically, Figure 3 As shown, the above halo effect correction method may include the following steps:

[0063] Step 301: Acquire an image of a target object as an initial image;

[0064] For example, an image of thermoplastic granular resin can be captured by a color line array camera as an initial image. That is, when performing heterochromatic detection on the granular material, the halo effect can be triggered to perform image correction.

[0065] Step 302: binarizing the initial image to obtain a binarized image;

[0066] Specifically, the initial image can be binarized based on a given HSL threshold, where HSL (Hue, Saturation, Lightness), Hue (H) is the basic attribute of color, which is the color name we usually say, such as red, yellow, etc. Saturation (S) refers to the purity of the color, the higher the color, the purer it is, and the lower the value, the grayer it becomes, and the value ranges from 0 to 100%. Brightness (L) is 0 to 100%.

[0067] Step 303: cutting out from the binary image a plurality of sub-images containing different-color parts;

[0068] For the binary image, the heterochromatic part of interest can be set to the maximum value X, and the non-heterchromatic part can be set to the minimum value Y. In addition, the binary image can be cropped according to the rule that the heterochromatic part takes a value of 255 and the non-heterchromatic part takes a value of 0 to obtain multiple sub-images containing heterochromatic parts.

[0069] Specifically, contour extraction can be performed on the binary image to obtain multiple contours containing heterochromatic parts and contour information of each contour in the binary image, wherein the contour information may include: contour center information, contour length, and contour width; based on the contour information of each contour, multiple sub-images containing heterochromatic parts are cropped. That is, a batch of cropped images containing heterochromatic information are obtained.

[0070] Step 304: determining a halo effect region of each sub-image among a plurality of sub-images containing different-color portions;

[0071] When implementing, the halo effect area of ​​each sub-image can be determined according to the following steps:

[0072] S1: Perform HSL channel decomposition on the current sub-image to obtain hue sub-image and saturation sub-image;

[0073] S2: Binarize the hue image to obtain a red color difference area and a green color difference area;

[0074] S3: Binarize the saturation image to obtain a saturation area that meets the preset saturation requirement;

[0075] S4: performing gradient calculation on the initial image to obtain a gradient image containing edge information, and performing Gaussian blurring on the gradient image to obtain a Gaussian blurred image;

[0076] S5: taking an intersection of the red color difference region and the saturation region that meets the preset saturation requirement to obtain a first result, taking an intersection of the green color difference region and the saturation region that meets the preset saturation requirement to obtain a second result, and taking the union of the first result and the second result as a third result;

[0077] S6: Obtain an intersection of the third result and the Gaussian blurred image as a halo effect region of the current sub-image.

[0078] Step 305: grayscale the initial image based on the halo effect area of ​​each sub-image to determine a processed image;

[0079] Step 306: Determine whether there is real heterochromaticity in the initial image according to the processed image.

[0080] Specifically, the initial image is grayed based on the halo effect area of ​​each sub-image to determine the heterochromatic area in the initial image, which can be binarized based on a given HSL threshold value for the processed image of each sub-image to determine whether there is real heterochromatic; if it is determined that there is real heterochromatic, the corresponding area of ​​the sub-area in the initial image is divided into heterochromatic areas. That is, the halo effect area is judged to determine whether there is a heterochromatic area of ​​interest in the halo effect area. If there is, the initial image is classified as real heterochromatic; if there is no heterochromatic area of ​​interest after processing, it is determined that there is no real heterochromatic in the initial image.

[0081] During implementation, if the detected heterochromatic region is not a real heterochromatic region, the detected non-real heterochromatic region can be cropped to retain only the real heterochromatic region.

[0082] The target object mentioned above may be, but is not limited to, thermoplastic granular resin.

[0083] The above method is described below in conjunction with a specific embodiment. However, it is worth noting that this specific embodiment is only for better illustrating the present application and does not constitute an improper limitation on the present application.

[0084] This example provides a correction method for the halo effect when detecting heterochromatic particles based on a color line array camera, so as to improve the accuracy of heterochromatic detection of resin particles while reducing the color interference caused by the halo effect, thereby improving the accuracy of digital image information acquisition. Specifically, the method extracts the number and shape of pixels in the color interval specified in the above cropped image based on all the identified heterochromatic cropped images (including the real heterochromatic recognition results and the erroneous recognition results caused by the halo effect); analyzes the extracted information to determine whether the cropped image is a valid recognition result; retains the valid recognition results, and performs color correction processing on the cropped images of invalid recognition results; and performs a secondary judgment on the image after correction processing to determine whether there is information within the identified HSL range. If so, it is a real heterochromatic recognition result. If not, the cropped image is discarded. Because when correcting the halo effect, only the cropped image of the heterochromatic part needs to be used, which reduces the dependence on the complete high-resolution image, improves the correction efficiency, and reduces the misoperation of the area that does not need correction.

[0085] Considering that the halo effect caused by black spots and color particles is objectively universal in the actual acquisition process, it can be considered that if a high contrast occurs during the image acquisition process, a halo effect will occur. Based on this, two areas: high contrast area and possible color difference area can be taken to take the intersection, and then grayscale or true color correction can be performed to solve the problem of heterochromatic interference. Among them, the high contrast area can be obtained by gradient transformation of the image, and the area with high gradient of the image is obtained. After Gaussian blurring, the "high contrast area" of interest to be processed is confirmed. The possible color difference area can be the range of red H area value, green H area value, and saturation S area value that are set in the imaging of the "halo effect" on the digital image; based on this parameter, the mask map is obtained for the existing cropped image to obtain the possible color difference area. Among them, the setting of each area value can be set according to the type of detection object and the requirements of detection accuracy, and this application does not limit this. The above two areas (i.e., high contrast area and possible color difference area) are comprehensively considered, and the intersection of the two is taken as the most likely part of the halo effect.

[0086] The method provided in this example is suitable for the correction of heterochromaticity caused by the halo effect caused by high contrast during the image processing of natural color thermoplastic granular resin. In this example, a halo effect correction method is provided, especially for the halo effect correction method in the detection of heterochromaticity of particles. The method is based on the image acquisition device (the acquired image is recorded as Image_A), such as Figure 4 As shown, the following steps may be included:

[0087] Step 1: Binarize Image_A based on a given HSL threshold to obtain a binary image Image_B, where the heterochromatic portion of interest is set as the maximum value X, and the non-interested portion is set as the minimum value Y; wherein X may be preferably 255, and Y may be preferably 0. The granular material may be a thermoplastic granular resin.

[0088] Among them, HSL (Hue, Saturation, Lightness), where Hue (H) is the basic attribute of color, which is the color name we usually say, such as red, yellow, etc. Saturation (S) refers to the purity of the color. The higher the saturation, the purer the color, and the lower the saturation, the grayer it becomes. The value is 0-100%. Brightness (L) is 0-100%.

[0089] Step 2: Perform contour extraction on Image_B to collect all contours. Based on this contour information, obtain the center information of the contour and the length and width of the contour;

[0090] Step 3: Based on the acquired contour information, crop Image_A to obtain a batch of cropped images Image_C containing heterochromatic information;

[0091] Step 4: Perform HSL channel decomposition on each Image_C to obtain three single-channel images Image_H, Image_S and Image_L; preferably, the red H area value, the H value is 280-360; the green H area value, the H value is 80-180; the saturation S area value, the S value is 0.02-1.

[0092] Step 5: Binarize Image_H based on the region value to obtain preliminary possible color difference regions: red (Image_Red), green (Image_Green), where the possible color difference region has a value of 1 in Image_Red and Image_Green, and the impossible color difference region has a value of 0 in Image_Red and Image_Green;

[0093] Step 6: Binarize Image_S based on the region value to obtain the saturation region Image_S_E that meets the requirements;

[0094] Step 7: Perform gradient calculation on Image_A to obtain the image Image_T containing edge information, and perform Gaussian blur to obtain Image_T_G;

[0095] Step 8: Take the intersection of Image_Red and Image_Green with Image_S_E respectively, and then union the obtained images to finally obtain the possible color difference area Image_SC;

[0096] Step 9: Take the intersection of Image_SC and Image_T_G to obtain the final calculated halo effect area Image_Mark;

[0097] Step 10: Grayscale or true color processing is performed on Image_A based on the mask of Image_Mark to obtain the processed image Image_P;

[0098] Step 11: Perform step 1 on Image_P. If there are still heterochromatic regions of interest, it is classified as true heterochromatic. If there are no heterochromatic regions of interest after processing, the image is discarded.

[0099] In the above example, when correcting the halo effect in the detection of heterochromatic particles, an analysis conclusion can be obtained as to whether the cropped image is a true heterochromatic image or an erroneous recognition result caused by the halo effect, and a suggestion can be given to keep or discard it, so as to facilitate subsequent digital image processing based on this cropped image to obtain more accurate heterochromatic information and reduce misjudgments. Specifically, the above method can be used in the process of using a color linear array camera computer vision method to detect heterochromatic colors of resin particles, thereby effectively reducing erroneous recognition caused by the halo effect, improving the accuracy of recognition data (for example, heterochromatic area, etc.), and facilitating subsequent digital image processing based on the current recognition result to obtain more accurate heterochromatic information, thereby reducing misjudgments.

[0100] A specific example is as follows:

[0101] In this example, a correction method for the halo effect when detecting particles with different colors based on a color line array camera is provided, which can be applied to the computer vision detection process and may include the following steps:

[0102] Step 1: Configure a set of image acquisition equipment and corresponding computer equipment;

[0103] Step 2: Take different types of plastic particles;

[0104] Step 3: Use existing equipment to collect images;

[0105] Step 4: Perform image processing using the above correction method to determine whether different heterochromatic image information is real heterochromatic or caused by the halo effect.

[0106] like Figure 5 As shown, the comparative example is a schematic diagram of the recognition result of the standard recognition process without adding the present method and the result of adding the operation process of the present method, and the recognition result in the comparative example is subjected to secondary processing, which reduces the misjudgment rate and improves the accuracy of heterochromatic recognition. Figure 5In the figure, the material is PP polypropylene, and the original image Image_A is the recognition result of the standard recognition process without adding this method. After gradient processing, the gradient image Image_T is obtained, and then the result image Image_P is obtained. It is found that there is a different color in the original image Image_A, but there is no different color in the result image Image_P.

[0107] However, it is worth noting that the above example is only an example of PP as a material. The method provided in this example can also be applied to other natural color thermoplastic granular resins, such as polyethylene (PE), polypropylene (PP), polystyrene (PS), high-impact polystyrene (PS-I), acrylonitrile-butadiene-styrene (ABS), styrene-acrylonitrile (SAN), ethylene-vinyl acetate (EVAC), etc. It can also be applied to modified granular plastics to realize the correction of the halo effect when detecting particle heterogeneity based on a color linear array camera.

[0108] The method embodiments provided in the above embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on an electronic device as an example, Figure 6 : is a hardware structure block diagram of an electronic device for a halo effect correction method provided by the present application. Figure 6 As shown, the electronic device 10 may include one or more (only one is shown in the figure) processors 02 (the processor 02 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 04 for storing data, and a transmission module 06 for communication functions. It can be understood by those skilled in the art that Figure 6 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 6 More or fewer components as shown, or with Figure 6 Different configurations shown.

[0109] The memory 04 can be used to store software programs and modules of application software, such as program instructions / modules corresponding to the halo effect correction method in the embodiment of the present application. The processor 02 executes various functional applications and data processing by running the software programs and modules stored in the memory 04, that is, the halo effect correction method of the above-mentioned application is realized. The memory 04 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 04 may further include a memory remotely arranged relative to the processor 02, and these remote memories may be connected to the electronic device 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0110] The transmission module 06 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the electronic device 10. In one example, the transmission module 06 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission module 06 can be a radio frequency (Radio Frequency, RF) module, which is used to communicate with the Internet wirelessly.

[0111] At the software level, the above halo correction system can be Figure 7 As shown, including:

[0112] An acquisition module 701 is used to acquire an image of a target object as an initial image;

[0113] The processing module 702 is used to perform binarization processing on the initial image to obtain a binarized image;

[0114] A cropping module 703 is used to crop a plurality of sub-images containing different-color parts from the binary image;

[0115] A first determination module 704 is used to determine a halo effect area of ​​each sub-image among a plurality of sub-images containing different-color parts;

[0116] A grayscale module 705, configured to perform grayscale processing on the initial image based on the halo effect area of ​​each sub-image to determine a processed image;

[0117] The second determination module 706 is used to determine whether there is real heterochromaticity in the initial image according to the processed image.

[0118] In one embodiment, the first determination module 704 may include: a decomposition module, configured to perform HSL channel decomposition on the current sub-image to obtain a hue sub-image and a saturation sub-image; a first processing unit, configured to perform binarization processing on the hue sub-image to obtain a red color difference region and a green color difference region; a second processing unit, configured to perform binarization processing on the saturation sub-image to obtain a saturation region that meets a preset saturation requirement; a gradient processing unit, configured to perform gradient calculation on the initial image to obtain a gradient image containing edge information, and perform Gaussian blurring on the gradient image to obtain a Gaussian blurred image; an intersection processing unit, configured to take an intersection of the red color difference region and the saturation region that meets the preset saturation requirement to obtain a first result, take an intersection of the green color difference region and the saturation region that meets the preset saturation requirement to obtain a second result, and use the union of the first result and the second result as a third result; and a calculation unit, configured to calculate the intersection of the third result and the Gaussian blurred image as the halo effect region of the current sub-image.

[0119] In one embodiment, the second determination module 706 can be specifically used to binarize the processed image based on a given HSL threshold to determine whether there is a heterochromatic region in the processed image; if there is still a heterochromatic region in the processed image, determine that there is real heterochromatic in the initial image; if there is no heterochromatic region in the processed image, determine that there is no real heterochromatic in the initial image.

[0120] In one embodiment, the above-mentioned cropping module 703 can be specifically used to perform contour extraction on the binary image to collect multiple contours containing different-color parts in the binary image and contour information of each contour, wherein the contour information includes: center information of the contour, length of the contour, and width of the contour; based on the contour information of each contour, multiple sub-images containing different-color parts are cropped.

[0121] In one embodiment, the cropping module 703 may be specifically used to crop the binary image according to the rule that the value of the heterochromatic part is 255 and the value of the non-heterchromatic part is 0, so as to obtain multiple sub-images containing heterochromatic parts.

[0122] In one embodiment, the target object may be a thermoplastic granular resin.

[0123] The embodiments of the present application also provide a specific implementation of an electronic device capable of implementing all the steps in the halo effect correction method in the above embodiment. The electronic device specifically includes the following contents: a processor, a memory, a communication interface and a bus; wherein the processor, the memory and the communication interface communicate with each other through the bus; the processor is used to call a computer program in the memory, and when the processor executes the computer program, all the steps in the halo effect correction method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0124] Step 1: Acquire an image of the target object as an initial image;

[0125] Step 2: binarizing the initial image to obtain a binarized image;

[0126] Step 3: From the binary image, cut out a plurality of sub-images containing different-color parts;

[0127] Step 4: determining a halo effect region of each sub-image among a plurality of sub-images containing heterochromatic portions;

[0128] Step 5: grayscale the initial image based on the halo effect area of ​​each sub-image to determine the heterochromatic area in the initial image;

[0129] Step 6: According to the determined heterochromatic region in the initial image, perform halo effect correction on the initial image.

[0130] The embodiments of the present application also provide a computer-readable storage medium capable of implementing all the steps of the halo effect correction method in the above embodiments. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the halo effect correction method in the above embodiments are implemented. For example, when the processor executes the computer program, the following steps are implemented:

[0131] Step 1: Acquire an image of the target object as an initial image;

[0132] Step 2: binarizing the initial image to obtain a binarized image;

[0133] Step 3: From the binary image, cut out a plurality of sub-images containing different-color parts;

[0134] Step 4: determining a halo effect region of each sub-image among a plurality of sub-images containing heterochromatic portions;

[0135] Step 5: grayscale the initial image based on the halo effect area of ​​each sub-image to determine the heterochromatic area in the initial image;

[0136] Step 6: According to the determined heterochromatic region in the initial image, perform halo effect correction on the initial image.

[0137] From the above description, it can be seen that the embodiment of the present application performs binarization processing on the initial image to obtain a binarized image, then cuts out multiple sub-images containing heterochromatic parts from the binarized image, and determines the halo effect area of ​​each sub-image in the multiple sub-images containing heterochromatic parts, and then grayscales the initial image based on the halo effect area of ​​each sub-image to determine whether there is real heterochromatic in the initial image, thereby achieving halo effect correction of the initial image. The above scheme solves the existing technical problem of being unable to perform efficient and accurate halo effect correction on images, and achieves the technical effect of simply and efficiently performing halo effect correction on images to improve detection accuracy.

[0138] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the hardware + program embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0139] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

[0140] Although the present application provides method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).

[0141] Although the present specification embodiment provides the method operation steps as described in the embodiment or flow chart, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiment is only one way in the order of execution of many steps, and does not represent a unique execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel (such as a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment) according to the method shown in the embodiment or the accompanying drawings. The term "include", "comprise" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements not only includes those elements, but also includes other elements not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements.

[0142] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing the embodiments of this specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0143] Those skilled in the art also know that, in addition to implementing the controller in a purely computer-readable program code, the controller can be made to implement the same function in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered as a hardware component, and the devices for implementing various functions included therein can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules for implementing the method and structures within the hardware component.

[0144] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0145] Those skilled in the art will appreciate that the embodiments of this specification may be provided as methods, systems or computer program products. Therefore, the embodiments of this specification may take the form of complete hardware embodiments, complete software embodiments or embodiments combining software and hardware. Moreover, the embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0146] The present specification embodiments may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present specification embodiments may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.

[0147] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, in the absence of contradiction, a person skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples.

[0148] The above is only an example of the embodiment of the present specification and is not intended to limit the embodiment of the present specification. For those skilled in the art, the embodiment of the present specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiment of the present specification shall be included in the scope of the claims of the embodiment of the present specification.

Claims

1. A halo effect correction method, characterized in that: The method comprises: Acquire an image of the target object as an initial image; Performing binarization processing on the initial image to obtain a binarized image; From the binary image, a plurality of sub-images containing different-color parts are obtained by cutting out; determining a halo effect region of each sub-image among a plurality of sub-images including heterochromatic portions; grayscale the initial image based on the halo effect area of ​​each sub-image to determine a processed image; According to the processed image, it is determined whether there is real heterochromaticity in the initial image.

2. The method according to claim 1, characterized in that: Determining a halo effect area of ​​each sub-image among a plurality of sub-images containing different-color portions, including: Perform HSL channel decomposition on the current sub-image to obtain hue sub-image and saturation sub-image; Binarize the hue image to obtain a red color difference area and a green color difference area; Binarization is performed on the saturation image to obtain a saturation area that meets the preset saturation requirement; Performing gradient calculation on the initial image to obtain a gradient image containing edge information, and performing Gaussian blur on the gradient image to obtain a Gaussian blurred image; Taking the intersection of the red color difference region and the saturation region that meets the preset saturation requirement to obtain a first result, taking the intersection of the green color difference region and the saturation region that meets the preset saturation requirement to obtain a second result, and taking the union of the first result and the second result as the third result; The intersection of the third result and the Gaussian blurred image is obtained as the halo effect area of ​​the current sub-image.

3. The method according to claim 1, characterized in that: Determining whether there is real heterochromaticity in the initial image according to the processed image includes: Binarizing the processed image based on a given HSL threshold to determine whether there is a heterochromatic area in the processed image; In the case where there are still heterochromatic areas in the processed image, determining that there are real heterochromatic areas in the initial image; In the case that there is no heterochromatic region in the processed image, it is determined that there is no real heterochromatic region in the initial image.

4. The method according to claim 1, characterized in that: From the binary image, a plurality of sub-images containing different-color parts are obtained by cutting out, including: Performing contour extraction on the binary image to acquire multiple contours containing different-color parts in the binary image and contour information of each contour, wherein the contour information includes: contour center information, contour length, and contour width; Based on the contour information of each contour, multiple sub-images containing different-color parts are cut out.

5. The method according to claim 1, characterized in that From the binary image, a plurality of sub-images containing different-color parts are obtained by cutting out, including: According to the rule that the value of the heterochromatic part is 255 and the value of the non-heterchromatic part is 0, the binary image is cropped to obtain multiple sub-images containing heterochromatic parts.

6. The method according to any one of claims 1 to 5, characterized in that The target object is a thermoplastic granular resin.

7. A halo effect correction system, characterized in that: include: An acquisition module, used for acquiring an image of a target object as an initial image; A processing module, used for performing binarization processing on the initial image to obtain a binarized image; A cropping module, used for cropping the binary image to obtain a plurality of sub-images containing different-color parts; A first determination module is used to determine the halo effect area of ​​each sub-image among a plurality of sub-images containing different-color parts; A grayscale module, used for performing grayscale processing on the initial image based on the halo effect area of ​​each sub-image to determine a processed image; The second determination module is used to determine whether there is real heterochromaticity in the initial image according to the processed image.

8. The system according to claim 7, characterized in that The first determining module comprises: A decomposition module is used to perform HSL channel decomposition on the current sub-image to obtain a hue sub-image and a saturation sub-image; The first processing unit is used to perform binarization processing on the hue image to obtain a red color difference area and a green color difference area; The second processing unit is used to perform binarization processing on the saturation sub-image to obtain a saturation area that meets a preset saturation requirement; A gradient processing unit, configured to perform gradient calculation on the initial image to obtain a gradient image containing edge information, and perform Gaussian blur on the gradient image to obtain a Gaussian blurred image; An intersection processing unit is used to obtain a first result by taking an intersection of the red color difference region and the saturation region that meets the preset saturation requirement, and obtain a second result by taking an intersection of the green color difference region and the saturation region that meets the preset saturation requirement, and taking the union of the first result and the second result as a third result; The obtaining unit is used to obtain the intersection of the third result and the Gaussian blurred image as the halo effect area of ​​the current sub-image.

9. An electronic device comprising a processor and a memory for storing instructions executable by the processor, characterized in that: When the processor executes the instructions, the steps of the method according to any one of claims 1 to 6 are implemented.

10. A computer-readable storage medium having a computer program / instruction stored thereon, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.