Image segmentation and enhancement method for information codes on the end faces of bundled bars
Through the image segmentation and enhancement method of end surface information code of the bundle of rods, the problem of low accuracy of information code recognition in complex lighting environments of steel production lines is solved, and the full process traceability of single rod product information is realized.
Patent Information
- Application Number
- CN202210527586.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-16
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2042-05-16
AI Technical Summary
The existing image enhancement methods are difficult to adapt to the complex lighting environment of steel special steel bar production lines, resulting in low accuracy of information code recognition and the inability to trace the entire process of single bar product information.
The image segmentation and enhancement method of bundled rod end surface information code, including image preprocessing, grayscale mean weighted adaptive, homomorphic filtering and median filtering, is used to segment the end surface image of a single rod and enhance it.
It achieves accurate segmentation and enhancement of the information code on the end face of a single bar under complex lighting conditions, improves the contrast between the information code area and the background area, and improves the accuracy of information code recognition.
Smart Images

Figure CN114708284B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to an image segmentation and enhancement method, in particular to an image segmentation and enhancement method for information codes on the end faces of bundled bars, belonging to the technical field of image enhancement. Background Art
[0002] Special steel bars, an essential foundational material for numerous industries, play a vital role in the national economy. With the gradual improvement of my country's industrial capacity, steel production is also on the rise, exceeding 1 billion tons annually. Special steel bars come in a wide variety of types and models. Currently, steel companies typically trace special steel bar product information by attaching information such as the furnace number, batch number, weight, and length to bundles of bars before they are shipped to warehouses. This information is then traced through methods such as gluing and welding. Given the significant strategic need for identifying, tracking, and managing information on special steel bars throughout their entire production and sales process, the trend is to replace the tracing of bundled bars with the tracing of individual special steel bars.
[0003] When steel companies trace the information of special steel bar products, they mark the bar products with an identity information code that can distinguish individual bars, use machine vision technology to identify the information code, and upload and obtain the production information of individual bars in the production management system. Due to the complex and changeable lighting environment on the special steel bar production line of steel companies and the clarity of the information code marking, it is necessary to design the most suitable image enhancement algorithm for information code recognition based on environmental requirements. Existing image enhancement methods are difficult to adapt to the on-site working conditions of steel companies, and the image enhancement effect is poor, resulting in low accuracy in information code recognition. Therefore, based on the industrial on-site production environment, a method for image segmentation and enhancement of information codes on the end faces of bundled bars is proposed to lay the foundation for the automatic recognition of marked identity information codes in the full-process information traceability of single bar products. Summary of the Invention
[0004] In order to solve the above technical problems, the present invention proposes a method for segmenting and enhancing the image of the end face information code of bundled bars, providing a technical basis for the full-process information traceability of a single bar.
[0005] The method for segmenting and enhancing the image of the end face information code of bundled bars of the present invention comprises the following steps:
[0006] In the first step, the natural light bundled bar end face image with information code is segmented into single bar end face images with information code. The information code marking color is white, and the information code marking scheme is square mark point, hundreds digit, tens digit, units digit and circular mark point from left to right. The specific steps are: (1) collecting natural light and polished bundled bar end face images; (2) pre-processing the polished image, binarizing it, and using morphological corrosion and expansion to segment the sticking part of the bar end face. According to the bar size information in the steel enterprise production information management system database and the placement position of the image acquisition system, the relationship between the single bar area in the world coordinate system and the single bar area in the image coordinate system is established, and the pixel coordinates and area information of the single bar end face of the polished image are adaptively obtained; (3) the acquired polished single special steel bar end face information is used to segment the single special steel bar end face area in the natural light bundled bar end face image to obtain the single special steel bar end face image with information code.
[0007] In the second step, all the end face images of single rods with information codes are enhanced separately. The specific steps of single rod end face image enhancement are as follows: (1) the grayscale level is adaptively determined based on the grayscale mean weight of the single rod end face image, the non-target grayscale level range of the image is directly filtered out by grayscale transformation, and the single rod end face image is linearly stretched; (2) the single rod end face image is subjected to homomorphic filtering and median filtering to achieve single rod end face image enhancement.
[0008] Beneficial effects of the method of the present invention:
[0009] (1) Based on the low-contrast end face images of bar materials under complex lighting, natural light and illuminated bundled bar end face images are collected. The area and pixel coordinate information of a single bar in the illuminated image are adaptively obtained based on the steel enterprise database. Based on this information, the accurate segmentation of the end face image of a single bar in the natural light bundled bar end face image is achieved;
[0010] (2) The image of the end face of the bar is enhanced by the grayscale mean weighted adaptive image enhancement method to improve the contrast between the information code area and the background area. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 Schematic diagram of the structure of the visual system used in the method of the present invention;
[0012] Figure 2 This is the bar end face information code marking scheme adopted by the method of the present invention;
[0013] Figure 3 This is a workflow diagram of the method for segmenting and enhancing the image of the end face information code of bundled bars of the present invention.
[0014] Among them: 1. Square mark, 2. Hundreds digit, 3. Tens digit, 4. Units digit, 5. Round mark and 6. Bar end face. DETAILED DESCRIPTION
[0015] The method for segmenting and enhancing the image of the end face information code of bundled bars of the present invention comprises the following steps:
[0016] In the first step, the natural light bundled bar end face image with information code is segmented into single bar end face images with information code. The information code marking color is white, and the information code marking scheme is square mark point, hundreds digit, tens digit, units digit and circular mark point from left to right. The specific steps are: (1) collecting natural light and polished bundled bar end face images; (2) pre-processing the polished image, binarizing it, and using morphological corrosion and expansion to segment the sticking part of the bar end face. According to the bar size information in the steel enterprise production information management system database and the placement position of the image acquisition system, the relationship between the single bar area in the world coordinate system and the single bar area in the image coordinate system is established, and the pixel coordinates and area information of the single bar end face of the polished image are adaptively obtained; (3) the acquired polished single special steel bar end face information is used to segment the single special steel bar end face area in the natural light bundled bar end face image to obtain the single special steel bar end face image with information code.
[0017] In the second step, all the end face images of single rods with information codes are enhanced separately. The specific steps of single rod end face image enhancement are as follows: (1) the grayscale level is adaptively determined based on the grayscale mean weight of the single rod end face image, the non-target grayscale level range of the image is directly filtered out by grayscale transformation, and the single rod end face image is linearly stretched; (2) the single rod end face image is subjected to homomorphic filtering and median filtering to achieve single rod end face image enhancement.
[0018] In the first step of the above method, Gaussian filtering is used to pre-process the illuminated image.
[0019] The machine vision system used in the present invention includes a gigabit Ethernet industrial camera, a camera lens, an optical filter, a ring light source, an Ethernet light source controller, and a host computer control system. The host computer control system is placed in a control room, with the lens and the filter mounted on the industrial camera. The ring light source and the lens are coplanar, with the centerline of the filter and the centerline of the ring light source coinciding. The industrial camera is placed directly in front of the special steel bar. The ring light source controller and the industrial camera are connected to the host computer control system via wires.
[0020] The coding scheme adopted by the present invention uses a three-digit code to carry out the "furnace" or "batch" bar identity information, and uses left and right double marking points to assist in correction, including a left marking point and a right circular marking point. A rectangular coordinate coding system for special steel bars is used for printing, and the coding system uses white ink for printing. Image segmentation and image enhancement are performed based on the end face marking information code image of bundled bars of the special steel bar finishing line. In order to verify the feasibility of the image segmentation and image enhancement method, the present invention simulates the industrial scene and lighting conditions of the steel plant in the laboratory, and collects the illuminated and natural light images of the end faces of bundled special steel bars through a machine vision system. According to the information characteristics of the end face images of the bundled special steel bars, the natural light images of the end faces of the bundled special steel bars are segmented into single bars, and the image of the end face image of each natural light special steel bar is enhanced.
[0021] In the industrial field of a special steel bar finishing production line, the method of the present invention is used to segment and enhance the information code images of the end faces of bundled bars.
[0022] 1. Segmentation of a single bar image in a bundle of bar images
[0023] Due to the complex industrial environment, a machine vision system with a ring light source and a filter was used. The system was controlled to capture illuminated and natural light images of the bundled bar end faces. For the illuminated end face images, the target area was cropped based on the bar's position within the camera's field of view. The image was then binarized after Gaussian filtering using the bar's end face grayscale. Since the end faces of special steel bars are circular, morphological corrosion and dilation were used to segment the adhered portions of the bar end faces. Based on the actual dimensions of the bundled bars in the steel company's production information management system database and the placement of the image acquisition system, a relationship was established between the area of a single bar in the world coordinate system and the area of a single bar in the image coordinate system. This relationship enabled adaptive selection of the maximum and minimum area parameters for the connected domain of the bar end faces. The select_shape function was used to accurately obtain the connected domain of the bar end faces, determining the area and center coordinates of each bar. The connected domain information for each bar in the illuminated image was subtracted from the natural light image to obtain the end face image of the individual bar.
[0024] In the Halcon environment, the reduce_domain function is used to obtain the end face image of a single special steel bar under natural light. The code is as follows:
[0025] read_image(Image1,'E: / bar_1_2.bmp') / / Read the natural light image of the end face of the bundled bar
[0026] read_image(Imag
[0015] e,'E: / bar_1_1.bmp') / / Read the end surface polishing image of the bundled bar
[0027] threshold(Image, Region, 200, 255) / / Global fixed threshold segmentation image
[0028] reduce_domain(Image, Region, ImageReduced) / / Reduce the domain of the image
[0029] gauss_filter(ImageReduced, ImageGauss, 5) / / Use discrete Gaussian function to smooth the image
[0030] opening_circle(Region, RegionOpening, 30) / / Open the region
[0031] erosion_circle(RegionOpening, RegionErosion, 35) / / erosion
[0032] opening_circle(RegionErosion, RegionOpening1, 50) / / Open the region
[0033] connection(RegionOpening1, ConnectedRegions) / / Calculate the connected parts of the region
[0034] dilation_circle(ConnectedRegions, RegionDilation, 35) / / expansion
[0035] select_shape(RegionDilation, SelectedRegions, 'area', 'and', Area_min, Area_max) / / Select the target area. Area_min and Area_max are determined based on the bar diameter information.
[0036] area_center(SelectedRegions, Area, Row, Column) / / Get the area and center position of the region
[0037] tuple_sort_index(Area, Indices) / / Sort the elements in the tuple
[0038] Num1 :=|Indices|
[0039] for i :=1 to Num1 by 1 / / Get the end face image of a single rod under natural light
[0040] select_obj(SelectedRegions, ObjectSelected, i) / / Select an image in the target tuple
[0041] reduce_domain(Image1, ObjectSelected, ImageReduced1) / / Reduce the domain of the image
[0042] crop_domain(ImageReduced1, ImagePart) / / Crop the natural light image
[0043] write_image(ImagePart,'bmp',0,'C: / Users / zhengyu / Desktop / Picture 11 / 00-'+i+'.bmp
[0044] ') / / Save natural light image
[0045] endfor
[0046] 2. Image enhancement of the rod end face
[0047] Due to the complex lighting conditions in the production environment of special steel bars, the contrast of the end face images of bundled special steel bars collected under natural light is low, and it is difficult to directly use the edge detection method to detect the information code area. Therefore, according to the certain grayscale difference characteristics between the information code and the background area, the present invention uses a grayscale mean weighted adaptive image enhancement algorithm based on the lighting environment to complete the enhancement of the low-contrast image of the end face of the special steel bar. First, the segmented end face image of the single bar is adaptively grayscale cut based on the grayscale mean weighting to remove the uninteresting areas in the image, and then a linear grayscale change is performed; secondly, a homomorphic filtering algorithm is applied in the frequency domain to enhance the contrast between the information code and the background in the image; finally, the processed image is median filtered to remove interference information. The specific steps are as follows:
[0048] (1) Direct grayscale conversion
[0049] The purpose of grayscale cropping is to enhance the contrast within a specific range and highlight the grayscale brightness of the target area of the image. Because the grayscale value of the information code in the bar end face image is greater than the grayscale level of the background, the grayscale of the non-target area is changed to a lower fixed grayscale value, while the grayscale of the area of interest remains unchanged.
[0050] The grayscale range of the non-target area is affected by the illumination of the industrial scene light. Therefore, the grayscale range of the non-target area needs to change according to the illumination of the scene light. The present invention applies the grayscale mean weighted adaptive method to achieve adaptive adjustment of the grayscale range of the non-interested area. The calculation formula is:
[0051]
[0052] Where, a represents the weighting coefficient; M Indicates the width of a single bar image; N Indicates the height of a single bar image; f ij Represents the pixel grayscale value.
[0053] Weighting coefficient a The choice is extremely important. a If the value of is too small, there will be too much interference information. a Choosing a larger value of will result in the removal of interesting information. Therefore, a =1.72.
[0054] The grayscale level of the processed image is low, and linear grayscale stretching is used to improve the image contrast. The grayscale value change formula of each pixel is:
[0055]
[0056] Where, s max Indicates the maximum gray value of the end face of the bar; s min Indicates the minimum grayscale value of the rod end surface.
[0057] The code for direct grayscale conversion in the MATLAB environment is:
[0058] [r,c] = size(I);%Get image row and column information
[0059] av1 = 1.712*mean(mean(I)); % Based on a large number of bar end surface image experiments, the weighting coefficient a 1.72 is the best
[0060] mi1=min(min(I));%Get the maximum gray level of the image
[0061] ma1=max(max(I));%Get the minimum gray level of the image
[0062] for i = 1:r% grayscale stretch the image
[0063] for j = 1:c
[0064] if I(i,j) < av1
[0065] I(i,j) = 0;
[0066] end
[0067] cA1_lashen(i,j)=I(i,j) / (ma1-mi1)*255;
[0068] end
[0069] end
[0070] (2) Homomorphic filtering
[0071] Homomorphic filtering is a frequency domain filtering method that improves image quality by compressing the brightness range of the bar end image while enhancing the image contrast. H ( u , v ) can act on the low-frequency part of the Fourier transform corresponding to the illumination component and the high-frequency part corresponding to the reflection component. The illumination component can be expressed as a slowly changing space, and the reflection component changes sharply at the junction of different objects. Therefore, by designing a different H ( u , v ) filter functions act on high-frequency components and low-frequency components respectively. Assume H l <1, H h >1, then H ( u , v ) The filtering function will inevitably weaken the low-frequency part while enhancing the high-frequency part. The final result is the compression of the image dynamic range and the enhancement of its contrast. The Gaussian homomorphic filter used is:
[0072]
[0073] Where, D ( u , v ) represents the distance to the center frequency ; D 0 represents the cutoff frequency; H h Indicates high frequency gain; H l represents the low-frequency gain; c represents a constant.
[0074] Due to the rust and roughness of the end faces of the bundled bars, the collected images of the unpolished end faces of the bundled bars contain a lot of noise. After image enhancement using the above method, the noise in the image is isolated noise points. Therefore, median filtering is used to remove isolated noise points. This method can filter out noise while protecting the edge information of the characters. Its expression is:
[0075]
[0076] Where, O ( x , y ) represents the output image; I ( x , y ) represents the input image; W Represents a sliding window.
[0077] The code for homomorphic filtering in the MATLAB environment is:
[0078] D0=10; cutoff frequency
[0079] Hl=0.5;% low frequency gain
[0080] Hh=2;% high frequency gain
[0081] c=4; constant
[0082] for i = 1:r
[0083] for j = 1:c
[0084] d = sqrt((i-n1)^2 + (j-n2)^2);
[0085] h = (rh-rl)*(1-exp(-c2*(d.^2 / d0.^2)))+rl;
[0086] tongtai(i,j) = h*g(i,j);
[0087] end
[0088] end
[0089] ercizhongzhi=medfilt2(tongtai,[3 3]);%Median filter
[0090] Through a large number of experiments on the end surface images of rods under different lighting environments, comprehensive consideration is given to H l =0.5, H h =2.0, D 0=10,c =4 for homomorphic filtering.
Claims
1. A method for segmenting and enhancing images of information codes on the end faces of bundled bars, comprising the following steps: Step 1: Segment the natural light bundled bar end face image with information codes into individual bar end face images with information codes. The information code marking color is white, and the information code marking scheme is square mark point, hundreds digit, tens digit, units digit and circular mark point from left to right. The specific steps are as follows: (1) Collect images of the end faces of bundled bars under natural light and lighting; (2) Gaussian filtering is used to pre-process the illuminated image and perform binarization. Morphological corrosion and expansion are used to segment the sticking parts of the bar end faces. According to the bar size information in the steel enterprise production information management system database and the placement of the image acquisition system, the relationship between the area of a single bar in the world coordinate system and the area of a single bar in the image coordinate system is established, and the pixel coordinates and area information of the end face of a single bar in the illuminated image are adaptively obtained. (3) Using the acquired polished single special steel bar end face information, the end face region of the single special steel bar in the natural light bundled bar end face image is segmented to obtain the end face image of the single special steel bar with the information code; Step 2: Enhance the end face images of all individual bars with information codes. The specific steps for enhancing the end face images of individual bars are as follows: (1) The grayscale level is determined based on the grayscale mean weighted adaptive method of the end face image of a single bar. The non-target grayscale range of the image is filtered out by direct grayscale transformation. The end face image of a single bar is linearly stretched. The grayscale mean weighted adaptive method is used to adaptively adjust the grayscale range of the uninterested area. The calculation formula is: , where a represents the weighting coefficient; M Indicates the width of a single bar image; N Indicates the height of a single bar image; f ij Represents the pixel grayscale value. Linear grayscale stretching is used to improve image contrast. The grayscale value change formula of each pixel is: , where t 、 s are the grayscale values before and after grayscale stretching, s max Indicates the maximum gray value of the end face of the bar; s min Indicates the minimum gray value of the end face of the bar; (2) Perform homomorphic filtering and median filtering on the end face image of a single bar to achieve single bar end face image enhancement. Homomorphic filtering uses a Gaussian homomorphic filter, and the formula is: , where D ( u , v ) represents the distance to the center frequency, , D 0 represents the cutoff frequency, H h represents the high frequency gain, H l represents the low frequency gain, c Represents a constant.
Citation Information
Patent Citations
Vision-based acquisition system for end surface center coordinates of bundles of round steel and acquisition method thereof
CN105865329A
Infrared image noise removal method based on adaptive weighted median filtering
CN111724315A
Bundled bar end face character recognition method
CN113378846A
Copper stamping part surface crack detection method based on quantum pigeon flock peak valley interval segmentation
CN113916894A