Label pasting angle detection method and device, electronic equipment and storage medium
By extracting and binarizing the images of glare labels, combined with image matching technology, the problem of poor detection effect of glare labels in the prior art is solved, and higher recognition accuracy and reliability are achieved.
Patent Information
- Application Number
- CN202411622112.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-04-11
AI Technical Summary
When detecting the adhesion angle of the glare label, the detection effect is poor due to the unstable glare imaging.
By obtaining the template information of the image to be tested and the label to be tested, the image to be tested is extracted, and the mask image is binarized and processed. Then, the label image to be tested and the mask image are intercepted respectively to obtain the region of interest. Finally, through image matching technology, the standard label image is compared with the region of interest to accurately obtain the pasting angle of the label.
It significantly improves the recognition accuracy and reliability of labels with special visual effects, and effectively distinguishes and deals with interfering factors in the label, such as reflection, high exposure, distortion, etc.
Smart Images

Figure CN119810841A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular to a method, device, electronic device and storage medium for detecting a label sticking angle. Background Art
[0002] During the production of electronic devices, it is necessary to detect whether the labels attached to the electronic devices are skewed. The current detection methods mainly include angle extraction methods based on edge lines and angle extraction methods based on template matching. In the angle extraction method based on edge lines, feature points are first extracted according to the contrast of the image. Then, the extracted feature points are linearly fitted to obtain the edge lines of the label image. Finally, based on this edge line, the tilt angle of the label is determined. In the angle extraction method based on template matching, a template is first established using the design document image of the label or the standard image collected on site. Then, the template is used to perform template matching on the image to be tested. If the matching score exceeds the set threshold, the match is considered successful. The angle of the matching rectangular box outputted correspondingly is the tilt angle of the label attachment.
[0003] However, due to the unstable imaging of glare tags, the detection effects of the above two detection methods will be affected when applied to glare tags. Summary of the invention
[0004] The present disclosure provides a method, device, electronic device and storage medium for detecting a label sticking angle, so as to at least solve the above technical problems existing in the prior art.
[0005] According to a first aspect of the present disclosure, a method for detecting a label pasting angle is provided, the method comprising:
[0006] Acquire template information corresponding to the image to be tested and the label to be tested, wherein the template information includes a standard label image and position information;
[0007] Extracting the image to be tested according to the position information to obtain a label image to be tested;
[0008] Binarizing the label image to be tested to obtain a mask image;
[0009] Respectively intercepting the label image to be tested and the mask image to obtain a label region of interest and a mask region of interest;
[0010] The sticking angle of the label to be tested is obtained by performing image matching on the label region of interest, the mask region of interest and the standard label image.
[0011] In one possible implementation, obtaining template information corresponding to the tag to be tested includes:
[0012] Information is extracted from the label design document corresponding to the label to be tested to obtain template information.
[0013] In one possible implementation manner, the binarization processing of the label image to be tested to obtain a mask image includes:
[0014] The pixels whose grayscale values in the label image to be tested are less than the preset grayscale value are set to 255, and the pixels whose grayscale values are greater than or equal to the preset grayscale value are set to 0, so as to obtain a mask image.
[0015] In one possible implementation manner, the step of respectively intercepting the label image to be tested and the mask image to obtain the label region of interest and the mask region of interest includes:
[0016] Determine a rectangular cropping frame based on the size information of the label image to be tested;
[0017] The label image to be tested and the mask image are intercepted by the rectangular cropping frame to obtain a label region of interest and a mask region of interest.
[0018] In one possible implementation manner, the obtaining the pasting angle of the label to be tested by performing image matching on the label region of interest, the mask region of interest and the standard label image includes:
[0019] By performing image matching on the label region of interest, the mask region of interest and the standard label image, a tilt angle is obtained, wherein the tilt angle represents an angle at which the standard label image is tilted relative to the label region of interest;
[0020] The tilt angle is inverted to obtain the sticking angle of the label to be tested.
[0021] According to a second aspect of the present disclosure, a device for detecting a label pasting angle is provided, the device comprising:
[0022] An image acquisition module is used to acquire template information corresponding to the image to be tested and the label to be tested, wherein the template information includes a standard label image and position information;
[0023] A label extraction module, used to extract the image to be tested according to the position information to obtain a label image to be tested;
[0024] A binarization processing module is used to perform binarization processing on the label image to be tested to obtain a mask image;
[0025] An area of interest capture module, used to capture the label image to be tested and the mask image respectively to obtain a label area of interest and a mask area of interest;
[0026] The image matching module is used to obtain the sticking angle of the label to be tested by performing image matching on the label region of interest, the mask region of interest and the standard label image.
[0027] In one possible implementation manner, the image acquisition module is further used to extract information from a label design document corresponding to the label to be tested to obtain template information.
[0028] In one possible implementation, the binarization processing module is further used to set pixels in the label image to be tested whose grayscale values are less than a preset grayscale value to 255, and pixels whose grayscale values are greater than or equal to the preset grayscale value to 0, to obtain a mask image.
[0029] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0030] at least one processor; and
[0031] a memory communicatively connected to the at least one processor; wherein,
[0032] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method described in the present disclosure.
[0033] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the method described in the present disclosure.
[0034] The present invention discloses a method, device, electronic device and storage medium for detecting the label pasting angle, which utilizes template information to achieve accurate extraction of the label to be tested. By binarizing the extracted label image to be tested and generating a mask image, interference factors in the label, such as reflection, high exposure, distortion, etc., are effectively distinguished. The label pasting angle is accurately obtained by using masked image matching technology. When dealing with labels with special visual effects (such as glare), the recognition accuracy and reliability are significantly improved.
[0035] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings. In the accompanying drawings, several embodiments of the present disclosure are shown in an exemplary and non-limiting manner, in which:
[0037] In the drawings, the same or corresponding reference numerals represent the same or corresponding parts.
[0038] Figure 1 The following is a schematic diagram showing the implementation process of a method for detecting a label pasting angle according to an embodiment of the present disclosure. Figure 1 ;
[0039] Figure 2 The following is a schematic diagram showing the implementation process of a method for detecting a label pasting angle according to an embodiment of the present disclosure. Figure 2 ;
[0040] Figure 3 A schematic diagram of a tag region of interest according to an embodiment of the present disclosure is shown;
[0041] Figure 4 A schematic diagram of a mask region of interest according to an embodiment of the present disclosure is shown;
[0042] Figure 5 A schematic diagram showing the structure of a device for detecting a label sticking angle according to an embodiment of the present disclosure is shown;
[0043] Figure 6 A schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0044] In order to make the purpose, features, and advantages of the present disclosure more obvious and easy to understand, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, not all of the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present disclosure.
[0045] According to a first aspect of the embodiments of the present disclosure, a method for detecting a label pasting angle is provided. Figure 1 The following is a schematic diagram showing the implementation process of a method for detecting a label pasting angle according to an embodiment of the present disclosure. Figure 1 ,like Figure 1 As shown, the method comprises the following steps:
[0046] Step 101, obtaining template information corresponding to the image to be tested and the label to be tested, wherein the template information includes a standard label image and position information.
[0047] First, obtain the template information of the image to be tested and its corresponding label to be tested. The label to be tested here refers to the brand label, model label or other iconic label with special visual effects (such as glare effect) affixed to the product. Special visual effects refer to different visual effects that may be produced due to different sight angles. The image to be tested refers to an image that includes the product and the label to be tested on it. Due to the existence of special visual effects, the image to be tested may appear blurred, reflective or distorted by high exposure.
[0048] The template information includes the standard label image and position information. The standard label image is a clear, glare-free, standard label image. The position information is the specific location where the label is pasted on the product, including but not limited to the coordinates and size of the label.
[0049] Step 102: extract the image to be tested according to the position information to obtain a label image to be tested.
[0050] According to the coordinates and other information provided in the position information, the precise position of the label to be tested is located in the image to be tested. Then, operations such as cropping or segmentation are performed to extract the image portion of the label to be tested from the image to be tested, so as to obtain an image containing only the label to be tested and removing other labels that are larger than the background.
[0051] Step 103: binarize the label image to be tested to obtain a mask image.
[0052] Determine the appropriate threshold value based on the grayscale distribution of the label image to be tested. Compare each pixel value of the label image to be tested with the threshold value. If the pixel value is greater than or equal to the threshold value, it is regarded as the background part. If it is less than the pixel value, it is regarded as the foreground part, and a mask image containing only black and white pixel values is obtained. Since the reflective part usually has a higher grayscale value, it can be regarded as the background part during the binarization process. Therefore, the obtained mask image distinguishes the reflective or unclear parts of the label image to be tested from the rest.
[0053] Step 104 : intercept the label image to be tested and the mask image respectively to obtain a label region of interest and a mask region of interest.
[0054] First, according to the size of the label image to be tested, a rectangular cropping frame is calculated to extract the region of interest. Then, the rectangular cropping frame is used to crop the regions of interest from the label image to be tested and the mask image, respectively, to obtain the label region of interest and the mask region of interest, respectively.
[0055] Step 105 , obtaining the sticking angle of the label to be tested by performing image matching on the label region of interest, the mask region of interest and the standard label image.
[0056] In this step, a masked correlation image matching method is used. Specifically, the label region of interest is input as a template image. At the same time, the mask region of interest is input as a mask image to cover the areas of interference such as high exposure distortion in the label region of interest. Then the standard label image is input as the target data. The image represents the ideal form of the label and is used for comparison with the label region of interest. By applying the image matching algorithm, the area that best matches the label region of interest is found in the standard label image, and the inclination angle of the label region of interest relative to the area is calculated. This angle is the pasting angle of the label to be tested. It reflects the degree of inclination of the label to be tested relative to the preset angle when it is pasted on the device to be tested.
[0057] The technical solution of this embodiment uses template information to achieve accurate extraction of the label to be tested. By binarizing the extracted label image to be tested and generating a mask image, interference factors in the label, such as reflection, high exposure, distortion, etc., are effectively distinguished. The image matching technology with mask is used to accurately obtain the pasting angle of the label. When dealing with labels with special visual effects (such as glare), the accuracy and reliability of recognition are significantly improved.
[0058] In one embodiment of the present disclosure, the template information corresponding to the tag to be tested is obtained. Specifically, the template information can be obtained by extracting information from the tag design document corresponding to the tag to be tested.
[0059] Label design documents usually include all the design details and specification information of the label, such as the size, shape, text content, QR code style, and the specific location where the label should be affixed on the product. First, obtain the label design document corresponding to the label to be tested. Use information extraction methods such as text parsing and image recognition to accurately obtain the required template information from the label design document.
[0060] By extracting template information from label design documents, an accurate and reliable basis can be provided for subsequent processing steps, thereby ensuring the accuracy of the test results.
[0061] In one embodiment of the present disclosure, the test label image is binarized to obtain a mask image. Specifically, pixels in the test label image whose grayscale values are less than a preset grayscale value are set to 255, and pixels whose grayscale values are greater than or equal to the preset grayscale value are set to 0 to obtain a mask image.
[0062] First, the preset grayscale value is determined according to the grayscale distribution of the label image to be tested and the detection task, which is preferably 220 in this embodiment. Then, the grayscale value of each pixel of the label image to be tested is compared with the preset grayscale value. If the grayscale value of the pixel is less than the preset grayscale value, the pixel is regarded as a foreground pixel and is set to 255 (white). If the grayscale value of the pixel value is greater than or equal to the preset grayscale threshold, the pixel is regarded as a background pixel and is set to 0 (black). Then, a mask image containing only black and white colors is generated.
[0063] The binarization process in this step can effectively distinguish the foreground (clear area) and background (interference factors such as reflection, high exposure distortion, etc.) in the label image to be tested, providing clear and concise image data for subsequent processing steps.
[0064] In one embodiment of the present disclosure, the label image to be tested and the mask image are respectively intercepted to obtain the label region of interest and the mask region of interest, which can be specifically achieved through the following technical means: based on the size information of the label image to be tested, a rectangular cropping frame is determined; the label image to be tested and the mask image are intercepted by the rectangular cropping frame to obtain the label region of interest and the mask region of interest.
[0065] First, based on the size information of the label image to be tested, determine the size of the rectangular cropping frame. Specifically, take the center point of the label image to be tested as the reference, and then use 0.7 times its width and 0.7 times its height as the width and height of the cropping frame, respectively, to obtain a rectangular cropping frame. Then use the rectangular cropping frame to intercept the label image to be tested and the mask image respectively. The part intercepted from the label image to be tested is used as the label region of interest, and the part intercepted from the mask image is used as the mask region of interest.
[0066] In one embodiment of the present disclosure, the pasting angle of the label to be tested is obtained by performing image matching on the label region of interest, the mask region of interest and the standard label image. This can be specifically achieved through the following technical means: by performing image matching on the label region of interest, the mask region of interest and the standard label image, a tilt angle is obtained, and the tilt angle represents the tilt angle of the standard label image relative to the label region of interest; the tilt angle is negated to obtain the pasting angle of the label to be tested.
[0067] In this embodiment, the label region of interest is image matched with the standard label image. At the same time, the mask region of interest is introduced as an auxiliary to cover interference factors such as reflection and high exposure in the label region of interest. During the image matching process, the algorithm calculates the angle at which the standard label image is tilted relative to the label region of interest, that is, the tilt angle. Since the tilt angle is relative to the standard label image, what the solution needs to determine is the tilt angle of the label to be tested relative to the normal pasting direction, that is, the pasting angle. Therefore, it is necessary to reverse the direction of the tilt angle. The reversed angle is the pasting angle of the label to be tested, that is, the degree of inclination of the label to be tested relative to the preset direction when it is pasted on the product.
[0068] The above detection method is described as a whole through a specific implementation method as follows. Figure 2 As shown, the method comprises the following steps:
[0069] First, the standard label image and position information corresponding to the label to be tested are extracted from the label design document as template information. The standard label image is recorded as mLabelImg, and the position information is recorded as mRect.
[0070] Read the image to be tested dImg, and extract the label image to be tested based on the position information mRect in the template image, which is recorded as dLabelImg. The calculation method can refer to the following formula (1):
[0071] dLabelImg=dImg(mRect) (1)
[0072] Binarize the label image dLabelImg to obtain the mask information of the valid non-distorted image and obtain the mask image, which is recorded as dValidMask. The calculation method can refer to the following formula (2):
[0073]
[0074] Among them, dValidMask(i,j) is the pixel value of the coordinate corresponding to the mask image, (i,j) is the coordinate value of the two-dimensional image, dLabelImg(i,j) is the pixel value of the coordinate corresponding to the grayscale image of the label image to be tested, and T is the grayscale threshold, such as 220.
[0075] The center of the label image dLabelImg to be tested is taken as the center point, and the width and height are 0.7 times of the image height and width, and the ROIRect rectangular cropping frame is obtained. The label image dLabelImg to be tested and the mask image dValidMask are cut out using the ROIRect rectangular cropping frame to obtain the label region of interest dLabelImgROI (such as Figure 3) and the mask region of interest dValidMaskROI (as shown Figure 4 The calculation method can refer to the following formulas (3) to (8):
[0076]
[0077] ROIRect.width=dLabelImg.width*0.7 (5)
[0078] ROIRect.height=dLabelImg.height*0.7 (6)
[0079] dLabelImgROI=dLabelImg(ROIRect) (7)
[0080] dValidMaskROI=dValidMask(ROIRect) (8)
[0081] Among them, ROIRect.x, ROIRect.y, ROIRect.width and ROIRect.height are the x-coordinate, y-coordinate, width and height of the upper left corner of the rectangular cropping box at the cutout position. dLabelImg.width and dLabelImg.height are the width and height of the label image to be tested. dLabelImgROI is the label image to be tested after cutout, that is, the label region of interest. dValidMaskROI is the mask image after cutout, that is, the mask region of interest.
[0082] The label region of interest dLabelImgROI is used as the template input of the image matching algorithm, the mask region of interest dValidMaskROI is used as the mask input of the image matching algorithm, and the standard label image is recorded as mLabelImg as the target image input of the image matching algorithm to be tested. The masked correlation image matching is performed, and finally the tilt angle ang of the standard label image mLabelImg relative to the label image dLabelImg to be tested is obtained. Furthermore, the tilt angle -ang of the label image dLabelImg to be tested relative to the standard label image mLabelImg is obtained, that is, the pasting angle of the label to be tested.
[0083] According to a second aspect of the embodiments of the present disclosure, a device for detecting a label pasting angle is provided. Figure 5 As shown, the device comprises:
[0084] An image acquisition module 501 is used to acquire template information corresponding to the image to be tested and the label to be tested, wherein the template information includes a standard label image and position information;
[0085] The label extraction module 502 is used to extract the image to be tested according to the position information to obtain the label image to be tested;
[0086] A binarization processing module 503 is used to perform binarization processing on the label image to be tested to obtain a mask image;
[0087] An area of interest capture module 504 is used to capture the label image to be tested and the mask image respectively to obtain a label area of interest and a mask area of interest;
[0088] The image matching module 505 is used to obtain the sticking angle of the label to be tested by performing image matching on the label region of interest, the mask region of interest and the standard label image.
[0089] In one embodiment of the present disclosure, the image acquisition module 501 is further used to extract information from the label design document corresponding to the label to be tested, and obtain template information.
[0090] In one embodiment of the present disclosure, the binarization processing module 503 is further used to set pixels in the label image to be tested whose grayscale values are less than a preset grayscale value to 255, and pixels whose grayscale values are greater than or equal to the preset grayscale value to 0, to obtain a mask image.
[0091] In one embodiment of the present disclosure, the region of interest capture module 504 is further used to determine a rectangular cropping frame based on the size information of the label image to be tested; the label image to be tested and the mask image are captured by the rectangular cropping frame to obtain a label region of interest and a mask region of interest.
[0092] In one embodiment of the present disclosure, the image matching module 505 is also used to obtain a tilt angle by performing image matching on the label region of interest, the mask region of interest and the standard label image, wherein the tilt angle represents the tilt angle of the standard label image relative to the label region of interest; and to negate the tilt angle to obtain the pasting angle of the label to be tested.
[0093] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.
[0094] Figure 6A schematic block diagram of an example electronic device 800 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0095] like Figure 6 As shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0096] A number of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0097] The computing unit 801 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 801 performs the various methods and processes described above, such as a method for detecting a label pasting angle. For example, in some embodiments, a method for detecting a label pasting angle may be implemented as a computer software program, which is tangibly included in a machine-readable medium, such as a storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of a method for detecting a label pasting angle described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to execute a method for detecting a label sticking angle in any other appropriate manner (eg, by means of firmware).
[0098] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0099] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0100] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0101] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0102] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0103] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0104] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0105] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0106] The above is only a specific embodiment of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present disclosure, which should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for detecting a label pasting angle, characterized in that: The method comprises: Acquire template information corresponding to the image to be tested and the label to be tested, wherein the template information includes a standard label image and position information; Extracting the image to be tested according to the position information to obtain a label image to be tested; Binarizing the label image to be tested to obtain a mask image; Respectively intercepting the label image to be tested and the mask image to obtain a label region of interest and a mask region of interest; The sticking angle of the label to be tested is obtained by performing image matching on the label region of interest, the mask region of interest and the standard label image.
2. The method according to claim 1, characterized in that Get the template information corresponding to the tag to be tested, including: Information is extracted from the label design document corresponding to the label to be tested to obtain template information.
3. The method according to claim 1, characterized in that The binarization process is performed on the label image to be tested to obtain a mask image, including: The pixels whose grayscale values in the label image to be tested are less than the preset grayscale value are set to 255, and the pixels whose grayscale values are greater than or equal to the preset grayscale value are set to 0, so as to obtain a mask image.
4. The method according to claim 1, characterized in that: The method of respectively intercepting the label image to be tested and the mask image to obtain a label region of interest and a mask region of interest includes: Determine a rectangular cropping frame based on the size information of the label image to be tested; The label image to be tested and the mask image are intercepted by the rectangular cropping frame to obtain a label region of interest and a mask region of interest.
5. The method according to claim 1, characterized in that The method of obtaining the pasting angle of the label to be tested by performing image matching on the label region of interest, the mask region of interest and the standard label image comprises: By performing image matching on the label region of interest, the mask region of interest and the standard label image, a tilt angle is obtained, wherein the tilt angle represents an angle at which the standard label image is tilted relative to the label region of interest; The tilt angle is inverted to obtain the sticking angle of the label to be tested.
6. A device for detecting a label pasting angle, characterized in that: The device comprises: An image acquisition module is used to acquire template information corresponding to the image to be tested and the label to be tested, wherein the template information includes a standard label image and position information; A label extraction module, used to extract the image to be tested according to the position information to obtain a label image to be tested; A binarization processing module is used to perform binarization processing on the label image to be tested to obtain a mask image; An area of interest capture module, used to capture the label image to be tested and the mask image respectively to obtain a label area of interest and a mask area of interest; The image matching module is used to obtain the sticking angle of the label to be tested by performing image matching on the label region of interest, the mask region of interest and the standard label image.
7. The device according to claim 6, characterized in that The image acquisition module is also used to extract information from the label design document corresponding to the label to be tested to obtain template information.
8. The device according to claim 6, characterized in that The binarization processing module is further used to set the pixels in the label image to be tested whose grayscale values are less than a preset grayscale value to 255, and set the pixels whose grayscale values are greater than or equal to the preset grayscale value to 0, so as to obtain a mask image.
9. An electronic device, characterized in that: include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 5.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to make a computer execute the method according to any one of claims 1-5.