A method for constructing wood surface character dataset
Through industrial camera acquisition and image processing technology, the character images of wood surfaces are extracted and integrated with the wood background is solved, and the problem of structuring wood surface characters data sets in the prior art is solved, efficient and low-cost data set generation is achieved, and the performance of character recognition algorithms and industrial production efficiency are improved.
Patent Information
- Application Number
- CN202111577222.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2041-12-22
AI Technical Summary
The prior art is difficult to efficiently construct a wood surface character dataset, resulting in high cost of labeling and long preparation time, which affects the performance of character recognition algorithms and industrial production efficiency.
Character images of the wood surface are collected by industrial cameras, and the character images to be fused are extracted using image processing methods, and fuse them with the wood background, replacing the background pixel values, and generating a data set with labels.
It effectively reduces the data set preparation time and cost, improves the performance and industrial production efficiency of character recognition algorithms, and the generated data sets are efficient and practical.
Smart Images

Figure CN114266839B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the construction of a wood surface character data set on an industrial production line, and in particular relates to a construction method of a wood surface character data set. Background Art
[0002] In recent years, the wood industry has been increasingly moving towards customized production. In order to ensure the corresponding processing of customized furniture accessories, it is necessary to print characters on the wood surface and recognize them. Since the labeling cost of the dataset is extremely high and the character recognition algorithm requires a large amount of data for training, it is necessary to construct a wood surface character dataset.
[0003] Manually labeling a dataset requires a lot of manpower, and obtaining a large number of labeled datasets takes a lot of time. By constructing a wood surface character dataset, the preparation time of the early dataset can be greatly reduced, effectively reducing cost consumption and improving industrial production efficiency.
[0004] By extracting the printed characters and integrating them into the wood background, the validity of the character data set can be guaranteed, and the large amount of data sets generated can effectively guarantee the performance of the character recognition algorithm. This method of constructing a wood surface character data set has a significant effect in the production and processing process.
[0005] The Chinese patent application number is: CN202010432299.3, and the name is: Method for constructing a supervised dataset for Raw domain video denoising. The invention discloses a method for constructing a supervised dataset for Raw domain video denoising, including step 1: modeling the Raw domain noise as Poisson-Gaussian mixed noise; step 2: correcting the parameters of the noise model under the specified ISO; step 3: performing ISP simulation and inverse ISP simulation to transform the sRGB domain video image into a Raw domain video image; step 4: preparing a dataset, including a synthetic noise simulation dataset and a real Raw domain video dataset. The method can construct a supervised dataset for Raw domain video denoising. Since the printed characters need to be extracted and fused into the wood background, the invention, as a method for constructing a supervised dataset for Raw domain video denoising, is not suitable for the construction of a dataset of characters on the surface of wood.
[0006] The Chinese patent application number is: CN201710828716.4, and the name is: A method and device for screening new words. The invention discloses a method and device for constructing a training data set, which relates to the field of computer technology. The method includes: randomly selecting two images to be annotated from the data set to be annotated, determining the first basic aesthetic label of the first image to be annotated and the second basic aesthetic label of the second image to be annotated; using the first image to be annotated and the second image to be annotated as input data to obtain a first evaluation factor and a second evaluation factor; updating the first basic aesthetic label and the second basic aesthetic label; repeating the above steps until the number of repetitions reaches a threshold, and using the final basic aesthetic label as the final aesthetic label of the image to be annotated. This method can reduce the complexity and cost of annotation. Since the printed characters need to be extracted and integrated into the wood background, this invention, as a method and device for constructing a training data set, is not suitable for the construction of a wood surface character data set. Summary of the invention
[0007] The purpose of the present invention is to provide a method for constructing a wood surface character data set, which is used to generate a wood surface character data set. First, the characters on the wood surface are collected by an industrial camera, and the character image to be fused is extracted by an image processing method; then the pixel values of the corresponding area of the wood background are calculated, and the thresholds of the three channels of R, G, and B are obtained respectively, and the size relationship between the pixel values of the character image to be fused and the corresponding area of the wood background is compared, and the pixel values of the corresponding positions of the wood background image are replaced with the pixel values of the character image to be fused that are simultaneously less than the thresholds of the three channels of R, G, and B. When the method for constructing a wood surface character data set proposed by the present invention is applied to actual industrial production, a large number of wood surface character data sets can be generated, which is helpful to improve the performance of the character recognition algorithm.
[0008] To achieve the above purpose, the technical solution of the present invention is: a method for constructing a wood surface character data set, first, printing characters on the wood surface, collecting the characters on the wood surface through an industrial camera, and extracting the character image to be fused using an image processing method; then, calculating the pixel values of the corresponding area of the wood background, respectively obtaining the thresholds of the three channels of R, G, and B, comparing the size relationship between the pixel values of the character image to be fused and the corresponding area of the wood background, replacing the pixel values of the corresponding position of the wood background image with the pixel values of the character image to be fused that are simultaneously less than the thresholds of the three channels of R, G, and B, to obtain the fused character image.
[0009] In one embodiment of the present invention, characters are printed on the wood surface, the characters on the wood surface are collected by an industrial camera, and the image processing method is used to extract the character image to be fused. The specific implementation method is as follows:
[0010] Print characters on the wood surface, and collect the characters on the wood surface by an industrial camera;
[0011] The collected character image is processed by grayscale and binarization, and the outline of the character is found using the binary image;
[0012] The character is extracted from the character image using the character's maximum outline circumscribed rectangular frame, and the area outside the character outline is set to white as the character image to be fused. The image height and width are recorded as h respectively. c 、w c .
[0013] In one embodiment of the present invention, the specific implementation method of calculating the pixel value of the area corresponding to the wood background is as follows:
[0014] The wood background image is obtained by an industrial camera. The height of the wood background image is set to h. b , with a width of w b ; The upper left corner of the wood background image is the origin, the width direction is recorded as the x-axis, and the height direction is recorded as the y-axis;
[0015] Respectively from 0 to (w b -w c ) and 0 to (h b -h c ) Generate a random number x in the range c ,y c , and (x c ,y c ) as the position coordinates of the upper left corner of the character image to be fused on the wood background image;
[0016] Assume the character image to be fused is in is the pixel value matrix of the R channel, denoted as is the pixel value matrix of the G channel, denoted as is the pixel value matrix of the B channel, denoted by F cb ;
[0017] Set on the wood background image, with (x c ,y c ) is the starting point, h c 、w c The wood background area is in is the pixel value matrix of the R channel, denoted as is the pixel value matrix of the G channel, denoted as is the pixel value matrix of the B channel, denoted by F bb ;
[0018] For the corresponding wood background area F b, respectively for the pixel value matrix F of the three channels of RGB br 、F bg 、F bb Sum and calculate the average value and record it as
[0019] In one embodiment of the present invention, the thresholds of the three channels of R, G, and B are obtained, the size relationship between the pixel values of the character image to be fused and the corresponding area of the wood background is compared, and the pixel values of the corresponding position of the wood background image are replaced by the pixel values of the character image to be fused that are simultaneously less than the thresholds of the three channels of R, G, and B. The specific implementation method of obtaining the fused character image is as follows:
[0020] Calculate the threshold of the R channel Threshold of G channel Threshold of channel B
[0021] Calculate F separately cr Each element in R L The size relationship of F cg Each element in G L The size relationship and F cb Each element in B L The size relationship is expressed by F cr 、F cg 、F cb At the same time, they are less than R L , G L , B L The pixel value of F is replaced by br 、F bg 、F bb The pixel value at the same position, otherwise, F b The pixel values in remain unchanged;
[0022] Get the fused character image, x c ,y c 、h c 、w c This is the position label of the character.
[0023] Compared with the prior art, the present invention has the following beneficial effects:
[0024] 1) The present invention generates the character image to be fused by printing and extracting characters, thereby ensuring the validity of the character data set and the performance of the character recognition algorithm.
[0025] 2) The present invention fuses the character image to be fused with the wood background, thereby obtaining labeled data and avoiding the cost of image annotation.
[0026] 3) By constructing a wood surface character data set, the present invention can obtain a large amount of labeled data in a short time, greatly reducing the time cost and improving the efficiency of industrial production. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 Extract the flow chart for the character images to be fused.
[0028] Figure 2 This is the flow chart of the fusion of the character image to be fused and the wood background image.
[0029] Figure 3 is the character image to be fused.
[0030] Figure 4 For wood background image.
[0031] Figure 5 is the fused character image. DETAILED DESCRIPTION
[0032] The technical solution of the present invention is described in detail below in conjunction with the accompanying drawings.
[0033] The invention discloses a method for constructing a wood surface character data set. First, characters are printed on the wood surface, and the characters on the wood surface are collected by an industrial camera, and a character image to be fused is extracted by an image processing method. Then, pixel values of a corresponding area of a wood background are calculated, and thresholds of three channels R, G, and B are obtained respectively. The size relationship between the pixel values of the character image to be fused and the corresponding area of the wood background is compared, and the pixel values of the corresponding positions of the wood background image are replaced by the pixel values of the character image to be fused that are simultaneously less than the thresholds of the three channels R, G, and B, so as to obtain a fused character image.
[0034] The following is the specific implementation process of the present invention.
[0035] like Figure 1 , 2 As shown, a method for constructing a wood surface character data set of the present invention includes the following implementation steps:
[0036] 1) Change character 2 (such as Figure 3 As shown) is printed on the wood surface, and the characters on the wood surface are collected by an industrial camera;
[0037] 2) The collected character image is processed by grayscale and binarization, and the outline of the character is found using the binary image;
[0038] 3) Extract the character from the character image using the character's maximum outline circumscribed rectangular frame, and set the area outside the character outline to white as the character image to be fused, with the image height and width being 124 and 146 respectively;
[0039] 4) Obtain wood background images through industrial cameras (such as Figure 4 As shown in the figure, the height of the wood background image is 1024 and the width is 1280. The upper left corner of the wood background image is the origin, the width direction is recorded as the x-axis, and the height direction is recorded as the y-axis;
[0040] 5) Generate random numbers 553,395 in the range of 0 to (1280-146) and 0 to (1024-124) respectively, and use (553,395) as the position coordinates of the upper left corner of the character image to be fused on the wood background image;
[0041] 6) Assume that the character image to be fused is in is the pixel value matrix of the R channel, denoted as is the pixel value matrix of the G channel, denoted as is the pixel value matrix of the B channel, denoted by F cb ;
[0042] 7) On the wood background image, with (553,395) as the starting point and 124 and 146 as the height and width of the wood background area in is the pixel value matrix of the R channel, denoted as is the pixel value matrix of the G channel, denoted as is the pixel value matrix of the B channel, denoted by F bb ;
[0043] 8) For the corresponding wood background area F b , respectively for the pixel value matrix F of the three channels of RGB br , F bg , F bb Sum and calculate the average, and we get
[0044] 9) Calculate the threshold R of the R channel L =143.54 / 2=71.77, the threshold value of G channel L =141.43 / 2=70.72, threshold B of channel B L =133.46 / 2=66.73;
[0045] 10) Calculate F separately cr Each element in R L 、F cg Each element in G L and F cb The elements in B L The size relationship is expressed by F cr , F cg , F cbAt the same time, they are less than R L , G L , B L Replace F with the pixel value br , F bg , F bb The pixel value at the same position, otherwise, F b The pixel values in remain unchanged;
[0046] 11) Get the fused character image (such as Figure 5 As shown), 553, 395, 124, and 146 are the position labels of the characters.
[0047] The above are preferred embodiments of the present invention. Any changes made according to the technical solution of the present invention, as long as the resulting functions do not exceed the scope of the technical solution of the present invention, belong to the protection scope of the present invention.
Claims
1. A method for constructing a wood surface character dataset, characterized in that: First, characters are printed on the wood surface, and the characters on the wood surface are collected by an industrial camera. The character image to be fused is extracted by image processing method. Then, the pixel values of the corresponding area of the wood background are calculated, and the thresholds of the three channels of R, G, and B are obtained respectively. The size relationship between the pixel values of the character image to be fused and the corresponding area of the wood background is compared. The pixel values of the corresponding positions of the wood background image are replaced with the pixel values of the character image to be fused that are less than the thresholds of the three channels of R, G, and B to obtain the fused character image. Get the thresholds of the three channels R, G, and B, compare the size relationship between the pixel values of the character image to be fused and the corresponding area of the wood background, and replace the pixel values of the corresponding position of the wood background image with the pixel values of the character image to be fused that are less than the thresholds of the three channels R, G, and B. The specific implementation method is as follows: Calculate the threshold R of the R channel L =m Fbr / 2, the threshold value of G channel L =m Fbg / 2, threshold B of channel B L =m Fbb / 2; m Fbr 、m Fbg 、m Fbb The wood background area F b The pixel value matrix F of the three RGB channels br 、F bg 、F bb The average value calculated after summing; Calculate F separately cr Each element in R L The size relationship of F cg Each element in G L The size relationship and F cb Each element in B L The size relationship is expressed by F cr 、F cg 、F cb At the same time, they are less than R L , G L , B L The pixel value of F is replaced by br 、F bg 、F bb The pixel value at the same position, otherwise, F b The pixel values in remain unchanged.
2. The method for constructing a wood surface character dataset according to claim 1, characterized in that: The characters are printed on the wood surface, the characters on the wood surface are collected by an industrial camera, and the image processing method is used to extract the character image to be fused. The specific implementation method is as follows: Print characters on the wood surface, and collect the characters on the wood surface by an industrial camera; The collected character image is processed by grayscale and binarization, and the outline of the character is found using the binary image; The character is extracted from the character image using the character's maximum outline circumscribed rectangular frame, and the area outside the character outline is set to white as the character image to be fused. The image height and width are recorded as h respectively. c 、w c .
3. The method for constructing a wood surface character dataset according to claim 2, characterized in that: The specific implementation method of calculating the pixel value of the area corresponding to the wood background is as follows: The wood background image is obtained by an industrial camera. The height of the wood background image is set to h. b , with a width of w b ; The upper left corner of the wood background image is the origin, the width direction is recorded as the x-axis, and the height direction is recorded as the y-axis; Respectively from 0 to (w b -w c ) and 0 to (h b -h c ) Generate a random number x in the range c ,y c , and (x c ,y c ) as the position coordinates of the upper left corner of the character image to be fused on the wood background image; Assume the character image to be fused is in is the pixel value matrix of the R channel, denoted by F cr , is the pixel value matrix of the G channel, denoted by F cg , is the pixel value matrix of the B channel, denoted by F cb ; Set on the wood background image, with (x c ,y c ) is the starting point, h c 、w c The wood background area is in is the pixel value matrix F of the R channel br , is the pixel value matrix F of the G channel bg , is the pixel value matrix F of the B channel bb .
Citation Information
Patent Citations
New word screening method and device
CN107622051A
Raw domain video denoising supervision data set construction method
CN111724317A
Method and device for extracting foreground image and replacing image background
CN106846336A
Chinese printing character image synthesis method and device
CN107274345A