A leather cutting rate detection method based on QR code
By using QR code recognition technology and industrial camera image processing in leather cutting rate detection, the problem of inconsistent cutting rate caused by manual operation is solved, high-accurate cutting rate detection and real-time monitoring are achieved, and leather waste is reduced .
Patent Information
- Application Number
- CN202411542091.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-31
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2044-10-31
AI Technical Summary
In the prior art, leather cutting rate detection relies on manual operation, resulting in inconsistent cutting rates, causing leather waste, and it is difficult to achieve real-time monitoring and problem solving.
The leather cutting rate detection method based on QR code is used to obtain leather and knife mold images through industrial cameras, and the number and size of knife molds are obtained using QR code recognition technology, the crop rate is calculated, and the recognition accuracy is improved through contrast adjustment.
It improves the accuracy and efficiency of leather cutting rate detection, reduces leather waste, and facilitates enterprises to monitor and solve problems in real time.
Smart Images

Figure CN119043222B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of leather cutting rate detection, and in particular relates to a leather cutting rate detection method based on a two-dimensional code. Background Art
[0002] With the continuous improvement of living standards, people's pursuit of product quality is getting higher and higher. The requirements for products are no longer just functional satisfaction, but more focused on product materials, comfort, durability, design and other factors. Genuine leather materials are widely used in many products due to their unique texture, durability and good breathability, which significantly improves the user experience and the overall value of the product. Before the leather is put into use, it needs to be cut from a large piece of whole leather according to a knife die of a specified shape, and the cut leather can be directly used for product production. In the prior art, the operator places multiple knife dies on the whole leather at the same time while avoiding the damaged position of the leather according to the size and shape of the knife die, so as to cut as much formed leather as possible and improve the cutting rate of the leather. However, due to different manual operating habits and experience, different personnel have different cutting rates for whole leather, which ultimately causes waste of leather. Therefore, the detection of leather cutting rate is a prerequisite for enterprises to reduce losses, reduce costs and improve the level of manual operation. Enterprises can monitor real-time data based on the leather cutting rate to find and solve problems in a timely manner. Summary of the invention
[0003] The purpose of the present invention is to propose a leather cutting rate detection method based on a two-dimensional code, which has high cutting rate recognition accuracy, is beneficial to the monitoring of enterprises, and enables enterprises to discover and solve problems in a timely manner.
[0004] The present invention is achieved through the following technical solutions:
[0005] A leather cutting rate detection method based on a QR code comprises the following steps:
[0006] Step S1, using an industrial camera to obtain a leather image, and calculating the leather area according to the leather image;
[0007] Step S2, obtaining a plurality of two-dimensional code images associated with each knife mold number and size, and using kraft paper as the printing paper for the two-dimensional code, and pasting the printed two-dimensional code drawings on the upper surface of each knife mold respectively;
[0008] Step S3, after placing each cutting die of this cutting on the leather, an industrial camera is used to obtain a cutting die image, and the cutting die image is preprocessed to enhance the grayscale jump part of the edge of the cutting die image;
[0009] Step S4, extracting each QR code area, and merging all QR code areas into a new image, and setting the background of the new image to black;
[0010] Step S5, performing QR code recognition on the new image. When some QR codes fail to be recognized, the contrast of the new image is adjusted and the QR code recognition is performed again until all QR codes are recognized successfully.
[0011] Step S6, obtaining the knife mold number, quantity and size of this cutting according to each QR code, and calculating the total area of the knife mold for this cutting according to the quantity and size, and then obtaining the cutting rate of the leather according to the leather area and the total area of the knife mold.
[0012] Furthermore, in step S1, before taking an image with an industrial camera, the following steps are used to calibrate the industrial camera:
[0013] Step S11, placing a chessboard within the field of view of the industrial camera, and acquiring a plurality of chessboard image data at different positions;
[0014] Step S12: Calculate the distortion coefficient and camera internal parameters using the calibrateCamera algorithm of the OpenCV open source algorithm library. M 1 and camera extrinsics M 2 ;
[0015] Step S13: According to the formula To achieve mutual conversion between pixel coordinates and world coordinates, two sets of corresponding world coordinates are obtained according to two sets of adjacent pixel coordinates, and the difference between the two sets of world coordinates is calculated as the proportional coefficient of the physical length of a single pixel. S ,in, Z c represents the scale factor, u , v represents pixel coordinates, X w , Y w , Z w represents the world coordinates, f x , f y Respectively represent the physical size of each pixel in the x and y directions, u 0 , v 0 They represent the optical axis projection coordinates in the camera’s pixel coordinate system, R Represents camera extrinsics M 2 The rotation matrix of T Represents camera extrinsics M 2 The translation matrix of .
[0016] Furthermore, in step S1, the field of view of the industrial camera is greater than 2.8m*2.8m.
[0017] Furthermore, in step S1, calculating the leather area according to the leather image comprises the following steps:
[0018] Step S14, using the remap algorithm to perform distortion correction on the leather image, and using the medianBlur median filtering algorithm to pre-process the leather image after distortion correction to remove knife marks on the surface of the workbench;
[0019] Step S15, using findContours algorithm to extract leather contours from the preprocessed leather image to obtain multiple contour data, respectively calculating the length of each contour, and when the contour length is less than a first set value, determining it as an invalid contour, eliminating the invalid contour, and finally obtaining a valid contour data set;
[0020] Step S16, respectively calculating the shortest distance between every two contours in the contour data set, and when the shortest distance between two contours is less than a second set value, determining that the two contours are continuous contours, and splicing the two continuous contours into one contour, and repeating the splicing in this way, finally obtaining a complete leather contour;
[0021] Step S17: Calculate the pixel area of the leather contour obtained in step S16 using the contourArea algorithm A pixel , and according to the formula A mm = A pixel * S Calculate leather area A mm .
[0022] Furthermore, in step S3, the knife die image is preprocessed using the Laplace algorithm.
[0023] Furthermore, in step S4, the matchTemplate algorithm is used to locate the two-dimensional code in the preprocessed knife die image, and the total number of two-dimensional codes is obtained, and then each two-dimensional code area is extracted.
[0024] Furthermore, in step S5, the ZXing open source algorithm library is used to perform QR code recognition on the new image. When the number of recognized QR codes is less than the total number of QR codes, , Using formula G’ = G * Mult + Add Perform contrast adjustment, where Mult =255 / ( G max - G min ), Add =- Mult * G min , G min is the minimum gray value of the new image, G max is the maximum grayscale value of the new image, G’ is the calculated new gray value, G is the original grayscale value of the new image.
[0025] Furthermore, in step S6, according to the formula Obtain the cutting rate of leather R cut ,in, A cut is the total area of the die, A mm For leather area.
[0026] The present invention has the following beneficial effects:
[0027] 1. The present invention first uses an industrial camera to obtain a leather image and calculates the leather area, then pastes a two-dimensional code associated with the knife model number and size on the upper surface of the corresponding knife die, uses an industrial camera to obtain the knife die image, extracts each two-dimensional code area from the knife die image and obtains a new image formed by merging all the two-dimensional code areas, performs two-dimensional code recognition on the new image, and then obtains the number and size of the knife dies for this cutting, obtains the total area of the knife dies based on the number and size of the knife dies, and finally obtains the cutting rate of the leather based on the leather area and the total area of the knife dies. In this process, because the size of the two-dimensional code is very small relative to the workbench, such as the size of the workbench is about 2.8 meters, the size of the two-dimensional code is only 40 mm If the QR code is recognized directly, it is very easy to fail, and the background environment of the leather cutting workbench is complex. For example, there are cutting marks of various shapes on the surface of the workbench, which can easily lead to a slow QR code recognition speed and recognition errors. In addition, due to the influence of the workshop lighting, the QR code will reflect in certain positions, which will also affect the QR code recognition rate. Therefore, in the present invention, kraft paper is used as the printing paper for the QR code, which can effectively avoid reflection. A series of processing is performed during the QR code recognition process, which effectively improves the recognition speed and recognition accuracy, thereby improving the accuracy of cutting rate detection, which is more conducive to enterprise monitoring and enables enterprises to discover and solve problems in a timely manner.
[0028] 2. Due to the large size of the leather, the field of view of the industrial camera must be large enough to cover the entire cutting workbench. However, while the lens captures a larger field of view, it also brings obvious lens distortion. The closer to the edge of the camera's field of view, the greater the distortion. Therefore, the industrial camera should be calibrated before shooting to further improve the accuracy of cutting rate detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] The present invention is further described in detail below with reference to the accompanying drawings.
[0030] Figure 1 It is a flow chart of the present invention.
[0031] Figure 2 This is the leather image of the present invention.
[0032] Figure 3 This is the effect diagram of the leather contour extraction of the present invention.
[0033] Figure 4 It is the knife die image of the present invention.
[0034] Figure 5 This is a rendering of the effect after the two-dimensional code recognition of the present invention. DETAILED DESCRIPTION
[0035] like Figure 1 As shown, the leather cutting rate detection method based on the QR code includes the following steps:
[0036] Step S1, using an industrial camera to obtain a leather image, and calculating the leather area according to the leather image;
[0037] like Figure 2 As shown, the size of the leather is large, and the field of view of the industrial camera must be larger than 2.8m*2.8m. To meet this field of view, the industrial camera uses a 1-inch 2000-pixel camera and a 6mm lens to cover the entire cutting table. In order to cope with lens distortion, the industrial camera is calibrated using the following steps before taking images:
[0038] Step S11, placing a 180*180 mm chessboard within the field of view of the industrial camera, and obtaining multiple chessboard image data at different positions;
[0039] Step S12: Using the chessboard image data, the calibrateCamera algorithm of the OpenCV open source algorithm library is used to calculate the distortion coefficient and the camera internal parameters. M 1 and camera extrinsics M 2 ;
[0040] Step S13: According to the formula To achieve the mutual conversion between pixel coordinates and world coordinates, two sets of corresponding world coordinates are obtained according to two sets of adjacent pixel coordinates, and the difference between the two sets of world coordinates is calculated as the proportional coefficient for calculating the physical length of a single pixel. S ,in, Z c represents the scale factor, u , v represents pixel coordinates, X w , Y w , Z w represents the world coordinates, f x , f y Respectively represent the physical size of each pixel in the x and y directions, u 0 , v 0 They represent the optical axis projection coordinates in the camera’s pixel coordinate system, R Represents camera extrinsics M 2 The rotation matrix of T Represents camera extrinsics M 2 The translation matrix of .
[0041] Calculating the leather area based on the leather image includes the following steps:
[0042] Step S14, using the remap algorithm to perform distortion correction on the leather image, and using the medianBlur median filtering algorithm to pre-process the leather image after distortion correction to remove knife marks on the surface of the workbench;
[0043] Step S15, using findContours algorithm to extract leather contours from the preprocessed leather image to obtain multiple contour data, respectively calculating the length of each contour, and when the contour length is less than a first set value, determining it as an invalid contour, eliminating the invalid contour, and finally obtaining a valid contour data set;
[0044] Step S16, respectively calculate the shortest distance between every two contours in the contour data set, and when the shortest distance between two contours is less than the second set value, determine that the two contours are continuous contours, and splice the two continuous contours into one contour, and repeat the splicing process to finally obtain a complete leather contour, such as Figure 3 As shown;
[0045] Step S17: Calculate the pixel area of the leather contour obtained in step S16 using the contourArea algorithmA pixel , and according to the formula A mm = A pixel * S Calculate leather area A mm .
[0046] Step S2, obtaining a plurality of two-dimensional code images associated with each knife mold number and size, and using kraft paper as the printing paper for the two-dimensional code, and pasting the printed two-dimensional code drawings on the upper surface of each knife mold respectively;
[0047] Using kraft paper to print the QR code can effectively reduce the reflection effect of lighting on the QR code;
[0048] Step S3, after placing each cutting die on the leather, an industrial camera is used to obtain a cutting die image, and the cutting die image is preprocessed to enhance the grayscale jump part of the edge of the cutting die image. Figure 4 As shown;
[0049] Specifically, the Laplace algorithm is used to pre-process the knife die image to make the knife die image clearer;
[0050] Step S4, extracting each QR code area, and merging all QR code areas into a new image, and setting the background of the new image to black;
[0051] Specifically, the matchTemplate algorithm is used to locate the QR code in the preprocessed die-cutting image, and the total number of QR codes is obtained, and then each QR code area is extracted. The background of the new image is set to black, which can avoid recognition failure caused by the cutter marks on the workbench; the QR code area refers to the area that only contains the QR code;
[0052] Step S5: Perform QR code recognition on the new image. If some QR code recognition fails, adjust the contrast of the new image and perform QR code recognition again until all QR codes are successfully recognized. Figure 5 As shown;
[0053] Specifically, the ZXing open source algorithm library is used to recognize the QR code of the new image. When the number of recognized QR codes is less than the total number of QR codes, , Using formula G’ = G * Mult + Add Perform contrast adjustment, where Mult =255 / ( G max - G min ), Add =- Mult * G min , G min is the minimum gray value of the new image, G max is the maximum grayscale value of the new image, G’ is the calculated new gray value, G is the original grayscale value of the new image;
[0054] Step S6, obtaining the knife mold number, quantity and size of the current cutting according to each QR code, and calculating the total area of the knife mold of the current cutting according to the quantity and size, and then obtaining the cutting rate of the leather according to the leather area and the total area of the knife mold;
[0055] Specifically, according to the formula Obtain the cutting rate of leather R cut ,in, A cut is the total area of the die, A mm For leather area.
[0056] The above description is only a preferred embodiment of the present invention, and therefore cannot be used to limit the scope of implementation of the present invention. That is, equivalent changes and modifications made according to the scope of the patent application of the present invention and the contents of the specification should still fall within the scope covered by the patent of the present invention.
Claims
1. A leather cutting rate detection method based on QR code, characterized in that: The steps include: Step S1, using an industrial camera to obtain a leather image, and calculating the leather area according to the leather image; Step S2, obtaining a plurality of two-dimensional code images associated with each knife mold number and size, and using kraft paper as the printing paper for the two-dimensional code, and pasting the printed two-dimensional code drawings on the upper surface of each knife mold respectively; Step S3, after placing each cutting die of this cutting on the leather, an industrial camera is used to obtain a cutting die image, and the cutting die image is preprocessed to enhance the grayscale jump part of the edge of the cutting die image; Step S4, extracting each QR code area, and merging all QR code areas into a new image, and setting the background of the new image to black; Step S5, performing QR code recognition on the new image. When some QR codes fail to be recognized, the contrast of the new image is adjusted and the QR code recognition is performed again until all QR codes are recognized successfully. Step S6, obtaining the knife mold number, quantity and size of the current cutting according to each QR code, and calculating the total area of the knife mold of the current cutting according to the quantity and size, and then obtaining the cutting rate of the leather according to the leather area and the total area of the knife mold; In step S1, before taking an image with an industrial camera, the following steps are used to calibrate the industrial camera: Step S11, placing a chessboard within the field of view of the industrial camera, and acquiring a plurality of chessboard image data at different positions; Step S12: Calculate the distortion coefficient and camera internal parameters using the calibrateCamera algorithm of the OpenCV open source algorithm library. M 1 and camera external parameters M 2; Step S13: According to the formula To achieve mutual conversion between pixel coordinates and world coordinates, two sets of corresponding world coordinates are obtained according to two sets of adjacent pixel coordinates, and the difference between the two sets of world coordinates is calculated as the proportional coefficient of the physical length of a single pixel. S ,in, Z c represents the scale factor, u , v represents pixel coordinates, X w , Y w , Z w represents the world coordinates, f x , f y Respectively represent the physical size of each pixel in the x and y directions, u 0 , v 0 They represent the optical axis projection coordinates in the camera’s pixel coordinate system, R Represents camera extrinsics M 2 The rotation matrix of T Represents camera extrinsics M 2 The translation matrix of In the step S1, calculating the leather area according to the leather image comprises the following steps: Step S14, using the remap algorithm to perform distortion correction on the leather image, and using the medianBlur median filtering algorithm to pre-process the leather image after distortion correction to remove knife marks on the surface of the workbench; Step S15, using findContours algorithm to extract leather contours from the preprocessed leather image to obtain multiple contour data, respectively calculating the length of each contour, and when the contour length is less than a first set value, determining it as an invalid contour, eliminating the invalid contour, and finally obtaining a valid contour data set; Step S16, respectively calculating the shortest distance between every two contours in the contour data set, and when the shortest distance between two contours is less than a second set value, determining that the two contours are continuous contours, and splicing the two continuous contours into one contour, and repeating the splicing in this way, finally obtaining a complete leather contour; Step S17: Calculate the pixel area of the leather contour obtained in step S16 using the contourArea algorithm A pixel , and according to the formula A mm = A pixel * S Calculate leather area A mm .
2. The leather cutting rate detection method based on a two-dimensional code according to claim 1, characterized in that: In step S1, the field of view of the industrial camera is greater than 2.8m*2.8m.
3. A leather cutting rate detection method based on a two-dimensional code according to claim 1 or 2, characterized in that: In the step S3, the knife die image is preprocessed using the Laplace algorithm.
4. A leather cutting rate detection method based on a two-dimensional code according to claim 1 or 2, characterized in that: In step S4, the matchTemplate algorithm is used to locate the two-dimensional code in the preprocessed knife die image, and the total number of two-dimensional codes is obtained, and then each two-dimensional code area is extracted.
5. The leather cutting rate detection method based on two-dimensional code according to claim 4, characterized in that: In step S5, the ZXing open source algorithm library is used to perform two-dimensional code recognition on the new image. When the number of recognized two-dimensional codes is less than the total number of two-dimensional codes, , Using formula G’ = G * Mult + Add Perform contrast adjustment, where , Add =- Mult * G min , G min is the minimum gray value of the new image, G max is the maximum grayscale value of the new image, G’ is the calculated new gray value, G is the original grayscale value of the new image.
6. A leather cutting rate detection method based on a two-dimensional code according to claim 1 or 2, characterized in that: In step S6, according to the formula Obtain the cutting rate of leather R cut ,in, A cut is the total area of the die, A mm For leather area.
Citation Information
Patent Citations
System and method for measuring leather area based on digital image method
CN101403610A
Systems and methods for real-time monitoring of die use or yield
CN101983117A
Method for determining area quality of tobacco leaves based on intelligent image processing and model estimation
CN103175835A
Intelligent tool cabinet based on RFID visual identification
CN116423463A
Plane target area measurement method and system based on artificial intelligence
CN117853560A