A drug appearance three-phase detection method, system, storage medium and electronic device

By identifying and analyzing the standard image of the drug appearance, judging the integrity and text content of the stamp area, calculating the character offset and outputting the adjustment parameters, it solves the problem of detection limitations in the existing technology and realizes the three-phase comprehensive inspection of the drug appearance. and equipment adjustments to improve detection accuracy and efficiency.

CN118379743BActive Publication Date: 2024-09-13JIANGZHONG PHARMA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410832007.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-26
Publication Date
2024-09-13
Estimated Expiration
2044-06-26

AI Technical Summary

Technical Problem

The existing three-phase drug appearance inspection method only detects whether the digital information is correct, and ignores printing position deviation, character adhesion, damage, overlap and missing printing. It cannot assist equipment adjustment, resulting in detection limitations.

Method used

By obtaining the standard image of the drug appearance, identifying and judging the integrity, proportion and text content of the stamped area, calculating the character offset, and outputting the printing equipment adjustment parameters according to the offset, the comprehensive detection and equipment of the three phases of drug appearance are achieved. Adjustment.

Benefits of technology

It achieves comprehensive inspection of the appearance of drugs in the third phase, can assist users in equipment adjustment, and improves the accuracy and efficiency of inspection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118379743B
    Figure CN118379743B
Patent Text Reader

Abstract

The present invention provides a method, system, storage medium and electronic device for detecting the three-phase appearance of a drug. The method obtains a standard image of the three-phase appearance of the drug and determines an identification area in the standard image; then identifies a steel stamp area in the identification area in the image to be detected, and determines whether the steel stamp area is complete; if so, obtains the length and pixel area of ​​the steel stamp area to determine whether the proportion of the steel stamp area is appropriate; if so, obtains the position information of the reference area and the steel stamp area respectively, and determines the character offset; determines whether the character offset meets a preset range; if so, identifies the text content in the steel stamp area, and determines whether the text content is consistent with the preset content; if so, determines that the result is qualified; if it is determined that the character offset does not meet the preset range, outputs the adjustment parameters of the device according to the character offset, so as to conduct a comprehensive inspection of the three-phase appearance of the drug, and assists the user in adjusting the device when defects occur in the appearance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of three-phase drug appearance detection, and in particular relates to a three-phase drug appearance detection method, system, storage medium and electronic equipment. Background Art

[0002] The three phases of a product refer to the batch number, expiration date and production date of the product. The three phases of a product are printed or sprayed on the packaging materials, including but not limited to small boxes, outer boxes, labels, etc. According to relevant regulations, the content printed or molded on the packaging materials should be clear and not easy to fade or erase.

[0003] Currently, pharmaceutical companies have a fast production speed, and traditional manual inspection cannot adapt to high-speed production. Phase III testing technology has come into being. By setting phase III information and confirming phase III compliance through image recognition and comparison, it replaces traditional manual inspection and has high application value.

[0004] The current detection method is that the user inputs the preset batch number, preset expiration date and preset production date of the product. When the sensor detects that a product is approaching the detection area, it identifies the object and transmits the identification result to the controller. The controller turns on the camera to collect image data. The controller identifies the batch number, production date and expiration date in the image data, and compares them with the preset information one by one. If the match is successful, it enters the next device. If the match is unsuccessful, the rejection device is turned on and an alarm is sounded. The above method only detects whether the digital information is correct, but ignores the detection of whether the printing position is deviated, whether the printed characters are sticky, damaged, overlapped, and whether there are any missing prints, which makes the detection more limited. Furthermore, when the above defects occur, it is impossible to assist the user to complete the equipment adjustment. Summary of the invention

[0005] Based on this, the present invention provides a three-phase drug appearance detection method, system, storage medium and electronic device, which aims to perform a comprehensive three-phase drug appearance detection, and at the same time, assist users to adjust the equipment when defects occur in the appearance.

[0006] A first aspect of an embodiment of the present invention provides a three-phase detection method for drug appearance, the method comprising:

[0007] Obtaining a standard image with three phases of drug appearance captured by a camera device, and determining a recognition area in the standard image;

[0008] Acquire an image to be detected, identify a steel stamp area in the identification area in the image to be detected, and determine whether the steel stamp area is complete;

[0009] If it is determined that the steel stamp area is complete, the length and pixel area of ​​the steel stamp area are obtained, and whether the proportion of the steel stamp area is appropriate is determined based on the length and the pixel area;

[0010] If it is determined that the proportion of the steel stamp area is appropriate, obtaining first position information of the reference area and second position information of the steel stamp area, and determining the character offset according to the first position information and the second position information;

[0011] Determine whether the character offset meets a preset range;

[0012] If it is determined that the character offset meets the preset range, the text content in the stamp area is identified, and it is determined whether the text content is consistent with the preset content;

[0013] If the text content is determined to be consistent with the preset content, the result is determined to be qualified;

[0014] If it is determined that the character offset does not meet the preset range, then outputting adjustment parameters of the character station of the corresponding printing device according to the character offset;

[0015] The steps of acquiring the image to be detected, identifying the steel stamp area in the identification area in the image to be detected, and determining whether the steel stamp area is complete include:

[0016] Acquire an image to be detected, determine the background color of the image to be detected, and determine the outline of the steel stamp according to the background color and the color of the pixels in the identification area of ​​the image to be detected;

[0017] Determine whether the steel stamp outline intersects with the boundary of the recognition area;

[0018] If it is determined that the steel stamp outline intersects with the boundary of the identification area, then it is determined that the steel stamp area is incomplete;

[0019] If it is determined that the steel stamp outline does not intersect with the boundary of the identification area, the steel stamp area is determined to be complete.

[0020] Furthermore, if it is determined that the steel stamp area is complete, the step of obtaining the length and pixel area of ​​the steel stamp area, and judging whether the proportion of the steel stamp area is appropriate according to the length and the pixel area includes:

[0021] Obtaining a first preset distance on the X-axis and a second preset distance on the Y-axis, and dividing the steel stamp outline into a plurality of steel stamp sub-areas according to the first preset distance and the second preset distance;

[0022] Respectively obtain the length and pixel area of ​​each of the steel stamp sub-regions, and determine the corresponding pixel area threshold according to the length of each of the steel stamp sub-regions;

[0023] Determine in sequence whether the pixel area of ​​each of the steel stamp sub-regions is greater than the corresponding pixel area threshold;

[0024] If it is determined in sequence that the pixel areas of each of the steel stamp sub-regions are greater than the corresponding pixel area thresholds, then it is determined that the proportion of the steel stamp region is appropriate.

[0025] Furthermore, the step of obtaining a first preset distance on the X-axis and a second preset distance on the Y-axis, and dividing the steel stamp contour into a plurality of steel stamp sub-areas according to the first preset distance and the second preset distance includes:

[0026] Obtaining the extreme point coordinates of each continuous steel stamp contour, the extreme point coordinates include the extreme point coordinates in four directions: up, down, left, and right, and framing the contour areas respectively according to the extreme point coordinates;

[0027] According to the coordinates of the extreme points of each continuous steel stamp contour, the distance between adjacent contour areas is obtained;

[0028] Obtain a first preset distance on the X-axis and a second preset distance on the Y-axis, and merge the corresponding contour areas according to the first preset distance, the second preset distance and the distance between adjacent contour areas to form the steel stamp area.

[0029] Furthermore, the step of obtaining a first preset distance on the X-axis and a second preset distance on the Y-axis, and fusing the corresponding contour areas according to the first preset distance, the second preset distance and the distance of adjacent contour areas to form the steel stamp sub-area includes:

[0030] Step 1: obtain a first contour area at the upper left corner, and obtain a distance between the first contour area and an adjacent contour area in the X-axis direction, and determine whether the distance is less than the first preset distance;

[0031] Step 2: If it is determined that the spacing is less than the first preset distance, the upper extreme point coordinates and the lower extreme point coordinates of the first contour area and the contour area adjacent to the first contour area are respectively obtained, and the upper extreme point coordinates and the lower extreme point coordinates are respectively compared to determine the target upper extreme point coordinates and the target lower extreme point coordinates;

[0032] Step 3: redraw the contour area according to the target upper extreme point coordinates and the target lower extreme point coordinates, as well as the left extreme point coordinates of the first contour area and the right extreme point coordinates of the contour area adjacent to the first contour area, and define the redrawn contour area as the first contour area to complete contour area fusion;

[0033] Step 4, looping steps 1 to 3 until the contour area in the X-axis direction is completely fused to form a steel stamp area;

[0034] Step 5, obtaining the coordinates of the upper extreme points of each contour area below the formed steel stamp sub-area, calculating the distance between the coordinates of each upper extreme point and the lower boundary of the formed steel stamp sub-area, and determining whether the distance is greater than the second preset distance;

[0035] Step 6: If yes, the leftmost contour area is determined as the first contour area, and steps 1 to 3 are repeated until the contour areas in the X-axis direction are completely merged to form a steel stamp area;

[0036] Step seven, loop step five to step six to form all the steel stamp areas.

[0037] Furthermore, the step of obtaining the first position information of the reference area and the second position information of the stamp area, and determining the character offset according to the first position information and the second position information includes:

[0038] Get the center point coordinates and right extreme point coordinates of the reference area, as well as the center point coordinates and left extreme point coordinates of the corresponding stamp area;

[0039] Determine the character offset in the Y-axis direction according to the ordinate of the center point coordinate of the reference area and the ordinate of the center point coordinate of the corresponding stamp area;

[0040] The character offset in the X-axis direction is determined according to the coordinates of the right extreme point of the reference area and the coordinates of the left extreme point of the corresponding stamp area.

[0041] Furthermore, in the step of outputting the adjustment parameters of the corresponding printing device character station according to the character offset, the adjustment parameters of the corresponding printing device character station are output by inputting the character offset into a pre-established mapping relationship between the character offset and the adjustment parameter.

[0042] A second aspect of an embodiment of the present invention provides a three-phase drug appearance detection system, which is used to implement the three-phase drug appearance detection method provided in the first aspect, and the system includes:

[0043] An acquisition module, used to acquire a standard image with three phases of drug appearance captured by a camera device, and determine a recognition area in the standard image;

[0044] A first judgment module is used to obtain an image to be detected, identify a steel stamp area in the identification area in the image to be detected, and determine whether the steel stamp area is complete;

[0045] A second judgment module is used to obtain the length and pixel area of ​​the steel stamp area if it is judged that the steel stamp area is complete, and judge whether the proportion of the steel stamp area is appropriate according to the length and the pixel area;

[0046] A character offset determination module, for obtaining first position information of a reference area and second position information of the steel stamp area if it is determined that the proportion of the steel stamp area is appropriate, and determining a character offset according to the first position information and the second position information;

[0047] A third judgment module is used to judge whether the character offset meets a preset range;

[0048] A fourth judgment module is used to identify the text content in the stamp area and judge whether the text content is consistent with the preset content if it is judged that the character offset meets the preset range;

[0049] A determination module, used for determining that if the text content is consistent with the preset content, the determination result is qualified;

[0050] The adjustment parameter output module is used to output the adjustment parameter of the character station of the corresponding printing device according to the character offset if it is determined that the character offset does not meet the preset range.

[0051] A third aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the three-phase drug appearance detection method provided in the first aspect.

[0052] The fourth aspect of an embodiment of the present invention provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the three-phase drug appearance detection method provided in the first aspect is implemented.

[0053] A method, system, storage medium and electronic device for detecting the three-phase appearance of a drug provided in an embodiment of the present invention, the method obtains a standard image of the three-phase appearance of the drug and determines an identification area in the standard image; then identifies the stamped area in the identification area in the image to be detected, and determines whether the stamped area is complete; if so, obtains the length and pixel area of ​​the stamped area to determine whether the proportion of the stamped area is appropriate; if so, obtains the first position information of the reference area and the second position information of the stamped area to determine the character offset; determines whether the character offset meets a preset range; if so, identifies the text content in the stamped area and determines whether the text content is consistent with the preset content; if so, determines that the result is qualified; if it is determined that the character offset does not meet the preset range, outputs the adjustment parameters of the corresponding printing device character station according to the character offset, so as to conduct a comprehensive inspection of the three-phase appearance of the drug, and assist the user in adjusting the equipment when defects occur in the appearance. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 A flowchart of a method for three-phase drug appearance detection provided in Example 1 of the present invention;

[0055] Figure 2 A structural block diagram of a drug appearance three-phase detection system provided in Embodiment 2 of the present invention;

[0056] Figure 3 This is a structural block diagram of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0057] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0058] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0059] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0060] Embodiment 1

[0061] According to an embodiment of the present invention, a method for three-phase detection of drug appearance is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0062] In this embodiment 1, a three-stage drug appearance detection method is provided, which can be used in electronic devices, such as computers, see Figure 1 , Figure 1 A flowchart of a method for three-phase drug appearance detection provided by the first embodiment of the present invention is shown, which specifically includes steps S01 to S08.

[0063] Step S01, obtaining a standard image with three phases of drug appearance captured by a camera device, and determining a recognition area in the standard image.

[0064] Generally, the camera device and the light source are fixed at preset positions, and the medicine box is conveyed to the camera device via a conveyor belt. Under the illumination of the light source, the camera device is controlled to collect the image of the medicine box. The light can highlight the three-phase steel stamp of the medicine appearance, that is, the concave part.

[0065] Specifically, a standard part of the three-phase appearance of a drug can be made, and the standard part can be transmitted to the front of the camera device in a fixed placement position (consistent with actual production, and can be controlled by tooling to ensure consistency of position), and the standard image of the standard part collected by the camera device is controlled. In this embodiment, the recognition area in the standard image is manually marked. It can be understood that when performing the three-phase recognition of the appearance of a drug, only the range of the marked recognition area is recognized, and there is no need to recognize the entire image of the drug box, which improves the recognition efficiency. At the same time, multiple recognition areas can be set according to actual needs. For example, the drug box also has its own three-phase information name, such as "

Product Batch Number

Expiration Date

Production Date

[0066] It can be understood that by identifying the recognition area of ​​the three-phase information name on the medicine box, a reference area is obtained for subsequent character offset analysis.

[0067] In addition, a plane rectangular coordinate system is established according to the standard image. For example, the minimum unit of the horizontal and vertical coordinates in the plane rectangular coordinate system is a pixel.

[0068] Step S02, obtaining the image to be detected, identifying the stamped area in the identification area in the image to be detected, and determining whether the stamped area is complete. If so, executing step S03.

[0069] Specifically, the image to be detected is obtained, and the background color of the image to be detected is determined. It should be noted that the background color is generally white, which can be manually specified or set, and the outline of the steel stamp is determined according to the background color and the color of the pixels in the identification area of ​​the image to be detected. In this embodiment, the RGB values ​​of all the pixels in the identification area of ​​the image to be detected are obtained, and according to the RGB range value of the background color, the target pixel whose RGB value is within the RGB range value is determined, and then the target pixel is deducted from the identification area of ​​the image to be detected, and the remaining pixels will form the outline of the steel stamp;

[0070] Determine whether the steel stamp contour intersects with the boundary of the recognition area. Specifically, determine the boundary pixel coordinates, and determine the coordinates adjacent to the boundary pixel coordinates based on the boundary pixel coordinates. At the same time, obtain the pixel coordinates of the steel stamp contour, and determine whether the pixel coordinates of the steel stamp contour overlap with the coordinates adjacent to the boundary pixel coordinates. If so, determine the overlapping coordinates and count the number of overlapping coordinates. It can be understood that the overlap of coordinates can indicate that the steel stamp contour exceeds the boundary or is close to the boundary. In order to make a certain degree of distinction, determine whether the number of overlapping coordinates is greater than a threshold. If so, it means that the steel stamp contour intersects with the boundary of the recognition area. If not, it means that the steel stamp contour does not intersect with the boundary of the recognition area.

[0071] If the steel stamp outline is judged to intersect with the boundary of the recognition area, the steel stamp area is judged to be incomplete;

[0072] If the steel stamp outline is judged not to intersect with the boundary of the recognition area, the steel stamp area is judged to be complete.

[0073] In step S03, the length and pixel area of ​​the stamped area are obtained, and based on the length and the pixel area, whether the proportion of the stamped area is appropriate is determined. If so, step S04 is executed.

[0074] Specifically, a first preset distance on the X-axis and a second preset distance on the Y-axis are obtained, and the steel stamp contour is divided into a number of steel stamp sub-areas according to the first preset distance and the second preset distance. It should be noted that the extreme point coordinates of each continuous steel stamp contour are obtained, and the extreme point coordinates include the extreme point coordinates in the four directions of up, down, left and right, and the contour areas are framed according to the extreme point coordinates. For example, taking the production date of 20240309 as an example, there are 8 characters, and each character will form a steel stamp contour. First, the extreme point coordinates in the four directions of up, down, left and right of each character are determined, that is, the pixel coordinate points. It should be noted that when there are multiple extreme point coordinates, it does not affect the determination of the contour area, wherein the contour area is a rectangular frame that frames each character. In addition, by counting the number of contour areas, it is also possible to detect whether there are problems of missing, overlapping, and adhesion of the steel stamp. When the preset number of characters does not correspond to the number of contour areas, there are problems of missing, overlapping, and adhesion of the steel stamp.

[0075] According to the coordinates of the extreme points of each continuous steel stamp contour, the distance between adjacent contour areas is obtained. It can be understood that the distance between adjacent contour areas is the shortest distance between two rectangular frames.

[0076] Obtain a first preset distance on the X-axis and a second preset distance on the Y-axis, and merge corresponding contour areas according to the first preset distance, the second preset distance, and the distance of adjacent contour areas to form a steel stamp sub-area. Specifically, in step 1, according to the coordinate system, obtain the first contour area in the upper left corner, and obtain the spacing between the first contour area and the adjacent contour area in the X-axis direction, and determine whether the spacing is less than the first preset distance;

[0077] Step 2: If it is determined that the spacing is less than the first preset distance, the upper extreme point coordinates and the lower extreme point coordinates of the first contour area and the contour area adjacent to the first contour area are respectively obtained, and the upper extreme point coordinates and the lower extreme point coordinates are respectively compared to determine the target upper extreme point coordinates and the target lower extreme point coordinates;

[0078] Step 3: redraw the contour area according to the coordinates of the target upper extreme point and the target lower extreme point, as well as the coordinates of the left extreme point of the first contour area and the coordinates of the right extreme point of the contour area adjacent to the first contour area, and define the redrawn contour area as the first contour area to complete the contour area fusion;

[0079] Step 4, looping steps 1 to 3 until the contour area in the X-axis direction is completely fused to form a steel stamp area;

[0080] Step 5, obtaining the coordinates of the upper extreme points of each contour area below the formed steel stamp sub-area, calculating the distance between the coordinates of each upper extreme point and the lower boundary of the formed steel stamp sub-area, and determining whether the distance is greater than the second preset distance;

[0081] Step 6: If yes, the leftmost contour area is determined as the first contour area, and steps 1 to 3 are repeated until the contour areas in the X-axis direction are completely merged to form a steel stamp area;

[0082] Step 7, looping steps 5 to 6 to form all the steel stamp areas;

[0083] The length and pixel area of ​​each steel stamp sub-region are obtained respectively, and the corresponding pixel area threshold is determined according to the length of each steel stamp sub-region;

[0084] Determine in turn whether the pixel area of ​​each steel stamp sub-region is greater than the corresponding pixel area threshold;

[0085] If it is determined in turn that the pixel areas of each stamp sub-region are greater than the corresponding pixel area threshold, then it is determined that the proportion of the stamp region is appropriate.

[0086] Step S04, obtaining the first position information of the reference area and the second position information of the stamped area, and determining the character offset according to the first position information and the second position information.

[0087] Specifically, the coordinates of the center point and the right extreme point of the reference area, as well as the coordinates of the center point and the left extreme point of the corresponding stamp area are obtained. Multiple reference areas can be set. For example, the area where "

Product Batch Number

Expiration Date

Production Date

[0088] Determine the character offset in the Y-axis direction according to the ordinate of the center point coordinate of the reference area and the ordinate of the center point coordinate of the corresponding stamp area;

[0089] The character offset in the X-axis direction is determined according to the coordinates of the right extreme point of the reference area and the coordinates of the left extreme point of the corresponding stamp area.

[0090] Step S05, determining whether the character offset meets a preset range, if so, executing step S06, if not, executing step S08.

[0091] In step S06, the text content in the stamped area is identified, and it is determined whether the text content is consistent with the preset content. If so, step S07 is executed.

[0092] In this embodiment, the text content in the stamped area may be captured by using OCR (Optical Character Recognition) technology.

[0093] Step S07: the result is judged to be qualified.

[0094] Step S08: outputting adjustment parameters of the character station of the corresponding printing device according to the character offset.

[0095] By inputting the character offset into the pre-established mapping relationship between the character offset and the adjustment parameter, the adjustment parameter of the corresponding character station of the printing device is output. In this embodiment, in actual production, 20 pixels correspond to about 1 mm. If the up and down offset exceeds the set value, the character station of the printing device can be adjusted forward and backward according to the correspondence relationship between the exceeded pixels and millimeters.

[0096] In summary, the three-phase drug appearance detection method in the above-mentioned embodiment of the present invention obtains a standard image of the three-phase drug appearance and determines the identification area in the standard image; then identifies the stamped area in the identification area in the image to be detected, and determines whether the stamped area is complete; if so, obtains the length and pixel area of ​​the stamped area to determine whether the proportion of the stamped area is appropriate; if so, obtains the first position information of the reference area and the second position information of the stamped area to determine the character offset; determines whether the character offset meets the preset range; if so, identifies the text content in the stamped area and determines whether the text content is consistent with the preset content; if so, the result is determined to be qualified; if it is determined that the character offset does not meet the preset range, then outputs the adjustment parameters of the corresponding printing device character station according to the character offset, so as to conduct a comprehensive inspection of the three-phase drug appearance, and when defects occur in the appearance, assists the user to adjust the equipment.

[0097] Embodiment 2

[0098] See also Figure 2 , Figure 2 1 is a block diagram of a drug appearance three-phase detection system provided in Example 2 of the present invention. The drug appearance three-phase detection system 200 is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0099] Specifically, the drug appearance phase III detection system 200 includes: an acquisition module 21, a first judgment module 22, a second judgment module 23, a character offset determination module 24, a third judgment module 25, a fourth judgment module 26, a determination module 27 and an adjustment parameter output module 28, wherein:

[0100] An acquisition module 21 is used to acquire a standard image with three phases of drug appearance captured by a camera device, and determine a recognition area in the standard image;

[0101] The first judgment module 22 is used to obtain the image to be detected, identify the steel stamp area in the identification area in the image to be detected, and determine whether the steel stamp area is complete;

[0102] The second judgment module 23 is used to obtain the length and pixel area of ​​the steel-printed area if it is judged that the steel-printed area is complete, and judge whether the proportion of the steel-printed area is appropriate according to the length and the pixel area;

[0103] A character offset determination module 24 is used to obtain first position information of a reference area and second position information of the steel stamp area if it is determined that the proportion of the steel stamp area is appropriate, and determine a character offset according to the first position information and the second position information;

[0104] A third judging module 25, used to judge whether the character offset meets a preset range;

[0105] The fourth judgment module 26 is used to identify the text content in the stamp area and judge whether the text content is consistent with the preset content if it is judged that the character offset meets the preset range;

[0106] A determination module 27, configured to determine that the text content is consistent with the preset content, and then determine that the result is qualified;

[0107] The adjustment parameter output module 28 is used to output the adjustment parameters of the corresponding printing device character station according to the character offset if it is determined that the character offset does not meet the preset range, wherein the adjustment parameters of the corresponding printing device character station are output by inputting the character offset into a pre-established mapping relationship between the character offset and the adjustment parameter.

[0108] Further, in some optional embodiments of the present invention, the first determination module 22 includes:

[0109] A steel stamp contour determination unit, used to obtain an image to be detected, determine the background color of the image to be detected, and determine the steel stamp contour according to the background color and the color of the pixels in the identification area in the image to be detected;

[0110] A first judgment unit, used to judge whether the outline of the steel stamp intersects with the boundary of the recognition area;

[0111] A second judgment unit, configured to judge that the steel stamp area is incomplete if it is judged that the steel stamp outline intersects with the boundary of the recognition area;

[0112] The third judgment unit is used to judge that the steel stamp area is complete if it is determined that the steel stamp outline does not intersect with the boundary of the recognition area.

[0113] Further, in some optional embodiments of the present invention, the second determination module 23 includes:

[0114] a division unit, configured to obtain a first preset distance on the X-axis and a second preset distance on the Y-axis, and divide the steel stamp contour into a plurality of steel stamp sub-areas according to the first preset distance and the second preset distance;

[0115] A first determination unit is used to respectively obtain the length and pixel area of ​​each of the steel stamp sub-regions, and determine the corresponding pixel area threshold according to the length of each of the steel stamp sub-regions;

[0116] A fourth judgment unit is used to judge in turn whether the pixel area of ​​each of the steel stamp sub-regions is greater than the corresponding pixel area threshold;

[0117] The fifth judgment unit is used to judge that the proportion of the steel stamp area is appropriate if it is judged in sequence that the pixel area of ​​each steel stamp sub-area is greater than the corresponding pixel area threshold.

[0118] Further, in some optional embodiments of the present invention, the division unit includes:

[0119] A framing subunit is used to obtain the extreme point coordinates of each continuous steel stamp contour, wherein the extreme point coordinates include the extreme point coordinates in four directions: up, down, left, and right, and to frame contour areas respectively according to the extreme point coordinates;

[0120] An acquisition subunit is used to acquire the distance between adjacent contour areas according to the extreme point coordinates of each continuous steel stamp contour;

[0121] The fusion subunit is used to obtain a first preset distance on the X-axis and a second preset distance on the Y-axis, and fuse the corresponding contour areas according to the first preset distance, the second preset distance and the distance of the adjacent contour areas to form the steel stamp sub-area, specifically including:

[0122] Step 1: obtain a first contour area at the upper left corner, and obtain a distance between the first contour area and an adjacent contour area in the X-axis direction, and determine whether the distance is less than the first preset distance;

[0123] Step 2: If it is determined that the spacing is less than the first preset distance, the upper extreme point coordinates and the lower extreme point coordinates of the first contour area and the contour area adjacent to the first contour area are respectively obtained, and the upper extreme point coordinates and the lower extreme point coordinates are respectively compared to determine the target upper extreme point coordinates and the target lower extreme point coordinates;

[0124] Step 3: redraw the contour area according to the target upper extreme point coordinates and the target lower extreme point coordinates, as well as the left extreme point coordinates of the first contour area and the right extreme point coordinates of the contour area adjacent to the first contour area, and define the redrawn contour area as the first contour area to complete contour area fusion;

[0125] Step 4, looping steps 1 to 3 until the contour area in the X-axis direction is completely fused to form a steel stamp area;

[0126] Step 5, obtaining the coordinates of the upper extreme points of each contour area below the formed steel stamp sub-area, calculating the distance between the coordinates of each upper extreme point and the lower boundary of the formed steel stamp sub-area, and determining whether the distance is greater than the second preset distance;

[0127] Step 6: If yes, the leftmost contour area is determined as the first contour area, and steps 1 to 3 are repeated until the contour areas in the X-axis direction are completely merged to form a steel stamp area;

[0128] Step seven, loop step five to step six to form all the steel stamp areas.

[0129] Further, in some optional embodiments of the present invention, the character offset determination module 24 includes:

[0130] A coordinate acquisition unit, used to acquire the center point coordinates and the right extreme point coordinates of the reference area, and the center point coordinates and the left extreme point coordinates of the corresponding stamp area;

[0131] A first character offset determination unit, used to determine the character offset in the Y-axis direction according to the ordinate of the center point coordinate of the reference area and the ordinate of the center point coordinate of the corresponding steel stamp area;

[0132] The second character offset determination unit is used to determine the character offset in the X-axis direction according to the right extreme point coordinates of the reference area and the left extreme point coordinates of the corresponding stamp area.

[0133] Embodiment 3

[0134] Another aspect of the present invention provides an electronic device, see Figure 3 , shown is an electronic device in Embodiment 3 of the present invention, including a memory 20, a processor 10, and a computer program 30 stored in the memory and executable on the processor, wherein when the processor 10 executes the computer program 30, the three-phase drug appearance detection method as described above is implemented.

[0135] In some embodiments, the processor 10 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 20, such as executing access restriction programs.

[0136] Among them, the memory 20 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 20 can be an internal storage unit of an electronic device, such as a hard disk of the electronic device. In other embodiments, the memory 20 can also be an external storage device of an electronic device, such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Further, the memory 20 can also include both an internal storage unit of the electronic device and an external storage device. The memory 20 can not only be used to store application software and various types of data of the electronic device, but also can be used to temporarily store data that has been output or is to be output.

[0137] It should be pointed out that Figure 3 The structure shown does not constitute a limitation on the electronic device. In other embodiments, the electronic device may include fewer or more components than those shown in the figure, or combine certain components, or arrange the components differently.

[0138] The embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-mentioned three-phase drug appearance detection method.

[0139] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0140] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0141] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0142] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0143] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the attached claims.

Claims

1. A three-phase drug appearance detection method, characterized in that: The method comprises: Obtaining a standard image with three phases of drug appearance captured by a camera device, and determining a recognition area in the standard image; Acquire an image to be detected, identify a steel stamp area in the identification area in the image to be detected, and determine whether the steel stamp area is complete; If it is determined that the steel stamp area is complete, the length and pixel area of ​​the steel stamp area are obtained, and whether the proportion of the steel stamp area is appropriate is determined based on the length and the pixel area; If it is determined that the proportion of the steel stamp area is appropriate, obtaining first position information of the reference area and second position information of the steel stamp area, and determining the character offset according to the first position information and the second position information; Determine whether the character offset meets a preset range; If it is determined that the character offset meets the preset range, the text content in the stamp area is identified, and it is determined whether the text content is consistent with the preset content; If the text content is determined to be consistent with the preset content, the result is determined to be qualified; If it is determined that the character offset does not meet the preset range, then outputting adjustment parameters of the character station of the corresponding printing device according to the character offset; The steps of acquiring the image to be detected, identifying the steel stamp area in the identification area in the image to be detected, and determining whether the steel stamp area is complete include: Acquire an image to be detected, determine the background color of the image to be detected, and determine the outline of the steel stamp according to the background color and the color of the pixels in the identification area of ​​the image to be detected; Determine whether the steel stamp outline intersects with the boundary of the recognition area; If it is determined that the steel stamp outline intersects with the boundary of the identification area, then it is determined that the steel stamp area is incomplete; If it is determined that the steel stamp outline does not intersect with the boundary of the identification area, then the steel stamp area is determined to be complete; If it is determined that the steel stamp area is complete, the step of obtaining the length and pixel area of ​​the steel stamp area, and judging whether the proportion of the steel stamp area is appropriate according to the length and the pixel area includes: Obtaining a first preset distance on the X-axis and a second preset distance on the Y-axis, and dividing the steel stamp outline into a plurality of steel stamp sub-areas according to the first preset distance and the second preset distance; Respectively obtain the length and pixel area of ​​each of the steel stamp sub-regions, and determine the corresponding pixel area threshold according to the length of each of the steel stamp sub-regions; Determine in sequence whether the pixel area of ​​each of the steel stamp sub-regions is greater than the corresponding pixel area threshold; If it is determined in sequence that the pixel areas of the steel stamp sub-regions are all greater than the corresponding pixel area thresholds, then it is determined that the proportion of the steel stamp region is appropriate; The step of obtaining a first preset distance on the X-axis and a second preset distance on the Y-axis, and dividing the steel stamp contour into a plurality of steel stamp sub-areas according to the first preset distance and the second preset distance comprises: Obtaining the extreme point coordinates of each continuous steel stamp contour, the extreme point coordinates include the extreme point coordinates in four directions: up, down, left, and right, and framing the contour areas respectively according to the extreme point coordinates; According to the coordinates of the extreme points of each continuous steel stamp contour, the distance between adjacent contour areas is obtained; Obtain a first preset distance on the X-axis and a second preset distance on the Y-axis, and merge the corresponding contour areas according to the first preset distance, the second preset distance and the distance between adjacent contour areas to form the steel stamp area.

2. The three-phase drug appearance detection method according to claim 1, characterized in that: The step of obtaining a first preset distance on the X-axis and a second preset distance on the Y-axis, and fusing the corresponding contour areas according to the first preset distance, the second preset distance and the distance of adjacent contour areas to form the steel stamp sub-area comprises: Step 1: obtain a first contour area at the upper left corner, and obtain a distance between the first contour area and an adjacent contour area in the X-axis direction, and determine whether the distance is less than the first preset distance; Step 2: If it is determined that the spacing is less than the first preset distance, the upper extreme point coordinates and the lower extreme point coordinates of the first contour area and the contour area adjacent to the first contour area are respectively obtained, and the upper extreme point coordinates and the lower extreme point coordinates are respectively compared to determine the target upper extreme point coordinates and the target lower extreme point coordinates; Step 3: redraw the contour area according to the target upper extreme point coordinates and the target lower extreme point coordinates, as well as the left extreme point coordinates of the first contour area and the right extreme point coordinates of the contour area adjacent to the first contour area, and define the redrawn contour area as the first contour area to complete contour area fusion; Step 4, looping steps 1 to 3 until the contour area in the X-axis direction is completely fused to form a steel stamp area; Step 5, obtaining the coordinates of the upper extreme points of each contour area below the formed steel stamp sub-area, calculating the distance between the coordinates of each upper extreme point and the lower boundary of the formed steel stamp sub-area, and determining whether the distance is greater than the second preset distance; Step 6: If yes, the leftmost contour area is determined as the first contour area, and steps 1 to 3 are repeated until the contour areas in the X-axis direction are completely merged to form a steel stamp area; Step seven, loop step five to step six to form all the steel stamp areas.

3. The three-phase drug appearance detection method according to claim 2, characterized in that: The step of obtaining the first position information of the reference area and the second position information of the stamp area, and determining the character offset according to the first position information and the second position information comprises: Get the center point coordinates and right extreme point coordinates of the reference area, as well as the center point coordinates and left extreme point coordinates of the corresponding stamp area; Determine the character offset in the Y-axis direction according to the ordinate of the center point coordinate of the reference area and the ordinate of the center point coordinate of the corresponding stamp area; The character offset in the X-axis direction is determined according to the coordinates of the right extreme point of the reference area and the coordinates of the left extreme point of the corresponding stamp area.

4. The three-phase drug appearance detection method according to claim 3, characterized in that: In the step of outputting the adjustment parameters of the corresponding printing device character station according to the character offset, the adjustment parameters of the corresponding printing device character station are output by inputting the character offset into a pre-established mapping relationship between the character offset and the adjustment parameter.

5. A three-phase drug appearance detection system, characterized in that: Used to implement the three-phase drug appearance detection method according to any one of claims 1 to 4, the system comprises: An acquisition module, used to acquire a standard image with three phases of drug appearance captured by a camera device, and determine a recognition area in the standard image; A first judgment module is used to obtain an image to be detected, identify a steel stamp area in the identification area in the image to be detected, and determine whether the steel stamp area is complete; A second judgment module is used to obtain the length and pixel area of ​​the steel stamp area if it is judged that the steel stamp area is complete, and judge whether the proportion of the steel stamp area is appropriate according to the length and the pixel area; A character offset determination module, for obtaining first position information of a reference area and second position information of the steel stamp area if it is determined that the proportion of the steel stamp area is appropriate, and determining a character offset according to the first position information and the second position information; A third judgment module is used to judge whether the character offset meets a preset range; A fourth judgment module is used to identify the text content in the stamp area and judge whether the text content is consistent with the preset content if it is judged that the character offset meets the preset range; A determination module, used for determining that if the text content is consistent with the preset content, the determination result is qualified; The adjustment parameter output module is used to output the adjustment parameter of the character station of the corresponding printing device according to the character offset if it is determined that the character offset does not meet the preset range.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the three-phase drug appearance detection method as described in any one of claims 1 to 4 is implemented.

7. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the three-phase drug appearance detection method as described in any one of claims 1 to 4 is implemented.