An OpenCV-based grid cloth wrapping machine visual recognition method and system

By using OpenCV technology to identify the model outline and corner coordinates of EPS lines, and combining hash algorithms and camera parameter conversion, the problem of automating the wrapping of EPS decorative lines with mesh fabric was solved, achieving efficient and stable wrapping effects and promoting the development of the construction industry towards intelligence and greenness.

CN119338842BActive Publication Date: 2025-11-11SHAANXI UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411374716.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-29
Publication Date
2025-11-11
Estimated Expiration
2044-09-29

AI Technical Summary

Technical Problem

The existing process of wrapping EPS decorative lines with mesh fabric has a low degree of automation, is easily affected by human factors, resulting in inconsistent wrapping quality and high labor costs.

Method used

A visual recognition method for wrapping EPS fabric based on OpenCV is adopted. Through image processing and machine vision technology, the model outline and corner coordinates of EPS lines are identified. Combined with hash algorithm and camera intrinsic and extrinsic parameter conversion, the precise wrapping of the EPS fabric is achieved.

Benefits of technology

It improves the automation and intelligence of EPS decorative line production, increases production efficiency, reduces labor costs, and ensures the consistency and stability of packaging quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119338842B_ABST
    Figure CN119338842B_ABST
Patent Text Reader

Abstract

The application discloses a kind of grid cloth wrapping machine visual identification method and system based on OpenCV, belong to visual identification technical field.Method includes the image of EPS line to be wrapped of acquisition, the image is preprocessed to obtain binary image;Based on the binary image extraction EPS line to be wrapped model contour, based on Shi-Tomasi operator extraction each corner point coordinate information of the model contour;Based on OpenCV library, the internal and external parameters of camera used for image acquisition are obtained, and the conversion relationship between pixel coordinate system and world coordinate system is established;Based on the conversion relationship, the coordinate information of EPS line under world coordinate system is converted into each corner point coordinate information, and grid cloth wrapping machine visual identification is completed.The problem that traditional laminating device laminating model is single is optimized, and through the combination of algorithm module and control system, the efficiency of EPS decorative line production and the automation and intelligentization of production process are effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of visual recognition technology, and relates to a visual recognition method and system for a mesh cloth wrapping machine based on OpenCV. Background Technology

[0002] With the accelerating pace of global urbanization, the construction industry is undergoing unprecedented transformation and innovation. This industry not only fulfills multiple functional needs such as residential, office, and commercial use, but is also increasingly becoming an important window showcasing regional culture, technological advancements, and environmental protection concepts. Against this backdrop, more stringent and diversified requirements have been placed on the aesthetic pursuit of building appearance, structural safety, energy efficiency, and the application of green building materials. EPS (polystyrene foam) decorative moldings, with their lightweight, high strength, good weather resistance, easy processing and molding, and excellent thermal insulation properties, have stood out among many building materials, becoming a new favorite in the modern architectural decoration field. Their rich shaping capabilities and high customizability allow designers to break through traditional limitations, creating architectural appearances that meet user needs and are also artistic, satisfying the market's urgent demand for personalized, environmentally friendly, and efficient architectural decoration materials.

[0003] However, despite the immense potential of EPS decorative lines in design and application, certain stages of their production process, particularly the crucial step of mesh fabric wrapping, still face challenges due to insufficient automation. Traditional manual wrapping methods are not only inefficient but also susceptible to human error, leading to inconsistent wrapping quality and consequently affecting the overall performance and appearance consistency of the product. Furthermore, with rising labor costs and a worsening labor shortage, companies are increasingly eager to improve production automation and reduce reliance on manual labor. Summary of the Invention

[0004] The purpose of this invention is to solve the technical problem that most mesh cloth wrapping in the prior art is done manually and has a low degree of automation, and to provide a visual recognition method and system for mesh cloth wrapping machines based on OpenCV.

[0005] To achieve the above objectives, the present invention employs the following technical solution:

[0006] In a first aspect, the present invention provides a visual recognition method for a mesh fabric wrapping machine based on OpenCV, comprising:

[0007] Acquire an image of the EPS line to be wrapped, and preprocess the image to obtain a binarized image;

[0008] The model outline of the EPS line to be wrapped is extracted based on the binarized image, and the coordinate information of each corner point of the model outline is extracted based on the Shi-Tomasi operator.

[0009] Based on the OpenCV library, the intrinsic and extrinsic parameters of the camera used to acquire images are obtained, and the transformation relationship between the pixel coordinate system and the world coordinate system is established.

[0010] Based on the transformation relationship, the coordinate information of each corner point is converted into the coordinate information of EPS lines in the world coordinate system, thus completing the visual recognition of the mesh cloth wrapping machine.

[0011] Further improvements are made in the following aspects:

[0012] After preprocessing the image to obtain a binarized image, the process further includes:

[0013] The binary image is compared with images in the existing EPS line database using a hash algorithm. If the same image exists, the coordinate information of the EPS line corresponding to the same image in the EPS line database is directly retrieved; if the same object does not exist, the subsequent steps are continued.

[0014] The specific steps of comparing the binarized image with images in the existing EPS line database based on the hash algorithm are as follows:

[0015] The final result of the hash algorithm is obtained by calculating the Hamming distance. A hash value calculation function is constructed using Python and the OpenCV open-source library:

[0016] The binarized image was reduced in size and its colors were simplified using the OpenCV open-source library.

[0017] When calculating the mean value of pixels, the data in the two lists being compared consists only of binary data 0 and 1. The process of converting specific numerical values ​​into binary data is based on the comparison result of all pixel value data with a specific threshold. In the hash algorithm, the mean value of all pixel values ​​is used as the threshold.

[0018] Construct a one-dimensional perceptual hash table. Based on the relationship between pixel values ​​and the mean of pixels in the image, construct a feature matrix. Compare the image with a specific value to obtain a logical value of True or False. Based on the returned logical value, convert the logical value to an integer value using astype(int) to construct the feature matrix. At this point, the perceptual hash value is a two-dimensional array. To simplify the subsequent algorithm, the two-dimensional array can be processed into a one-dimensional array using the flatten function.

[0019] The encapsulated function is needed to extract the perceptual hash value of the retrieved image and the perceptual hash values ​​of all images in the image library when searching for images. To make the extraction more convenient, all of the above functions need to be encapsulated.

[0020] The Glob library reads all images from the existing EPS line database and calls the encapsulated perceptual hash value calculation function to calculate the perceptual hash value of each image, providing data for subsequent calculation of the Hamming distance between the target image to be tested and each image in the folder.

[0021] When the background environment, shooting distance, focal length, rotation and translation and other external conditions do not differ significantly, there is a large difference in the similarity between photos of completely identical EPS decorative lines and photos of highly similar but different EPS decorative lines; based on this difference, a basic specific value can be determined, and decisions can be made by comparing the similarity with the specific value.

[0022] After calculation, the Hamming distance between the newly acquired binarized image and each sample in the existing EPS line database is obtained. To intuitively obtain the image similarity, the above data is processed; the similarity calculation formula is as follows:

[0023]

[0024] Where s represents similarity; t represents total pixel value, which is 100 for all images at a size of 10×10; h represents Hamming distance, which is the difference between images; th represents the image similarity value. The total calculation formula expresses the image similarity as a percentage. 92% is used as the cutoff value for judgment. If the similarity is greater than 92%, it proves that the similarity is high, and it is determined that there is an image in the existing EPS line database that matches the EPS decorative line to be tested.

[0025] The specific steps for preprocessing the image to obtain a binarized image are as follows:

[0026] The image size is reduced based on downsampling methods in the image pyramid.

[0027] The image is smoothed and denoised using Gaussian filtering;

[0028] Binarized images of EPS line contours are obtained through threshold segmentation.

[0029] The model outline of the EPS line to be wrapped is extracted based on the binarized image, and the coordinate information of each corner point of the model outline is extracted based on the Shi-Tomasi operator as follows:

[0030] Edge detection is performed using the Canny algorithm to extract the model contour, which is then fitted using the least squares method. Next, the Shi-Tomasi corner detection algorithm is used to detect corners. In the Shi-Tomasi algorithm, based on the principle that corner stability is related to the smaller eigenvalues ​​of matrix M, smaller eigenvalues ​​are used as a necessary condition, effectively avoiding the problem of selecting the k value. The principle of the improved Shi-Tomasi algorithm formula is as follows:

[0031] R=min(λ1,λ2) (2)

[0032] During the detection process, the corner detection algorithm generates a rectangular area in the image and calculates the sum of all pixel values ​​within the rectangular area. Then, it moves the area and calculates the sum of pixel values ​​within the rectangular area of ​​the next area. If the pixel value calculation results of the two rectangular areas before and after the move are very different, it is considered that there are corners to be detected in the original area before the move; otherwise, it is considered that there are no corners to be detected in the original area.

[0033] Detected corner points are typically categorized into concave and convex corners based on their appearance: recessed or convex. Concave corners, or recessed corners, are of primary interest. For example, in the image of a recessed area on the surface of an EPS decorative line, two points on the contour near the point are taken on either side of it and connected to form a straight line. The concave point is located below this line. In the geometric relationship of a Cartesian coordinate system, if the coefficient of the linear function y is negative, and the result obtained after substituting it into coordinates is greater than 0, it indicates that the point is located below the image. However, due to the different definitions of the positive direction in the coordinate system, the judgment process is completely reversed: a result less than 0 indicates that the point is located below the image, thus defining it as a concave corner.

[0034] Based on the OpenCV library, the intrinsic and extrinsic parameters of the camera used to acquire images are obtained, and the transformation relationship between the pixel coordinate system and the world coordinate system is established as follows:

[0035] The camera calibration model is established, including the following four important coordinate systems and three important transformation methods:

[0036] World coordinate system, the position coordinates in the world coordinate system are (x w ,y w ,z w ), which are the real coordinates in the coordinate system established in the real world;

[0037] The camera coordinate system refers to a coordinate system with the camera center as the origin, and its coordinates are represented as (X... c ,Y c Z c );

[0038] Image coordinate system, the coordinates of the image coordinate system are represented as (x,y). The image coordinate system can be obtained from the camera coordinate system through trigonometric transformation. The origin of the image coordinate system is the intersection of the optical axis and the image plane, and the unit is millimeters.

[0039] The pixel coordinate system is derived from the image coordinate system. The coordinates are represented as (u,v). The origin of this coordinate system is the top left corner of the image. u and v represent the column number and row number of the pixel in the digital chart, respectively. The coordinate unit is usually pixels, which describes the physical size and position of the image.

[0040] The four coordinate systems mentioned above can be used to transform coordinates between different coordinate systems through their relationships; the transformation from the world coordinate system to the camera coordinate system is mainly achieved through rigid body transformation, that is, only rotation and translation transformations occur; the transformation process is described as follows:

[0041]

[0042] The process of converting from the camera coordinate system to the image coordinate system is mainly achieved through trigonometric similarity transformation; the conversion from the image coordinate system to the pixel coordinate system is achieved through coordinate offset.

[0043]

[0044] in:

[0045]

[0046] In the formula, (u0,v0) represents the offset of the origin of the image coordinate system relative to the origin of the pixel coordinate system, and dx,dy represents the size of each pixel;

[0047] The purpose of camera calibration is to solve for the parameters of all matrices in the above formulas, that is, to solve for the intrinsic and extrinsic parameters of the camera. The parameters f, dx, and dy in the formulas are obtained through camera calibration. x ,f y ;

[0048] Combining the above formulas, the final conversion formula is:

[0049]

[0050] In the formula:

[0051]

[0052] Solving the camera calibration model:

[0053] A 12×9 checkerboard calibration board was used to calibrate the camera. The camera's intrinsic and extrinsic parameters were solved using the OpenCV open-source library and Python. The resulting intrinsic parameter matrix was then obtained.

[0054]

[0055] The distortion parameters of the camera are: k1=0.324242681, k2=-2.18543749, p1=-0.000966342267, p2=-0.000839539629, k3=4.95031381. The parameters k1, k2, p1, p2, k3 in the obtained distortion parameters correspond to the parameter values ​​in formula (11).

[0056] The external parameters of the camera regarding the plane containing the cross-sectional profile of the EPS lines are obtained, namely the rotation and translation matrices obtained through camera calibration:

[0057]

[0058]

[0059] Formula (12) represents the rotation matrix, and formula (13) represents the translation matrix.

[0060] The distortion parameters are calculated as follows:

[0061] Distortion parameters include radial distortion coefficients and tangential distortion coefficients. Image distortion needs to be corrected during camera calibration. Radial distortion is caused by the shape of the additive lens, distributed radially along the lens, and is more curved further away from the lens center. It can be described using a mathematical polynomial as follows:

[0062]

[0063] In the formula, k1, k2, and k3 represent radial distortion parameters, which are intrinsic parameters of the camera;

[0064]

[0065] Combining formulas (14) and (15), the distortion formula is as follows:

[0066]

[0067] Secondly, this invention discloses a visual recognition system for a mesh fabric wrapping machine based on OpenCV, comprising:

[0068] The image acquisition module acquires an image of the EPS line to be wrapped, and preprocesses the image to obtain a binarized image;

[0069] The corner coordinate information acquisition module extracts the model outline of the EPS line to be wrapped based on the binarized image, and extracts the corner coordinate information of the model outline based on the Shi-Tomasi operator;

[0070] The transformation relationship establishment module uses the OpenCV library to obtain the intrinsic and extrinsic parameters of the camera used to acquire images and establishes the transformation relationship between the pixel coordinate system and the world coordinate system.

[0071] The coordinate information conversion module converts the coordinate information of each corner point into the coordinate information of EPS lines in the world coordinate system based on the conversion relationship, thereby completing the visual recognition of the mesh cloth wrapping machine.

[0072] Thirdly, the present invention discloses an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described OpenCV-based mesh cloth wrapping machine visual recognition method.

[0073] Fourthly, the present invention discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the above-described OpenCV-based visual recognition method for mesh cloth wrapping machines.

[0074] Compared with the prior art, the present invention has the following beneficial effects:

[0075] This invention discloses a visual recognition method for EPS (Expanded Polystyrene) wrapping machines based on OpenCV. The invention designs a method specifically for recognizing, classifying, extracting, and storing feature points of EPS lines of different shapes, providing a new approach to the EPS line lamination process. It optimizes the problem of limited lamination options in traditional lamination devices. Furthermore, by combining the algorithm module with the control system, it effectively improves the efficiency of EPS decorative line production and enhances the automation and intelligence of the production process. This invention provides strong technical support for the automation upgrade of EPS decorative line production. Machine vision technology, by simulating human visual functions, utilizes high-precision image acquisition and processing algorithms to achieve rapid and accurate recognition and measurement of object shape, size, and position. In the mesh fabric wrapping stage, the machine vision system can capture the three-dimensional contour information of the EPS decorative lines in real time, accurately calculate the required mesh fabric size and layout, and guide automated robotic arms or wrapping equipment to complete precise wrapping operations, thereby significantly improving production efficiency, reducing labor costs, and ensuring the consistency and stability of wrapping quality. In conclusion, applying machine vision technology to the automated production of EPS decorative line mesh wrapping is not only a significant innovation in traditional production processes, but also an important measure to respond to national policy calls and promote the development of the construction industry towards intelligence, greening, and efficiency. Therefore, developing an automated EPS decorative line mesh wrapping system based on machine vision technology has significant practical implications and market prospects. Attached Figure Description

[0076] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0077] Figure 1 This is a flowchart of a visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention;

[0078] Figure 2 This is a technical roadmap of the visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention;

[0079] Figure 3 This is a schematic diagram illustrating the principle of the hash algorithm in a visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention.

[0080] Figure 4 This is a diagram showing the Gaussian filtering effect in a visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention.

[0081] Figure 5 This is a diagram showing the threshold segmentation result in a visual recognition method for a mesh cloth wrapping machine based on OpenCV, as described in this invention.

[0082] Figure 6 This is a diagram showing the processing result of the Canny operator in a visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention.

[0083] Figure 7 This is a line contour extraction result image from a visual recognition method for a mesh cloth wrapping machine based on OpenCV, as described in this invention.

[0084] Figure 8 This image shows the corner detection results in a visual recognition method for a mesh cloth wrapping machine based on OpenCV, as described in this invention.

[0085] Figure 9 This is a schematic diagram of the concave dots in a visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention;

[0086] Figure 10 This is a schematic diagram of the triangular similarity transformation principle in a visual recognition method for a mesh cloth wrapping machine based on OpenCV in this invention;

[0087] Figure 11 This is a flowchart of the mesh fabric coverage process in a mesh fabric wrapping machine visual recognition method based on OpenCV in this invention;

[0088] Figure 12 This is a block diagram of a visual recognition system for a mesh cloth wrapping machine based on OpenCV, as described in this invention.

[0089] Figure 13 This is a block diagram of the electronic device in this invention. Detailed Implementation

[0090] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0091] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0092] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0093] The present invention will now be described in further detail with reference to the accompanying drawings:

[0094] See Figure 1 This invention discloses a visual recognition method for a mesh fabric wrapping machine based on OpenCV, comprising:

[0095] S1, acquire an image of the EPS line to be wrapped, and preprocess the image to obtain a binarized image;

[0096] S2, extract the model outline of the EPS line to be wrapped based on the binarized image, and extract the coordinate information of each corner point of the model outline based on the Shi-Tomasi operator;

[0097] S3 uses the OpenCV library to obtain the intrinsic and extrinsic parameters of the camera used to acquire images and establishes the transformation relationship between the pixel coordinate system and the world coordinate system.

[0098] S4. Based on the transformation relationship, the coordinate information of each corner point is transformed into the coordinate information of EPS lines in the world coordinate system to complete the visual recognition of the mesh cloth wrapping machine.

[0099] This invention discloses a visual recognition method for EPS (Expanded Polystyrene) wrapping machines based on OpenCV. The invention designs a method specifically for recognizing, classifying, extracting, and storing feature points of EPS lines of different shapes, providing a new approach to the EPS line lamination process. It optimizes the problem of limited lamination options in traditional lamination devices. Furthermore, by combining the algorithm module with the control system, it effectively improves the efficiency of EPS decorative line production and enhances the automation and intelligence of the production process. This invention provides strong technical support for the automation upgrade of EPS decorative line production. Machine vision technology, by simulating human visual functions, utilizes high-precision image acquisition and processing algorithms to achieve rapid and accurate recognition and measurement of object shape, size, and position. In the mesh fabric wrapping stage, the machine vision system can capture the three-dimensional contour information of the EPS decorative lines in real time, accurately calculate the required mesh fabric size and layout, and guide automated robotic arms or wrapping equipment to complete precise wrapping operations, thereby significantly improving production efficiency, reducing labor costs, and ensuring the consistency and stability of wrapping quality. In conclusion, applying machine vision technology to the automated production of EPS decorative line mesh wrapping is not only a significant innovation in traditional production processes, but also an important measure to respond to national policy calls and promote the development of the construction industry towards intelligence, greening, and efficiency. Therefore, developing an automated EPS decorative line mesh wrapping system based on machine vision technology has significant practical implications and market prospects.

[0100] See Figure 2 This invention discloses a visual recognition method for a mesh cloth wrapping machine based on OpenCV. The following detailed description of the invention is provided in conjunction with specific embodiments:

[0101] Step 1: Acquire an image of the EPS line to be wrapped, and preprocess the image to obtain a binarized image;

[0102] The image acquisition hardware platform was built, including camera selection, light source selection and arrangement, determination of image acquisition position, and camera calibration. A 500W pixel CCD industrial camera was selected and horizontally positioned. A ring LED light was placed above the camera to provide front lighting for the EPS foam lines. The acquisition position was 50CM away from the camera. After the hardware platform was built, the camera was calibrated according to Zhang Youzheng's camera calibration method to obtain the camera's internal and external parameters and establish the relationship between the pixel coordinate system and the world coordinate system.

[0103] Establish an EPS line model database to store images of each model as well as information on their outlines and corners. Compare newly acquired images with existing images in the database. If the model is an existing model, the mechanical part is directly retrieved based on the stored information. If it is a new model, further processing is performed.

[0104] Image preprocessing includes:

[0105] (1) Downsampling in the image pyramid reduces the size of the image to facilitate its display.

[0106] First, a Gaussian filter is applied to the image. Gaussian filtering, also known as Gaussian kernel convolution, involves taking a weighted average of each pixel in the image with its neighboring pixels to obtain the desired new pixel value. After this kernel processing, the resulting image is obtained. Next, all even-numbered rows and columns are removed. Finally, a Gaussian pyramid is used to reduce the image size to one-quarter of its original size. This allows for easier viewing of the image and subsequent processing effects.

[0107] (2) Perform image smoothing processing, using Gaussian filtering to achieve noise reduction. For example... Figure 4 As shown.

[0108] Gaussian filtering is a linear filter that smooths an image by applying a Gaussian function to each pixel. Gaussian filtering is typically implemented using convolution operations. First, a Gaussian kernel is created, which is a two-dimensional Gaussian function matrix. Then, this kernel is applied to each pixel of the image, and the smoothed pixel value is obtained by calculating a weighted sum of the kernel and the local region of the image.

[0109] In image processing, since all images are two-dimensional, the two-dimensional Gaussian function is often used. The Gaussian formula for a circle-symmetric image in two-dimensional Gaussian processing is shown below:

[0110]

[0111] Where x and y are the coordinates of the point, and σ is the standard deviation;

[0112] (3) Obtain the binarized image of the EPS line contour through threshold segmentation. For example... Figure 5 As shown.

[0113] Image thresholding aims to divide a pixel set according to gray levels, creating a subset that forms a region corresponding to a real-world scene. Each region possesses consistent attributes, while adjacent regions do not. This division is achieved by selecting a threshold based on gray levels. The threshold is obtained using a gray-level histogram; gray values ​​below the selected threshold are set to zero, while gray values ​​above or equal to the threshold are set to 255, thus completing the image binarization.

[0114] See Figure 3Step two: Based on the hash algorithm, compare the binarized image with the images in the existing EPS line database. If the same image exists, directly call the coordinate information of the EPS line corresponding to the same image in the EPS line database; if the same object does not exist, continue with the subsequent steps.

[0115] (1) Reduce size: The OpenCV open source library provides the function cv2.resize(src,dsize) to achieve this function, where src is the input image and dsize is the size of the converted image; through conversion, the original image with size (1440, 1920, 3) is reduced to size (10, 10, 3), where 3 indicates that the image is a color image with three channels.

[0116] (2) Simplify colors:

[0117] An image can be converted to grayscale using the cv2.cvtCOLOR function provided by the OpenCV open-source library. In this case, the image size is represented as (10, 10).

[0118] (3) Calculate the average value of pixels

[0119] In the subsequent calculation of Hamming distance, the data in the two lists being compared consists only of binary data 0 and 1. The process of converting specific numerical values ​​into binary data is based on the comparison results of all pixel value data with a specific threshold. In the hash algorithm, the average value of all pixel values ​​is used as the threshold.

[0120] (4) Construct a one-dimensional perceptual hash table

[0121] A feature matrix is ​​constructed based on the relationship between pixel values ​​and the mean value within the image. The image is compared to a specific value, yielding a logical value of True or False. Based on this logical value, it is converted to an integer value using `astype(int)`, thus constructing the feature matrix. At this point, the perceptual hash value is a two-dimensional array. To simplify the subsequent algorithm, the two-dimensional array can be processed into a one-dimensional array using the `flatten` function.

[0122] (5) Encapsulation function

[0123] When retrieving images, it is necessary to extract the perceptual hash value of the retrieved image, as well as the perceptual hash values ​​of all images in the image library. To facilitate the extraction, all of the above functions need to be encapsulated.

[0124] The Glob library enables efficient file reading. This method uses the Glob library to read all image files in a specified folder. By calling the encapsulated perceptual hash value calculation function, it iterates through all image files in the folder and calculates the perceptual hash value of each image, providing data for subsequent calculation of the Hamming distance between the target image and each image in the folder.

[0125] When external conditions such as background environment, shooting distance, focal length, rotation, and translation remain largely unchanged, there is a significant difference in the similarity between photos of completely identical EPS decorative lines and photos of highly similar but different EPS decorative lines. Based on this difference, a basic specific value can be determined, and decisions can be made by comparing the similarity score with this specific value.

[0126] After calculation, the Hamming distance between the newly acquired EPS line images and each sample in the database can be obtained. To intuitively obtain the image similarity, the above data is processed. The similarity calculation formula is as follows:

[0127]

[0128] In the above formula, s represents similarity, t represents total pixel value (in a 10×10 size, the total pixel value of the image is 100), h represents Hamming distance, which is the difference between images, and th represents the similarity value of the images. The total calculation formula expresses the similarity of the images as a percentage.

[0129] Using 92% as the cutoff value, if the similarity is greater than 92%, it proves that the similarity is high and sufficient to determine that there is an image in the database that matches the image of the EPS decorative line to be tested. This proves that there is a wrapping scheme that matches the EPS decorative line to be tested, and the logical value True is returned. By sorting by similarity, the line of that model in the database can be filtered out, preparing for the operating system to call the corresponding wrapping scheme of the EPS decorative line model. If no image has a matching degree higher than 92%, it means that there is no EPS decorative line image or data matching the model of the EPS decorative line to be tested in the database. At this time, False is returned, and the program enters another branch. Here, by detecting and returning the coordinates of important feature points of the EPS decorative line and their real coordinates in the world coordinate system, the matching wrapping scheme is generated and the scroll wheel is controlled to perform the corresponding operation.

[0130] Step 3: Extract the model outline of the EPS lines to be wrapped based on the binarized image, and extract the coordinate information of each corner point of the model outline based on the Shi-Tomasi operator; such as Figure 6 As shown.

[0131] Edge detection is performed using the Canny algorithm to extract the model contour, which is then fitted using the least squares method. Next, the Shi-Tomasi corner detection algorithm is used to detect corners. In the Shi-Tomasi algorithm, based on the principle that corner stability is related to the smaller eigenvalues ​​of matrix M, smaller eigenvalues ​​are used as a necessary condition, effectively avoiding the problem of selecting the right k value. The improved Shi-Tomasi algorithm formula is as follows:

[0132] R=min(λ1,λ2) (2)

[0133] During the detection process, the corner detection algorithm generates a rectangular region in the image and calculates the sum of all pixel values ​​within that region. Then, it moves this region and calculates the sum of pixel values ​​in the next rectangular region. If the calculated pixel values ​​in the two rectangular regions before and after the move differ significantly, the original region before the move is considered to contain a corner point that needs to be detected; otherwise, the original region is considered to contain no corner points that need to be detected. Figure 7 , Figure 8 and Figure 9 As shown.

[0134] Currently detected corner points can be categorized into concave and convex corner points based on whether they are recessed or convex. Among all corner points, concave corner points are of particular concern. During the wrapping process, convex corner points are easier to wrap effectively, while concave corner points are more prone to loose wrapping and gaps. Therefore, extra attention needs to be paid to concave corner points during the wrapping process. This method is based on the fact that most EPS decorative lines have rich shapes on their surface. Therefore, since concave points exist on the surface of EPS decorative lines, a corner point classification scheme is designed to classify concave and convex corner points.

[0135] In the image of the recessed area on the surface of the EPS decorative line, select two points on the contour near that point that are close to it on either side. Connect these two points to form a straight line, with the recessed point located below this line. In the geometric relationship of the Cartesian coordinate system, when the coefficient of the linear function y is negative, if the result obtained after substituting it into the coordinate system is greater than 0, it indicates that the point is located below the image. However, due to the different definition of the positive direction of the coordinate system, the judgment process is completely reversed. That is, if the result is less than 0, it indicates that the point is located below the image, which means that the point is the concave corner of the image.

[0136] Step 4: Obtain the intrinsic and extrinsic parameters of the camera used to acquire images using the OpenCV library, and establish the transformation relationship between the pixel coordinate system and the world coordinate system;

[0137] (1) Camera calibration model establishment, including the following four important coordinate systems and three important transformation methods:

[0138] (a) World coordinate system, the position coordinates of the world coordinate system are (x... w ,y w ,z w ), which are the real coordinates in the coordinate system established in the real world;

[0139] (b) Camera coordinate system

[0140] The camera coordinate system refers to a coordinate system formed with the camera center as the origin, and its coordinates are represented as (X... c ,Y c Z c This can be obtained by rigid body transformation using world coordinate system coordinates.

[0141] (c) Image coordinate system

[0142] The coordinates of the image coordinate system are represented as (x, y). The image coordinate system can be obtained from the camera coordinate system through trigonometric transformation. The origin of this coordinate system is the intersection of the optical axis and the image plane, and the unit is millimeters.

[0143] (d) Pixel coordinate system

[0144] The pixel coordinate system is derived from the image coordinate system and is represented as (u,v). This coordinate system takes the top left corner of the image as its origin, and u and v represent the number of columns and rows of the pixel in the digital chart, respectively. It is usually expressed in pixels as the coordinate unit and describes the physical size and position of the image.

[0145] The four coordinate systems mentioned above can be used to transform coordinates between different coordinate systems through their relationships. The transformation from the world coordinate system to the camera coordinate system is mainly achieved through rigid body transformation, that is, only rotation and translation transformations occur. The transformation process can be roughly described as follows:

[0146]

[0147] The process of transforming from the camera coordinate system to the image coordinate system is mainly achieved through trigonometric similarity transformation.

[0148] By shifting coordinates, a transformation from image coordinates to pixel coordinates can be achieved. For example... Figure 10 As shown.

[0149]

[0150] in:

[0151]

[0152] In the formula, (u0,v0) represents the offset of the origin of the image coordinate system relative to the origin of the pixel coordinate system, and dx,dy represents the size of each pixel.

[0153] The purpose of camera calibration is to solve for the parameters of all matrices in the above formulas, that is, to solve for the intrinsic and extrinsic parameters of the camera. The parameters f, dx, and dy in the formulas cannot be obtained through direct calibration, but f can be obtained through camera calibration. x ,f y .

[0154] Combining the above formulas, the final conversion formula is:

[0155]

[0156] In the formula:

[0157]

[0158] In the practical application of machine vision, both the camera's intrinsic and extrinsic parameters can affect the final research results. The above formula mainly explains the influence of the camera's extrinsic parameters, namely the translation and rotation matrices, and the camera's intrinsic parameters, namely the camera's focal length, on the final experimental results. By directly or indirectly solving the above parameters, it is theoretically possible to achieve the transformation between different coordinate systems.

[0159] (2) Solving the camera calibration model

[0160] This method uses a 12×9 checkerboard calibration board to calibrate the camera, and employs the OpenCV library and Python language to solve for the camera's intrinsic and extrinsic parameters. The resulting intrinsic parameter matrix is ​​as follows:

[0161]

[0162] The camera's distortion parameters are: k1 = 0.324242681, k2 = -2.18543749, p1 = -0.000966342267, p2 = -0.000839539629, k3 = 4.95031381. The parameters k1, k2, p1, p2, and k3 in the obtained distortion parameters correspond to the parameter values ​​in formulas 1-12.

[0163] However, in practical applications, some cameras may produce distorted images due to inherent quality issues. For these types of cameras, the impact of distortion parameters on the final experimental results must be considered during camera calibration.

[0164] Distortion parameters include radial distortion coefficients and tangential distortion coefficients, and distortion in the image needs to be corrected during camera calibration.

[0165] Radial distortion is caused by the shape of the additive lenses and is distributed radially along the lens, becoming more curved further away from the lens center. It can be described using a mathematical polynomial as follows:

[0166]

[0167] In the formula, k1, k2, and k3 represent radial distortion parameters, which are intrinsic parameters of the camera.

[0168]

[0169] Combining formulas (14) and (15), the distortion formula can be obtained as follows:

[0170]

[0171] Step 5: Based on the transformation relationship, the coordinate information of each corner point is converted into the coordinate information of EPS lines in the world coordinate system to complete the visual recognition of the mesh cloth wrapping machine.

[0172] The external parameters of the camera with respect to the plane containing the cross-sectional profile of the EPS lines are obtained, namely the rotation and translation matrices obtained through camera calibration:

[0173]

[0174] Formula (12) represents the rotation matrix, and formula (13) represents the translation matrix.

[0175] Simulation verification of the present invention:

[0176] The coordinate transformation mentioned in this method is mainly to transform the coordinates in the pixel coordinate system into the coordinates in the world coordinate system. Formula (6) illustrates the transformation method of coordinates in different coordinate systems. The real coordinates in the world coordinate system can be derived by using the inverse operation of formula (6).

[0177] By jointly verifying the interactive corner detection method and the Shi-Tomasi-based corner detection method, it can be jointly proved that the corner coordinates in the pixel coordinate system are real and valid. During the verification process, it was found that the results obtained by the two corner detection methods are basically consistent. Since the corner information obtained by the Shi-Tomasi algorithm does not have a strict order, in order to facilitate the detection of the authenticity of the coordinate transformation information, the mouse callback function is combined with the coordinate transformation function to obtain the real coordinate values ​​of the feature points.

[0178] During the calibration process, one image shows the relative positions of the camera and calibration board being identical to those of the camera and the EPS decorative lines. The world coordinate system was established based on this image. Therefore, it is not easy to directly determine the coordinate transformation effect under the world coordinate system through coordinate comparison. The coordinate transformation effect can be indirectly obtained through the distance and angle between corner points. If these two indicators are within a reasonable range, it can also prove that the roller can normally perform the mesh cloth wrapping operation. Since single-target calibration lacks depth information, the measured coordinate values ​​are not completely equivalent to the true values, but the result has a certain relationship with the true coordinates. The distance between corner points has a certain proportional relationship with the true distance. The coordinate transformation effect can be indirectly verified by measuring the distance and angle.

[0179] Table 1. Corner coordinates in the world coordinate system

[0180]

[0181] By selecting data that allows for a small discrepancy between the calculated and actual distances, we can obtain a scaling factor of 210.0458 between the distance value returned in the world coordinate system after camera calibration and the actual measured distance value. Using this as a benchmark, the actual returned distance and angle can be calculated. This scaling factor remains essentially unchanged assuming the relative positions of the camera and the target remain essentially constant.

[0182] Table 2 Coordinate Transformation Effect Detection

[0183]

[0184]

[0185] The errors in distance and angle are caused by a number of factors, including measurement error, corner drawing error during corner detection, and error caused by the lack of depth information in the algorithm. The distance error is within 1mm and the angle error is within 3°. Overall, the detection effect can meet the expectations.

[0186] By inspecting the quality of various types of EPS decorative lines, the coordinate transformation effect can be detected. Four groups of EPS decorative lines were selected, and five sets of length and angle data were selected for each group. The results are shown in the table below.

[0187] Table 3 Verification of Corner Point Coordinate Transformation Results

[0188]

[0189] The data in the table shows that the corner coordinate transformation is quite effective, and the error is basically within a controllable range.

[0190] In summary, the OpenCV-based visual recognition method for mesh fabric wrapping machines possesses excellent feature point recognition capabilities and can extract the physical location information of feature points within a reasonable error range. This method is well-suited for implementing preset functions during the mesh fabric wrapping process, such as... Figure 11 As shown.

[0191] See Figure 12 This invention also discloses a visual recognition system for a mesh fabric wrapping machine based on OpenCV, comprising:

[0192] The image acquisition module acquires an image of the EPS line to be wrapped, and preprocesses the image to obtain a binarized image;

[0193] The corner coordinate information acquisition module extracts the model outline of the EPS line to be wrapped based on the binarized image, and extracts the corner coordinate information of the model outline based on the Shi-Tomasi operator;

[0194] The transformation relationship establishment module uses the OpenCV library to obtain the intrinsic and extrinsic parameters of the camera used to acquire images and establishes the transformation relationship between the pixel coordinate system and the world coordinate system.

[0195] The coordinate information conversion module converts the coordinate information of each corner point into the coordinate information of EPS lines in the world coordinate system based on the conversion relationship, thereby completing the visual recognition of the mesh cloth wrapping machine.

[0196] See Figure 13 A third objective of this invention is to provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the OpenCV-based mesh wrapping machine visual recognition method.

[0197] The OpenCV-based visual recognition method for mesh cloth wrapping machines includes the following steps:

[0198] Acquire an image of the EPS line to be wrapped, and preprocess the image to obtain a binarized image;

[0199] The model outline of the EPS line to be wrapped is extracted based on the binarized image, and the coordinate information of each corner point of the model outline is extracted based on the Shi-Tomasi operator.

[0200] Based on the OpenCV library, the intrinsic and extrinsic parameters of the camera used to acquire images are obtained, and the transformation relationship between the pixel coordinate system and the world coordinate system is established.

[0201] Based on the transformation relationship, the coordinate information of each corner point is converted into the coordinate information of EPS lines in the world coordinate system, thus completing the visual recognition of the mesh cloth wrapping machine.

[0202] The fourth objective of this invention is to provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the OpenCV-based visual recognition method for mesh cloth wrapping machines.

[0203] The OpenCV-based visual recognition method for mesh cloth wrapping machines includes the following steps:

[0204] Acquire an image of the EPS line to be wrapped, and preprocess the image to obtain a binarized image;

[0205] The model outline of the EPS line to be wrapped is extracted based on the binarized image, and the coordinate information of each corner point of the model outline is extracted based on the Shi-Tomasi operator.

[0206] Based on the OpenCV library, the intrinsic and extrinsic parameters of the camera used to acquire images are obtained, and the transformation relationship between the pixel coordinate system and the world coordinate system is established.

[0207] Based on the transformation relationship, the coordinate information of each corner point is converted into the coordinate information of EPS lines in the world coordinate system, thus completing the visual recognition of the mesh cloth wrapping machine.

[0208] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0209] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0210] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0211] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0212] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.

Claims

1. A visual recognition method for a mesh fabric wrapping machine based on OpenCV, characterized in that, include: Acquire an image of the EPS line to be wrapped, and preprocess the image to obtain a binarized image; The model outline of the EPS line to be wrapped is extracted based on the binarized image, and the coordinate information of each corner point of the model outline is extracted based on the Shi-Tomasi operator. Based on the OpenCV library, the intrinsic and extrinsic parameters of the camera used to acquire images are obtained, and the transformation relationship between the pixel coordinate system and the world coordinate system is established. Based on the transformation relationship, the coordinate information of each corner point is converted into the coordinate information of EPS lines in the world coordinate system, and the visual recognition of the mesh cloth wrapping machine is completed. After preprocessing the image to obtain a binarized image, the process further includes: The binarized image is compared with images in the existing EPS line database based on a hash algorithm. If the same image exists, the coordinate information of the EPS line corresponding to the same image in the EPS line database is directly retrieved; if the same object does not exist, the subsequent steps are continued. The specific steps of comparing the binarized image with images in the existing EPS line database based on the hash algorithm are as follows: The final result of the comparison is obtained by calculating the Hamming distance. A hash value calculation function is constructed using Python and the OpenCV open-source library: The binarized image was reduced in size and its colors were simplified using the OpenCV open-source library. When calculating the mean value of pixels, the data in the two lists being compared consists only of binary data 0 and 1. The process of converting specific numerical values ​​into binary data is based on the comparison result of all pixel value data with a specific threshold. In the hash algorithm, the mean value of all pixel values ​​is used as the threshold. Construct a one-dimensional perceptual hash table. Based on the relationship between pixel values ​​and the mean of pixels in the image, construct a feature matrix. Compare the image with a specific value to obtain a logical value of True or False. Based on the returned logical value, convert the logical value to an integer value using astype(int) to construct the feature matrix. At this point, the perceptual hash value is a two-dimensional array. To simplify the subsequent algorithm, the two-dimensional array can be processed into a one-dimensional array using the flatten function. The encapsulated function is needed to extract the perceptual hash value of the retrieved image and the perceptual hash values ​​of all images in the image library when searching for images. To make the extraction more convenient, all of the above functions need to be encapsulated. The Glob library reads all images from the existing EPS line database and calls the encapsulated perceptual hash value calculation function to calculate the perceptual hash value of each image, providing data for subsequent calculation of the Hamming distance between the target image to be tested and each image in the folder. When the background environment, shooting distance, focal length, rotation and translation are not significantly different, photos of identical EPS decorative lines have a high degree of similarity, but photos of different EPS decorative lines have a large difference in similarity. Based on this difference, a basic specific value can be determined, and decisions can be made by comparing the similarity with the specific value. After calculation, the Hamming distance between the newly acquired binarized image and each sample in the existing EPS line database is obtained. To intuitively obtain the image similarity, the above data is processed; the similarity calculation formula is as follows: Where s represents the similarity; t represents the total pixel value, in 10 In the 10-size processing, the total pixel value of the image is 100; h represents the Hamming distance, which is the difference between images; th represents the image similarity value. The total calculation formula expresses the image similarity as a percentage; 92% is the threshold value for judgment. If the similarity is greater than 92%, it proves that the similarity is high, and it is determined that there is an image in the existing EPS line database that matches the EPS decorative line to be tested.

2. The visual recognition method for mesh fabric wrapping machine based on OpenCV according to claim 1, characterized in that, The specific steps for preprocessing the image to obtain a binarized image are as follows: The image size is reduced based on downsampling methods in the image pyramid. The image is smoothed and denoised using Gaussian filtering; Binarized images of EPS line contours are obtained through threshold segmentation.

3. The visual recognition method for mesh fabric wrapping machines based on OpenCV according to claim 1, characterized in that, The model outline of the EPS line to be wrapped is extracted based on the binarized image, and the coordinate information of each corner point of the model outline is extracted based on the Shi-Tomasi operator as follows: Edge detection is performed using the Canny algorithm to extract the model contour, which is then fitted using the least squares method. Next, the Shi-Tomasi corner detection algorithm is used to detect corners. In the Shi-Tomasi algorithm, based on the principle that corner stability is related to the smaller eigenvalues ​​of matrix M, smaller eigenvalues ​​are used as a necessary condition, effectively avoiding the problem of selecting the k value. The principle of the improved Shi-Tomasi algorithm formula is as follows: During the detection process, the corner detection algorithm generates a rectangular area in the image and calculates the sum of all pixel values ​​within the rectangular area. Then, it moves the area and calculates the sum of pixel values ​​within the rectangular area of ​​the next area. If the pixel value calculation results of the two rectangular areas before and after the move are very different, it is considered that there are corners to be detected in the original area before the move; otherwise, it is considered that there are no corners to be detected in the original area. Detected corner points are typically categorized as either recessed or convex, and are classified as either concave or convex. Concave corner points, or recessed corner points, are of particular interest. For example, in the image of a recessed area on the surface of an EPS decorative line, two points on the contour near the point are taken on either side of it and connected to form a straight line. The recessed point is located below this line. In the geometric relationship of a Cartesian coordinate system, if the coefficient of the linear function y is negative, and the result obtained after substituting it into coordinates is greater than 0, it indicates that the point is located below the image. However, due to the different definitions of the positive direction in the coordinate system, the judgment process is completely reversed. A result less than 0 indicates that the point is located below the image, and thus is a concave corner point.

4. The OpenCV-based visual recognition method for mesh fabric wrapping machines according to claim 3, characterized in that, Based on the OpenCV library, the intrinsic and extrinsic parameters of the camera used to acquire images are obtained, and the transformation relationship between the pixel coordinate system and the world coordinate system is established as follows: The camera calibration model is established, including the following four important coordinate systems and three important transformation methods: World coordinate system, the position coordinates in the world coordinate system are ( ), which are the real coordinates in the coordinate system established in the real world; Camera coordinate system, the camera coordinate system refers to the coordinate system formed with the center of the camera as the origin, and its coordinates are represented as ( ); Image coordinate system, the coordinates of the image coordinate system are represented as (x,y). The image coordinate system can be obtained from the camera coordinate system through trigonometric transformation. The origin of the image coordinate system is the intersection of the optical axis and the image plane, and the unit is millimeters. The pixel coordinate system is derived from the image coordinate system. The coordinates are represented as (u,v). The origin of this coordinate system is the top left corner of the image. u and v represent the column number and row number of the pixel in the digital chart, respectively. The coordinate unit is usually pixels, which describes the physical size and position of the image. The four coordinate systems mentioned above can be used to transform coordinates between different coordinate systems through their relationships; the transformation from the world coordinate system to the camera coordinate system is mainly achieved through rigid body transformation, involving only rotation and translation; the transformation process is described as follows: The process of converting from the camera coordinate system to the image coordinate system is mainly achieved through trigonometric similarity transformation; the conversion from the image coordinate system to the pixel coordinate system is achieved through coordinate offset. in: In the formula, ( , ) represents the offset of the origin of the image coordinate system relative to the origin of the pixel coordinate system, and dx,dy represents the size of each pixel; The purpose of camera calibration is to solve for the parameters of all matrices in the above formulas, and to solve for the intrinsic and extrinsic parameters of the camera. The parameters f, dx, and dy in the formulas are obtained through camera calibration. , ; Combining the above formulas, the final conversion formula is: In the formula: Solving the camera calibration model: A 12×9 checkerboard calibration board was used to calibrate the camera. The camera's intrinsic and extrinsic parameters were solved using the OpenCV open-source library and Python. The resulting intrinsic parameter matrix was then obtained. The camera's distortion parameters are: =0.324242681, -2.18543749, =-0.000966342267, =-0.000839539629, =4.95031381, the parameter in the obtained distortion parameters , , , , The corresponding parameter values ​​in formula (11); Obtain the external parameters of the camera regarding the plane containing the cross-sectional profile of the EPS lines. The rotation and translation matrices obtained through camera calibration are as follows: Formula (12) represents the rotation matrix, and formula (13) represents the translation matrix.

5. The visual recognition method for mesh fabric wrapping machine based on OpenCV according to claim 4, characterized in that, The distortion parameters are calculated as follows: Distortion parameters include radial distortion coefficients and tangential distortion coefficients. Image distortion needs to be corrected during camera calibration. Radial distortion is caused by the shape of the additive lens, distributed radially along the lens, and is more curved further away from the lens center. It can be described using a mathematical polynomial as follows: In the formula This represents the radial distortion parameter, which is a camera intrinsic parameter. Combining formulas (14) and (15), the distortion formula is as follows:

6. A visual recognition system for a mesh fabric wrapping machine based on OpenCV, characterized in that, include: The image acquisition module acquires an image of the EPS line to be wrapped, and preprocesses the image to obtain a binarized image; After preprocessing the image to obtain a binarized image, the process further includes: The binarized image is compared with images in the existing EPS line database based on a hash algorithm. If the same image exists, the coordinate information of the EPS line corresponding to the same image in the EPS line database is directly retrieved; if the same object does not exist, the subsequent steps are continued. The corner coordinate information acquisition module extracts the model outline of the EPS line to be wrapped based on the binarized image, and extracts the corner coordinate information of the model outline based on the Shi-Tomasi operator; The transformation relationship establishment module uses the OpenCV library to obtain the intrinsic and extrinsic parameters of the camera used to acquire images and establishes the transformation relationship between the pixel coordinate system and the world coordinate system. The coordinate information conversion module converts the coordinate information of each corner point into the coordinate information of EPS lines in the world coordinate system based on the conversion relationship, thereby completing the visual recognition of the mesh cloth wrapping machine. The specific steps of comparing the binarized image with images in the existing EPS line database based on the hash algorithm are as follows: The final result of the comparison is obtained by calculating the Hamming distance. A hash value calculation function is constructed using Python and the OpenCV open-source library: The binarized image was reduced in size and its colors were simplified using the OpenCV open-source library. When calculating the mean value of pixels, the data in the two lists being compared consists only of binary data 0 and 1. The process of converting specific numerical values ​​into binary data is based on the comparison result of all pixel value data with a specific threshold. In the hash algorithm, the mean value of all pixel values ​​is used as the threshold. Construct a one-dimensional perceptual hash table. Based on the relationship between pixel values ​​and the mean of pixels in the image, construct a feature matrix. Compare the image with a specific value to obtain a logical value of True or False. Based on the returned logical value, convert the logical value to an integer value using astype(int) to construct the feature matrix. At this point, the perceptual hash value is a two-dimensional array. To simplify the subsequent algorithm, the two-dimensional array can be processed into a one-dimensional array using the flatten function. The encapsulated function is needed to extract the perceptual hash value of the retrieved image and the perceptual hash values ​​of all images in the image library when searching for images. To make the extraction more convenient, all of the above functions need to be encapsulated. The Glob library reads all images from the existing EPS line database and calls the encapsulated perceptual hash value calculation function to calculate the perceptual hash value of each image, providing data for subsequent calculation of the Hamming distance between the target image to be tested and each image in the folder. When the background environment, shooting distance, focal length, rotation and translation are not significantly different, photos of identical EPS decorative lines have a high degree of similarity, but photos of different EPS decorative lines have a large difference in similarity. Based on this difference, a basic specific value can be determined, and decisions can be made by comparing the similarity with the specific value. After calculation, the Hamming distance between the newly acquired binarized image and each sample in the existing EPS line database is obtained. To intuitively obtain the image similarity, the above data is processed; the similarity calculation formula is as follows: Where s represents the similarity; t represents the total pixel value, in 10 In the 10-size processing, the total pixel value of the image is 100; h represents the Hamming distance, which is the difference between images; th represents the image similarity value. The total calculation formula expresses the image similarity as a percentage; 92% is the threshold value for judgment. If the similarity is greater than 92%, it proves that the similarity is high, and it is determined that there is an image in the existing EPS line database that matches the EPS decorative line to be tested.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the OpenCV-based visual recognition method for mesh wrapping machines according to any one of claims 1-5.

8. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the OpenCV-based visual recognition method for mesh cloth wrapping machines according to any one of claims 1-5.

Citation Information

Patent Citations

  • Depth extraction method based on monocular vision

    CN109035320A

  • Visual system for four-axis industrial palletizing robot

    CN111604909A