The present invention will be further described in detail below with reference to the drawings and embodiments.
 At present, X-ray equipment produces X-rays by bombarding the anode target (usually a tungsten target) with high-speed electrons emitted from the cathode filament in the tube. The X-rays are not generated on the surface of the anode target, but by its atoms inside the anode target. And the interaction of high-speed electrons. The path that X-rays travel through when exiting the anode target varies according to their exit angle, such as figure 1 As shown, this effect is the heel effect. According to Lambert-Beer theorem I=I 0 e -μl That is, when the attenuation coefficient of the material is the same, the intensity of the rays is inversely proportional to the exponent of the path length of the rays in the material. Therefore, the intensity of the X-rays emitted from the anode target gradually decreases along the direction of the high-speed electrons. Obviously, the X-ray intensity difference caused by the heel effect will increase as the ray coverage increases. At present, the size of medical flat-panel detectors is usually 14 inches to 17 inches. When scanning small parts, the distance from the focus to the flat-panel detector is usually no more than 1 meter. It can be concluded that the angle covered by the heel effect should exceed 20 degrees. The influence on the X-ray intensity distribution is not negligible. When the X-ray emerges from the tube, its intensity change follows the inverse square law I∝D without considering the attenuation -2 , That is, the intensity of the ray is inversely proportional to the square of the distance to the focal point. The length of the filtering path that the X-ray travels through increases with the increase of the ray angle, and the attenuation of the ray is proportional to the index of the filtering path length, which leads to the difference of the ray intensity under different filtering paths. The X-rays will scatter after interacting with the scanned object, and the scattered X-rays are more randomly distributed.
 During X-ray scanning, the above-mentioned factors will eventually produce an X-ray background with inconsistent intensity distribution in the image. When scanning large parts, due to the larger attenuation of the part, the proportion of the background in the image is smaller, and the coverage area is also smaller. After conventional processing, the influence of the background on the image quality can basically be eliminated Lost. However, when shooting a small part, the attenuation of the small part is very small, and sometimes the attenuation change of the part is even smaller than the change of the background intensity. In this case, the influence of the background intensity difference on the image quality cannot be ignored.
 The small part X-ray image background suppression method of the present invention is mainly divided into two parts: background extraction and background suppression. The method flow is as follows figure 2 Shown
 A. Extract the rough background information image from the original image;
 B. Obtain a fine background information image according to the rough background information image;
 C. Synthesize a background image based on the fine background information image;
 D. Remove the background image from the original image to obtain an image with background suppression.
 The specific algorithm flow of the present invention is as follows image 3 Shown:
 Step 301. Obtain an absolute gradient image, first in the row direction according to the preset column interval c gap Compute absolute gradient image img grad (r,c):
 img grad (r,c)=|img(r,c)-img(r,c+c gap )|
 Among them, img represents the original image, img(r,c) represents the pixel value of the rth row and cth column in the original image.
 Then based on the row gradient image according to the preset row interval r gap Calculate the final absolute gradient image img grad :
 img grad =|img grad (r,c)-img grad (r+r gap ,c)|
 Step 302. img the absolute gradient image grad Pixels that exceed the preset strong edge threshold grad_gt are set to 0, which means that the pixels are cleared and the image img is obtained no_eedge.
 Step 303. Set the pixels in the original image img that exceed the preset strong tissue threshold tissue_gt to 0, which means that the pixels are cleared to obtain the image img no_etissue.
 Step 304. Pass the image img no_eedge And image img no_etissue The set of pixels contained in it is intersected to obtain a rough background information image img rough , The image effect is like Figure 5 Shown:
 img rough =img no_eedge ∩img no_etissue
 Step 305. Perform row direction filtering on the rough background information image: first img rough Assign value to img tmp , Retain the original rough background information image img rough. Statistics rough background image img tmp The pixel value of the current line in, remove isolated points, and extract the starting position of the continuous segment seg_st i , End position seg_ed i And continuous segment length seg_len i.
 Clear the background information segment whose length is less than the preset threshold seg_gt, i.e. img tmp Seg_st in the corresponding line i To seg_ed i The corresponding pixel value is set to 0.
 Calculate the mean value of each segment in the remaining segment seg_mean i , Take the segment where the minimum mean value is located, and record it as the valley information segment seg valley. From the first background information segment to the valley information segment seg valley Derivation of background information between:
 dev i = 2 X ( seg _ mean i - seg _ mean i + 1 ) seg _ st i + seg _ ed i - seg _ st i + 1 - seg _ ed i + 1
 Clear derivative dev i The background information segment corresponding to greater than 0. Use the above formula to seg the valley information segment valley Go to the last paragraph of background information for derivation, and then clear dev i The background information segment corresponding to less than 0.
 Among the remaining background information segments, take the last point c_ed in the previous information segment in the adjacent information segment i And its background value val_ed i , And the first point c_st in the following information segment i+1 And its background value val_st i+1 , Calculate the rate of change of adjacent segments and the allowable upper threshold:
 change _ ratio = val _ ed i - val _ st i + 1 c _ ed i - c _ st i + 1
 change_ratio_gt=(c_ed i -c_st i+1 )×adj_coef
 Among them, adj_coef is the effective expansion coefficient. If the change rate change_ratio is greater than the allowable upper threshold change_ratio_gt, then the i-th information segment and the previous information segments are cleared; otherwise, if the change rate change_ratio is less than the allowable lower threshold -change_ratio_gt, then the i+1th information segment and The information segment that follows it.
 After completing the above operations on the current row, perform the above operations on the remaining rows in turn, until all rows are covered, and then get the updated image img tmp.
 Step 306. Image img tmp Perform the processing described in step 305 for each column of, until all the columns have been processed once, and then get the updated image img again tmp.
 Step 307. Clear image img tmp Residual organization information in the. First calculate img rough Hist rough , Then calculate img tmp Hist tmp , Calculate the difference ratio of the two histograms:
 hist dif _ ratio = hist rough - hist tmp hist rough
 In hist dif_ratio Find the position tissue_lt where the tissue_ratio_lt continuously exceeds the preset threshold and the number of points that exceeds the threshold tissue_ratio_lt also exceeds the preset threshold len_lt. Clear img tmp Pixels whose mid-gray value exceeds tissue_lt.
 Step 308. Clear img tmp Invalid row information in. The background information that the behavior is considered invalid when one of the following three rules is met, the specific rules are as follows:
 The number of information points contained in the background information of the current row is less than the preset threshold;
 The position of the starting background information segment of the current line is greater than a preset threshold;
 The position of the current line ending background information segment is less than the preset threshold.
 The image after the above processing is the fine background image img fine ,Such as Image 6 Shown.
 Step 309. Perform row direction fitting to fine background img fine Polynomial fitting is performed on each row of information existing in, and second-order polynomial fitting is used in this embodiment, and then the fitting coefficients are used to generate target row information.
 Step 310. Perform column-direction fitting, and perform row-direction fitting on the fine background image img fine Polynomial fitting is performed on each column of information in this embodiment. Second-order polynomial fitting is also used in this embodiment, and then fitting coefficients are used to generate target column information. After the above processing, an ideal background image is obtained, such as Figure 7 Shown.
 Step 311. The background image is subtracted from the original image to obtain a background suppressed image, such as Figure 8 As shown in the right picture.
 Such as Figure 4 As shown, the working mode of each module and unit in the device embodiment of the present invention corresponds to the method operation steps in the method embodiment, and will not be repeated here.
 The modules and units described in the embodiments of the present invention may or may not be physically separated, and some or all of the modules may be selected according to actual needs to achieve the objectives of the solutions of the embodiments. According to the above-mentioned steps of the present invention, those of ordinary skill in the art can understand and implement them without creative work.