CN114299502A - Method for correcting and identifying inclination of code-spraying characters on end face of round casting blank and storage medium - Google Patents
Method for correcting and identifying inclination of code-spraying characters on end face of round casting blank and storage medium Download PDFInfo
- Publication number
- CN114299502A CN114299502A CN202210213702.2A CN202210213702A CN114299502A CN 114299502 A CN114299502 A CN 114299502A CN 202210213702 A CN202210213702 A CN 202210213702A CN 114299502 A CN114299502 A CN 114299502A
- Authority
- CN
- China
- Prior art keywords
- image
- character
- characters
- round
- gradient
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Images
Abstract
The invention relates to a method for correcting and identifying the inclination of code-spraying characters on the end surface of a round casting blank and a storage medium, wherein the method comprises the following steps of positioning an effective area of a round outline; the minimum circumscribed rectangle of each character outline is obtained; solving the character inclination angle; post-processing the character correction result; and identifying the code spraying characters. The method adopts an improved contour gradient template matching algorithm, can accurately position the effective area of the end face contour of the round billet, combines the prior condition information of the row and column distribution characteristics of the code-spraying characters, and adopts a short-side slope mean value method of the circumscribed rectangle and a slope arrangement combination voting method of the connecting line of the central points of the minimum circumscribed rectangles of any two contours to finish the slope correction of the characters; and identifying the characters by taking a model fused by ResNet-18 and inclusion structural paradigms as a classifier. The method for positioning the effective area of the round casting blank and the method for correcting the character inclination can be well suitable for detection in a static or moving state, have strong robustness and can be multiplexed on a square blank.
Description
Technical Field
The invention relates to the technical field of industrial visual character recognition, in particular to a method for correcting and recognizing inclination of code-spraying characters on the end face of a round casting blank and a storage medium.
Background
At present, in the steel pipe production process of the pipe processing industry, the mode of PLC and manual participation is basically adopted for steel pipe tracking, tracking according to furnace numbers or batch numbers is realized, the tracking is realized less for the tracking of the whole process one by one, the steel pipe production is a discrete and discontinuous processing mode, the phenomena of off-line and rework of unqualified products in the production process are inevitable, the recording is generally input into a computer through manual work, the tracking of the product process quality is realized according to the furnace or batch, and the raw materials and the specific process parameters in the processing process cannot be tracked for a certain steel pipe. The round casting blank is used as a raw material for pipe processing, how to obtain information such as a raw material production place, production time, materials, batch numbers and the like before an upper processing production line is mostly in a form of end face code spraying characters, casting blank information is manually input through visual observation and verification, the automation degree is low, and great manpower is consumed. Therefore, a system and a method capable of automatically acquiring code spraying characters on the end face of a casting blank are urgently needed, and the code spraying characters can be quickly and efficiently identified.
Disclosure of Invention
The method for correcting and identifying the inclination of the code-sprayed characters on the end surface of the round casting blank can quickly and efficiently finish the inclination correction and identification of the code-sprayed characters on the end surface of the round blank.
In order to achieve the purpose, the invention adopts the following technical scheme:
a method for correcting and identifying the inclination of code-sprayed characters on the end surface of a round casting blank comprises the following steps,
s1, acquiring an end face image of the round casting blank, and processing the end face image of the round casting blank by adopting an improved contour gradient template matching algorithm to obtain an effective area surrounded by a round contour;
s2, extracting the outline of the character connected domain after preprocessing the image of the effective area surrounded by the circular outline, and solving the minimum circumscribed rectangle of each character outline;
s3, solving the character inclination angle by adopting a slope average method of the short sides of the external rectangles or a slope arrangement combination voting method of the central connecting line of any two external rectangles to obtain a corrected image;
s4, combining the prior condition information of character row-column distribution, post-processing the correction result to obtain a plurality of single character correction images;
s5, fusing ResNet-18 and an inclusion structure paradigm to construct a ResNet-inclusion model fusion classifier, recognizing the single character correction image by using the trained fusion classifier, and summarizing classification results to obtain character recognition results;
the improved contour gradient template matching algorithm described in step S1 specifically includes:
s1.1, assuming that in the collected round casting blank end face image, the size of the outline radius of the round blank accounts for pixelsIn whichAs constant, the end face image of the round casting blank is subjected to scale factorZooming is performed, whereinIs a positive integer and takes the value of 3;
s1.2, setting the reference radius of the circular template asThe size of the reference circle template image is set toThe center coordinates are set asSetting the color of a pixel inside a circular outline of a reference circular template image as 0 and the color of a pixel outside the outline as 1; the upper and lower deviations of the round template are set asWhereinThe process is carried out by rounding to get the whole,rounding up, therefore, the number of the circular template images is set toRadius of the circular template isChange in between;
s1.3, adopting sobel operator to setHorizontal gradient image is obtained from round template imageAnd vertical gradient image(ii) a Similarly, a sobel operator is adopted to obtain a horizontal gradient image of the zoomed round casting blank end surface imageAnd vertical gradient imageAt the same time, toAndthe image is post-processed byThe horizontal and vertical gradients of the pixel points are set to 0, whereinIs a constant number of times, and is,in thatThe value of (A) is selected from,as a matrix, of all templates and imagesNormalization processing is carried out;
S1.4traversing, matching and zooming the image of a certain circular template to the end face image of the circular casting blank to obtain a gradient matching image, which specifically comprises the following steps: calculating the gradient matching value of the single-point pixel, and assuming that the horizontal gradient of a certain pixel point on the edge profile of the circular template isVertical gradient ofAnd the horizontal gradient of a certain pixel point of the corresponding zoomed round casting blank end surface imageVertical gradient ofThen the single point pixel gradient matching value isWherein, m and n are values in all the traversal ranges;
calculating the gradient matching value of the circular template, performing down-sampling on the outline of the circular template, setting the down-sampling coefficient to be 2, namely taking one pixel at every other pixel point, traversing the outline points of the circular template after down-sampling, and obtaining the gradient matching values of all pixels of the end face image of the circular casting blank after being correspondingly zoomedAccumulating and summing to obtain an average value so as to complete primary circular template gradient matching; setting the matching step length as 1, and completing the calculation of the gradient matching value of the circular template of the whole image by traversing the zoomed circular casting blank end face image so as to obtain a complete gradient matching image;
s1.5, mixingThe calculation of step S1.4 is repeated for each round template image, thereby obtainingA gradient matching map is obtained by searchingAnd comparing the maximum value which is the brightest point in the gradient matching image with the set brightest point threshold value, so as to obtain the corresponding center coordinate and the radius of the circular template, and completing the positioning of the circular effective area.
Further, the method for calculating the slope average of the short side of the circumscribed rectangle in step S3 specifically includes:
s3.1, assuming that the number of minimum outline bounding rectangles is NcRemoving two profiles of which the inclination angle of the short side of the minimum circumscribed rectangle is the maximum value and the minimum value, wherein,in order to remove the i-th minimum outline short edge inclination angle after the maximum value and the minimum value of the inclination angle, the inclination angle of the code-sprayed character is。
Further, the method for voting by arranging and combining slopes of connecting lines between any two external rectangles in step S3 to obtain the tilt angle of the character specifically includes:
s3.2, according to the prior condition information of the character row-column distribution characteristics, assuming that M rows of characters exist, wherein AiThe number of the ith row of characters is, the number of any two character permutation and combination in the single row of characters isThe total number of any two character permutation and combination of all the single-line characters is(ii) a Assuming that the number of minimum bounding rectangles of the obtained outline is Nc,Is the inclination angle of the connecting line of the central points of any two minimum external rectangles of outlines, wherein,the total number of the permutation and combination of the connecting lines of the center points of any two contour minimum circumscribed rectangles isThe total number of any two character permutation and combination of all the single-line characters is as followsBy looking forThe ratio of the total number of middle inclination angle values concentrated in a certain inter-cell range is PSet of angles of inclination, taking the ratio PAnd taking the average value of the elements in the inclination angle set as the inclination angle of the code spraying character.
Further, the post-processing of the character correction result in step S4 specifically includes: sorting all corrected single characters according to the central coordinate position of the circumscribed rectangle to obtain the quantity information of each row of characters, comparing the quantity information with the prior condition information of the character row-column distribution, namely the quantity characteristics, and if the quantity information is matched with the prior condition information of the characters, the correction result of the step S3 is the final correction result; if not, a 180 degree rotation is required as the final correction result.
Further, the ResNet-inclusion model fusion classifier described in step S5 uses ResNet-18 as a main feature extraction network, fuses the inclusion module, adjusts the 7 × 7 convolution kernel of the 1 st convolution module of ResNet-18 into two 5 × 5 convolution kernels, the 2 nd convolution module includes 2 residual error structures composed of 3 × 3+3 × 3 convolution kernels and the number of convolution kernels is 64, fuses the 2 residual error structures by concat connection, the 4 th convolution module includes 2 residual error structures composed of 3 × 3+3 × 3 convolution kernels and the number of convolution kernels is 256, fuses the 2 residual error structures by cat connection, adjusts the 3 × 3+3 × 3 convolution kernels of the 3 rd convolution module and the 5 th convolution module into 1 × 1 +3 × 3+ 1 × 1 convolution kernel, fuses the split-transform-merge structure paradigm, and finally changes the fully-connected layer into 64-d output, and the regularization method DropBlock is used in the 2 nd convolution module.
Further, in step S2, only the pixels in the area surrounded by the circle contour are preprocessed, and the pixels outside the circle contour are not processed as invalid pixels.
In another aspect, the present invention also discloses a computer readable storage medium storing a computer program, which when executed by a processor causes the processor to perform the steps of the method as described above.
According to the technical scheme, the method for correcting and identifying the inclination of the code-sprayed characters on the end face of the round casting blank and the storage medium have the advantages that most of the end faces of the round casting blank are non-perfect round profiles, Hough transform is adopted and is difficult to adapt to the detection condition, and an improved profile gradient template matching algorithm is adopted, so that the effective area of the end face of the round blank can be accurately positioned. By combining the prior condition information of the row and column distribution characteristics of the code-spraying characters, the inclination angle of the code-spraying characters in the end face image of the round casting blank can be accurately calculated by adopting a short-edge slope average method of the circumscribed rectangle and a random minimum circumscribed rectangle central point connecting slope arrangement combination voting method. Meanwhile, a model with a combined ResNet-18 and inclusion structure paradigm is used as a classifier, and corrected single characters can be accurately and efficiently recognized. The round casting blank effective area positioning method and the character inclination correction method can be well suitable for detection in a static or moving state, have strong robustness and can be multiplexed on a square blank.
Drawings
FIG. 1 is a schematic flow diagram of an embodiment of the present invention;
FIG. 2a is an image acquisition scheme diagram of a round casting blank transmission mode according to an embodiment of the invention; FIG. 2b is a schematic diagram of an image acquisition scheme of a round casting blank rolling mode according to an embodiment of the invention;
FIG. 3a is an end view of a round billet according to an embodiment of the present invention; FIG. 3b is a diagram illustrating the effect of contour alignment according to an embodiment of the present invention;
FIG. 4a is a diagram illustrating the pre-processing result of the effective area image according to the embodiment of the present invention; FIG. 4b is a diagram of the effective area image post-processing results of an embodiment of the present invention;
FIG. 5a is a diagram illustrating the effect of the inkjet printing of 30 degree inclination according to the embodiment of the present invention;
FIG. 5b is a diagram illustrating the effect of the inkjet inclination of 210 degrees according to the embodiment of the present invention;
FIG. 6a is a block diagram of a model fusion classifier according to an embodiment of the present invention;
FIG. 6b, FIG. 6c, FIG. 6d and FIG. 6e are schematic structural diagrams of stem1, stem2, stem3 and stem4 modules, respectively;
FIG. 7a is a diagram illustrating the effect of correcting the end surface inclination of a round cast slab according to the embodiment of the present invention; fig. 7b is a diagram of a result of inkjet recognition according to the embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention.
As shown in fig. 1, the method for correcting and identifying the inclination of the code-sprayed characters on the end surface of the round casting blank in the embodiment includes the following steps,
s1, acquiring an end face image of the round casting blank, and processing the end face image of the round casting blank by adopting an improved contour gradient template matching algorithm to obtain an effective area surrounded by a round contour;
s2, extracting the outline of the character connected domain after preprocessing the image of the effective area surrounded by the circular outline, and solving the minimum circumscribed rectangle of each character outline;
s3, solving the character inclination angle by adopting a slope average method of the short sides of the external rectangles or a slope arrangement combination voting method of the central connecting line of any two external rectangles to obtain a corrected image;
s4, combining the prior condition information of character row-column distribution, post-processing the correction result to obtain a plurality of single character correction images;
s5, fusing ResNet-18 and an inclusion structure paradigm to construct a ResNet-inclusion model fusion classifier, recognizing the single character correction image by using the trained fusion classifier, and summarizing classification results to obtain character recognition results;
the following are specifically described:
s1, acquiring an end face image of the round casting blank, and obtaining an effective area surrounded by a round contour by adopting an improved contour gradient template matching algorithm:
the round casting blank passes through the image acquisition device in a rolling or transmission mode, corresponding image acquisition schemes are designed aiming at two motion modes of the round casting blank on a production line in a graph 2a and a graph 2b respectively, main hardware comprises an industrial camera, a lens, a bowl-shaped light source, a light source controller, a photoelectric sensor and the like, wherein the photoelectric sensor arranged below the acquisition device is connected with the industrial camera in a hard wiring mode, automatically acquires in-place signals, triggers the camera to acquire and acquires end face images of the round casting blank, and can be well suitable for image acquisition and detection in a static or motion state.
S1.1, assuming that in the collected round casting blank end face image, the size of the outline radius of the round blank accounts for pixelsIn whichAs constant, the end face image of the round casting blank is subjected to scale factorZooming is performed, whereinIs a positive integer and takes the value of 3;
FIG. 3a is an end view of a round billet according to an embodiment of the present invention, wherein the radius of the round billet profile is between (500, 540), and the round billet profile is scaled by 8 times.
S1.2, setting the reference radius of the circular template asThe size of the reference circle template image is set toThe center coordinates are set asSetting the color of a pixel inside a circular outline of a reference circular template image as 0 and the color of a pixel outside the outline as 1; the upper and lower deviations of the round template are set asWhereinThe process is carried out by rounding to get the whole,rounding up, therefore, the number of the circular template images is set toRadius of the circular template isChange in between;
according to the relevant settings of the step S1.1, the reference radius of the circular template is 65, the size of the reference template image is (135 ), the center coordinates of the circle are set (67, 67), the vertical deviation of the circular template is set to be 3, the number of the circular template images is 7, and the radius of the circular template is changed from 62 to 68.
S1.3, adopting sobel operator to setHorizontal gradient image is obtained from round template imageAnd vertical gradient image(ii) a Similarly, a sobel operator is adopted to obtain a horizontal gradient image of the zoomed round casting blank end surface imageAnd vertical gradient imageAt the same time, toAndthe image is post-processed byThe horizontal and vertical gradients of the pixel points are set to 0, whereinIs a constant number of times, and is,in thatThe value of (A) is selected from,as a matrix, of all templates and imagesNormalization processing is carried out;
according to the relevant settings of S1.1 and S1.2, sequentially solving horizontal gradient images and vertical gradient images of 7 circle template images by using a sobel operator; solving a horizontal gradient image and a vertical gradient image of the end face image of the round casting blank after scaling by 8 times by using a sobel operator; and all the obtained gradient images are normalized.
S1.4, traversing, matching and zooming the round casting blank end face image of a certain round template image to obtain a gradient matching image, which specifically comprises the following steps: calculating the gradient matching value of the single-point pixel, and assuming that the horizontal gradient of a certain pixel point on the edge profile of the circular template isVertical gradient ofAnd the horizontal gradient of a certain pixel point of the corresponding zoomed round casting blank end surface imageVertical gradient ofThen the single point pixel gradient matching value isWherein, m and n are values in all the traversal ranges;
calculating the gradient matching value of the circular template, performing down-sampling on the outline of the circular template, setting the down-sampling coefficient to be 2, namely taking one pixel at every other pixel point, traversing the outline points of the circular template after down-sampling, and obtaining the gradient matching values of all pixels of the end face image of the circular casting blank after being correspondingly zoomedAccumulating and summing to obtain an average value so as to complete primary circular template gradient matching; setting the matching step length to be 1, and finishing the calculation of the gradient matching value of the circular template of the whole image by traversing the zoomed circular casting blank end face image, thereby obtainingA complete gradient match map;
s1.5, mixingThe calculation of step S1.4 is repeated for each round template image, thereby obtainingA gradient matching map is obtained by searchingAnd comparing the maximum value which is the brightest point in the gradient matching image with the set brightest point threshold value, so as to obtain the corresponding center coordinate and the radius of the circular template, and completing the positioning of the circular effective area.
The improved contour gradient template matching algorithm described in S1 above can be multiplexed into the contour effective area location of the square billet by changing the reference circle template into the reference rectangle template.
FIG. 3b is a diagram of the contour positioning effect according to the embodiment of the present invention, which is calculated according to the above-mentioned processing method.
According to the obtained central coordinate and radius of the round billet, background information is removed, and only an image of an effective area inside the outline of the round billet is captured, wherein the method specifically comprises the following steps: and keeping the pixel points in the profile of the round billet unchanged, and setting the pixel points in other areas to be 0.
S2, extracting the outline of the character connected domain after preprocessing the image of the effective area surrounded by the circular outline, and solving the minimum circumscribed rectangle of each character outline:
the following pretreatment methods may be employed: adopting Gaussian filtering to carry out smooth denoising on the image and eliminate certain noise interference; the method comprises the following steps of solving a segmentation threshold value of an effective area of the end face of a round billet by adopting a maximum inter-class variance method, carrying out binarization on an image, and specifically referring to the following settings by setting a plurality of convolution kernels with different sizes: when i is odd, the convolution kernel size S =2k + i; and when i is an even number, the size of the convolution kernel is S =2k-i +1, wherein S > =3, k is a constant value, 2 is generally selected, and the binary image is subjected to open algorithm processing according to different set convolution kernels, so that isolated dots and burrs can be effectively removed.
And extracting the connected domain outline of the preprocessed image, solving the minimum circumscribed rectangle of all the outlines, and removing the obvious abnormal outline according to the area of the connected domain outline and the length and width information of the minimum circumscribed rectangle.
And finally, solving the minimum circumscribed rectangle of each character outline.
S3, solving the character inclination angle by adopting a method of averaging the slopes of the short sides of the external rectangles or adopting a method of arranging and combining the slopes of the central connecting lines of any two external rectangles to obtain a corrected image:
the inclination angle of the code spraying character is calculated by adopting the following two methods, namely: solving the character inclination angle by an external rectangle short edge slope average method; II, secondly: the slope arrangement combination voting method for the connection line of the centers of any two external rectangles.
S3.1, a character inclination angle calculation method I:
assuming that the number of minimum bounding rectangles of the obtained outline is NcRemoving two profiles of which the inclination angle of the short side of the minimum circumscribed rectangle is the maximum value and the minimum value, wherein,in order to remove the i-th minimum outline short edge inclination angle after the maximum value and the minimum value of the inclination angle, the inclination angle of the code-sprayed character is。
S3.2, a character inclination angle calculation method II:
according to the prior condition information of character row-column distribution characteristics, M rows of characters are assumed, wherein AiThe number of the ith row of characters is, the number of any two character permutation and combination in the single row of characters isThe total number of any two character permutation and combination of all the single-line characters is(ii) a Assuming that the number of minimum bounding rectangles of the obtained outline is Nc,Is the inclination angle of the connecting line of the central points of any two minimum external rectangles of outlines, wherein,the total number of the permutation and combination of the connecting lines of the center points of any two contour minimum circumscribed rectangles isThe total number of any two character permutation and combination of all the single-line characters is as followsBy looking forThe ratio of the total number of middle inclination angle values concentrated in a certain inter-cell range is PSet of angles of inclination, taking the ratio PAnd taking the average value of the elements in the inclination angle set as the inclination angle of the code spraying character.
FIG. 4a is a diagram illustrating the pre-processing result of the effective area image according to the embodiment of the present invention; FIG. 4b is a diagram of the effective area image post-processing results of an embodiment of the present invention; according to the above calculation method, we obtain:
s4, combining the prior condition information of character row-column distribution, post-processing the correction result to obtain a plurality of single character correction images:
performing character inclination correction according to the character inclination angle obtained by calculation, and obtaining a corrected image; sorting all corrected single characters according to the central coordinate position of the circumscribed rectangle to obtain the quantity information of each row of characters, comparing the quantity information with the prior condition information of the character row-column distribution, namely the quantity characteristics, and if the quantity information is matched with the prior condition information of the characters, the correction result of the step S3 is the final correction result; if not, a 180 degree rotation is required as the final correction result.
As shown in fig. 5a and 5b, wherein fig. 5a is an effect diagram of the inkjet printing of the embodiment of the present invention being inclined by 30 degrees; FIG. 5b is a diagram illustrating the effect of the inkjet inclination of 210 degrees according to the embodiment of the present invention; according to the inclination angle obtained in step S3, the calculation results of the inclination angles of the characters in the two images should be the same, but actually the inclination angle of the right image needs to be turned over by 180 degrees to ensure the accuracy of character correction, so the character correction result needs to be verified with the prior condition information of the characters to ensure the accuracy of character correction when the inclination angle falls within the interval of [180 ° and 360 °.
S5, adopting a ResNet-inclusion model fusion classifier to recognize the single character correction image, and summarizing classification results to obtain character recognition results:
as shown in fig. 6a to 6e, the ResNet-inclusion model fusion classifier uses ResNet-18 as a main feature extraction network, fuses the inclusion module, adjusts the 7 × 7 convolution kernel of the 1 st convolution module of ResNet-18 into two 5 × 5 convolution kernels, the 2 nd convolution module includes a residual structure composed of 2 3 × 3+3 × 3 convolution kernels (the number of convolution kernels is 64), fuses the 2 residual structures by concat connection, the 4 th convolution module includes a residual structure composed of 2 3 × 3+3 × 3 convolution kernels (the number of convolution kernels is 256), fuses the 2 residual structures by concat connection, the 3 × 3+3 × 3 convolution kernels of the 3 rd convolution module and the 5 th convolution module are adjusted into 1 × 1 +3 × 3+ 1 × 1 convolution kernel, and fuses a split-transform-filter structure normal expression, finally, the fully-connected layer is changed to output 64-d and the regularization DropBlock is used in convolution module 2.
Firstly, finishing inclination correction of code-sprayed characters on the end face of a round blank, storing the corrected single characters in an image form, establishing a single character sample database, wherein the database comprises common characters such as numbers, capital letters and lower case letters, and the like, and totally 64 categories, manually finishing classification of character data in the early stage, and after a certain amount of sample sets are collected, sending the character data into the model fusion classifier for training; in the later stage, newly acquired circular casting blank end face image data can be recognized by using a classifier trained in the earlier stage, recognized single character results are stored, the recognized results are manually verified (wrongly-divided characters need to be corrected), the verified recognition result data is added to a single character sample database again, and iteration of a model fusion classifier is performed; and repeating the operations, and continuously performing model iteration to improve the detection effect of the character classifier.
In summary, according to the method for correcting and identifying the inclination of the code-sprayed characters on the end face of the round casting blank, the corresponding image acquisition schemes are designed for 2 motion modes of the round casting blank on a production line, the photoelectric sensor can be directly connected with an industrial camera, the camera is automatically triggered to acquire images after the round blank is in place, and a PLC (programmable logic controller) is not required to acquire in-place signals. Most of the end surfaces of the round casting blanks are non-perfect round profiles, so that the Hough transform is difficult to adapt to the detection condition, and the effective areas of the end surfaces of the round blanks can be accurately positioned by adopting an improved profile gradient template matching algorithm. By combining the prior condition information of the row and column distribution characteristics of the code-spraying characters, the inclination angle of the code-spraying characters in the end face image of the round casting blank can be accurately calculated by adopting a short-edge slope average method of the circumscribed rectangle and a random minimum circumscribed rectangle central point connecting slope arrangement combination voting method. Meanwhile, a model with a combined ResNet-18 and inclusion structural paradigm is used as a classifier, corrected single characters can be accurately and efficiently identified, as shown in FIGS. 7a and 7b, wherein FIG. 7a is a diagram of the effect of correcting the end face inclination of the round casting blank in the embodiment of the invention; fig. 7b is a diagram of a result of code spraying identification according to an embodiment of the present invention, and it can be seen that the method for positioning an effective area of a round casting blank and the method for correcting a character tilt according to the present invention can be well adapted to detection in a stationary or moving state, have strong robustness, and can also be multiplexed onto a square blank.
In yet another aspect, the present invention also discloses a computer readable storage medium storing a computer program, which when executed by a processor causes the processor to perform the steps of the method as described above.
In yet another aspect, the present invention also discloses a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the above method.
In another embodiment provided by the present application, there is also provided a computer program product containing instructions, which when run on a computer, causes the computer to execute any one of the above-mentioned methods for correcting and identifying the skew of the end-face code-sprayed characters of the round billet.
It is understood that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, the example and the beneficial effects of the related contents can refer to the corresponding parts in the method.
The embodiment of the application also provides an electronic device, which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus,
a memory for storing a computer program;
the processor is used for realizing the inclination correction and identification method of the code-sprayed characters on the end face of the round casting blank when executing the program stored in the memory;
the communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus may be divided into an address bus, a data bus, a control bus, etc.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; the Integrated Circuit may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), or other Programmable logic devices, discrete Gate or transistor logic devices, or discrete hardware components.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (7)
1. A method for correcting and identifying the inclination of code-sprayed characters on the end surface of a round casting blank is characterized by comprising the following steps of,
s1, acquiring an end face image of the round casting blank, and processing the end face image of the round casting blank by adopting an improved contour gradient template matching algorithm to obtain an effective area surrounded by a round contour;
s2, extracting the outline of the character connected domain after preprocessing the image of the effective area surrounded by the circular outline, and solving the minimum circumscribed rectangle of each character outline;
s3, solving the character inclination angle by adopting a slope average method of the short sides of the external rectangles or a slope arrangement combination voting method of the central connecting line of any two external rectangles to obtain a corrected image;
s4, combining the prior condition information of character row-column distribution, post-processing the correction result to obtain a plurality of single character correction images;
s5, fusing ResNet-18 and an inclusion structure paradigm to construct a ResNet-inclusion model fusion classifier, recognizing the single character correction image by using the trained fusion classifier, and summarizing classification results to obtain character recognition results;
the improved contour gradient template matching algorithm described in step S1 specifically includes:
s1.1, assuming that in the collected round casting blank end face image, the size of the outline radius of the round blank accounts for pixelsIn whichAs constant, the end face image of the round casting blank is subjected to scale factorZooming is performed, whereinIs a positive integer and takes the value of 3;
s1.2, setting the reference radius of the circular template asThe size of the reference circle template image is set toThe center coordinates are set asSetting the color of a pixel inside a circular outline of a reference circular template image as 0 and the color of a pixel outside the outline as 1; the upper and lower deviations of the round template are set asWhereinThe process is carried out by rounding to get the whole,rounding up, therefore, the number of the circular template images is set toRadius of the circular template isChange in between;
s1.3, adopting sobel operator to setHorizontal gradient image is obtained from round template imageAnd vertical gradient image(ii) a Similarly, a sobel operator is adopted to obtain a horizontal gradient image of the zoomed round casting blank end surface imageAnd vertical gradient imageAt the same time, toAndthe image is post-processed byThe horizontal and vertical gradients of the pixel points are set to 0, whereinIs a constant number of times, and is,in thatThe value of (A) is selected from,as a matrix, of all templates and imagesNormalization processing is carried out;
s1.4, traversing, matching and zooming the round casting blank end face image of a certain round template image to obtain a gradient matching image, which specifically comprises the following steps: calculation of gradient matching value of single-point pixel, assuming circular template edge wheelThe horizontal gradient of a certain pixel point on the outline isVertical gradient ofAnd the horizontal gradient of a certain pixel point of the corresponding zoomed round casting blank end surface imageVertical gradient ofThen the single point pixel gradient matching value isWherein, m and n are values in all the traversal ranges;
calculating the gradient matching value of the circular template, performing down-sampling on the outline of the circular template, setting the down-sampling coefficient to be 2, namely taking one pixel at every other pixel point, traversing the outline points of the circular template after down-sampling, and obtaining the gradient matching values of all pixels of the end face image of the circular casting blank after being correspondingly zoomedAccumulating and summing to obtain an average value so as to complete primary circular template gradient matching; setting the matching step length as 1, and completing the calculation of the gradient matching value of the circular template of the whole image by traversing the zoomed circular casting blank end face image so as to obtain a complete gradient matching image;
s1.5, mixingThe calculation of step S1.4 is repeated for each round template image, thereby obtainingA gradient matching map is obtained by searchingAnd comparing the maximum value which is the brightest point in the gradient matching image with the set brightest point threshold value, so as to obtain the corresponding center coordinate and the radius of the circular template, and completing the positioning of the circular effective area.
2. The method for correcting and identifying the inclination of the code-sprayed characters on the end faces of the round casting blanks according to claim 1, wherein the method comprises the following steps: step S3, the method for obtaining the slope average of the short side of the circumscribed rectangle includes:
s3.1, assuming that the number of minimum outline bounding rectangles is NcRemoving two profiles of which the inclination angle of the short side of the minimum circumscribed rectangle is the maximum value and the minimum value, wherein,in order to remove the i-th minimum outline short edge inclination angle after the maximum value and the minimum value of the inclination angle, the inclination angle of the code-sprayed character is。
3. The method for correcting and identifying the inclination of the code-sprayed characters on the end faces of the round casting blanks according to claim 1, wherein the method comprises the following steps: step S3, where the method for voting by combining and arranging the slopes of the connecting lines between any two external rectangles to obtain the tilt angle of the character specifically includes:
s3.2, according to the prior condition information of the character row-column distribution characteristics, assuming that M rows of characters exist, wherein AiThe number of the ith row of characters is, the number of any two character permutation and combination in the single row of characters isThe total number of any two character permutation and combination of all the single-line characters is(ii) a Assuming that the number of minimum bounding rectangles of the obtained outline is Nc,Is the inclination angle of the connecting line of the central points of any two minimum external rectangles of outlines, wherein,the total number of the permutation and combination of the connecting lines of the center points of any two contour minimum circumscribed rectangles isThe total number of any two character permutation and combination of all the single-line characters is as followsBy looking forThe ratio of the total number of middle inclination angle values concentrated in a certain inter-cell range is PSet of angles of inclination, taking the ratio PAnd taking the average value of the elements in the inclination angle set as the inclination angle of the code spraying character.
4. The method for correcting and identifying the inclination of the code-sprayed characters on the end faces of the round casting blanks according to claim 1, wherein the method comprises the following steps: the post-processing of the character correction result in step S4 specifically includes: sorting all corrected single characters according to the central coordinate position of the circumscribed rectangle to obtain the quantity information of each row of characters, comparing the quantity information with the prior condition information of the character row-column distribution, namely the quantity characteristics, and if the quantity information is matched with the prior condition information of the characters, the correction result of the step S3 is the final correction result; if not, a 180 degree rotation is required as the final correction result.
5. The method for correcting and identifying the inclination of the code-sprayed characters on the end faces of the round casting blanks according to claim 1, wherein the method comprises the following steps: the ResNet-inclusion model fusion classifier described in step S5, using ResNet-18 as a backbone feature extraction network, fusing an inclusion module, adjusting 7 × 7 convolution kernels of the 1 st convolution module of ResNet-18 into two 5 × 5 convolution kernels, where the 2 nd convolution module includes 2 residual error structures composed of 3 × 3+3 × 3 convolution kernels and the number of convolution kernels is 64, fusing the 2 residual error structures by concat connection, the 4 th convolution module includes 2 residual error structures composed of 3 × 3+3 × 3 convolution kernels and the number of convolution kernels is 256, fusing the 2 residual error structures by concat connection, adjusting 3 × 3+3 × 3 convolution kernels of the 3 rd convolution module and the 5 th convolution module to 1 × 1 +3 × 3+ 1 × 1 convolution kernels, fusing a split-transform-merge structural paradigm, and finally changing the full connection layer into 64-d, and the regularization method DropBlock is used in the 2 nd convolution module.
6. The method for correcting and identifying the inclination of the code-sprayed characters on the end faces of the round casting blanks according to claim 1, wherein the method comprises the following steps: in step S2, only the pixels in the area surrounded by the circle contour are preprocessed, and the pixels outside the circle contour are not processed as invalid pixels.
7. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210213702.2A CN114299502B (en) | 2022-03-07 | 2022-03-07 | Method for correcting and identifying inclination of code-spraying characters on end face of round casting blank and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210213702.2A CN114299502B (en) | 2022-03-07 | 2022-03-07 | Method for correcting and identifying inclination of code-spraying characters on end face of round casting blank and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114299502A true CN114299502A (en) | 2022-04-08 |
CN114299502B CN114299502B (en) | 2022-06-17 |
Family
ID=80978509
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210213702.2A Active CN114299502B (en) | 2022-03-07 | 2022-03-07 | Method for correcting and identifying inclination of code-spraying characters on end face of round casting blank and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114299502B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115497099A (en) * | 2022-09-23 | 2022-12-20 | 神州数码系统集成服务有限公司 | Single character image matching and identifying method based on circular scanning |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101751785A (en) * | 2010-01-12 | 2010-06-23 | 杭州电子科技大学 | Automatic license plate recognition method based on image processing |
CN108596066A (en) * | 2018-04-13 | 2018-09-28 | 武汉大学 | A kind of character identifying method based on convolutional neural networks |
CN109871938A (en) * | 2019-01-21 | 2019-06-11 | 重庆大学 | A kind of components coding detection method based on convolutional neural networks |
CN111598083A (en) * | 2020-05-08 | 2020-08-28 | 南通大学 | Method for detecting quality of spray printing and code spraying on bottle bottom mold closing line |
CN112085024A (en) * | 2020-09-21 | 2020-12-15 | 江苏理工学院 | Tank surface character recognition method |
-
2022
- 2022-03-07 CN CN202210213702.2A patent/CN114299502B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101751785A (en) * | 2010-01-12 | 2010-06-23 | 杭州电子科技大学 | Automatic license plate recognition method based on image processing |
CN108596066A (en) * | 2018-04-13 | 2018-09-28 | 武汉大学 | A kind of character identifying method based on convolutional neural networks |
CN109871938A (en) * | 2019-01-21 | 2019-06-11 | 重庆大学 | A kind of components coding detection method based on convolutional neural networks |
CN111598083A (en) * | 2020-05-08 | 2020-08-28 | 南通大学 | Method for detecting quality of spray printing and code spraying on bottle bottom mold closing line |
CN112085024A (en) * | 2020-09-21 | 2020-12-15 | 江苏理工学院 | Tank surface character recognition method |
Non-Patent Citations (1)
Title |
---|
李厚君: "基于梯度模板匹配的眉毛识别方法", 《广西科技大学学报》 * |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN115497099A (en) * | 2022-09-23 | 2022-12-20 | 神州数码系统集成服务有限公司 | Single character image matching and identifying method based on circular scanning |
CN115497099B (en) * | 2022-09-23 | 2023-04-18 | 神州数码系统集成服务有限公司 | Single character image matching and identifying method based on circular scanning |
Also Published As
Publication number | Publication date |
---|---|
CN114299502B (en) | 2022-06-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108985137B (en) | License plate recognition method, device and system | |
CN110348264B (en) | QR two-dimensional code image correction method and system | |
CN108345881B (en) | Document quality detection method based on computer vision | |
CN116664559B (en) | Machine vision-based memory bank damage rapid detection method | |
CN113498528A (en) | Image defect determining method and device, electronic equipment and storage medium | |
CN111860439A (en) | Unmanned aerial vehicle inspection image defect detection method, system and equipment | |
CN114299502B (en) | Method for correcting and identifying inclination of code-spraying characters on end face of round casting blank and storage medium | |
CN111833369A (en) | Alum image processing method, system, medium and electronic device | |
CN113019973B (en) | Online visual inspection method for manufacturing defects of ring-pull cans | |
CN111476759B (en) | Screen surface detection method and device, terminal and storage medium | |
CN104331693A (en) | Symmetry detecting method and system of printing matter | |
CN113177899A (en) | Method for correcting text tilt of medical photocopy, electronic device and readable storage medium | |
CN112378350A (en) | Flatness detection method for PIN PIN of network transformer | |
CN115953373A (en) | Glass defect detection method and device, electronic equipment and storage medium | |
Wankhede et al. | A low cost surface strain measurement system using image processing for sheet metal forming applications | |
CN117689655B (en) | Metal button surface defect detection method based on computer vision | |
WO2022121021A1 (en) | Identity card number detection method and apparatus, and readable storage medium and terminal | |
CN113705564A (en) | Pointer type instrument identification reading method | |
CN113421223A (en) | Industrial product surface defect detection method based on deep learning and Gaussian mixture | |
CN117314901A (en) | Scale-adaptive chip detection neural network system | |
CN113516619A (en) | Product surface flaw identification method based on image processing technology | |
CN110969612B (en) | Two-dimensional code printing defect detection method | |
CN112036232A (en) | Image table structure identification method, system, terminal and storage medium | |
CN113378847B (en) | Character segmentation method, system, computer device and storage medium | |
CN109949245B (en) | Cross laser detection positioning method and device, storage medium and computer equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |