A tablet visual inspection method and system for tablet press
By analyzing the texture distribution and edge characteristics of the tablet grayscale image, the tablet surface defects are identified, which solves the accuracy problem of the traditional corner detection algorithm in identifying regular notch texture defects on the tablet surface, and improves the accuracy of tablet detection.
Patent Information
- Application Number
- CN202410987802.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-07-23
AI Technical Summary
Existing technology cannot effectively identify defects on the surface of tablets produced by tablet presses. In particular, defects caused by regular scratch textures on the surface of the tablets are similar to texture distribution. The traditional corner detection algorithm has poor recognition results and reduces tablet detection. accuracy.
By obtaining the grayscale image of the tablet, analyzing the closed smooth state of the texture distribution, calculating the tablet contour membership degree, dividing the initial tablet contour area, analyzing the edge texture difference, filtering out the tablet defect area, and combining the tablet contour membership degree and distance distribution to improve the identification of defects Corner point accuracy.
It improves the accuracy of tablet detection results, reduces the interference of normal tablet score texture on defect corner information, increases the difference between partial defects on the tablet surface and similar corners with score texture distribution rules, and enhances the detection of tablet surface Defect identification ability.
Smart Images

Figure CN118521585B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image processing, and in particular to a tablet visual detection method and system for a tablet press. Background Art
[0002] As an important equipment in pharmaceutical engineering, tablet press mainly compresses powdered or granular drugs into tablets of specified shapes. However, the surface of tablets made by tablet press may have surface defects such as cracks due to operational problems or low viscosity of the drug itself. These surface defects will reduce the drug content contained in the tablets and affect the drug effect. Therefore, it is necessary to conduct visual inspection of tablets to detect the defective areas of the tablets.
[0003] The existing technology usually uses a corner detection algorithm to detect the collected tablet images. However, due to the presence of certain regular tablet score textures on the tablet surface, some defects on the tablet surface will be similar to the distribution rules of the tablet score texture. The traditional corner detection algorithm cannot effectively identify such defective corners, thereby reducing the accuracy of the tablet detection results. Summary of the invention
[0004] The present invention provides a tablet visual inspection method and system for a tablet press to solve the existing problem that there are regular tablet score textures on the tablet surface, and some defects on the tablet surface are similar to the distribution rules of the tablet score textures, and traditional corner point detection algorithms cannot effectively identify such defective corner points.
[0005] The present invention provides a tablet visual inspection method and system for a tablet press machine using the following technical solutions:
[0006] The present invention provides a tablet visual inspection method for a tablet press, the method comprising the following steps:
[0007] Acquire a tablet grayscale image, wherein the tablet grayscale image contains a plurality of contour corner point sequences, each contour pixel point sequence contains a plurality of initial contour corner points, and each initial contour corner point corresponds to a chain code value;
[0008] Based on the chain code value differences and distribution positions between different initial contour corner points in the same contour corner point sequence, the closed smooth state of texture distribution in the tablet grayscale image is analyzed to obtain the tablet contour membership of each initial contour corner point; the tablet contour membership is combined with the distance distribution between different initial contour corner points to divide several initial tablet contour areas from the tablet grayscale image;
[0009] Analyze the differences in distribution rules between different edge textures in the same initial tablet contour area, and combine the tablet contour membership to obtain the tablet surface normality of each initial tablet contour area;
[0010] According to the normality of the tablet surface, several tablet defect contour areas are screened out from all the initial tablet contour areas; and tablet inspection is performed on the tablet defect contour areas.
[0011] Preferably, the method for obtaining the tablet contour membership is:
[0012] Any initial contour corner point in any contour corner point sequence is recorded as the target contour corner point, and the difference in chain code values between the target contour corner point and the surrounding initial contour corner points is analyzed to obtain the contour smoothing factor of the target contour corner point;
[0013] Analyze the distance relationship between the target contour corner point and other initial contour corner points to obtain the contour closure factor of the target contour corner point;
[0014] According to the contour smoothing factor and the contour closing factor, the tablet contour membership of the target contour corner point is obtained; the tablet contour membership is positively correlated with the contour smoothing factor and positively correlated with the contour closing factor.
[0015] Preferably, after calculating the tablet contour membership, the method further comprises:
[0016] The tablet contour membership is normalized.
[0017] Preferably, the method for obtaining the initial tablet contour area is:
[0018] Analyze the distances between different initial contour corner points in the same contour corner point sequence, as well as the tablet contour membership of each initial contour corner point, to obtain the tablet outer contour degree of each initial contour corner point;
[0019] According to the degree of the outer contour of the tablet, all initial contour corner points are divided into several initial tablet contour corner point types;
[0020] According to the image areas occupied by the types of the initial tablet contour corner points, several initial tablet contour areas are obtained.
[0021] Preferably, after calculating the outer layer contour of the tablet, the method further comprises:
[0022] The degree of the outer contour of the tablet is normalized.
[0023] Preferably, the method for obtaining the normality of the tablet surface is:
[0024] For any initial pill contour region, the initial contour corner points with the same grayscale value within the initial pill contour region are divided into a region internal contour corner point type;
[0025] Analyze the grayscale distribution differences of the internal contour corner point types in different regions within the initial tablet contour area to obtain the contour grayscale uniformity of the initial tablet contour area;
[0026] The chain code fluctuations of adjacent initial contour corner points under the same internal contour corner point type are analyzed to obtain the internal texture regularity of the initial tablet contour area.
[0027] According to the contour grayscale uniformity and the internal texture regularity, the normality of the tablet surface in the initial tablet contour area is obtained; the normality of the tablet surface is positively correlated with the contour grayscale uniformity and positively correlated with the internal texture regularity.
[0028] Preferably, the method for acquiring the contour grayscale uniformity is:
[0029] Obtain the mean difference in grayscale ratio between the contour corner type inside each region and the initial tablet contour region as a whole;
[0030] Obtain the gradient amplitude variance of the contour corner point types inside all regions within the initial pill contour region;
[0031] According to the grayscale proportion difference mean, gradient amplitude variance, and tablet contour membership, the contour grayscale uniformity of the initial tablet contour area is obtained; the contour grayscale uniformity is negatively correlated with the grayscale proportion difference mean, negatively correlated with the gradient amplitude variance, and positively correlated with the tablet contour membership.
[0032] Preferably, the method for obtaining the internal texture regularity is:
[0033] For any region internal contour corner point type, the chain code values of different initial contour corner points under the region internal contour corner point type are combined in pairs to obtain several internal contour chain code combinations;
[0034] The overall distribution stability of the internal contour chain code combination is analyzed to obtain the internal texture regularity of the initial tablet contour area.
[0035] Preferably, after calculating the normality of the tablet surface, the method further comprises:
[0036] Normalize the tablet surface to normalize.
[0037] The present invention also proposes a tablet visual inspection system for a tablet press, comprising a memory and a processor, wherein the processor executes a computer program stored in the memory to implement the steps of the above-mentioned tablet visual inspection method for a tablet press.
[0038] The technical solution of the present invention has the following beneficial effects: the present invention obtains the tablet contour membership by analyzing the closed smooth state of the texture distribution in the tablet grayscale image; wherein the tablet contour membership is used to describe the probability that the initial contour corner point belongs to the outer contour of the tablet, thereby improving the accuracy of identifying the complete tablet contour; then the tablet contour membership is combined with the distance distribution between different initial contour corner points to obtain a number of initial tablet contour areas; wherein the initial tablet contour area is used to describe the surface area of the tablet as a whole, so as to better analyze the corner points with defects on the tablet surface; then the difference in distribution rules between different edge textures in the same initial tablet contour area is analyzed to obtain the normality of the tablet surface; wherein the normality of the tablet surface is used to describe the possibility that there are no defective corner points in the initial tablet contour area, thereby reducing the interference of normal tablet scratch texture on the representation of defective corner point information; the present invention increases the difference between the corner points corresponding to the partial defects on the tablet surface and the corner points with similar distribution rules of the tablet scratch texture by analyzing the distribution law of the tablet scratch texture with certain rules on the tablet surface, thereby improving the accuracy of identifying the corner points in the defective area and improving the accuracy of the tablet detection result. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0040] Figure 1 The present invention is a flowchart of the steps of a method for visually inspecting tablets for a tablet press. DETAILED DESCRIPTION
[0041] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the following is a detailed description of a tablet visual inspection method and system for a tablet press according to the present invention, its specific implementation, structure, features and effects, in conjunction with the accompanying drawings and preferred embodiments. In the following description, different "one embodiment" or "another embodiment" does not necessarily refer to the same embodiment. In addition, specific features, structures or characteristics in one or more embodiments may be combined in any suitable form.
[0042] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
[0043] The specific scheme of a tablet visual inspection method and system for a tablet press provided by the present invention is described in detail below with reference to the accompanying drawings.
[0044] See also Figure 1 , which shows a flowchart of a method for visually inspecting tablets for a tablet press provided by an embodiment of the present invention, the method comprising the following steps:
[0045] Step S001: Obtain a tablet grayscale image, wherein the tablet grayscale image contains a plurality of contour corner point sequences, each contour pixel point sequence contains a plurality of initial contour corner points, and each initial contour corner point corresponds to a chain code value.
[0046] It should be noted that the existing technology usually uses a corner detection algorithm to detect the collected tablet images. However, due to the presence of certain regular tablet score textures on the tablet surface, some defects on the tablet surface will be similar to the distribution rules of the tablet score texture. The traditional corner detection algorithm cannot effectively identify such defective corners, thereby reducing the accuracy of the tablet detection results.
[0047] In a specific implementation of the embodiment of the present invention, a method for obtaining a tablet grayscale image is as follows: placing a tablet horizontally on a platform, using an industrial camera to vertically photograph the tablet to obtain a tablet image; graying the tablet image to obtain an initial tablet grayscale image; and using the maximum inter-class variance method to segment the initial tablet grayscale image to obtain a tablet grayscale image. The graying process and the maximum inter-class variance method are both well-known technologies and will not be described in detail in this embodiment.
[0048] In a specific implementation of the embodiment of the present invention, the method for obtaining the contour corner point sequence, the initial contour corner point and the chain code value is as follows: a plurality of contours of the tablet grayscale image are obtained by using a boundary tracing algorithm; corner point detection is performed on each contour to obtain a plurality of contour corner point sequences, and each pixel point included in each contour corner point sequence is recorded as an initial contour corner point. Each contour corresponds to a contour corner point sequence, and each initial contour corner point corresponds to a chain code value.
[0049] It should be noted that the process of obtaining the contour in the image is a well-known content of the boundary tracing algorithm, and the process of obtaining the pixel point sequence and the chain code value through corner point detection are both well-known contents of the corner point detection algorithm based on Freeman chain code analysis.
[0050] So far, the grayscale image of the tablet is obtained through the above method.
[0051] Step S002: Based on the chain code value differences and distribution positions between different initial contour corner points in the same contour corner point sequence, the closed and smooth state of the texture distribution in the tablet grayscale image is analyzed to obtain the tablet contour membership of each initial contour corner point; the tablet contour membership is combined with the distance distribution between different initial contour corner points to divide a number of initial tablet contour areas from the tablet grayscale image.
[0052] It should be noted that each contour corner point sequence represents a contour edge, wherein the chain code value of each initial contour corner point represents the extension direction of the texture edge of the corresponding pixel point; under normal circumstances, the edge of the outer contour of a normal tablet usually changes in a smooth state, thereby forming a closed outer edge contour of the tablet; therefore, based on the difference in chain code values and distribution positions between different initial contour corner points in the same contour corner point sequence, the closed and smooth state of texture distribution in the tablet grayscale image can be analyzed to obtain the tablet contour membership of each initial contour corner point, so as to characterize the probability that each initial contour corner point belongs to the outer contour of the tablet; wherein the larger the tablet contour membership, the more likely the initial contour corner point belongs to the contour edge of the tablet surface. At the same time, because the normal tablet shape is formed by a continuous distribution of multiple pixel points, the distance between the corresponding adjacent pixel points is relatively small, and the shape is usually circular, so the tablet contour membership can be combined with the distance distribution between different initial contour corner points to divide several initial tablet contour areas from the tablet grayscale image.
[0053] Preferably, in some implementations of the embodiments of the present invention, the method for obtaining the tablet contour membership is: record any initial contour corner point in any contour corner point sequence as the target contour corner point, analyze the difference in chain code values between the target contour corner point and the surrounding initial contour corner points, and obtain the contour smoothing factor of the target contour corner point; analyze the distance relationship between the target contour corner point and other initial contour corner points to obtain the contour closure factor of the target contour corner point; obtain the tablet contour membership of the target contour corner point based on the contour smoothing factor and the contour closure factor; the tablet contour membership is positively correlated with the contour smoothing factor and positively correlated with the contour closure factor. The specific process is:
[0054] 1. Get the contour smoothing factor.
[0055] In the contour corner point sequence, the absolute value of the difference in chain code values between the previous initial contour corner point of the target contour corner point and the target contour corner point is used as the front contour smoothing value of the target contour corner point; the absolute value of the difference in chain code values between the next initial contour corner point of the target contour corner point and the target contour corner point is used as the rear contour smoothing value of the target contour corner point; the absolute value of the difference between the front contour smoothing value and the rear contour smoothing value is used as the contour smoothing factor of the target contour corner point.
[0056] It should be noted that if the target contour corner point is the first initial contour corner point in the contour corner point sequence, the post-contour smoothing value of the target contour corner point is used as the contour smoothing factor of the target contour corner point; if the target contour corner point is the last initial contour corner point in the contour corner point sequence, the pre-contour smoothing value of the target contour corner point is used as the contour smoothing factor of the target contour corner point.
[0057] 2. Get the contour closure factor.
[0058] Preset a window size ; Take the target contour corner point as the center and get the size The window area is recorded as the reference contour area of the target contour corner point; if there are other initial contour corner points in the reference contour area, the inverse normalized value of the mean of the Euclidean distances between the target contour corner point and all other initial contour corner points is used as the contour closure factor of the target contour corner point; if there are no other initial contour corner points in the reference contour area, the contour closure factor of the target contour corner point is preset to 0. This example is described as an example, and this embodiment is not specifically limited. It may be determined according to the specific implementation situation; the acquisition of Euclidean distance is a well-known technology and will not be described in detail in this embodiment.
[0059] It is particularly noted that the embodiment adopts Model to present inverse proportional relationship and normalization, As the input of the model, the implementer can choose the inverse proportional function and the normalization function according to the actual situation.
[0060] 3. Obtain the tablet contour membership.
[0061] The normalized value of the product of the contour smoothing factor and the contour closing factor of the target contour corner point is used as the tablet contour membership of the target contour corner point. The larger the tablet contour membership, the more likely the initial contour corner point is to belong to the contour edge of the tablet surface.
[0062] It is particularly noted that the embodiment adopts The linear normalization function is used for normalization processing, and the implementer can select the normalization function according to the actual situation.
[0063] Preferably, in some implementations of the embodiments of the present invention, the method for obtaining the initial tablet contour area is: analyzing the distance between different initial contour corner points in the same contour corner point sequence, and the tablet contour membership of each initial contour corner point, to obtain the tablet outer contour degree of each initial contour corner point; according to the tablet outer contour degree, all initial contour corner points are divided into several initial tablet contour corner point types; according to the image area occupied by the initial tablet contour corner point type, several initial tablet contour areas are obtained. The specific process is:
[0064] Taking any contour corner point sequence as an example, the minimum enclosing rectangle is obtained according to all the initial contour corner points in the contour corner point sequence; the absolute value of the difference between the aspect ratio of the minimum enclosing rectangle and 1 is used as the tablet outer layer morphology of the contour corner point sequence; the normalized value of the product of the tablet outer layer morphology and the tablet contour membership of each initial contour corner point in the contour corner point sequence is used as the tablet outer layer contour degree of each initial contour corner point.
[0065] Furthermore, the absolute value of the difference in the degree of the outer contour of the tablet between different initial contour corner points is used as a distance metric; according to the distance metric, all the initial contour corner points in the contour corner point sequence are clustered to obtain a number of cluster clusters; the mean value of the degree of the outer contour of the tablet of all the initial contour corner points in each cluster cluster is used as the contour type screening value of each cluster cluster; all cluster clusters except the cluster cluster with the smallest contour type screening value are recorded as the initial tablet contour corner point type; the image area occupied by the minimum circumscribed circle of all the initial contour corner points in all the initial tablet contour corner point types is recorded as the initial tablet contour area. Several initial tablet contour areas are obtained.
[0066] Among them, each initial tablet contour area corresponds to a contour corner point sequence; each initial contour corner point corresponds to a pixel point, and the process of clustering pixel points according to the distance metric is a well-known content of the K-Means clustering algorithm. In addition, the K value in the K-Means clustering algorithm is explained using 5 as an example. The K value in this embodiment can be determined according to actual conditions.
[0067] So far, several initial tablet contour regions are obtained through the above method.
[0068] Step S003: Analyze the differences in distribution rules between different edge textures in the same initial tablet contour area, and combine the tablet contour membership to obtain the tablet surface normality of each initial tablet contour area.
[0069] It should be noted that the initial tablet contour area reflects the surface area of the tablet as a whole; and there will be a certain amount of tablet marks on the tablet surface to identify the tablet name, dosage, production batch number and other related notes; these tablet marks themselves will be arranged in a fixed regular manner with different texture distributions. If there are defects on the tablet surface, it will destroy the regular distribution of several textures corresponding to the tablet marks to a certain extent, interfere with the similarity of the distribution rules of several textures corresponding to the tablet marks, and thus affect the accurate expression of the tablet mark information; therefore, the difference in distribution rules between different edge textures in the same initial tablet contour area can be analyzed, and combined with the tablet contour membership, the tablet surface normality of each initial tablet contour area can be obtained; according to the tablet surface normality, several tablet defect contour areas are selected from all initial tablet contour areas. Among them, the greater the tablet surface normality, the less likely it is that there will be defective textures that blur the tablet marks in the initial tablet contour area, reflecting that the tablet marks in the initial tablet contour area can more accurately represent the relevant notes of the tablet.
[0070] Preferably, in some implementations of the embodiments of the present invention, the method for obtaining the normality of the tablet surface is as follows: for any initial tablet contour area, the initial contour corner points with the same grayscale value in the initial tablet contour area are divided into a regional internal contour corner point type; the grayscale distribution difference of the internal contour corner point types of different regions in the initial tablet contour area is analyzed to obtain the contour grayscale uniformity of the initial tablet contour area; the chain code change fluctuations of adjacent initial contour corner points under the same regional internal contour corner point type are analyzed to obtain the internal texture regularity of the initial tablet contour area; the normality of the tablet surface in the initial tablet contour area is obtained based on the contour grayscale uniformity and the internal texture regularity; the tablet surface normality is positively correlated with the contour grayscale uniformity and positively correlated with the internal texture regularity. The specific process is:
[0071] 1. Obtain the contour grayscale uniformity.
[0072] It should be noted that the tablet notch is constructed by a plurality of pixels with different grayscale values. These pixels constituting the tablet notch mainly form a contrast with other areas of the tablet surface by forming a large grayscale gradient change on the tablet surface, so that the tablet notch as a whole is darker in grayscale than other surface areas, thereby effectively highlighting the tablet notch. Under normal circumstances, the grayscale content at the edge of the tablet notch tends to be evenly distributed due to its regular distribution. If there are defects in the tablet notch, the distribution of the grayscale content at the edge of the corresponding notch will be destroyed. Therefore, the grayscale distribution differences of the contour corner point types in different areas within the initial tablet contour area can be analyzed to obtain the contour grayscale uniformity of the initial tablet contour area. The greater the contour grayscale uniformity, the more uniform the contour grayscale distribution within the initial tablet contour area, reflecting that the contour of the tablet notch is more likely to exist within the initial tablet contour area.
[0073] Preferably, in some implementations of the embodiments of the present invention, the method for obtaining the contour grayscale uniformity is: obtaining the mean difference in grayscale proportion between the contour corner point type inside each region and the initial tablet contour region as a whole; obtaining the gradient amplitude variance of the contour corner point type inside all regions within the initial tablet contour region; obtaining the contour grayscale uniformity of the initial tablet contour region according to the mean grayscale proportion difference, the gradient amplitude variance, and the tablet contour membership; the contour grayscale uniformity is negatively correlated with the mean grayscale proportion difference, negatively correlated with the gradient amplitude variance, and positively correlated with the tablet contour membership. As an example, the contour grayscale uniformity of the initial tablet contour region can be calculated by the following formula:
[0074]
[0075] In the formula, Represents the contour grayscale uniformity of the initial tablet contour area; Indicates the number of internal contour corner point types of all regions within the initial pill contour region; Indicates The type of the internal contour corner points of the first region is The absolute value of the difference in the number of initial contour corner points contained in the contour corner point types within the regions; Represents the number of all pixels in the initial pill outline area; Represents the variance of the gradient amplitude of all initial contour corner points within the contour corner point type of all regions, that is, the gradient amplitude variance; It represents the mean value of the tablet contour membership of all initial contour corner points within all regions of the contour corner point type; represents an exponential function with a natural constant as the base, and the embodiment adopts Model to present inverse proportional relationship and normalization, As the input of the model, the implementer can select the inverse proportional function and the normalization function according to the actual situation. The acquisition of the gradient amplitude is a well-known content of the Sobel algorithm, which will not be repeated in this embodiment.
[0076] It should be noted that Represents the mean value of the grayscale proportion difference; if the contour grayscale uniformity of the initial tablet contour area is greater, it means that the contour grayscale distribution in the initial tablet contour area is more uniform, reflecting that the contour of the tablet mark is more likely to exist in the initial tablet contour area.
[0077] 2. Obtain internal texture regularity.
[0078] It should be noted that when there are defects in the tablet scoring, the defects will cause the corresponding tablet scoring to show texture defects such as breakage and blur, disrupting the texture extension direction of the pixel points in some areas; and because the chain code value reflects the texture extension direction of the pixel points, the chain code change fluctuations of adjacent initial contour corner points under the same area internal contour corner point type can be analyzed to obtain the internal texture regularity of the initial tablet contour area; among them, the greater the internal texture regularity, the more consistent the distribution distance interval of the same texture direction in the initial tablet contour area, reflecting that the contour of the tablet scoring may exist in the initial tablet contour area.
[0079] Preferably, in some implementations of the embodiments of the present invention, the method for obtaining the internal texture regularity is: for any type of internal contour corner point of a region, the chain code values of different initial contour corner points under the type of internal contour corner point of the region are combined in pairs to obtain several internal contour chain code combinations; the overall distribution stability of the internal contour chain code combination is analyzed to obtain the internal texture regularity of the initial tablet contour region. The specific process is:
[0080] The pixel point combination corresponding to each internal contour chain code combination in the drug grayscale image is recorded as a chain code direction pixel point pair; the set composed of the same internal contour chain code combination is recorded as a same-texture extension direction set; taking any two internal contour chain code combinations in any same-texture extension direction set as an example, the chain code direction pixel point pair of any internal contour chain code combination is recorded as a target chain code pixel point pair, and the chain code direction pixel point pair of the other internal contour chain code combination is recorded as a reference chain code pixel point pair; the minimum value of the Euclidean distance between each pixel point in the target chain code pixel point pair and each pixel point in the reference chain code pixel point pair is taken as the contour distance between the two internal contour chain code combinations. The contour distances between all different internal contour chain code combinations are obtained.
[0081] Furthermore, the variance of the contour distances between all different internal contour chain code combinations within the initial tablet contour region is taken as the internal texture regularity of the initial tablet contour region.
[0082] It should be noted that, if the regularity of the internal texture is greater, it means that the distribution distance interval of the same texture direction in the initial tablet contour area is more consistent, reflecting that there may be a tablet score outline in the initial tablet contour area.
[0083] 3. Obtain the normality of the tablet surface based on the uniformity of the contour grayscale and the regularity of the internal texture.
[0084] The normalized value of the product of the contour grayscale uniformity and the internal texture regularity of the initial tablet contour area is used as the tablet surface normality of the initial tablet contour area. The tablet surface normality of each initial tablet contour area is obtained.
[0085] It should be noted that the more normal the tablet surface is, the less likely it is that there will be defective textures in the initial tablet contour area that blur the tablet scoring, which means that the tablet scoring in the initial tablet contour area can more accurately represent the relevant remarks information of the tablet.
[0086] So far, the tablet surface normality of each initial tablet contour area is obtained through the above method.
[0087] Step S004: According to the normality of the tablet surface, a number of tablet defect contour areas are screened out from all the initial tablet contour areas; and tablet detection is performed on the tablet defect contour areas.
[0088] Preferably, in a specific implementation of the embodiment of the present invention, the method for obtaining the tablet defect contour area is: presetting a tablet surface normality threshold , the tablet surface is smaller than the normal The initial tablet contour area is recorded as the tablet defect contour area. This example is described as an example, and this embodiment is not specifically limited. It may depend on the specific implementation situation.
[0089] It should be noted that the initial contour corner points existing in the tablet defect contour area are defective corner points.
[0090] Preferably, in a specific implementation of the embodiment of the present invention, the specific process of pill detection is: presetting a region quantity proportion threshold ; If the number of tablet defect contour areas is greater than the number of all initial tablet contour areas , the tablet grayscale image is recorded as a tablet grayscale image with tablet defects. This example is described as an example, and this embodiment is not specifically limited. It may depend on the specific implementation situation.
[0091] Through the above steps, the visual inspection method for tablets based on the tablet press is completed.
[0092] Another embodiment of the present invention provides a tablet visual inspection system for a tablet press, the system comprising a memory and a processor, and when the processor executes a computer program stored in the memory, the above method steps S001 to S004 are performed.
[0093] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A tablet visual inspection method for a tablet press, characterized in that: The method comprises the following steps: Acquire a tablet grayscale image, wherein the tablet grayscale image contains a plurality of contour corner point sequences, each contour pixel point sequence contains a plurality of initial contour corner points, and each initial contour corner point corresponds to a chain code value; Based on the chain code value differences and distribution positions between different initial contour corner points in the same contour corner point sequence, the closed smooth state of texture distribution in the tablet grayscale image is analyzed to obtain the tablet contour membership of each initial contour corner point; the tablet contour membership is combined with the distance distribution between different initial contour corner points to divide several initial tablet contour areas from the tablet grayscale image; Analyze the differences in distribution rules between different edge textures in the same initial tablet contour area, and combine the tablet contour membership to obtain the tablet surface normality of each initial tablet contour area; According to the normality of the tablet surface, several tablet defect contour areas are screened out from all the initial tablet contour areas; and tablet inspection is performed on the tablet defect contour areas.
2. A tablet visual inspection method for a tablet press according to claim 1, characterized in that: The method for obtaining the tablet contour membership is: Any initial contour corner point in any contour corner point sequence is recorded as the target contour corner point, and the difference in chain code values between the target contour corner point and the surrounding initial contour corner points is analyzed to obtain the contour smoothing factor of the target contour corner point; Analyze the distance relationship between the target contour corner point and other initial contour corner points to obtain the contour closure factor of the target contour corner point; According to the contour smoothing factor and the contour closing factor, the tablet contour membership of the target contour corner point is obtained; the tablet contour membership is positively correlated with the contour smoothing factor and positively correlated with the contour closing factor.
3. A tablet visual inspection method for a tablet press according to claim 1, characterized in that: After calculating the tablet contour membership, it also includes: The tablet contour membership is normalized.
4. A tablet visual inspection method for a tablet press according to claim 1, characterized in that: The method for obtaining the initial tablet contour area is: Analyze the distances between different initial contour corner points in the same contour corner point sequence, as well as the tablet contour membership of each initial contour corner point, to obtain the tablet outer contour degree of each initial contour corner point; According to the degree of the outer contour of the tablet, all initial contour corner points are divided into several initial tablet contour corner point types; According to the image areas occupied by the types of the initial tablet contour corner points, several initial tablet contour areas are obtained.
5. A tablet visual inspection method for a tablet press according to claim 4, characterized in that: After calculating the degree of the tablet outer layer contour, it also includes: The degree of the outer contour of the tablet is normalized.
6. A tablet visual inspection method for a tablet press according to claim 1, characterized in that: The method for obtaining the normality of the tablet surface is: For any initial pill contour region, the initial contour corner points with the same grayscale value within the initial pill contour region are divided into a region internal contour corner point type; Analyze the grayscale distribution differences of the internal contour corner point types in different regions within the initial tablet contour area to obtain the contour grayscale uniformity of the initial tablet contour area; The chain code fluctuations of adjacent initial contour corner points under the same internal contour corner point type are analyzed to obtain the internal texture regularity of the initial tablet contour area. According to the contour grayscale uniformity and the internal texture regularity, the normality of the tablet surface in the initial tablet contour area is obtained; the normality of the tablet surface is positively correlated with the contour grayscale uniformity and positively correlated with the internal texture regularity.
7. A tablet visual inspection method for a tablet press according to claim 6, characterized in that: The method for obtaining the contour grayscale uniformity is: Obtain the mean difference in grayscale ratio between the contour corner type inside each region and the initial tablet contour region as a whole; Obtain the gradient amplitude variance of the contour corner point types inside all regions within the initial pill contour region; According to the grayscale proportion difference mean, gradient amplitude variance, and tablet contour membership, the contour grayscale uniformity of the initial tablet contour area is obtained; the contour grayscale uniformity is negatively correlated with the grayscale proportion difference mean, negatively correlated with the gradient amplitude variance, and positively correlated with the tablet contour membership.
8. A tablet visual inspection method for a tablet press according to claim 6, characterized in that: The method for obtaining the internal texture regularity is: For any region internal contour corner point type, the chain code values of different initial contour corner points under the region internal contour corner point type are combined in pairs to obtain several internal contour chain code combinations; The overall distribution stability of the internal contour chain code combination is analyzed to obtain the internal texture regularity of the initial tablet contour area.
9. A tablet visual inspection method for a tablet press according to claim 1, characterized in that: After calculating the normality of the tablet surface, it also includes: Normalize the tablet surface to normalize.
10. A tablet visual inspection system for a tablet press, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the steps of a method for visually inspecting tablets for a tablet press are implemented as described in any one of claims 1 to 9.
