Surface image precision identification method and device for medical instrument production, and medium
By using image acquisition and processing methods with different angles and light intensity in medical film detection, the detection process is dynamically adjusted, and the problem of inefficient detection in the prior art is solved, achieving more efficient and accurate defect detection.
Patent Information
- Application Number
- CN202510305495.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-14
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2045-03-14
AI Technical Summary
The existing surface detection technology of medical devices cannot dynamically adjust the detection method in the production of medical films. A large number of images will be collected and processed for films that are obviously without defects, resulting in insufficiency of detection.
By performing the first image acquisition process and the initial surface defect inspection process on the medical film based on different angles, the second image acquisition process and the second surface defect inspection process are performed based on the results, and the detection method is dynamically adjusted to reduce resource waste on defect-free film.
It improves detection efficiency, reduces image acquisition and processing of defect-free films, and enhances the accuracy of recognition of surface defects.
Smart Images

Figure CN120219338A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of surface detection of medical devices, and particularly to a precise surface image recognition method, device and medium for medical device production. Background Art
[0002] The surface detection technology of medical devices is a technical system that specifically aims at various situations on the surface of medical devices that do not meet quality standards and design requirements, and uses a variety of technical means and methods for identification, positioning and evaluation, aiming to ensure the safety, reliability and effectiveness of medical devices.
[0003] When the existing medical device surface detection technology detects surface defects through images in the production of medical films, in order to comprehensively capture various possible defects of medical films, it is often necessary to collect multiple images from different perspectives, which greatly increases the time required to collect image data for each film; while the probability of defects in medical films is relatively low, a large number of medical films are actually defect-free during the production process, but still need to perform the same multi-image collection operation as the films that may have defects, and processing and analyzing the large number of collected images requires a large amount of computing resources. Since most films are defect-free, operations such as feature extraction and analysis of the images of these films are actually a waste of computing resources. For example, in the patent application with the publication number CN114926441A, a defect detection method and system for injection molding part processing and forming are disclosed. This scheme is similar to the above situation, and it is necessary to perform detailed processing and analysis on a large number of defect-free images, wasting a lot of time and resources; therefore, when the existing medical device surface detection technology detects surface defects through images in the production of medical films, for films that are obviously defect-free, the detection method will not be adjusted either, lacking the ability to dynamically adjust according to the actual situation, resulting in low detection efficiency. Summary of the Invention
[0004] The present invention aims to at least solve one of the technical problems in the prior art to some extent. By performing first image acquisition and processing on medical films from different angles; and performing preliminary surface defect inspection to obtain the surface condition of the medical film; performing second image acquisition and processing according to the surface condition of the medical film; and performing second surface defect inspection to obtain the defect condition of the medical film; to solve the problem that when the existing medical device surface detection technology detects surface defects through images in the production of medical films, for films that are obviously defect-free, the detection method will not be adjusted either, lacking the ability to dynamically adjust according to the actual situation, resulting in low detection efficiency.
[0005] To achieve the above object, in the first aspect, the present application provides a precise surface image recognition method for medical device production, including the following steps:
[0006] Perform the first image acquisition and processing on the medical film from different angles to obtain the first surface image data;
[0007] Perform the initial inspection of surface defects based on the first surface image data to obtain the surface condition of the medical film;
[0008] Perform the second image acquisition and processing according to the surface condition of the medical film to obtain the second surface image data;
[0009] Perform the second inspection of surface defects based on the second surface image data to obtain the defect condition of the medical film.
[0010] Furthermore, performing the first image acquisition and processing on the medical film from different angles to obtain the first surface image data includes the following sub-steps:
[0011] Set up the medical film image acquisition device, including: setting an image acquisition device directly above the geometric center of the medical film, and evenly setting four identical light sources obliquely above the medical film, which are respectively denoted as the first light source, the second light source, the third light source, and the fourth light source in clockwise order, and making the rotation angles of the four light sources in the clockwise direction the same.
[0012] Furthermore, performing the first image acquisition and processing on the medical film from different angles to obtain the first surface image data further includes the following sub-steps:
[0013] For any medical film to be recognized, according to the medical film image acquisition device, only turn on the first light source and set the illumination intensity of the first light source to A0; then use the image acquisition device to acquire an image of a medical film, denoted as the initial debugging image;
[0014] Calculate the gray average value of all pixel points in the initial debugging image, denoted as H0; determine whether H0 satisfies H1 < H0 < H2. If it satisfies, then denote the illumination intensity of A0 as the appropriate illumination intensity; if it does not satisfy, then increase or decrease the size of A0 according to H0 ≤ H1 or H0 ≥ H2 until the appropriate illumination intensity is obtained, where H1 is the set too-dark gray threshold and H2 is the set too-bright gray threshold; and obtain the illumination intensities corresponding to H0 = H1 and H0 = H2, which are denoted as Am and Aw in sequence;
[0015] According to the medical film image acquisition device, only turn on the first light source and set the illumination intensity of the first light source to the appropriate illumination intensity, use the image acquisition device to acquire an image of a medical film, denoted as the first initial inspection image 1; then only turn on the second light source and set the illumination intensity of the second light source to the appropriate illumination intensity, and use the image acquisition device to acquire an image of a medical film, denoted as the first initial inspection image 2; after completion, denote the first initial inspection image 1 and the first initial inspection image 2 as the first surface image data.
[0016] Further, perform an initial inspection of surface defects based on the first surface image data to obtain the surface condition of the medical film, including the following sub-steps:
[0017] Set the size of the divided grid to b1, and perform grid division processing on the first initial inspection image 1 and the first initial inspection image 2 respectively. After completion, obtain the grid images to be inspected 1 and the grid images to be inspected 2 in sequence;
[0018] The grid division processing includes: for any image of a medical film, denoted as the first divided image, divide the image area corresponding to the medical film in the first divided image, denoted as the medical film area, and remove the image areas of the non-medical film areas respectively. After completion, obtain the second divided image;
[0019] Use the divided grid to perform grid division on the second divided image, and denote the divided grid areas as C1 - Cn in sequence from left to right and top to bottom.
[0020] Further, perform an initial inspection of surface defects based on the first surface image data to obtain the surface condition of the medical film, and further include the following sub-steps:
[0021] Perform defect grid screening processing on the grid images to be inspected 1 and the grid images to be inspected 2 respectively to obtain the initial inspection grid images 1 and the initial inspection grid images 2;
[0022] The defect grid screening processing includes: for any grid image to be inspected, denoted as the first grid image, and for any grid area in the first grid image, denoted as grid Ci; arrange the gray values corresponding to all pixels in grid Ci in ascending order, denoted as the Ci gray value sequence;
[0023] Set the threshold ratios k1% and k2%, where k2% > k1%; remove the smallest k2% of the gray values and the largest k2% of the gray values in the Ci gray value sequence, and calculate the average value of the remaining gray values, denoted as the first reference value; calculate the average value of the smallest k1% of the gray values in the Ci gray value sequence, denoted as the first defect value; then calculate the average value of the largest k1% of the gray values in the Ci gray value sequence, denoted as the second defect value; calculate the absolute value of the difference between the first defect value and the first reference value, denoted as the first characteristic value; and calculate the absolute value of the difference between the second defect value and the first reference value, denoted as the second characteristic value; mark the larger value of the first characteristic value and the second characteristic value as the defect characteristic value of grid Ci, denoted as the Ci defect characteristic value;
[0024] Obtain the defect eigenvalue of all grid regions in the first grid image, and sort them in ascending order, denoted as the first eigenvalue sequence; set the threshold ratio k3%, remove the smallest k3% of the defect eigenvalues and the largest k3% of the defect eigenvalues in the first eigenvalue sequence, and calculate the average value and standard deviation of the remaining defect eigenvalues, denoted as D0 and D1 in sequence; for any defect eigenvalue in the first eigenvalue sequence, denoted as TD, if TD satisfies TD < [D0 - k4*D1] or TD > [D0 + k4*D1], then mark the grid region corresponding to TD as a defective grid, otherwise mark the grid region corresponding to TD as a normal grid; where k4 is the set threshold ratio; repeat to obtain all defective grids and normal grids in the first grid image;
[0025] If there are no defective grids in both the initial inspection grid image 1 and the initial inspection grid image 2, then mark the medical film to be identified as defect-free, otherwise mark it as defective.
[0026] Further, perform second image acquisition processing according to the surface condition of the medical film, and the obtained second surface image data includes the following sub-steps:
[0027] For the defective medical film to be identified, use the medical film image acquisition device to acquire the second surface image data; including: sequentially set the illumination intensities of the first light source, the second light source, the third light source, and the fourth light source as E1, E2, E3, and E4 respectively, where Aw > E1 > E2 > E3 > E4 > Am; sequentially turn on only the first light source, the second light source, the third light source, and the fourth light source, and acquire the surface image of the medical film each time it is turned on, and obtain the second inspection image 1, the second inspection image 2, the second inspection image 3, and the second inspection image 4 in sequence, denoted as the second surface image data.
[0028] Further, perform second inspection processing on the surface defects according to the second surface image data, and the obtained medical film defect situation includes the following sub-steps:
[0029] Set the size of the divided grid as b2, perform grid division processing on the second inspection image 1, the second inspection image 2, the second inspection image 3, and the second inspection image 4 respectively, and after completion, obtain the second inspection grid image 1, the second inspection grid image 2, the second inspection grid image 3, and the second inspection grid image 4 in sequence, denoted as the second inspection grid images 1 - 4;
[0030] According to the position areas where the defective grids are located in the first inspection grid image 1 and the first inspection grid image 2, the corresponding position areas in the second inspection grid images 1-4 are denoted as possible defect areas; and the areas other than the possible defect areas in the second inspection grid images 1-4 are denoted as normal areas, and the first reference processing is performed on the normal areas, including: for any normal area, the gray values of all pixel points in the normal area are arranged in ascending order, denoted as the first normal sequence, the first normal sequence is evenly divided into k5 subsequences, and the first subsequence and the last subsequence are removed. After completion, the second normal sequence is obtained, and the average value of the second normal sequence is calculated, denoted as the second inspection reference gray value of the corresponding second inspection grid image.
[0031] Furthermore, the surface defect second inspection process is carried out according to the second surface image data, and the situation of the medical film defects also includes the following sub-steps:
[0032] The grid areas at the same positions in the possible defect areas of the second inspection grid images 1-4 are sorted according to the serial numbers of the corresponding images, denoted as the grid area sequence; the first defect processing is performed on any grid area sequence.
[0033] The first defect processing includes: for any grid area in the grid area sequence, denoted as the first grid area; the gray values corresponding to all pixel points in the first grid area are arranged in ascending order, denoted as the first gray sequence, the smallest k6 gray values and the largest k6 gray values in the first gray sequence are removed, and then the average value of the smallest k7 gray values and the average value of the largest k7 gray values in the remaining first gray sequence are obtained, and are denoted as the minimum average value and the maximum average value in sequence.
[0034] Calculate the difference between the minimum average value and the corresponding second inspection reference gray value, denoted as the first difference, and calculate the difference between the maximum average value and the corresponding second inspection reference gray value, denoted as the second difference; mark the value with the larger corresponding absolute value among the first difference and the second difference as the defect feature difference of the corresponding grid area; repeat to obtain the defect feature differences of all grid areas in the grid area sequence, and mark the grid area corresponding to the defect feature difference with the largest absolute value as the suspected defect area.
[0035] Repeat to obtain all suspected defect areas in the second inspection grid images 1-4; and perform the second defect processing on all suspected defect areas.
[0036] The second defect processing includes: For any defect suspected area denoted as the first suspected area, obtain the defect feature differences of the f1 grid areas closest to the defect suspected area in the second inspection grid image where the first suspected area is located, denoted as the feature difference sequence. Calculate the average value and standard deviation of the k8 defect feature differences closest to 0 in the feature difference sequence, denoted as G1 and G2 respectively in sequence; Obtain the defect feature difference of the first suspected area denoted as Q; If Q is not within [G1 - p * G2, G1 + p * G2], then mark the corresponding defect suspected area as a defective area, otherwise mark it as a non-defective area;
[0037] Repeatedly obtain all the defective areas in the second inspection grid images 1 - 4, and mark them at the corresponding positions in the corresponding second inspection images 1, second inspection image 2, second inspection image 3, and second inspection image 4, denoted as the medical film defect situation.
[0038] In a second aspect, the present application provides an electronic device, including a processor and a memory. The memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the above method are run.
[0039] In a third aspect, the present application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above method are run.
[0040] The beneficial effects of the present invention: The present invention obtains the first surface image data by performing first image acquisition and processing on the medical film from different angles; performs surface defect preliminary inspection processing based on the first surface image data to obtain the surface situation of the medical film; performs second image acquisition and processing based on the surface situation of the medical film to obtain the second surface image data; performs surface defect second inspection processing based on the second surface image data to obtain the medical film defect situation; When detecting surface defects during the production of medical films, for films that are obviously defect-free, the detection method can be dynamically adjusted to reduce the waste of detection resources and improve the detection efficiency;
[0041] The present invention first collects a small number of images from different angles to judge whether there are defects. The advantage is that it can reduce a large amount of image acquisition and image analysis of defect-free medical films and improve the detection efficiency; By performing defect grid screening processing on the initially collected images through image gray values and making a comprehensive judgment, it can quickly detect whether the surface of the medical film has defects and detect the approximate position of the defects with only a small number of images collected; By collecting images of defective medical films at different angles and different light intensities, and then analyzing and processing according to the gray scale change and gray scale characteristics, the advantage is that it can detect surface defects more comprehensively, avoid information loss or misjudgment that may occur under a single light angle and intensity, and improve the defect recognition accuracy. Brief Description of the Drawings
[0042] Figure 1 It is a flowchart of the steps of the method of the present invention;
[0043] Figure 2 It is a schematic structural diagram of the medical film image acquisition device of the present invention;
[0044] Figure 3 It is a flowchart of the initial inspection and processing of surface defects of the present invention;
[0045] Figure 4 It is a schematic structural diagram of the electronic device of the present invention. Detailed Description of the Invention
[0046] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0047] Example 1, please refer to Figure 1 As shown, the present application provides a method for precise identification of surface images for medical device production, including the following steps:
[0048] Step S1, perform first image acquisition processing on the medical film from different angles to obtain first surface image data; Step S1 includes the following sub-steps:
[0049] Step S101, set up a medical film image acquisition device, including: please refer to Figure 2 As shown, an image acquisition device is set directly above the geometric center of the medical film, and four identical light sources are evenly arranged obliquely above the medical film. They are respectively denoted as the first light source, the second light source, the third light source, and the fourth light source in clockwise order, and the rotation angles of the four light sources in the clockwise direction are the same, that is, each rotation angle is 90°;
[0050] Step S102, for any medical film to be identified, according to the medical film image acquisition device, only turn on the first light source and set the illumination intensity of the first light source to A0; then use the image acquisition device to acquire an image of a medical film, denoted as the initial debugging image, and A0 can be set according to the actual application scenario;
[0051] Step S103, calculate the grayscale average value of all pixel points in the initial debugging image, denoted as H0; determine whether H0 satisfies H1 < H0 < H2. If it is satisfied, then record the illumination intensity of A0 as the appropriate illumination intensity;
[0052] Step S104: If not satisfied, increase or decrease the magnitude of A0 according to whether H0 ≤ H1 or H0 ≥ H2 until an appropriate light intensity is obtained, where H1 is the set gray scale threshold for being too dark, and H2 is the set gray scale threshold for being too bright; and obtain the light intensities corresponding to H0 = H1 and H0 = H2, denoted as Am and Aw respectively; in this embodiment, H1 is 80, H2 is 170, and the gray scale value range is 0 - 255.
[0053] Step S105: According to the medical film image acquisition device, only turn on the first light source, set the light intensity of the first light source to the appropriate light intensity, and use the image acquisition device to acquire an image of a medical film, denoted as the first preliminary inspection image 1.
[0054] Step S106: Then only turn on the second light source, set the light intensity of the second light source to the appropriate light intensity, and use the image acquisition device to acquire an image of a medical film, denoted as the first preliminary inspection image 2; after completion, record the first preliminary inspection image 1 and the first preliminary inspection image 2 as the first surface image data.
[0055] In the specific implementation process, by acquiring two images at different angles with a rotation angle of 90°, the advantage is that since the light reflection and shadow effects are different at different angles, some defects that are not obvious at a certain angle may become more prominent due to the action of light at another angle; for example, some tiny scratches or depressions may have a small gray scale difference from the surrounding area at a certain angle, but in the images at other angles, due to the different incident angles of light, obvious shadows or highlights may be generated, making them easier to be recognized; by combining the information of the two images, the defect characteristics at different angles can be integrated, improving the accuracy of defect recognition and reducing the situations of missed detection and false detection; if the rotation angle between the two acquired images is 180°, the information of the two acquired images has a high degree of repetition because the two perspectives are opposite and the content seen is basically symmetric, just left - right reversed; while the two perspectives with a rotation angle of 90° are different, which can obtain information from different sides, reduce information redundancy, provide more diverse image data, and contribute to a more comprehensive analysis of the surface condition of the medical film.
[0056] Step S2: Please refer to Figure 3 As shown, perform a preliminary inspection process on the surface defects based on the first surface image data to obtain the surface condition of the medical film; Step S2 includes the following sub - steps:
[0057] Step S201, set the size of the divided grid as b1, and perform grid division processing on the first preliminary inspection image 1 and the first preliminary inspection image 2 respectively. After completion, obtain the to-be-inspected grid image 1 and the to-be-inspected grid image 2 in sequence; the size and shape of the divided grid can be set according to the resolution of the collected image. Generally, it is sufficient to divide the image into 8 to 16 grids;
[0058] Step S202, grid division processing; Step S202 includes the following sub-steps:
[0059] Step S2021, for any image of a medical film, denoted as the first divided image, divide the image area corresponding to the medical film in the first divided image, denoted as the medical film area, and remove the image areas of the non-medical film areas respectively. After completion, obtain the second divided image;
[0060] Step S2022, use the divided grid to perform grid division on the second divided image, and sequentially denote the divided grid areas as C1 - Cn in the order from left to right and from top to bottom; when dividing, it is necessary to ensure that the areas on the medical film corresponding to the grid areas with the same serial number in the two to-be-inspected grid images are consistent. For example, the actual areas represented by C1 of the to-be-inspected grid image 1 and C1 of the to-be-inspected grid image 2 should be the same;
[0061] Step S203, perform defective grid screening processing on the to-be-inspected grid image 1 and the to-be-inspected grid image 2 respectively to obtain the preliminary inspection grid image 1 and the preliminary inspection grid image 2;
[0062] Step S204, defective grid screening processing, Step S204 includes the following sub-steps:
[0063] Step S2041, for any to-be-inspected grid image denoted as the first grid image, for any grid area in the first grid image, denoted as grid Ci; arrange the gray values corresponding to all pixels in grid Ci in ascending order, denoted as the Ci gray value sequence;
[0064] Step S2042, set the threshold ratios k1% and k2%, k2% > k1%; remove the smallest k2% of the gray values and the largest k2% of the gray values in the Ci gray value sequence, and calculate the average value of the remaining gray values, denoted as the first reference value; in this embodiment, k2% = 20%, the purpose is to remove the gray values related to the defective area in the Ci gray value sequence, as well as the extreme gray values affected by noise, reflection or other factors, so as to obtain the normal gray values of the normal surface;
[0065] Step S2043: Obtain the average value of the smallest k1% of the gray values in the Ci gray value sequence, denoted as the first defect value; then obtain the average value of the largest k1% of the gray values in the Ci gray value sequence, denoted as the second defect value; in this embodiment, k2% = 8%.
[0066] Step S2044: Obtain the absolute value of the difference between the first defect value and the first reference value, denoted as the first characteristic value; and obtain the absolute value of the difference between the second defect value and the first reference value, denoted as the second characteristic value; mark the larger value of the first characteristic value and the second characteristic value as the defect characteristic value of grid Ci, denoted as the Ci defect characteristic value.
[0067] Step S2045: Obtain the defect characteristic values of all grid regions in the first grid image, and sort them in ascending order, denoted as the first characteristic value sequence; set the threshold ratio k3%; remove the smallest k3% of the defect characteristic values and the largest k3% of the defect characteristic values in the first characteristic value sequence; in this embodiment, k3% = 15%, aiming to obtain the defect characteristic values of normal grid regions; and obtain the average value and standard deviation of the remaining defect characteristic values, denoted as D0 and D1 in sequence.
[0068] Step S2046: For any defect characteristic value in the first characteristic value sequence, denoted as TD, if TD satisfies TD < [D0 - k4 * D1] or TD > [D0 + k4 * D1], then mark the grid region corresponding to TD as a defective grid, otherwise mark the grid region corresponding to TD as a normal grid; where k4 is the set threshold ratio; repeat to obtain all defective grids and normal grids in the first grid image.
[0069] Step S205: If there are no defective grids in both the initial inspection grid image 1 and the initial inspection grid image 2, then mark the medical film to be identified as non-defective, otherwise mark it as defective.
[0070] In the specific implementation process, after dividing the image into grids, the gray value characteristics within each grid can be observed more carefully. Different grids may contain different image details. By analyzing the gray value characteristics within each grid, finer changes in the image can be captured; some features that are not easily noticed in the overall image may become more obvious at the grid scale; and using the presence or absence of defective grids as the judgment basis; without the need for complex algorithms or a large amount of data analysis, a conclusion can be quickly drawn, improving the detection efficiency; and analyzing two images collected at different angles ensures the detection accuracy.
[0071] Step S3: Perform second image acquisition and processing according to the surface condition of the medical film to obtain second surface image data; Step S3 includes the following sub-steps:
[0072] Step S301: Use a medical film image acquisition device to acquire second surface image data for defective medical films to be identified, including: sequentially setting the light intensities of a first light source, a second light source, a third light source, and a fourth light source to E1, E2, E3, and E4 respectively, where Aw > E1 > E2 > E3 > E4 > Am; E1, E2, E3, and E4 can be set according to the light conditions of the actual application scenario.
[0073] Step S302: Sequentially turn on only the first light source, the second light source, the third light source, and the fourth light source, and acquire the surface image of the medical film each time it is turned on. Obtain second inspection images 1, 2, 3, and 4 in sequence, denoted as second surface image data; that is, when one light source is turned on, the other three light sources should remain off.
[0074] In the specific implementation process, the relative positions of the light source, the medical film, and the image acquisition device should be kept unchanged when acquiring the first surface image data and the second surface image data; only in this way can it be ensured that when dividing the grid, the grid areas corresponding to the same position on different images are consistent; there are various types of defects on the surface of the medical film, and light sources of different intensities can highlight different types of defects. Light sources of different intensities illuminate the surface of the medical film at different angles, enabling various defects to be highlighted under different illuminations; 4 images with different light intensities, and observing the same defect from different angles can more comprehensively and accurately judge the nature, position, and range of the defect, improve the defect recognition accuracy rate, and reduce misjudgment and missed judgment.
[0075] Step S4: Perform second inspection processing on the surface defects based on the second surface image data to obtain the defect situation of the medical film. Step S4 includes the following sub-steps:
[0076] Step S401: Set the size of the divided grid to b2, where b2 is smaller than b1. Perform grid division processing on second inspection images 1, 2, 3, and 4 respectively. After completion, obtain second inspection grid images 1, 2, 3, and 4 in sequence, denoted as second inspection grid images 1 - 4.
[0077] Step S402: According to the position areas where the defective grids are located in the first inspection grid image 1 and the first inspection grid image 2, mark the corresponding position areas in the second inspection grid images 1 - 4 as possible defect areas; and mark the areas outside the possible defect areas in the second inspection grid images 1 - 4 as normal areas, and perform a first reference process on the normal areas.
[0078] Step S403, the first reference processing includes: for any normal region, arranging the gray values of all pixel points in the normal region in ascending order, denoted as the first normal sequence, evenly dividing the first normal sequence into k5 subsequences, removing the first subsequence and the last subsequence, and after completion, obtaining the second normal sequence, and calculating the average value of the second normal sequence, denoted as the second reference gray value of the corresponding second inspection grid image; in this embodiment, k5 is 5, that is, only 60% of the data in the middle of the first normal sequence is retained, mainly to remove the extreme gray values affected by noise, reflection or other factors;
[0079] Step S404, arranging the grid regions at the same position in the possible defect regions of the second inspection grid images 1-4 in the order of the corresponding image numbers, denoted as the grid region sequence; performing the first defect processing on any grid region sequence;
[0080] Step S405, the first defect processing; Step S405 includes the following sub-steps:
[0081] Step S4051, for any grid region in the grid region sequence, denoted as the first grid region; arranging the gray values corresponding to all pixel points in the first grid region in ascending order, denoted as the first gray sequence;
[0082] Step S4052, removing the smallest k6 gray values and the largest k6 gray values in the first gray sequence, and then obtaining the average value of the smallest k7 gray values and the average value of the largest k7 gray values in the remaining first gray sequence, denoted as the minimum mean value and the maximum mean value in order; in this embodiment, k6 is 2, mainly to remove the extreme gray values affected by noise, reflection or other factors; k7 is 5, mainly to screen out the gray values of the defect region, and the gray value of the defect region often differs from that of the normal region, and may be larger or smaller;
[0083] Step S4053, calculating the difference between the minimum mean value and the corresponding second reference gray value, denoted as the first difference value, and calculating the difference between the maximum mean value and the corresponding second reference gray value, denoted as the second difference value;
[0084] Step S4054: Mark the value with the larger corresponding absolute value among the first difference and the second difference as the defect feature difference of the corresponding grid area. That is, first find the absolute values of the first difference and the second difference, and then compare them. Repeat to obtain the defect feature differences of all grid areas in the grid area sequence, and mark the grid area corresponding to the defect feature difference with the largest absolute value as the defect suspected area. The obviousness of a defect at the same position varies under different angles and different light intensities, that is, the obviousness in the second inspection grid images 1-4 is different. And the grid area corresponding to the defect feature difference with the largest absolute value is the most obvious situation of the defect in the grid area sequence.
[0085] Step S406: Repeat to obtain all defect suspected areas in the second inspection grid images 1-4, and perform second defect processing on all defect suspected areas.
[0086] Step S407: The second defect processing includes: Step S407 includes the following sub-steps:
[0087] Step S4071: For any defect suspected area denoted as the first suspected area, obtain the defect feature differences of the f1 grid areas closest to the defect suspected area in the second inspection grid image where the first suspected area is located, and denote it as the feature difference sequence. In this embodiment, f1 is 8.
[0088] Step S4072: Calculate the average value and standard deviation of the k8 defect feature differences closest to 0 in the feature difference sequence, and denote them as G1 and G2 in sequence. Obtain the defect feature difference of the first suspected area and denote it as Q. If Q is not within [G1 - p*G2, G1 + p*G2], then mark the corresponding defect suspected area as a defective area, otherwise mark it as a non-defective area, where p is the set proportionality coefficient. In this embodiment, k8 is 10 and p is 2. Because the grids divided in the initial inspection processing of surface defects are relatively large, although it is determined that a certain grid area is defective during the processing, it is often relatively small. So most areas in the grid area are still normal areas, that is, most of the grid areas divided in the second inspection processing of surface defects in the possible defect areas are still normal areas. And the defect feature differences of normal areas should fluctuate around 0. Therefore, the defect feature differences of these normal areas can be screened out for comparative analysis to determine the defective area.
[0089] Step S408: Repeat to obtain all defective areas in the second inspection grid images 1-4, and mark them at the corresponding positions in the corresponding second inspection images 1, second inspection image 2, second inspection image 3, and second inspection image 4, denoted as the medical film defect situation.
[0090] In the specific implementation process, the initial inspection and processing of surface defects is to detect whether there are defects on the surface of the medical film, and the second inspection and processing of surface defects is to further identify the location of the defects and the areas involved.
[0091] Example 2, please refer to Figure 4 as shown in Figure 4 which illustrates a schematic structural diagram of an electronic device. The electronic device may include: a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete mutual communication through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, it runs the steps in a method for precise recognition of surface images for medical device production to achieve the following functions: performing first image acquisition and processing on the medical film from different angles to obtain first surface image data; performing initial inspection and processing of surface defects based on the first surface image data to obtain the surface condition of the medical film; performing second image acquisition and processing based on the surface condition of the medical film to obtain second surface image data; performing second inspection and processing of surface defects based on the second surface image data to obtain the defect condition of the medical film.
[0092] In addition, when the logical instructions in the above-mentioned memory are implemented in the form of software functional units and sold or used as an independent product, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of this application. The aforementioned storage medium includes: USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical disks, etc., which can store program codes.
[0093] Example 3, this application also provides a computer-readable storage medium. This application provides a storage medium on which a computer program is stored. When the computer program is executed by a processor, it runs the steps in the above-mentioned method for precise recognition of surface images for medical device production to achieve the following functions: performing first image acquisition and processing on the medical film from different angles to obtain first surface image data; performing initial inspection and processing of surface defects based on the first surface image data to obtain the surface condition of the medical film; performing second image acquisition and processing based on the surface condition of the medical film to obtain second surface image data; performing second inspection and processing of surface defects based on the second surface image data to obtain the defect condition of the medical film.
[0094] Through the description of the above embodiments, the embodiments of the present invention can be provided as a method, a system or a computer program product. Based on such an understanding, the above technical solution, in essence, or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0095] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The above-described embodiments are merely illustrative. For example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation. For another example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some communication interfaces. The indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.
[0096] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application and are not intended to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of each embodiment of the present application.
Claims
1. A method for precise surface image recognition for medical device production, characterized in that: It includes the following steps: Perform first image acquisition and processing on the medical film from different angles to obtain first surface image data; Perform preliminary inspection processing on surface defects based on the first surface image data to obtain the surface condition of the medical film; Perform second image acquisition and processing according to the surface condition of the medical film to obtain second surface image data; Perform second inspection processing on surface defects based on the second surface image data to obtain the defect condition of the medical film.
2. A method for precise surface image recognition for medical device production according to claim 1, characterized in that: Performing first image acquisition and processing on the medical film from different angles to obtain first surface image data includes the following sub-steps: Set up a medical film image acquisition device, including: setting an image acquisition device directly above the geometric center of the medical film, and evenly setting four identical light sources obliquely above the medical film, which are respectively denoted as the first light source, the second light source, the third light source, and the fourth light source in clockwise order, and making the rotation angles of the four light sources the same in the clockwise direction.
3. A method for precise surface image recognition for medical device production according to claim 2, characterized in that: Performing first image acquisition and processing on the medical film from different angles to obtain first surface image data further includes the following sub-steps: For any medical film to be recognized, according to the medical film image acquisition device, only turn on the first light source and set the illumination intensity of the first light source to A0; then use the image acquisition device to acquire an image of a medical film, denoted as the initial debugging image; Calculate the gray average value of all pixel points in the initial debugging image, denoted as H0; determine whether H0 satisfies H1 < H0 < H2. If it satisfies, record the illumination intensity of A0 as the appropriate illumination intensity; if it does not satisfy, increase or decrease the size of A0 according to H0 ≤ H1 or H0 ≥ H2 until the appropriate illumination intensity is obtained, where H1 is the set too-dark gray threshold and H2 is the set too-bright gray threshold; and obtain the illumination intensities corresponding to H0 = H1 and H0 = H2, which are denoted as Am and Aw in sequence; According to the medical film image acquisition device, only turn on the first light source and set the illumination intensity of the first light source to the appropriate illumination intensity, and use the image acquisition device to acquire an image of a medical film, denoted as the first preliminary inspection image 1; Then only turn on the second light source, set the illumination intensity of the second light source to the appropriate illumination intensity, and use the image acquisition device to acquire an image of a medical film, denoted as the first preliminary inspection image 2; after completion, record the first preliminary inspection image 1 and the first preliminary inspection image 2 as the first surface image data.
4. A method for precise surface image recognition for medical device production according to claim 3, characterized in that: Performing preliminary inspection processing on surface defects based on the first surface image data to obtain the surface condition of the medical film includes the following sub-steps: Set the size of the divided grid to b1, and perform grid division processing on the first preliminary inspection image 1 and the first preliminary inspection image 2 respectively. After completion, obtain the to-be-inspected grid image 1 and the to-be-inspected grid image 2 in sequence; The grid division processing includes: for any image of a medical film, denoted as the first divided image, divide the image area corresponding to the medical film in the first divided image, denoted as the medical film area, and remove the image areas of the non-medical film areas respectively. After completion, obtain the second divided image; The second divided image is divided into grids using the division grids, and the divided grid areas are sequentially recorded as C1-Cn in order from left to right and from top to bottom.
5. A method for precise surface image recognition for medical device production according to claim 4, characterized in that: Performing a preliminary surface defect inspection process according to the first surface image data to obtain the surface condition of the medical film also includes the following sub-steps: Perform defective grid screening processing on the grid image 1 to be inspected and the grid image 2 to be inspected, respectively, to obtain the initial inspection grid image 1 and the initial inspection grid image 2; The defective grid screening process includes: for any grid image to be inspected, it is recorded as a first grid image, and for any grid area in the first grid image, it is recorded as a grid Ci; the grayscale values corresponding to all pixels in the grid Ci are arranged in order from small to large, which is recorded as a Ci grayscale sequence; Set the threshold ratio k1% and k2%, k2%>k1%; remove the smallest k2% grayscale value and the largest k2% grayscale value in the Ci grayscale sequence, and calculate the average value of the remaining grayscale values, which is recorded as the first reference value; calculate the average value of the smallest k1% grayscale value in the Ci grayscale sequence, which is recorded as the first defect value; then calculate the average value of the largest k1% grayscale value in the Ci grayscale sequence, which is recorded as the second defect value; calculate the absolute value of the difference between the first defect value and the first reference value, which is recorded as the first eigenvalue; and calculate the absolute value of the difference between the second defect value and the first reference value, which is recorded as the second eigenvalue; mark the larger value between the first eigenvalue and the second eigenvalue as the defect eigenvalue of the grid Ci, which is recorded as the Ci defect eigenvalue; Obtain defect eigenvalues of all grid areas in the first grid image, and sort them in ascending order, which are recorded as the first eigenvalue sequence; set a threshold ratio of k3%, remove the smallest k3% defect eigenvalues and the largest k3% defect eigenvalues in the first eigenvalue sequence, and calculate the average value and standard deviation of the remaining defect eigenvalues, which are recorded as D0 and D1 in sequence; for any defect eigenvalue in the first eigenvalue sequence, record it as TD, if TD satisfies TD<[D0-k4*D1] or satisfies TD>[D0+k4*D1], then mark the grid area corresponding to TD as a defective grid, otherwise mark the grid area corresponding to TD as a normal grid; k4 is the set threshold ratio; repeatedly obtain all defective grids and normal grids in the first grid image; If there is no defective grid in the initial inspection grid image 1 and the initial inspection grid image 2, the medical film to be identified is marked as having no defects, otherwise it is marked as having defects.
6. A method for precise surface image recognition for medical device production according to claim 5, characterized in that: Performing a second image acquisition process according to the surface condition of the medical film to obtain the second surface image data includes the following sub-steps: For defective medical films to be identified, second surface image data are collected using a medical film image acquisition device; the process includes: setting the illumination intensities of the first light source, the second light source, the third light source and the fourth light source to be E1, E2, E3 and E4 respectively, wherein Aw>E1>E2>E3>E4>Am; turning on only the first light source, the second light source, the third light source and the fourth light source in sequence, and collecting the surface image of the medical film each time they are turned on, and obtaining second inspection image 1, second inspection image 2, second inspection image 3 and second inspection image 4 in sequence, which are recorded as second surface image data.
7. A method for precise surface image recognition for medical device production according to claim 6, characterized in that: Performing a second surface defect inspection process according to the second surface image data to obtain the defect status of the medical film includes the following sub-steps: Set the size of the divided grid to b2, and perform grid division processing on the second inspection image 1, the second inspection image 2, the second inspection image 3, and the second inspection image 4 respectively. After completion, the second inspection grid image 1, the second inspection grid image 2, the second inspection grid image 3, and the second inspection grid image 4 are obtained in sequence, which are recorded as the second inspection grid images 1-4; According to the position area where the defective grids in the initial inspection grid image 1 and the initial inspection grid image 2 are located, the corresponding position area in the second inspection grid images 1-4 is recorded as a possible defect area; The areas outside the possible defective areas in the second inspection grid images 1-4 are recorded as normal areas, and the normal areas are subjected to a first reference processing; including: for any normal area, the grayscale values of all pixels in the normal area are arranged in ascending order, recorded as a first normal sequence, the first normal sequence is evenly divided into k5 subsequences, and the first subsequence and the last subsequence are removed. After completion, a second normal sequence is obtained, and the average value of the second normal sequence is calculated, which is recorded as the second inspection reference grayscale value of the corresponding second inspection grid image.
8. A method for precise surface image recognition for medical device production according to claim 7, characterized in that: Performing a second surface defect inspection process according to the second surface image data to obtain the defect status of the medical film also includes the following sub-steps: The grid areas at the same position in the second inspection grid images 1-4 in the possible defect area are sorted according to the sequence number of the corresponding image, and recorded as a grid area sequence; and the first defect processing is performed on any grid area sequence; The first defect processing includes: for any grid area in the grid area sequence, record it as the first grid area; arrange the gray values corresponding to all pixel points in the first grid area in ascending order, record it as the first gray sequence, remove the smallest k6 gray values and the largest k6 gray values in the first gray sequence, and then obtain the average value of the smallest k7 gray values and the average value of the largest k7 gray values in the remaining first gray sequence, and record them as the minimum mean value and the maximum mean value in order; The difference between the minimum mean and the corresponding second-inspection reference grayscale value is calculated, recorded as the first difference, and the difference between the maximum mean and the corresponding second-inspection reference grayscale value is calculated, recorded as the second difference; the value with the larger corresponding absolute value between the first difference and the second difference is marked as the defect feature difference of the corresponding grid area; the defect feature difference of all grid areas in the grid area sequence is repeatedly obtained, and the grid area corresponding to the defect feature difference with the largest absolute value is marked as the suspected defect area; Repeatedly obtain all suspected defect areas in the second inspection grid images 1-4; and perform the second defect processing on all suspected defect areas; The second defect processing includes: for any suspected defect area, record it as the first suspected area, obtain the defect feature difference values of the f1 grid areas closest to the suspected defect area in the second inspection grid image where the first suspected area is located, record it as a feature difference sequence, calculate the average value and standard deviation of the k8 defect feature differences closest to 0 in the feature difference sequence, and record them as G1 and G2 in sequence; obtain the defect feature difference value of the first suspected area, record it as Q; if Q is not in [G1-p*G2, G1+p*G2], mark the corresponding suspected defect area as a defective area, otherwise mark it as a non-defective area, where p is the set proportional coefficient; Repeatedly obtain all defective areas in the second inspection grid images 1-4, and mark the corresponding positions in the corresponding second inspection image 1, second inspection image 2, second inspection image 3 and second inspection image 4, and record them as medical film defects.
9. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores computer-readable instructions. When the computer-readable instructions are executed by the processor, the steps in the method according to any one of claims 1 to 8 are executed.
10. A storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 8 are executed.
Citation Information
Patent Citations
Surface scratch defect identification method and visual inspection equipment
CN115880248A
Identity card surface defect detection method and device, medium and electronic equipment
CN116380915A
Plastic mold injection molding surface defect detection method
CN116912261A
Wafer surface detection method and device based on deep learning, equipment and medium
CN117495856A
Photovoltaic aluminum frame surface defect detection system
CN119125167A
Cited By
Light guide plate conveying line foreign matter visual detection method and system and storage medium
CN120563505A