A multi-scale black and white speckle design method based on adaptive material background color
Through the multi-scale black and white speckle design method of adaptive material background color, the accuracy problem of uneven background materials in multi-scale tests is solved, and the multi-scale test needs are met without spraying primer. It is suitable for various camera.
Patent Information
- Application Number
- CN202111133325.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-27
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2041-09-27
AI Technical Summary
The prior art cannot meet the needs of materials with uneven background colors and patterns in multi-scale tests. Spraying primer will cover up the tiny deformation characteristics and affect the accuracy, and a single scale speckle cannot meet the testing needs of multiple scales at the same time.
Using a multi-scale black and white speckle design method with adaptive material background color, through the speckle generation and design diagram synthesis of macroscopic and meshes, the material background color distribution map is used for binary and grid design, and the generation is adapted to different Random speckle of scale, avoid spraying primer and meet multi-scale testing needs.
It achieves the multi-scale testing needs without spraying primer, improves measurement accuracy, and avoids the impact of speckle size contrast and position randomness on test accuracy. It is suitable for various black and white high-speed cameras and industrial cameras.
Smart Images

Figure CN113870374B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of digital image detection, and in particular to a multi-scale black-and-white speckle design method for adaptive material background color for image analysis. Background Art
[0002] Digital image correlation method is a test method that measures the displacement, strain and other information of the specimen based on the images of the specimen before and after deformation. It has the advantages of non-contact, high precision and wide application range. In the calculation of digital image correlation method, the random speckle on the surface of the specimen is tracked and analyzed. Therefore, it is very important to process the surface of the specimen to make it have a high-quality speckle combination to improve the measurement accuracy. Black and white high-speed cameras and industrial cameras are widely used in scientific research and industry, and black and white speckle has the highest contrast, so black and white speckle is the most widely used speckle design color combination.
[0003] Common methods for producing speckles on the surface of the specimen include direct spray painting, transfer printing, UV printing, etc. The direct spray painting method is to first spray a layer of white primer on the surface of the specimen, and then spray black paint on the white primer to form black speckles with random positions. The direct spray painting method is easy to operate and widely used, but the speckle particles produced by this method are random in size and distribution density, and the speckle quality is unstable; the transfer and UV printing methods are to combine the pre-designed speckles and print them on the surface of the specimen through transfer technology or printer. Because the speckle size and distribution are designed in advance, the speckle image quality obtained by this method is stable. The key to the transfer and UV printing methods is to design the speckle pattern.
[0004] When the surface of the specimen itself has color or pattern, such as granite, wood with texture, steel with partial rust on the surface, concrete blocks, etc., both the transfer and UV printing methods require spraying a layer of primer on the surface of the specimen in advance. However, the sprayed primer is fully covered and has a certain thickness. In the micron-level precision test, it was found that the extremely small local deformation features produced on the surface of the specimen will be covered by the primer, which will affect the accuracy of the test. This effect cannot be ignored in small-scale, high-precision tests. In addition, the appearance of many materials will change during the deformation process. For example, quartz, calcite, plastic, etc. will change color during the destruction process. These changes in appearance are important phenomena for studying the deformation and destruction of materials at a microscopic level. Spraying primer will cause the surface to be covered and the phenomenon cannot be observed. However, for the specimen surface that has uneven color and pattern itself, if the primer is not sprayed, the image quality will be reduced and the test accuracy will be affected.
[0005] At the same time, the size of the speckle has a significant impact on the analysis accuracy of the digital image correlation method. If the speckle is too large, it will lead to poor image contrast and increase random errors; if the speckle is too small, it will lead to undersampling of the image and increase the system error. In some experiments, it is necessary to observe the sample from multiple scales at the same time. At this time, the speckle of a single scale cannot meet the test requirements of multiple scales at the same time. Therefore, for materials with uneven background colors and patterns, the current existing technology cannot meet the test requirements of multiple scales. There is an urgent need for a speckle design method that does not require spraying primer and meets the requirements of multi-scale testing. Summary of the invention
[0006] The purpose of the present invention is to overcome the defects of the above-mentioned prior art and provide a multi-scale black and white speckle design method that is adaptive to the background color of the material.
[0007] The purpose of the present invention can be achieved by the following technical solutions:
[0008] A multi-scale black-and-white speckle design method for adaptive material background color is used to conduct multi-scale tests on materials with uneven background colors and patterns. The method includes a speckle generation part in a macroscopic observation area, a speckle generation part in a microscopic observation area, and a synthesis part of a speckle design diagram, wherein the speckle generation part in the macroscopic observation area includes the following steps:
[0009] 101) Determine the scope of the macroscopic observation area on the surface of the sample to be tested according to the experimental requirements;
[0010] 102) Determine the required canvas size according to the scope of the macroscopic observation area;
[0011] 103) Scanning the surface of the sample to be tested to obtain a material background color distribution map of the macroscopic observation area, scaling the material background color distribution map to the size of the canvas, and binarizing the material background color distribution map based on the maximum inter-variance method;
[0012] 104) determining the size of the macroscopic speckle in the canvas, and then determining the side length of the canvas grid according to the speckle area ratio;
[0013] 105) The canvas is divided into grids according to a certain side length, and macroscopic speckles are generated at random positions in each grid.
[0014] In the step 102), the size of the canvas is determined according to the range of the macroscopic observation area and the resolution of the speckle design diagram, and then:
[0015] S c =L1×ppi
[0016] Among them, S cis the number of pixels occupied by the side length of the canvas, L1 is the actual size of the side length of the macro observation area on the sample, and ppi is the resolution of the speckle design image.
[0017] In the step 103), the material background color distribution map is binarized based on the maximum intervariate variance method as follows:
[0018] 1031) Convert the material background color distribution map into a grayscale map, and obtain the grayscale range of the pixel points [0, L-1];
[0019] 1032) Selecting a grayscale threshold T in the grayscale range [0, L-1] so that the total variance of the two regions after segmentation is maximized;
[0020] 1033) The grayscale image is divided according to the grayscale threshold T. A pixel grayscale greater than T indicates that the background color of the regional material is darker and is represented by black. A pixel grayscale less than T indicates that the background color of the regional material is lighter and is represented by white, thus completing the binarization.
[0021] In the step 1032), the expression of the total variance is:
[0022] σ B 2 =P0(μ0-μ) 2 +P1(μ1-μ) 2 =P0P1(μ0-μ1) 2
[0023]
[0024]
[0025] μ=P0μ0+P1μ1
[0026]
[0027] P1=1-P0
[0028]
[0029] Among them, n i is the number of pixels with grayscale i in the image, N is the total number of pixels, P i is the probability of gray value i appearing, P0 is the probability of gray value appearing in C0 area, P1 is the probability of gray value appearing in C1 area, C0 and C1 represent two types of areas divided by gray threshold T, μ0 is the average gray value of C0 area, μ1 is the average gray value of C1 area, μ is the average gray value of the whole image, σ B 2 is the total variance of the two regions.
[0030] In the step 104), the size of the macroscopic speckle in the canvas is determined without considering the magnification of the camera, and then:
[0031]
[0032] D ci =D ri ×ppi
[0033] Considering the magnification of the camera to determine the size of the macroscopic speckle in the canvas, we have:
[0034]
[0035] D ci =D ri ×ppi
[0036] Among them, D ri is the real size of the macroscopic speckle, D pi is the pixel size of the macro-scale photo in the final calculated photo, D ci is the pixel size of the macro speckle in the canvas, R1 is the resolution of the camera with different magnifications, L i is the actual size of the macroscopic observation area on the sample, ppi is the resolution of the speckle design image, L C is the actual side length of the camera’s photosensitive element sensor, and ω is the camera’s magnification.
[0037] In the step 104), the side length of the canvas grid is determined according to the speckle area ratio. The specific principle is:
[0038] Draw a square outside a circular speckle of a given size so that the ratio of the area of the speckle to the area of the square is equal to the preset speckle area ratio. The side length of the square is the side length of the grid, and we have:
[0039]
[0040] Among them, H i is the pixel length occupied by the grid side length at the macro scale in the canvas, and α is the area ratio of the total speckle to the macro observation area.
[0041] In the step 105), generating macroscopic speckles at random positions in each grid is specifically as follows:
[0042] The center position of the macro speckle is determined in each grid. In order to prevent the generated macro speckle from deviating from the grid in a large area, each grid generates a macro speckle at a random position within the set range from the center of the grid. The color of the speckle is determined by the color of the corresponding position of the position in the material background distribution map. White speckle is generated in the area with black background color, and black speckle is generated in the area with white background color. The coordinates of the randomly generated position of the speckle are:
[0043] X mn =X_grid mn +γ×H i ×rand(-1, 1, seed)
[0044] Y mn =Y_grid mn +γ×H i ×rand(-1, 1, seed)
[0045] Among them, X mn is the horizontal coordinate of the random speckle, the subscript m, n represents the grid of the mth row and nth column, Y mn is the ordinate of random speckle, X_grid mn Y_grid is the horizontal coordinate of the center position of the grid corresponding to the speckle. mn is the ordinate of the center position of the grid corresponding to the speckle, γ is the position random coefficient, which represents the input parameter of the speckle deviation from the center position, rand(-1, 1, seed) is the random number generation function, the generated result is a random number from -1 to 1, and seed is the random seed.
[0046] In the speckle generation part of the microscopic observation area, in order to avoid undersampling caused by too small speckles, two speckles of different sizes are generated, including the following steps:
[0047] 106) obtaining the overlapping area of the macroscopic and microscopic observation ranges, that is, the microscopic observation area where the microscopic speckle needs to be generated within the macroscopic observation area;
[0048] 107) generating large-scale mesoscopic speckles in the mesoscopic observation area according to the random speckle generation method, and the color of the large-scale mesoscopic speckles is the same as the color of the corresponding position in the binary material background color distribution map, that is, when the corresponding position in the background color distribution map is black, the color of the mesoscopic speckles is black, and when the corresponding position in the background color distribution map is white, the color of the mesoscopic speckles is white;
[0049] 108) superimposing the background color distribution map of the mesoscopic observation area with the larger-scale mesoscopic speckle and the original mesoscopic observation area, and binarizing them to obtain the updated binary background color distribution map of the mesoscopic observation area;
[0050] 109) Based on the updated binary background color distribution map of the meso observation area, a small-scale meso speckle is generated in the meso observation area according to a random speckle generation method, and the color of the small-scale meso speckle is opposite to the color of the corresponding position in the updated binary background color distribution map of the meso observation area.
[0051] The synthesis part of the speckle design image specifically includes the following steps:
[0052] 110) Synthesis and preview of speckle design diagram: The final generated layers with macro / micro speckles are superimposed to synthesize the speckle design diagram. The Gaussian blur method is used on the speckle design diagram to simulate the photo effect formed by the final shooting. By previewing the actual effect of the simulation, the speckle size and position parameters are optimized and adjusted.
[0053] The method further comprises the following steps:
[0054] 111) Target and bleed design: To facilitate the positioning on the sample during subsequent transfer, black square targets are added to the upper left, lower left and upper right corners of the speckle design image to play a role in positioning and identification during subsequent observations. Figure 4 A 3mm bleeding distance is added around each week to adapt to various types of UV printers or water transfer printing production equipment, and the final design drawing in the corresponding format is output according to the requirements of the speckle production equipment.
[0055] Compared with the prior art, the present invention has the following advantages:
[0056] 1. The present invention uses black and white areas to represent observation areas at different scales, and can divide observation areas of multiple different scales to meet the experimental requirements of multi-scale testing.
[0057] 2. The size of the design drawing and the actual size of the observation area are converted and correspond to each other, and its resolution can be adjusted at any time as a design parameter.
[0058] 3. The present invention utilizes the difference in the depth of the background color of the material itself to guide the design of the position distribution and color of the speckle, avoiding the problem of detail covering caused by spraying primer and the problem of color overlap and inability to display of randomly sprayed speckle.
[0059] 4. The speckle sizes at different scales are used as input parameters. Different test and observation scales can set speckles of different sizes according to needs, avoiding the influence of random and uncontrolled speckle size on test accuracy in existing technologies.
[0060] 5. Through the grid design diagram, each speckle is confined near the grid, avoiding the stacking of random speckles, and the control of the speckle distribution density can be achieved only by the area ratio.
[0061] 6. When generating speckles, a random algorithm with seeds is used to determine the center position of the speckles, ensuring that the speckles are generated within the grid and the position is random. The degree of randomness can be controlled by the position random coefficient, and the generated design can be controlled by the seeds to be both random and repeatable.
[0062] 7. The design map of the microscopic observation area is a superposition of two black and white speckles of different sizes. It avoids undersampling caused by too small a speckle scale at a larger observation scale, and avoids too low a contrast caused by too large a speckle scale at a smaller scale.
[0063] 8. The present invention can simulate the actual imaging effect of the camera through the Gaussian blur method, and optimize the speckle under conditions close to the actual test scene. By changing the input parameters of the design, different types of speckle design diagrams are generated to meet the needs of different tests.
[0064] 9. Adding targets during the design process improves positioning accuracy, effectively ensures spatial accuracy in subsequent transfer operations, increases bleed, and enables the design to adapt to a variety of general-purpose printer models.
[0065] 10. The present invention can achieve the goal of not spraying primer, will not cover up the fine cracks on the surface of the test sample, will not block the color change of the material before destruction, and meets the needs of multi-scale testing.
[0066] 11. Pure black and pure white are used in speckle design, with high speckle contrast, which is suitable for various black and white high-speed cameras and industrial cameras. This design method has few parameters, simple design and wide applicability. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 Schematic diagram of ROI perspective relationship at various scales.
[0068] Figure 2 Schematic diagram of speckle size calculation.
[0069] Figure 3 Gridding and speckle random position map.
[0070] Figure 4 Schematic diagram of speckle generation at each level and superposition according to color strategy.
[0071] Figure 5 Schematic diagram of bleeding and target.
[0072] Figure 6 The figure is a flow chart of the method of the present invention.
[0073] Description of Reference Numerals
[0074] 1. Specimen, 2. Macro observation area, 3. Micro observation area, 4. Speckle on the imaging element, 5. Camera imaging element, 6. High-speed camera, 7. Specimen, 8. Real speckle on the specimen, 9. Speckle on the electronic canvas, 10. Electronic canvas, 11. Schematic diagram of speckle generated after gridding, 12. The position range of random speckle generated randomly within the grid, 13. Macro observation area, 14. Large-scale speckle generated in the macro observation area, 15. Large-scale speckle generated in the micro observation area, 16. Small-scale speckle generated in the micro observation area, 17. Preview of the actual effect after the final superposition, 18. Positioning target, 19. Bleeding distance. DETAILED DESCRIPTION
[0075] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0076] Example
[0077] At present, when conducting micron-level precision tests, the white primer sprayed in the traditional black and white speckle production will cover the tiny local deformation characteristics of the specimen surface. At the same time, the appearance changes such as color when the material deforms will also be covered by the primer, which will cause great inconvenience to the analysis of the microscopic mechanism of material destruction. Some materials themselves have random patterns with uneven color depth on the surface, such as granite, textured wood, rusty steel, and concrete blocks. If random black speckle is sprayed directly on the surface of these specimens without spraying primer, the background color of the material itself will have a huge impact on the test accuracy. In addition, when observing different areas and scales of the specimen, the speckle of a single scale cannot meet the observation requirements of different scale accuracy.
[0078] To solve the above problems, the present invention proposes a multi-scale black-and-white speckle design method that is adaptive to the background color of the material. The method first determines the observation area of the sample at different observation scales according to the test requirements, and uses a black-and-white binary image to represent the observation area, wherein white represents the observation area and black represents the non-observation area.
[0079] The canvas size required for the design drawing is calculated based on the actual size of the observation area at each scale and the resolution (ppi) of the speckle design drawing.
[0080] The surface of the test sample is scanned to obtain the material background color distribution map of the surface of the test area of the sample, and then the material background color distribution map is changed to the size of the canvas, and the image is binarized based on the maximum variance method, where black is used to represent the area with darker material background color, and white is used to represent the area with lighter material background color.
[0081] Next, the size of speckle of each scale in the canvas is calculated. The pixel size of the final image of the speckle directly affects the accuracy of digital image analysis and processing. Therefore, the size of each scale of the final image is selected according to the needs of the experiment. The actual size of the speckle can be calculated based on the resolution or magnification of the camera used for observation at the corresponding scale, and then the actual size of the speckle is converted into the pixel size in the canvas according to the resolution of the canvas.
[0082] In order to obtain clear and high-precision images, it is necessary to select the area ratio of speckle to observation area at different scales according to the experimental requirements, and then divide the canvas into grids. The area of the grid is determined by the area of a single speckle and the selected area ratio.
[0083] Then, the speckle of each observation area is generated step by step. The specific process is as follows: First, the speckle in the macroscopic observation area is generated according to the calculated speckle size. When generating speckle, the center position of the speckle is determined first. In order to prevent the generated speckle from deviating from the grid in a large area, the center of the speckle is generated at a random position within a certain range with the center of the grid as the midpoint. The random range is controlled by the design parameters. The color of the speckle is determined by the color of the corresponding position of the position in the material background color distribution map. White speckle is generated in the area with a black background color, and black speckle is generated in the area with a white background color. In order to avoid undersampling caused by too small speckle, two different sizes of speckle are generated in the microscopic observation area. First, a larger speckle is generated. The random position of the speckle generation is the same as the macroscopic speckle generation method. However, the color of the speckle is opposite to that of the macroscopic speckle. Black speckle is generated in the area with a black background color, and white speckle is generated in the area with a white background color. Then the generated speckle is superimposed with the material background color of the original microscopic observation area and then re-binarized to obtain a new background color image. Next, a very small speckle of the microscopic observation area is generated to meet the micron-level precision observation. The position and color of this type of speckle generation are consistent with the process of speckle generation in the macroscopic area, that is, white speckle is generated in the area with black background color, and black speckle is generated in the area with white background color. After all speckles are generated, all speckle layers are superimposed to synthesize the speckle pattern of the entire observation area.
[0084] Due to the accuracy of the printer and the inevitable errors of the camera, the final photographic imaging cannot achieve the ideal effect of the design drawing. Therefore, the Gaussian blur method is used to process the speckle design drawing to simulate the photo effect formed by the final shooting, and the speckle design can be previewed and optimized based on the Gaussian blurred picture.
[0085] After optimizing the design to obtain the best speckle pattern, black square targets are added to the upper left, lower left, and upper right corners of the speckle pattern to facilitate positioning on the sample during subsequent transfer, which also plays a role in positioning and identification during subsequent observations. In addition, in order to facilitate printing, it is necessary to increase the bleeding distance around the speckle pattern, and finally form a speckle design diagram and export it to the required format.
[0086] like Figure 6 As shown, the specific steps of the present invention are described as follows:
[0087] (1) Select the observation area: According to the experimental requirements, determine the observation area at each observation scale and represent it with a black-and-white binary image, where white represents the observation area at this scale and black represents the non-observation area;
[0088] (2) Calculating the canvas size: Calculate the electronic canvas size of the design draft according to the size of the observation area at each scale in (1) and the resolution of the speckle design drawing. The electronic canvas size calculation method is as follows:
[0089] S c =L1×ppi
[0090] Among them, S c is the number of pixels occupied by the side length of the electronic canvas, L1 is the actual size of the side length of the macro observation area on the sample (the diameter of the circular area), and ppi is the resolution of the speckle design image (pixel per inch).
[0091] (3) Obtaining the material background color: Use an electron microscope or camera to scan the surface of the sample to be tested, obtain the material background color distribution in the test area, and process the obtained photo into a grayscale image.
[0092] (4) Binarization of material background color: The material background color image scanned in step (3) is scaled to the canvas size calculated in step (2), and then the material background color image is binarized in black and white based on the maximum inter-class variance method, where black indicates that the material background color in the area is darker, and white indicates that the material background color in the area is lighter. The threshold for judging the dark and light material background color is segmented based on the maximum inter-class difference method, and the selected segmentation threshold maximizes the difference between the average grayscale of the two segmented areas and the average grayscale of the entire image.
[0093] The specific principle of this method is:
[0094] Assume the image grayscale range is [0, L-1],
[0095]
[0096] Among them, n iis the number of pixels with grayscale i in the image, and N is the total number of pixels;
[0097]
[0098] Among them, P i is the probability of occurrence of each gray value;
[0099]
[0100] The pixels in the image are divided into two categories C0 and C1 using the threshold T. C0 consists of pixels with grayscale values in [0, T-1], and C1 consists of pixels with grayscale values in [T, L-1]. The probabilities of regions C0 and C1 are
[0101]
[0102]
[0103] Among them, P0 is the probability of the gray value appearing in the C0 area, and P1 is the probability of the gray value appearing in the C1 area;
[0104]
[0105]
[0106]
[0107] Among them, μ0 is the average grayscale of the C0 area, μ1 is the average grayscale of the C1 area, and μ is the average grayscale of the entire image;
[0108] σ B 2 =P0(μ0-μ) 2 +P1(μ1-μ) 2 =P0P1(μ0-μ1) 2
[0109] Among them, σ B 2 is the total variance of the two regions.
[0110] By taking T values in the range of [0, L-1] in turn, the T value with the largest regional variance is taken as the optimal region segmentation threshold.
[0111] (5) Speckle size conversion and grid division: Determine the theoretical optimal pixel size of speckles of various scales in the final analyzed photos according to the test requirements, and then convert the pixel size of the speckle in the design drawing according to the camera resolution or magnification factor and the resolution of the speckle design drawing.
[0112] When the camera resolution is used as a parameter, the conversion method for speckle size is as follows:
[0113]
[0114] D ci =D ri ×ppi
[0115] Among them, D ri is the real size of speckle at each scale, D pi is the pixel size of each scale photo in the final calculated photo, D ci is the pixel size of speckle of each scale in the design image, R i is the resolution of cameras with different magnifications, L i is the actual size of the observation area at each scale on the sample, and ppi is the resolution of the speckle design image (pixel per inch).
[0116] When the magnification is used as an adjustable parameter, the conversion method of the speckle size is as follows:
[0117]
[0118] D ci =D ri ×ppi
[0119] Among them, L C is the actual side length of the camera's photosensitive element sensor, and ω is the camera magnification;
[0120] (6) The canvas is divided into grids according to the speckle size obtained in the design drawing and the selected speckle area ratio. The principle of calculating the grid size is to draw a square outside the circular speckle of a given size so that the ratio of the area of the speckle to the area of the square is equal to the speckle area ratio. At this time, the side length of the square is the side length of the grid.
[0121] The grid size is calculated as follows:
[0122]
[0123] Among them, H i is the pixel length occupied by the side length of each scale grid in the design diagram, and α is the area ratio of the total speckle to the observation area.
[0124] (7) Random speckle generation in the macro observation area: First, generate speckle in the macro observation area based on the calculated speckle size and grid. When generating speckle, first determine the center position of the speckle in each grid. In order to prevent the generated speckle from deviating from the grid in a large area, each grid generates a speckle at a random position within a certain range from the center of the grid. The color of the speckle is determined by the color of the corresponding position in the material background distribution map. White speckle is generated in the area with a black background color, and black speckle is generated in the area with a white background color. The formula for generating the position of random speckle is as follows:
[0125] X mn =X_grid mn +γ×H i ×rand(-1, 1, seed)
[0126] Y mn =Y_grid mn +γ×H i ×rand(-1, 1, seed)
[0127] Among them, X mn is the horizontal coordinate of the random speckle, the subscripts m and n represent the grid of the mth row and nth column, Y mn is the ordinate of random speckle, X_grid mn Y_grid is the horizontal coordinate of the center position of the grid corresponding to the speckle. mn is the ordinate of the center position of the grid corresponding to the speckle, γ is the position random coefficient, which represents the input parameter of the speckle deviation from the center position, rand(-1, 1, seed) is the random number generation function, the result is a random number between -1 and 1, and the random seed is seed.
[0128] (8) Generation of speckles in the microscopic observation area: In order to avoid undersampling caused by too small speckles, two speckles of different sizes are generated in the microscopic observation area. First, a larger speckle is generated. Each grid generates a speckle at a random position within the range of the speckle radius from the center of the grid. However, the color of the speckle is opposite to that of the macroscopic speckle. Black speckles are generated in areas with a black background color, and white speckles are generated in areas with a white background color. The generated speckle is then superimposed on the material background color of the original microscopic observation area and then binarized in black and white according to the same method as step (4) to obtain a new background color image. Next, extremely small speckles are generated in the microscopic observation area to meet the observation requirements of micron-level precision. The randomness of the position and color of this type of speckle generation is consistent with the process of speckle generation in the macroscopic area in step (6), that is, white speckles are generated in areas with a black background color, and black speckles are generated in areas with a white background color.
[0129] (9) Synthesis and preview of speckle design: Use software to superimpose the layers of the final macro-micro speckle to synthesize the speckle design. Use the Gaussian blur method on the speckle design to simulate the photo effect of the final shot. By previewing the actual effect of the simulation, the design of the speckle size is optimized and adjusted to finally obtain the best size selection.
[0130] (10) Target and bleed design: In order to facilitate the positioning on the sample during the subsequent transfer, black square targets are added to the upper left, lower left, and upper right corners of the speckle pattern. They also play a role in positioning and identification during subsequent observations. Figure 4 The bleeding distance is increased by 3mm each week to adapt to various types of UV printers or water transfer printing equipment. And the final design drawing of the corresponding format is output according to the requirements of the speckle production equipment.
[0131] The above steps also include the following features:
[0132] The observation area in step (1) is determined according to the specific test purpose. Different tests may have different observation areas. The observation scales include but are not limited to 2 scales, and the target observation area at each scale may be composed of multiple closed areas.
[0133] Step (2) calculates the size of the speckle design image by converting the actual size of the observation area and the resolution of the design draft, wherein the resolution of the design draft is usually 600ppi, and the design resolution can be increased to 2400ppi for ultra-high-definition printers.
[0134] Steps (3) and (4) obtain the material background color by scanning or photographing. In order to distinguish the depth of the background color in each area, the maximum variance method is used for binarization, and the binarized image is used to guide the design of speckle generation. In addition, in order to fully cover the area to be tested, the actual shooting range must be larger than the range of the specified observation area, and sufficient margin must be reserved.
[0135] The speckle size in step (5) is the speckle size in the final design draft, in pixels. First, determine the expected size of speckles of each scale in the test photos, expressed in pixels, and this parameter is the input parameter. Then, the actual size of the speckle sprayed on the sample is calculated by the camera resolution or the magnification during shooting, and the unit is usually millimeters or microns. After that, the actual speckle size is converted into the pixel size in the design drawing according to the resolution of the design drawing, in pixels. The speckle size is determined according to the actual situation of the experiment, that is, the pixel size may be different. In addition, the size of the speckle at the same scale can be a single size or different sizes, which is also selected according to the test requirements. The shape of the speckle includes but is not limited to a circle, and can also be designed into other shapes according to specific test requirements.
[0136] The calculation principle of the grid in step (6) is to draw a square outside the circular speckle of a given size, so that the ratio of the area of the speckle to the area of the square is equal to the speckle area ratio, and the side length of the square is the side length of the grid. Different experiments and different observation areas of the same experiment can select different speckle area ratios according to observation requirements. The purpose of generating a grid in the design draft is to limit the generation of speckles within or near the grid, which can avoid the overlap of random speckles in space and thus reduce the image quality.
[0137] When generating speckle in step (7), the color of the speckle is determined by the color of the corresponding position of the position in the material background distribution map. White speckle is generated in the area with black background color, and black speckle is generated in the area with white background color. When generating speckle, the position of the speckle is based on the grid center coordinate as the origin, and deviates by a random distance in the horizontal and vertical directions respectively. The length of the random distance is obtained by multiplying a random number between -1 and 1 with the position random coefficient and the grid side length. Among them, the parameter that characterizes the degree of randomness in the speckle position is the position random coefficient, which can be set according to specific experimental requirements. This parameter is an input parameter with a value between 0 and 1, wherein the position random coefficient is 0, indicating that the speckle is in the center of the grid, and the position random coefficient is 0.5, indicating that the center position of the speckle is within the range of 0.5 squares of the grid side length from the center and is randomly distributed.
[0138] The speckle in the microscopic observation area in step (8) is the superposition of two speckles of very different sizes. First, a larger speckle is randomly generated, and the color is the same as the background color at the location of the center of the speckle. Then, the image after the speckle is generated is binarized again using the method in step (4) to obtain a new background color image. Then, a very small random speckle is generated in it to meet the observation of micron-level precision, and the color is opposite to the background color at the location of the center of the speckle to obtain the best speckle effect.
[0139] In step (9), the actual shooting effect is simulated by using the Gaussian blur method to guide the optimization design of the speckle pattern. The design can be repeatedly optimized according to the simulated shooting effect diagram until the best effect is achieved.
[0140] In step (10), positioning is performed by adding targets. Black square targets are added to the upper left, lower left, and upper right corners of the speckle pattern. The positions of the speckle and the sample can be completely aligned by locking the three-point position. The targets can be used to accurately transfer the speckle to the surface of the sample to be tested after water transfer.
Claims
1. A multi-scale black and white speckle design method that is adaptive to the background color of a material, used to perform multi-scale tests on materials that have uneven background colors and patterns, characterized in that: The method includes a speckle generation part in a macroscopic observation area, a speckle generation part in a microscopic observation area, and a synthesis part of a speckle design map, wherein the speckle generation part in the macroscopic observation area includes the following steps: 101) Determine the scope of the macroscopic observation area on the surface of the sample to be tested according to the experimental requirements; 102) Determine the required canvas size according to the scope of the macroscopic observation area; 103) Scanning the surface of the sample to be tested to obtain a material background color distribution map of the macroscopic observation area, scaling the material background color distribution map to the size of the canvas, and binarizing the material background color distribution map based on the maximum inter-variance method; 104) determining the size of the macroscopic speckle in the canvas, and then determining the side length of the canvas grid according to the speckle area ratio; 105) dividing the canvas into grids according to the determined side lengths, and generating macroscopic speckles at random positions in each grid; In the step 102), the size of the canvas is determined according to the range of the macroscopic observation area and the resolution of the speckle design diagram, and then: S c =L1×ppi Among them, S c is the number of pixels occupied by the side length of the canvas, L1 is the actual size of the side length of the macro observation area on the sample, and ppi is the resolution of the speckle design image; In the speckle generation part of the microscopic observation area, in order to avoid undersampling caused by too small speckles, two speckles of different sizes are generated, including the following steps: 106) obtaining the overlapping area of the macroscopic and microscopic observation ranges, that is, the microscopic observation area where the microscopic speckle needs to be generated within the macroscopic observation area; 107) generating large-scale mesoscopic speckles in the mesoscopic observation area according to a random speckle generation method, wherein the large-scale mesoscopic speckles are generated at random positions of each grid within a range not exceeding the speckle radius from the grid center, and the color of the large-scale mesoscopic speckles is the same as the color of the corresponding position in the binary material background color distribution map, that is, when the corresponding position in the background color distribution map is black, the color of the mesoscopic speckles is black, and when the corresponding position in the background color distribution map is white, the color of the mesoscopic speckles is white; 108) superimposing the background color distribution map of the mesoscopic observation area with the larger-scale mesoscopic speckle and the original mesoscopic observation area, and binarizing them to obtain the updated binary background color distribution map of the mesoscopic observation area; 109) Based on the updated binary background color distribution map of the mesoscopic observation area, a small-scale mesoscopic speckle is generated in the mesoscopic observation area according to a random speckle generation method, the color of the small-scale mesoscopic speckle is opposite to the color of the corresponding position in the updated binary background color distribution map of the mesoscopic observation area, and the small-scale mesoscopic speckle meets the observation of micron-level precision; The synthesis part of the speckle design image specifically includes the following steps: 110) Synthesis and preview of speckle design diagram: The final generated layers with macro / micro speckles are superimposed to synthesize the speckle design diagram. The Gaussian blur method is used on the speckle design diagram to simulate the photo effect formed by the final shooting. By previewing the actual effect of the simulation, the speckle size and position parameters are optimized and adjusted.
2. The method for designing a multi-scale black and white speckle pattern according to claim 1, characterized in that: In the step 103), the material background color distribution map is binarized based on the maximum intervariate variance method as follows: 1031) Convert the material background color distribution map into a grayscale map, and obtain the grayscale range of the pixel point [0, L-1]; 1032) Selecting a grayscale threshold T in the grayscale range [0, L-1] so that the total variance of the two regions after segmentation is maximized; 1033) The grayscale image is divided according to the grayscale threshold T. A pixel grayscale greater than T indicates that the background color of the regional material is darker and is represented by black. A pixel grayscale less than T indicates that the background color of the regional material is lighter and is represented by white, thus completing the binarization.
3. The method for designing a multi-scale black and white speckle pattern according to claim 2, characterized in that: In the step 1032), the expression of the total variance is: s B 2 =P0(μ0-μ) 2 +P1(μ1-μ) 2 =P0P1(μ0-μ1) 2 P1=1-P0 Among them, n i is the number of pixels with grayscale i in the image, N is the total number of pixels, P i is the probability of gray value i appearing, P0 is the probability of gray value appearing in C0 area, P1 is the probability of gray value appearing in C1 area, C0 and C1 represent two types of areas divided by gray threshold T, μ0 is the average gray value of C0 area, μ1 is the average gray value of C1 area, μ is the average gray value of the whole image, σ B 2 is the total variance of the two regions.
4. The method for designing a multi-scale black and white speckle pattern according to claim 2, characterized in that: In the step 104), the size of the macroscopic speckle in the canvas is determined without considering the magnification of the camera, and then: D ci =D ri ×ppi Considering the magnification of the camera to determine the size of the macroscopic speckle in the canvas, we have: D ci =D ri ×ppi Among them, D ri is the real size of the macroscopic speckle, D pi is the pixel size of the macro-scale photo in the final calculated photo, D ci is the pixel size of the macro speckle in the canvas, R i is the resolution of the camera with different magnifications, L i is the actual size of the macroscopic observation area on the sample, ppi is the resolution of the speckle design image, L C is the actual side length of the camera’s photosensitive element sensor, and ω is the camera’s magnification.
5. The method for designing a multi-scale black and white speckle pattern according to claim 4, characterized in that: In the step 104), the side length of the canvas grid is determined according to the speckle area ratio. The specific principle is: Draw a square outside a circular speckle of a given size so that the ratio of the area of the speckle to the area of the square is equal to the preset speckle area ratio. The side length of the square is the side length of the grid, and we have: Among them, H i is the pixel length occupied by the grid side length at the macro scale in the canvas, and α is the area ratio of the total speckle to the macro observation area.
6. The method for designing a multi-scale black and white speckle pattern according to claim 1, characterized in that: In the step 105), generating macroscopic speckles at random positions in each grid is specifically as follows: The center position of the macro speckle is determined in each grid. In order to prevent the generated macro speckle from deviating from the grid in a large area, each grid generates a macro speckle at a random position within the set range from the center of the grid. The color of the speckle is determined by the color of the corresponding position of the position in the material background distribution map. White speckle is generated in the area with black background color, and black speckle is generated in the area with white background color. The coordinates of the randomly generated position of the speckle are: X mn =X_grid mn +γ×H i ×rand(-1,1,seed) Y mn =Y_grid mn +γ×H i ×rand(-1,1,seed) Among them, X mn is the horizontal coordinate of the random speckle, the subscript m, n represents the grid of the mth row and nth column, Y mn is the ordinate of random speckle, X_grid mn Y_grid is the horizontal coordinate of the center position of the grid corresponding to the speckle. mn is the ordinate of the center position of the grid corresponding to the speckle, y is the position random coefficient, which represents the input parameter of the speckle deviation from the center position, rand(-1,1,seed) is the random number generation function, the generated result is a random number between -1 and 1, and seed is the random seed.
7. The method for designing a multi-scale black and white speckle pattern according to claim 1, characterized in that: The method further comprises the following steps: 111) Target and bleed design: To facilitate positioning on the sample during subsequent transfer, black square targets are added to the upper left, lower left and upper right corners of the speckle design diagram to play a role in positioning and identification during subsequent observations. In addition, a bleed distance of 3mm is added around the speckle design diagram to adapt to various types of UV printers or water transfer production equipment, and the final design diagram is output in the corresponding format according to the requirements of the speckle production equipment.
Citation Information
Patent Citations
Full-field measuring method for triaxial test sample cylindrical surface deformation
CN108535097A
Strain measuring method based on SEM in-situ imaging system
CN108548834A