Image processing method, apparatus, device, storage medium and program product

By performing convolution processing on the detection image and combining it with mask region weakening, the problem of low efficiency in pixel-by-pixel comparison is solved, achieving more efficient defect detection.

CN120852406BActive Publication Date: 2026-02-10SHENZHEN XINXINTENG TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511337068.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-18
Publication Date
2026-02-10
Estimated Expiration
2045-09-18

AI Technical Summary

Technical Problem

In existing technologies, pixel-by-pixel comparison is inefficient and consumes a large amount of data in image quality detection.

Method used

By performing convolution processing on the detection image and combining it with the convolution results of the mask region for weakening processing, the influence of edge parts on the detection image is reduced, thereby improving the accuracy and efficiency of defect detection.

Benefits of technology

It improves the accuracy of defect detection and enhances the efficiency of image processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120852406B_ABST
    Figure CN120852406B_ABST
Patent Text Reader

Abstract

The application is suitable for the technical field of image processing, and provides an image processing method, device, equipment, storage medium and program product, which comprises the following steps: performing convolution processing on an input detection image, and performing weakening processing on the convolution result of an edge region in combination with a mask region, so as to reduce the influence of the edge part on the detection image, improve the accuracy of defect detection, and improve the image processing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of image processing, and particularly relates to an image processing method, device, equipment, storage medium and program product. BACKGROUND

[0002] With the development of technology, in the product production process, each sample to be produced is detected, and samples meeting the factory conditions are selected from the samples to ensure the quality of the products after leaving the factory.

[0003] In the related art, a reference sample meeting the factory conditions is selected from a plurality of samples, and the quality of other to-be-detected samples is detected based on the reference sample. In the quality detection process, a pixel-by-pixel comparison method is often used to compare the differences between the to-be-detected sample image and the reference sample image to determine the quality of the to-be-detected sample.

[0004] However, the pixel-by-pixel comparison method may result in low image processing efficiency and large data overhead. SUMMARY

[0005] The embodiments of the present application provide an image processing method, device, equipment, storage medium and program product. The input detection image is convolved, and the convolution result of the edge region is weakened in combination with the mask region, so as to reduce the influence of the edge part on the detection image, improve the accuracy of defect detection, and improve the image processing efficiency.

[0006] In a first aspect, the embodiments of the present application provide an image processing method, and the method comprises:

[0007] obtaining a detection image, wherein the detection image comprises a pre-set mask region;

[0008] performing first convolution processing on a plurality of pixel points in the detection image to obtain a first convolution result;

[0009] obtaining a first proportion of the mask region in the plurality of pixel points, wherein the first proportion is according to the area proportion of the mask region in a neighborhood region corresponding to each of the plurality of pixel points, and the neighborhood region refers to a region at a specified position of a single pixel point in the detection image;

[0010] obtaining a first error value based on the first proportion, the edge region and the mask region, wherein the first error value is used to indicate the error influence of the mask region on the first convolution result;

[0011] A second convolution result is obtained based on a difference between the first convolution result and the first error value, and the second convolution result is used to determine a defect region in the detection image, and the defect region is used to indicate a region corresponding to a defect part in the detection image.

[0012] Optionally, the first error value is obtained based on the first proportion, the edge region, and the mask region, and the obtaining includes:

[0013] The mask region is subjected to the second convolution processing to obtain a weakening coefficient map, and the weakening coefficient map is used to indicate an influence degree of the first convolution result corresponding to a pixel point in the mask region on the mask region.

[0014] A weakening result corresponding to the edge region is determined based on the weakening coefficient map and the edge region.

[0015] The edge region is subjected to contrast compensation processing based on the weakening result to obtain the first error value.

[0016] Optionally, the mask region is subjected to the second convolution processing to obtain the weakening coefficient map, and the processing includes:

[0017] The mask region is subjected to the second convolution processing by a first convolution kernel to obtain a first sub-convolution result.

[0018] The weakening coefficient map is obtained based on a numerical relationship between the first sub-convolution result and the first convolution kernel.

[0019] Optionally, the weakening coefficient map includes a plurality of weakening coefficients corresponding to a plurality of pixel points respectively, and the edge region includes a first pixel point.

[0020] The weakening result corresponding to the edge region is determined based on the weakening coefficient map and the edge region, and the determining includes:

[0021] A weakening coefficient corresponding to the first pixel point is determined from the weakening coefficient map as the weakening result corresponding to the edge region.

[0022] Optionally, the edge region corresponds to a second contrast.

[0023] The first error value is obtained based on the contrast compensation processing of the edge region based on the weakening result, and the obtaining includes:

[0024] A first contrast is obtained.

[0025] A sum of contrasts between the first contrast and a second contrast is taken as the first error value.

[0026] Optionally, the first pixel value corresponding to a first pixel point in the edge region is included.

[0027] After the detection image is acquired, the method further includes:

[0028] The first pixel value is subjected to zero processing to obtain a zero image corresponding to the detection image.

[0029] The first convolution processing on the plurality of pixel points in the detection image to obtain the first convolution result includes:

[0030] The first convolution processing is performed on the plurality of pixel points in the zero image to obtain the first convolution result.

[0031] In a second aspect, an image processing apparatus is provided, including:

[0032] An acquisition module is configured to acquire a detection image, the detection image including a mask region set in advance.

[0033] A convolution module is configured to perform first convolution processing on a plurality of pixel points in the detection image to obtain a first convolution result.

[0034] The acquisition module is configured to acquire a first proportion of the mask region in the plurality of pixel points, the first proportion being determined according to an area proportion of the mask region in a neighborhood region corresponding to each of the plurality of pixel points, the neighborhood region being a region of a specified position of a single pixel point in the detection image.

[0035] An error module is configured to obtain a first error value based on the first proportion, the edge region, and the mask region, the first error value being used to indicate an error influence of the mask region on the first convolution result.

[0036] The convolution module is configured to obtain a second convolution result based on a difference between the first convolution result and the first error value, the second convolution result being used to determine a defect region in the detection image, the defect region being used to indicate a region corresponding to a defect part in the detection image.

[0037] In a third aspect, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the image processing method of any one of the first aspect when executing the computer program.

[0038] In a fourth aspect, a computer readable storage medium is provided, the computer readable storage medium storing a computer program, the computer program being executable on a processor to implement the image processing method of any one of the first aspect.

[0039] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when running on a computer device, causes the computer device to execute the image processing method in any one of the first aspect.

[0040] It can be understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description in the first aspect, which will not be repeated here.

[0041] The technical scheme provided by the embodiment of the present application has at least the following beneficial effects:

[0042] After the first convolution processing is performed on the detection image containing the mask area to obtain the first convolution result, the area proportion of the mask area in the detection image is obtained, and the error value caused by the screen area to the first convolution result is determined according to the area proportion, the mask area and the edge area in the detection image. Therefore, the second convolution result is determined according to the difference between the first convolution result and the error value, and thus the defect area corresponding to the detection image is determined according to the second convolution result, that is, by performing convolution processing on the input detection image and weakening the convolution result of the edge area combined with the mask area, the influence of the edge part on the detection image is reduced, which can improve the accuracy of defect detection and improve the image processing efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments or prior art description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0044] Figure 1 is a flow chart of an image processing method provided by an embodiment of the present application;

[0045] Figure 2 is a weakening result schematic diagram provided by an embodiment of the present application;

[0046] Figure 3 is a weakening coefficient schematic diagram provided by an embodiment of the present application;

[0047] Figure 4 is a schematic diagram of an image processing method provided by an embodiment of the present application;

[0048] Figure 5 is a defect detection schematic diagram provided by an embodiment of the present application;

[0049] Figure 6 is a structure diagram of an image processing device provided by an embodiment of the present application;

[0050] Figure 7 is a structural schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0051] In the following description, for the purposes of explanation and not limitation, specific details are set forth, such as particular sequences of acts, techniques, etc., in order to provide a thorough understanding of the embodiments of the application. However, it will be apparent to those skilled in the art that the application can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known devices, circuits, and methods are omitted so as not to obscure the description of the application with unnecessary detail.

[0052] It is to be understood that the terminology "includes", "has", "holds", "contains" or "comprising", "comprised of" or "comprising", as used in the specification and in the following claims, indicates the presence of the stated features, integers, steps, operations, elements, or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, or groups thereof.

[0053] It is also to be understood that the terminology "and / or" as used in the specification and in the following claims, indicates any combination of the associated listed items, as well as all possible combinations of the items.

[0054] As used in the specification and in the following claims, the term "if" can be interpreted as meaning "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [the described condition or event] is detected" can be interpreted as meaning "upon determining" or "in response to determining" or "upon detecting [the described condition or event]" or "in response to detecting [the described condition or event]", depending on the context.

[0055] In addition, in the description of the specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish descriptions, and cannot be understood as indicating or implying relative importance.

[0056] Reference within the specification of this application to "one embodiment" or "some embodiments" means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the application. The appearances of the phrase "in one embodiment" or "in some embodiments" in various places within specified

[0057] In the related art, a reference sample meeting a factory condition is selected from multiple samples, and quality detection is performed on other to-be-detected samples based on the reference sample. In the quality detection process, a pixel-by-pixel comparison manner is usually used to compare the differences between a to-be-detected sample image and a reference sample image to determine the quality of the to-be-detected sample. However, the pixel-by-pixel comparison manner is complex, and if the picture area is large and the number of pixel points is large, the image processing efficiency is low and a large amount of data is occupied.

[0058] Based on this, an image processing method is provided in the embodiments of the application. After first convolution processing is performed on a detection image containing a mask region to obtain a first convolution result, the area proportion of the mask region in the detection image is obtained, and an error value caused by a screen region to the first convolution result is determined according to the area proportion, the mask region, and an edge region in the detection image. Therefore, a second convolution result is determined according to the difference between the first convolution result and the error value. Thus, a defect region corresponding to the detection image is determined according to the second convolution result. That is, by performing convolution processing on the input detection image and weakening the convolution result of the edge region in combination with the mask region, the influence of the edge part on the detection image is reduced, and the accuracy of defect detection and the image processing efficiency are improved.

[0059] Next, the image processing method provided by the embodiments of the application will be described in detail. For illustration, reference is made to Figure 1 which shows a flowchart of an image processing method provided by an example embodiment of the application. The method includes the following steps 110 to 150.

[0060] Step 110: Obtain a detection image.

[0061] The detection image includes a pre-set mask region.

[0062] For illustration, the detection image refers to an image obtained after image acquisition is performed on a to-be-detected sample.

[0063] Optionally, the detection image is an RGB image, where R represents red, G represents green, and B represents blue, or the detection image is a grayscale image, which is not limited in the embodiments of the present application.

[0064] Illustratively, the mask region is marked by a binary matrix in the detection image, and the mask region is a specific region that needs to be focused on or processed.

[0065] Optionally, the mask region corresponds to a mask image, and the mask image has the same area size as the detection image, where the pixel points in the mask image include a plurality of pixel points, and the pixel points in the mask region are marked as 1, and the pixel points not in the mask region are marked as 0, or the pixel points in the mask region are marked as 0, and the pixel points not in the mask region are marked as 1.

[0066] Optionally, the mask region is a region manually marked in the detection image, that is, the pixel values of the pixel points in the mask region in the detection image are 0 or 255, which is not limited in the embodiments of the present application.

[0067] Illustratively, please refer to Figure 2 which shows a schematic diagram of an image processing method provided by an example embodiment of the present application, as shown in Figure 2 The detection image 210 is currently displayed, and after the detection image 210 is marked by a binary matrix, the pixel points in the mask region are marked as 1, and the pixel points not in the mask region are marked as 0, thereby generating a mask image 220, where the mask image 220 includes a mask region 221.

[0068] In some embodiments, the edge region includes a first pixel value corresponding to a first pixel point; and the first pixel value is set to 0 to obtain a zero image corresponding to the detection image.

[0069] Illustratively, the detection image includes an edge region, and the edge region refers to a region in the detection image that meets a preset edge rule, for example, a region with a width of 1 pixel around the detection image is an edge region.

[0070] Optionally, the edge region and the mask region are consistent, for example, the area sizes are consistent, the shapes are consistent, etc.; or the edge region and the mask region have a same part of the region, that is, the edge region and the mask region have an intersection.

[0071] In the embodiments, the pixel points in the edge region are first pixel points, the first pixel value corresponding to the first pixel points in the edge region in the detection image is set to 0 to obtain a zero image corresponding to the detection image.

[0072] Optionally, the first pixel value of all first pixels in the edge region is set to 0, or the first pixel value of some first pixels in the edge region is set to 0.

[0073] Step 120: Perform a first convolution process on multiple pixels in the detected image to obtain the first convolution result.

[0074] Indicatively, the first convolution process refers to using a pre-defined convolution kernel as a sliding window. The input data (i.e., the pixel values ​​of each pixel in the detection image) is locally weighted and summed through the sliding window (convolution kernel) to extract the corresponding pixel features. In other words, the convolution kernel is applied to the pixel position corresponding to each pixel in the detection image. After application, the corresponding elements in the pixels are multiplied to obtain the product result. The product results related to the pixel are then added together to obtain the output result corresponding to that pixel. For details, please refer to Formula 1.

[0075] Formula 1:

[0076] Where (a, b) are the coordinates of the center point of the convolution kernel, (x, y) are the coordinates of the pixel in the output convolution result, (m, n) are the side length of the convolution kernel, kernel(i, j) are the weight values ​​of the convolution kernel at coordinate point (i, j), and (i, j) includes the row index (i) and column index (j).

[0077] In some embodiments, a first convolution process is performed on multiple pixels in the zeroed image to obtain a first convolution result.

[0078] In this embodiment, the zero-set image is convolved using the method described above to obtain the first convolution result. This is illustrative; please refer to the previous section for further details. Figure 2 After setting the pixels in the edge region 221 to zero, a zeroed image is generated. The first convolution process is performed on multiple pixels in the zeroed image to obtain the first convolution result 230.

[0079] Step 130: Obtain the first proportion of the mask area among multiple pixels.

[0080] The first proportion is based on the area ratio of the mask region in the neighborhood region corresponding to each of the multiple pixels. The neighborhood region refers to the region of a single pixel at a specified position in the detection image.

[0081] To illustrate, taking the i-th pixel as an example (where i is a positive integer), multiple reference pixels within a specified area of ​​the i-th pixel are obtained (e.g., multiple reference pixels that are adjacent to the i-th pixel). The first number of reference pixels belonging to the mask area and the total number of reference pixels are determined, and the ratio between the first number and the total number is taken as the first proportion.

[0082] Step 140: Obtain a first error value based on the first proportion, the edge region in the detected image, and the mask region.

[0083] The first error value is used to indicate the error impact of the mask region on the formation of the first convolution result.

[0084] Indicatively, the first error value refers to the effect of the mask region on the first convolution result.

[0085] In some embodiments, a second convolution process is performed on the mask region to obtain a reduction coefficient map, which is used to indicate the degree to which the first convolution result corresponding to the pixel in the mask region is affected by the mask region; the reduction result corresponding to the edge region is determined based on the reduction coefficient map and the edge region; and the edge region is subjected to contrast compensation processing based on the reduction result to obtain a first error value.

[0086] In a schematic manner, a second convolution process is performed on each pixel in the mask region to obtain a reduction coefficient map, which includes the reduction coefficients corresponding to multiple pixels.

[0087] Optionally, the first convolution process and the second convolution process are the same convolution process (e.g., the same convolution kernel), or the first convolution process and the second convolution process are different convolution processes (e.g., different convolution kernels).

[0088] In some embodiments, a second convolution process is performed on the mask region using a first convolution kernel to obtain a first sub-convolution result; a weakening coefficient map is obtained based on the numerical relationship between the first sub-convolution result and the first convolution kernel.

[0089] To illustrate, firstly, a first convolution kernel is set, and then the second pixel points in the mask area are locally weighted and summed using the first convolution kernel as a sliding window to obtain the first sub-convolution results corresponding to multiple second pixel points.

[0090] To illustrate, the weakening coefficient corresponding to the second pixel is obtained by dividing the result of the first sub-convolution by the first convolution kernel.

[0091] In a schematic diagram, the attenuation coefficients corresponding to multiple second pixels are combined to form an attenuation coefficient map.

[0092] This is illustrative; please refer to it. Figure 3 It illustrates a schematic diagram of the attenuation coefficient provided in an exemplary embodiment of this application, such as Figure 3 As shown, the current display shows the attenuation coefficient diagram 310, where the attenuation coefficients corresponding to each pixel may be the same or different.

[0093] In some embodiments, the attenuation coefficient map includes attenuation coefficients corresponding to multiple pixels, and the edge region includes a first pixel; the attenuation coefficient corresponding to the first pixel is determined from the attenuation coefficient map as the attenuation result corresponding to the edge region.

[0094] In this embodiment, the attenuation coefficient map includes attenuation coefficients corresponding to multiple second pixels, and the edge region includes first pixels; the attenuation coefficient corresponding to the second pixel is determined from the attenuation coefficient map, and is used as the attenuation result corresponding to the first pixel in the edge region.

[0095] This is illustrative; please refer to it. Figure 4 It illustrates a schematic diagram of the weakening result provided by an exemplary embodiment of this application, such as... Figure 4 As shown, the weakening result 400 is displayed for each pixel in the current detection image.

[0096] In some embodiments, the edge region corresponds to the second contrast ratio; the first contrast ratio is obtained; and the sum of the contrast ratios between the first contrast ratio and the second contrast ratio is used as the first error value.

[0097] In this embodiment, the second contrast corresponding to the first pixel in the edge region is obtained, the second contrast is added to the preset first contrast, and the sum of the contrast between the first contrast and the second contrast is used as the first error value.

[0098] Step 150: Based on the difference between the first convolution result and the first error value, obtain the second convolution result.

[0099] The second convolution result is used to determine the defect region in the detection image, and the defect region is used to indicate the region corresponding to the defect in the detection image.

[0100] In this embodiment, the first convolution result is subtracted from the first error value to obtain the second convolution result. Compared with the first convolution result, the second convolution result makes the defect parts in the detected image clearer.

[0101] Indicatively, the defect region in the detection image is determined based on the result of the second convolution, and the defect region is used to indicate the area corresponding to the defective part in the detection image.

[0102] This is just an illustration; please refer to the following for further information. Figure 2 After obtaining the first convolution result 230, the first error value 240 is obtained through the above method. After subtracting the first error value 240 from the first convolution result 230, the second convolution result 250 is obtained.

[0103] This is illustrative; please refer to it. Figure 5 It illustrates a defect detection schematic diagram provided by an exemplary embodiment of this application, such as... Figure 5As shown, the second convolution result 510 is currently displayed. By locating the edge region of the defect region 520 in the second convolution result 510, the position and area of ​​the defect region 520 in the detection image can be determined.

[0104] The image processing method provided in this application performs a first convolution process on a detection image containing a mask region. After obtaining the first convolution result, it obtains the region ratio of the mask region in the detection image. Based on the region ratio, the mask region, and the edge region in the detection image, it determines the error value caused by the screen region to the first convolution result. Therefore, it determines a second convolution result based on the difference between the first convolution result and the error value. Thus, it determines the defect region corresponding to the detection image based on the second convolution result. That is, by performing convolution processing on the input detection image and combining the convolution result of the mask region on the edge region for weakening processing, the influence of the edge part on the detection image is reduced, which can improve the accuracy of defect detection and improve image processing efficiency.

[0105] This is illustrative; please refer to it. Figure 6 The diagram illustrates an image processing apparatus provided in an exemplary embodiment of this application, wherein the image processing apparatus may specifically include the following modules:

[0106] The acquisition module 610 is used to acquire a detection image, wherein the detection image includes a pre-defined mask area;

[0107] Convolution module 620 is used to perform a first convolution process on multiple pixels in the detection image to obtain a first convolution result;

[0108] The acquisition module 610 is used to acquire a first proportion of the mask region among the plurality of pixels. The first proportion is based on the area ratio of the mask region in the neighborhood regions corresponding to the plurality of pixels. The neighborhood region refers to the region of a single pixel at a specified position in the detection image.

[0109] Error module 630 is used to obtain a first error value based on the first proportion, the edge region in the detected image and the mask region, wherein the first error value is used to indicate the error influence of the mask region on the formation of the first convolution result;

[0110] The convolution module 620 is used to obtain a second convolution result based on the difference between the first convolution result and the first error value. The second convolution result is used to determine the defect region in the detection image. The defect region is used to indicate the region corresponding to the defect portion in the detection image.

[0111] Optionally, the error module 630 is configured to perform the second convolution processing on the mask region to obtain a weakening coefficient map, wherein the weakening coefficient map is used to indicate the degree to which the first convolution result corresponding to the pixel in the mask region is affected by the mask region; determine the weakening result corresponding to the edge region based on the weakening coefficient map and the edge region; and perform contrast compensation processing on the edge region based on the weakening result to obtain the first error value.

[0112] Optionally, the error module 630 is used to perform the second convolution processing on the mask region through the first convolution kernel to obtain the first sub-convolution result; and to obtain the attenuation coefficient map based on the numerical relationship between the first sub-convolution result and the first convolution kernel.

[0113] Optionally, the attenuation coefficient map includes attenuation coefficients corresponding to multiple pixels, and the edge region includes a first pixel.

[0114] The error module 630 is used to determine the attenuation coefficient corresponding to the first pixel from the attenuation coefficient map, as the attenuation result corresponding to the edge region.

[0115] Optionally, the edge region corresponds to a second contrast.

[0116] The error module 630 is used to obtain the first contrast ratio;

[0117] The first error value is the sum of the contrast ratios between the first and second contrast ratios.

[0118] Optionally, the edge region includes the first pixel value corresponding to the first pixel point;

[0119] The acquisition module 610 is further configured to zero out the first pixel value to obtain a zeroed image corresponding to the detection image; and to perform the first convolution process on multiple pixels in the zeroed image to obtain the first convolution result.

[0120] The image processing apparatus provided in this application performs a first convolution process on a detection image containing a mask region. After obtaining the first convolution result, it acquires the region proportion of the mask region in the detection image. Based on the region proportion, the mask region, and the edge region in the detection image, it determines the error value caused by the screen region to the first convolution result. Therefore, it determines a second convolution result based on the difference between the first convolution result and the error value. Thus, it determines the defect region corresponding to the detection image based on the second convolution result. That is, by performing convolution processing on the input detection image and combining the convolution result of the mask region on the edge region for weakening processing, the influence of the edge part on the detection image is reduced, which can improve the accuracy of defect detection and improve image processing efficiency.

[0121] See Figure 7 This illustration shows a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 7 As shown, the computer device 1000 of this embodiment includes: at least one processor 1010 ( Figure 7 (Only one is shown in the image) A processor, a memory 1020, and a computer program 1021 stored in the memory 1020 and executable on at least one processor 1010. When the processor 1010 executes the computer program 1021, it implements the steps in the above-described image processing method embodiments.

[0122] Computer device 1000 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. This terminal device may include, but is not limited to, processor 1010 and memory 1020. Those skilled in the art will understand that... Figure 7 This is merely an example of computer device 1000 and does not constitute a limitation on computer device 1000. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0123] The processor 1010 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0124] In some embodiments, memory 1020 may be an internal storage unit of computer device 1000, such as a hard disk or memory of computer device 1000. In other embodiments, memory 1020 may be an external storage device of computer device 1000, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., provided on computer device 1000. Furthermore, memory 1020 may include both internal and external storage units of computer device 1000. Memory 1020 is used to store operating systems, applications, boot loaders, data, and other programs, such as program code for computer programs. Memory 1020 may also be used to temporarily store data that has been output or will be output.

[0125] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments 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. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0126] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0127] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein 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.

[0128] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or 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.

[0129] 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.

[0130] Furthermore, 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. The integrated unit can be implemented in hardware or as a software functional unit.

[0131] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording media, USB flash drives, swivel hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0132] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, the computer device can implement the steps in the various method embodiments described above.

[0133] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An image processing method, characterized in that, The method includes: A detection image is acquired, the detection image including a pre-defined mask region and an edge region, the edge region including a first pixel, the area of ​​the region corresponding to the edge region and the mask region being the same, and / or the shape of the region corresponding to the edge region and the mask region being the same; A first convolution process is performed on multiple pixels in the detected image to obtain a first convolution result; The mask region is subjected to a second convolution process using a first convolution kernel to obtain the first sub-convolution result; A weakening coefficient map is obtained based on the numerical relationship between the first sub-convolution result and the first convolution kernel. The weakening coefficient map is used to indicate the degree to which the first convolution result corresponding to the pixel in the mask region is affected by the mask region. The weakening result corresponding to the edge region is determined based on the weakening coefficient map and the edge region; Based on the weakening result, the edge region is subjected to contrast compensation processing to obtain a first error value. The first error value is used to indicate the error influence of the mask region on the formation of the first convolution result. Based on the difference between the first convolution result and the first error value, a second convolution result is obtained. The second convolution result is used to determine the defect region in the detection image. The defect region is used to indicate the region corresponding to the defect portion in the detection image. The step of determining the weakening result corresponding to the edge region based on the weakening coefficient map and the edge region includes: The attenuation coefficient corresponding to the first pixel is determined from the attenuation coefficient map and used as the attenuation result for the edge region.

2. The method according to claim 1, characterized in that, The edge region corresponds to the second contrast. The step of performing contrast compensation processing on the edge region based on the weakening result to obtain the first error value includes: Obtain the preset first contrast; The first error value is the sum of the contrast ratios between the first and second contrast ratios.

3. The method according to claim 1 or 2, characterized in that, The edge region includes the first pixel value corresponding to the first pixel point; After acquiring the detection image, the process also includes: The first pixel value is zeroed out to obtain the zeroed image corresponding to the detected image; The first convolution process, which involves performing a first convolution on multiple pixels in the detected image to obtain a first convolution result, includes: The first convolution process is performed on multiple pixels in the zeroed image to obtain the first convolution result.

4. An image processing apparatus, characterized in that, The device includes: An acquisition module is used to acquire a detection image, the detection image including a pre-defined mask region and an edge region, the edge region including a first pixel, the area of ​​the region corresponding to the edge region and the mask region being the same, and / or the shape of the region corresponding to the edge region and the mask region being the same; The convolution module is used to perform a first convolution process on multiple pixels in the detected image to obtain a first convolution result. An error module is configured to perform a second convolution process on the mask region using a first convolution kernel to obtain a first sub-convolution result; obtain a reduction coefficient map based on the numerical relationship between the first sub-convolution result and the first convolution kernel, the reduction coefficient map indicating the degree to which the first convolution result corresponding to a pixel in the mask region is affected by the mask region; determine the reduction result corresponding to the edge region based on the reduction coefficient map and the edge region; and perform contrast compensation processing on the edge region based on the reduction result to obtain a first error value, the first error value indicating the error influence of the mask region on the first convolution result. The convolution module is used to obtain a second convolution result based on the difference between the first convolution result and the first error value. The second convolution result is used to determine the defect region in the detection image. The defect region is used to indicate the region corresponding to the defect portion in the detection image. The step of determining the weakening result corresponding to the edge region based on the weakening coefficient map and the edge region includes: determining the weakening coefficient corresponding to the first pixel from the weakening coefficient map as the weakening result corresponding to the edge region.

5. A computer device, characterized in that, The computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the image processing method as described in any one of claims 1 to 3.

6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the image processing method as described in any one of claims 1 to 3.

7. A computer program product, characterized in that, Includes a computer program, which, when run, causes the image processing method as described in any one of claims 1 to 3 to be performed.

Citation Information

Patent Citations

  • Image edge detection method, image processing device and computer storage medium

    CN111630563A

  • Image blurring judgment method and device, terminal equipment and medium

    CN111986144A