Sample detection method, system, equipment and medium
By using image processing and contour analysis techniques, samples in XFEL experiments are automatically screened, solving the problem of low efficiency in manual operations, achieving high-throughput and high-precision sample detection, and improving the reliability and consistency of experimental data.
Patent Information
- Application Number
- CN202511867930.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-11
- Publication Date
- 2026-03-20
AI Technical Summary
In current XFEL experiments, sample screening relies on manual operation, which is inefficient and cannot meet the requirements of high throughput and high speed. Furthermore, the subjectivity of human judgment makes it difficult to guarantee the accuracy of sample identification, affecting the reliability and reproducibility of experimental data.
Image processing and contour analysis methods are used to acquire sample images from X-ray free electron laser single-pulse experiments, perform grayscale conversion, noise reduction, adaptive threshold segmentation, and contour recognition, and filter sample contour data that meet the conditions based on preset rules to achieve automated batch detection.
It enables rapid and accurate identification and sorting of batch samples, improves screening efficiency and accuracy, enhances the automation and standardization of XFEL experiments, reduces labor costs and optimizes production efficiency.
Smart Images

Figure CN121703167A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of sample testing technology, and relates to a sample testing method, and in particular to a sample testing method, system, equipment and medium. Background Technology
[0002] X-ray free-electron lasers (XFELs) are an indispensable and crucial technological infrastructure for advancing cutting-edge scientific research. With their extremely high brightness and femtosecond-level temporal resolution, XFELs can deeply probe the microscopic structure of matter and precisely capture transient processes. They have shown great potential in resolving complex molecular configurations and observing the dynamic evolution of chemical reactions, becoming an important research tool for unraveling the mysteries of the microscopic world. In a typical XFEL experiment, the sample is transported to the focal region of an X-ray pulse for irradiation, and the detector reconstructs the sample structure by collecting the signals generated by the interaction. Therefore, the quality of the sample itself and the transport efficiency determine the quality of the data and the efficiency of the experiment.
[0003] However, the current XFEL experimental workflow faces a significant bottleneck in obtaining high-quality experimental data: the sample selection process relies on manual operation. Specifically, researchers must manually select samples that meet the standards and place them one by one into the interaction region. This method is not only time-consuming, labor-intensive, and low-throughput, making it difficult to meet the demands of high-throughput, high-speed experiments, but also suffers from inconsistent accuracy in sample identification due to the subjectivity and uncertainty of human judgment. This bottleneck severely restricts the reliability, reproducibility, and overall efficiency of experimental data. Summary of the Invention
[0004] This application provides a sample testing method, system, device, and medium to solve the problem of low efficiency caused by manual operation in sample screening in the prior art.
[0005] In a first aspect, this application provides a sample detection method. The sample detection method includes: acquiring a sample image to be tested in an X-ray free-electron laser single-pulse experiment; performing conversion processing on the sample image to obtain a binary image of the sample; performing contour recognition processing on the binary image of the sample to obtain at least one sample contour data; and performing filtering processing on the sample contour data based on preset rules to obtain sample contour data that meets the conditions and generate a visualization image.
[0006] In this application, the sample image to be tested in an X-ray free electron laser single-pulse experiment is converted to obtain a binary image of the sample. Contour recognition is performed on the binary image of the sample, and the resulting sample contour data is used for filtering to obtain sample contour data that meets the specified criteria. This sample detection method can automatically process batches of samples, enabling rapid and accurate identification and sorting, thus improving screening efficiency and accuracy.
[0007] In one implementation of the first aspect, the conversion processing of the sample image to be tested to obtain a sample binary image includes: performing grayscale processing on the sample image to be tested using a weighted average method to obtain a corresponding grayscale image; performing noise reduction processing on the grayscale image using a Gaussian filtering method to obtain a denoised grayscale image; and performing adaptive threshold segmentation processing on the denoised grayscale image to obtain the sample binary image.
[0008] In one implementation of the first aspect, performing adaptive threshold segmentation processing on the denoised grayscale image to obtain the sample binary image includes: calculating a corresponding local threshold based on any neighborhood region of the denoised grayscale image using an adaptive threshold algorithm; and processing according to each of the corresponding local thresholds to obtain the sample binary image.
[0009] In one implementation of the first aspect, performing contour recognition processing based on the sample binary image to obtain at least one sample contour data includes: using a contour detection algorithm to detect the sample binary image to extract the outermost contour points of the sample as the sample contour data.
[0010] In one implementation of the first aspect, the sample contour data includes the number of contour pixels, contour point coordinates, contour area values, and / or contour centroid coordinates.
[0011] In one implementation of the first aspect, the process of filtering the sample contour data based on preset rules to obtain sample contour data that meets the conditions includes: performing information extraction processing on the sample contour data to obtain the number of contour pixels and area of the sample; and filtering the number of contour pixels and area of the sample based on preset contour dimensions to obtain sample contour data that meets the conditions.
[0012] In one implementation of the first aspect, filtering the number of outline pixels and area of the sample based on a preset outline size to obtain sample outline data that meets the conditions includes: preset a size threshold for the actual sample based on the size characteristics and image resolution of the actual sample; determining whether the size of the sample meets the size threshold based on the number of outline pixels and area of the sample; if yes, obtaining the outline data corresponding to the sample as sample outline data that meets the conditions; otherwise, discarding the outline data corresponding to the sample.
[0013] Secondly, this application provides a sample detection system. The sample detection system includes: an image acquisition module for acquiring a sample image to be tested in an X-ray free-electron laser single-pulse experiment; an image processing module for converting the sample image to obtain a binary image of the sample; a contour recognition module for performing contour recognition processing based on the binary image of the sample to obtain at least one sample contour data; and a filtering processing module for filtering the sample contour data based on preset rules to obtain sample contour data that meets the conditions and generate a visual image.
[0014] Thirdly, this application provides an electronic device. The electronic device includes: a memory for storing a computer program; and a processor for executing the computer program stored in the memory to cause the electronic device to perform the sample detection method as described in any one of the first aspects.
[0015] Fourthly, this application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program that, when executed by a processor, implements the sample detection method described in any one of the first aspects.
[0016] As described above, the sample detection method, system, equipment, and medium described in this application have the following beneficial effects:
[0017] The sample inspection method described in this application overcomes the limitations of traditional manual screening in terms of efficiency and accuracy by utilizing automated image processing and contour analysis, achieving high-throughput, high-precision, and fully automated sorting of batches of samples. This not only directly improves the efficiency of sample inspection but also provides a key technological foundation for promoting automation and standardization in the XFEL experimental field. Attached Figure Description
[0018] Figure 1 The diagram shown illustrates an application scenario of the sample testing method described in this application.
[0019] Figure 2 This diagram illustrates the structure of the mid-cloud interaction scenario in these implementation methods.
[0020] Figure 3 The diagram shown is a schematic flowchart of the sample testing method described in the embodiments of this application.
[0021] Figure 4 The diagram shown is a schematic flowchart of the sample testing method described in the embodiments of this application.
[0022] Figure 5 The diagram shown is a schematic flowchart of the sample testing method described in the embodiments of this application.
[0023] Figure 6 The diagram shown is a schematic flowchart of the sample testing method described in the embodiments of this application.
[0024] Figure 7 The diagram shown is a schematic flowchart of the sample testing method described in the embodiments of this application.
[0025] Figure 8 The diagram shown is a schematic representation of the sample testing system described in an embodiment of this application.
[0026] Figure 9 The diagram shown is a structural schematic of the electronic device described in an embodiment of this application.
[0027] Component designation explanation
[0028] 1 Sample testing device 11 Image acquisition equipment 12 Local processor 13 Display terminal 2 End-to-Cloud Interaction System 20 terminal 21 cloud server 100 Sample testing system 110 Image acquisition module 120 Image processing module 130 Contour recognition module 140 Filtering module 900 electronic devices 910 memory 920 processor 930 monitor S11~S14 step S121~S123 step S1231~S1232 step S141~S142 step S1421~S1423 step Detailed Implementation
[0029] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.
[0030] It should be noted that in the embodiments of this application, the words "optionally" or "for example" indicate examples, illustrations, or descriptions. Any embodiment or design scheme described as "optionally" or "for example" in this application should not be construed as being more preferred or advantageous than other embodiments or design schemes. Specifically, the use of the words "optionally" or "for example" is intended to present the relevant concepts in a specific manner.
[0031] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0032] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. Therefore, the drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0033] In a typical XFEL experiment, the sample is transported to the focal region of the X-ray pulse for irradiation, and the detector reconstructs the sample structure by collecting the signals generated by the interaction. Therefore, the quality and efficiency of sample selection are crucial preliminary steps determining data quality and acquisition efficiency. However, current experimental procedures face a significant bottleneck: sample selection relies heavily on manual operation. Researchers must manually select and transport samples one by one. This method is not only inefficient and limited in throughput, making it difficult to match the high-throughput data acquisition capabilities of the XFEL device itself, but also, due to the strong subjectivity and inconsistent standards of manual judgment, the accuracy and consistency of sample identification are difficult to guarantee. This bottleneck has become a key factor restricting the reliability, reproducibility, and overall research efficiency of experimental data.
[0034] To address at least the aforementioned issues, this application provides a sample detection method. The sample detection method includes: acquiring a sample image to be tested in an X-ray free-electron laser single-pulse experiment; converting the sample image to obtain a binary image; performing contour recognition processing on the binary image to obtain at least one sample contour data; and filtering the sample contour data based on preset rules to obtain sample contour data that meets the criteria and generating a visualization image.
[0035] In this embodiment, the sample image to be tested in an X-ray free electron laser single-pulse experiment is converted to obtain a binary image of the sample. Contour recognition is performed on the binary image of the sample, and the resulting sample contour data is used for filtering to obtain sample contour data that meets the criteria. The sample detection method of this application can automatically realize the detection and processing of batch samples, enabling rapid and accurate identification and sorting of samples, improving screening efficiency and accuracy.
[0036] Furthermore, the sample inspection method of this application integrates machine vision and multiple intelligent analysis algorithms, enabling simultaneous identification and precise positioning of multiple densely packed samples in the image under test. It achieves high-speed, high-precision automated grading and sorting based on preset criteria such as shape, size, and pixel count. This completely transforms the process from reliance on human experience to objective, quantitative, and intelligent evaluation, ultimately improving product quality consistency and yield while significantly reducing labor costs and optimizing production efficiency.
[0037] Figure 1 This diagram illustrates an application scenario of the sample testing method described in this application. The sample testing device 1 can be used to implement the sample testing method provided in the embodiments of this application, but the application scenarios of the sample testing method provided in the embodiments of this application are not limited to this. Figure 1 The sample detection device 1 shown is as follows. Figure 1 As shown, the sample detection device 1 includes an image acquisition device 11, a local processor 12, and a display terminal 13. The sample detection method provided in this embodiment can be applied to the local processor 12.
[0038] in, Figure 1 The local processor 12 can be a single local processor, a cluster of multiple local processors, or a cloud computing center, etc., and is not specifically limited here. Although Figure 1 Only one image acquisition device 11, one local processor 12, and one display terminal 13 are shown, but it should be understood that... Figure 1 The examples in this paper are only for understanding this solution. The specific number of local processors 12 and display terminals 13 should be flexibly determined based on the actual situation.
[0039] In some other implementations, the sample detection device 1 may not include the display terminal 13, but only a local processor 12 with display function and an image acquisition device 11. The sample detection method provided in this application embodiment can be applied to the local processor 12. The local processor 12 with display function may include tablet computers, laptops, handheld computers, mobile phones, personal computers, and voice interaction devices, or it may be a monitoring device, etc., which is not limited here.
[0040] In some other implementations, the sample detection method described in this application can be applied to edge-cloud interaction scenarios. Figure 2 This diagram illustrates the structure of the endpoint-cloud interaction scenario in these implementation methods. For example... Figure 2 As shown, the terminal-cloud interaction system 2 includes a terminal 20 and a cloud server 21. The terminal 20 and the cloud server 21 can communicate with each other, and the communication method is not limited to wired or wireless.
[0041] The terminal 20 can be mobile or fixed. For example, it can be a wireless terminal or a wired terminal. A wireless terminal can refer to a device with wireless transceiver capabilities, which can be deployed indoors, outdoors, and in industrial workshops. The terminal 20 can be a mobile phone, tablet computer, laptop computer, etc., and is not limited thereto. The cloud server 21 can include one or more servers, or one or more processing nodes, or one or more virtual machines running on the server. The cloud server 21 can also be referred to as a server cluster, management platform, data processing center, etc., and is not limited thereto in this embodiment.
[0042] The technical solutions in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0043] The following embodiments of this application provide a sample detection method, which, for example, can be... Figure 1 The local processor 12 shown Figure 2 The cloud server 21 shown is used to implement this. Figure 3 The diagram shown is a schematic flowchart of the sample testing method described in an embodiment of this application. Figure 3 As shown, the sample detection method includes steps S11 to S14.
[0044] Step S11: Obtain the sample image to be tested in the X-ray free electron laser single pulse experiment.
[0045] Step S12: The sample image to be tested is converted to obtain a binary image of the sample.
[0046] Step S13: Perform contour recognition processing based on the binary image of the sample to obtain at least one sample contour data.
[0047] Step S14: Based on preset rules, the sample contour data is filtered to obtain sample contour data that meets the conditions and generate a visualization image.
[0048] In some possible implementations, visual acquisition is performed on the sample used for X-ray free-electron laser single-pulse experiments to obtain a sample image to be tested. This sample image is a panoramic image, including the complete shape features and spatial location information of the sample. Optionally, a single sample image includes the complete shape features and spatial location information of one or more samples. The visual acquisition system includes an imaging device, an optical lens, and an illumination assembly. The illumination assembly is configured to provide illumination conditions that suppress surface reflections and enhance the contrast between the sample and the background, thereby obtaining a sample image with clear contour features. Optionally, the illumination assembly uses a coaxial illumination source. This coaxial optical path design effectively eliminates light spots caused by surface reflections, making subsequent contour recognition based on image processing more accurate, resulting in a high-quality sample image. Optionally, the imaging device is configured to acquire a sample image with sufficient detail to ensure that subsequent image processing steps can accurately separate individual sample contours and calculate their geometric features. The imaging device is, for example, a CCD camera, a CMOS camera, or other types of area array image sensors. The sample image is then converted to obtain a binary image of the sample. Contour recognition processing is performed on the binary image of the sample to obtain at least one sample contour data. Optionally, several sample contours can be identified in a sample image to be tested, and each sample contour includes corresponding sample contour data. The sample contour data is filtered based on preset rules to obtain sample contour data that meets the conditions and generate a visualization image.
[0049] In this embodiment, the sample image to be tested in an X-ray free electron laser single-pulse experiment is converted to obtain a binary image of the sample. Contour recognition is performed on the binary image of the sample, and the resulting sample contour data is used for filtering to obtain sample contour data that meets the criteria. The sample detection method of this application can automatically realize the detection and processing of batch samples, enabling rapid and accurate identification and sorting of samples, improving screening efficiency and accuracy.
[0050] Figure 4 The diagram shown is a schematic flowchart of the sample testing method described in an embodiment of this application. Figure 4 As shown, step S12 includes steps S121 to S123.
[0051] Step S121: The sample image to be tested is converted to grayscale using a weighted average method to obtain the corresponding grayscale image.
[0052] Step S122: Use Gaussian filtering to denoise the grayscale image to obtain a denoised grayscale image.
[0053] Step S123: Perform adaptive threshold segmentation on the denoised grayscale image to obtain the sample binary image.
[0054] In some possible implementations, a weighted average method is used to convert the sample image to grayscale to obtain a corresponding grayscale image. The weighted average method prioritizes preserving image information important for contour recognition during grayscale conversion by configuring coefficients that conform to human visual sensitivity. Gaussian filtering is then used to denoise the grayscale image to obtain a denoised grayscale image. Specifically, a convolution kernel is generated using a two-dimensional Gaussian distribution function, and convolution operations are performed on the grayscale image to achieve weighted averaging. The output value of each pixel is calculated by weighting its own value and the pixel values in its neighborhood according to Gaussian weight coefficients. The size of the Gaussian filter convolution kernel is, for example, 3×3 to 9×9, and the standard deviation σ is, for example, 0.5 to 2.0, adaptively selected based on the image noise level and detail preservation requirements. Adaptive thresholding is then applied to the denoised grayscale image to obtain a sample binary image. Specifically, an OpenCV-based adaptive thresholding algorithm (cv2.adaptiveThreshold()) is used to binarize the grayscale image to obtain the sample binary image. Among them, cv2.adaptiveThreshold() is the core function in OpenCV used for detecting contours in binary images.
[0055] In this embodiment, edge features in the grayscale image of the sample and background in the sample test image of an X-ray free electron laser single-pulse experiment are enhanced based on the specific color distribution, reducing information loss in subsequent binarization processing. This lays the foundation for accurate contour extraction and area calculation, thereby improving the reliability and accuracy of sample detection. Gaussian filtering denoising of the grayscale image effectively smooths high-frequency noise interference while better preserving edge details of the sample, providing improved preprocessing results for subsequent image segmentation and contour extraction operations.
[0056] Figure 5 The diagram shown is a schematic flowchart of the sample testing method described in an embodiment of this application. Figure 5 As shown, the sample detection includes steps S1231 to S1232.
[0057] Step S1231: Calculate the corresponding local threshold based on any neighborhood region of the denoised grayscale image using an adaptive threshold algorithm.
[0058] Step S1232: Process according to the corresponding local thresholds to obtain the binary image of the sample.
[0059] In some possible implementations, an adaptive thresholding algorithm is used to calculate a local threshold based on any neighborhood region of the denoised grayscale image. Processing is then performed based on these local thresholds to obtain a sample binary image. The adaptive thresholding algorithm calculates the corresponding local threshold based on a defined neighborhood region in the image, such as a Gaussian-weighted adaptive thresholding method (ADAPTIVE_THRESH_GAUSSIAN_C) or a mean-based adaptive thresholding method (ADAPTIVE_THRESH_MEAN_C), where the neighborhood region size is configured to be within the range of 3×3 to 15×15 pixels depending on the sample size and image resolution.
[0060] In this embodiment, different local thresholds are used in different regions of the grayscale image, which can obtain a sample binarized image with clearer boundaries and better noise suppression effect in the presence of uneven illumination and background intensity changes.
[0061] In one embodiment of this application, performing contour recognition processing based on the sample binary image to obtain at least one sample contour data includes: using a contour detection algorithm to detect the sample binary image to extract the outermost contour points of the sample as the sample contour data.
[0062] In some possible implementations, a contour detection algorithm is used to detect the binary image of the sample to extract the outermost contour points as the sample contour data. The contour detection algorithm is implemented based on the OpenCV library, for example, using the cv2.findContours() function for contour detection. The contour extraction method is set to cv2.RETR_EXTERNAL to detect only the outermost contour, and the contour representation method is set to cv2.CHAIN_APPROX_NONE to store all points on the contour. The extracted outermost contour points of the sample are then stored as the sample contour data.
[0063] In one embodiment of this application, the sample contour data includes the number of contour pixels, contour point coordinates, contour area value, and / or contour centroid coordinates.
[0064] Figure 6 The diagram shown is a schematic flowchart of the sample testing method described in an embodiment of this application. Figure 6 As shown, step S14 includes steps S141 to S142.
[0065] Step S141 performs information extraction processing on the sample contour data to obtain the number of contour pixels and area of the sample.
[0066] Step S142: Based on the preset contour size, the number of contour pixels and area of the sample are filtered to obtain sample contour data that meets the conditions.
[0067] In some possible implementations, information extraction processing is performed on the sample contour data. This involves traversing each detected contour, calculating the number of pixels and area enclosed by each contour, and simultaneously recording and storing sample contour data associated with each contour. This sample contour data includes, but is not limited to, the number of contour pixels, contour point coordinates, contour area values, and contour centroid coordinates, to obtain complete sample contour data. The contour area and centroid coordinates are then calculated using contour moments. Specifically, the `cv2.moments()` function from the OpenCV library is used to obtain contour moments, which are then used to calculate the contour area and centroid coordinates. Contour moments are mathematical tools used to quantify contour shape features and are used in image processing to describe and analyze the geometric properties of contours.
[0068] Figure 7 The diagram shown is a schematic flowchart of the sample testing method described in an embodiment of this application. Figure 7 As shown, step S142 includes steps S1421 to S1423.
[0069] Step S1421: Preset the size threshold of the actual sample based on the size characteristics of the actual sample and the image resolution.
[0070] Step S1422: Determine whether the size of the sample meets the size threshold based on the number of outline pixels and the area of the sample.
[0071] Step S1423: If yes, then obtain the contour data corresponding to the sample as the sample contour data that meets the conditions; if no, then discard the contour data corresponding to the sample.
[0072] In some possible implementations, a size threshold for the actual sample is preset based on the actual sample's size characteristics and image resolution. Specifically, the size threshold for the actual sample is, for example, the pixel data of the region enclosed by the sample's contour, or the physical size area calculated through camera calibration. The size threshold for the actual sample is preset based on the actual sample's size characteristics and image resolution, including a minimum size threshold and a maximum size threshold. For example, the minimum size threshold is configured to a value greater than zero to exclude invalid contours caused by image noise interference. The maximum size threshold is configured to exclude invalid large contours caused by sample adhesion or misidentification of background areas. The size of the sample is determined based on the number of pixels and area of the sample's contour. If it meets the size threshold, the contour data corresponding to the sample is obtained as the qualified sample contour data; otherwise, the contour data corresponding to the sample is discarded.
[0073] Specifically, the implementation of contour-based pixel count filtering is as follows: The range of pixel counts included in the sample contour within the image is pre-calculated based on the actual sample size characteristics and image resolution. For example, a pixel count threshold can be obtained by analyzing the pixel count statistics of known standard samples. Alternatively, a pixel count threshold can be theoretically calculated using camera resolution and the physical size of the standard sample. Contours with pixel counts significantly exceeding this range are filtered out to eliminate obvious noise and large, invalid regions.
[0074] The implementation method for screening based on the physical size area of the contour is as follows: The actual physical size area corresponding to each pixel is obtained using pre-calibrated camera image parameters. The number of pixels contained within the contour of the standard sample is converted into the corresponding physical size area to obtain the physical size threshold of the actual sample. The contours are then screened according to the maximum and minimum physical size thresholds of the actual sample to obtain sample contour data that meets the conditions. The above are only two possible sample screening implementation methods in this application. The specific screening criteria are configured according to actual needs, such as grading and sorting multiple samples of multiple specifications, or removing defective samples. This application is not limited to these methods.
[0075] In other possible implementations, the sample contour data includes the number of contour pixels, contour point coordinates, contour area values, and / or contour centroid coordinates. Contours of samples that meet the screening criteria are drawn on the sample image to be tested, and the corresponding sample contour data is labeled next to the contours to obtain an intuitive visualization of sample sorting. The sample contour data includes, but is not limited to, the number of contour pixels, contour point coordinates, contour area values, and / or contour centroid coordinates. The drawing operation is implemented using a computer vision library, such as OpenCV. Specifically, contour drawing functions, such as cv2.drawContours(), are used to overlay the selected contours onto the original image. Simultaneously, text drawing functions, such as cv2.putText(), are used to label the contour data on the image.
[0076] Figure 8 The diagram shown is a schematic representation of the sample detection system described in this application embodiment. As shown in Figure 8, the sample detection system 100 includes an image acquisition module 110, an image processing module 120, a contour recognition module 130, and a screening processing module 140.
[0077] The image acquisition module 110 is used to acquire the sample image to be tested in the X-ray free electron laser single pulse experiment.
[0078] The image processing module 120 is used to convert the sample image to obtain a binary image of the sample.
[0079] The contour recognition module 130 is used to perform contour recognition processing based on the binary image of the sample to obtain at least one sample contour data.
[0080] The screening processing module 140 is used to perform screening processing on the sample contour data based on preset rules, so as to obtain sample contour data that meets the conditions and generate a visualization image.
[0081] In some possible implementations, the image acquisition module 110 is used to visually acquire samples from X-ray free-electron laser single-pulse experiments, obtaining a sample image to be tested. This sample image is a panoramic image, including the complete shape features and spatial location information of the sample. Optionally, a sample image to be tested may include the complete shape features and spatial location information of one or more samples. The visual acquisition system includes an imaging device, an optical lens, and an illumination assembly. The illumination assembly is configured to provide illumination conditions that suppress reflections from the sample surface and enhance the contrast between the sample and the background, thereby acquiring a sample image with clear contour features. Optionally, the illumination assembly uses a coaxial illumination source. This coaxial optical path design effectively eliminates light spots caused by reflections from the sample surface, making subsequent contour recognition based on image processing more accurate, thus acquiring a high-quality sample image to be tested. Optionally, the imaging device is configured to acquire sample images with sufficient detail to ensure that subsequent image processing steps can accurately separate individual sample contours and calculate their geometric features. The imaging device may be, for example, a CCD camera, a CMOS camera, or other types of area array image sensors. Image processing module 120 is used to convert and process the sample image to obtain a binary image of the sample. Contour recognition module 130 is used to perform contour recognition processing based on the binary image of the sample to obtain at least one sample contour data. Optionally, several sample contours can be identified in a sample image to be tested, and each sample contour includes corresponding sample contour data. Filtering module 140 is used to filter the sample contour data based on preset rules to obtain sample contour data that meets the conditions and generate a visualization image.
[0082] In this embodiment, the sample image to be tested in an X-ray free electron laser single-pulse experiment is converted to obtain a binary image of the sample. Contour recognition is performed on the binary image of the sample, and the resulting sample contour data is used for filtering to obtain sample contour data that meets the criteria. The sample detection system 100 of this application can automatically realize the detection and processing of batch samples, performing rapid and accurate identification and sorting of samples, improving screening efficiency and accuracy.
[0083] In the embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, or methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of modules / units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of apparatuses or modules or units may be electrical, mechanical, or other forms.
[0084] The modules / units described as separate components may or may not be physically separate. The components shown as modules / units may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules / units can be selected to achieve the objectives of the embodiments of this application, depending on actual needs. For example, the functional modules / units in the various embodiments of this application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0085] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0086] This application also provides an electronic device. Figure 9 The diagram shown is a structural schematic of the electronic device described in an embodiment of this application. Figure 9 As shown, in this embodiment, the electronic device 900 includes a memory 910 and a processor 920.
[0087] The memory 910 is used to store computer programs; preferably, the memory 910 includes various media that can store program code, such as ROM, RAM, magnetic disk, USB flash drive, memory card or optical disk.
[0088] Specifically, memory 910 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) and / or cache memory. Electronic device 900 may further include other removable / non-removable, volatile / non-volatile computer system storage media. Memory 910 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of this application. It is understood that memory 910 may be volatile memory or non-volatile memory, or both. Non-volatile memory may be read-only memory (ROM) or programmable read-only memory (PROM), which serves as an external cache. By way of example, but not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memories described in the embodiments of this invention are intended to include, but are not limited to, these and any other suitable categories of memories.
[0089] The processor 920 is connected to the memory 910 and is used to execute the computer program stored in the memory 910 so that the electronic device 900 performs the sample detection method described in any embodiment of this application.
[0090] Optionally, the processor 920 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it 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.
[0091] Optionally, the electronic device 900 in this embodiment may further include a display 930. The display 930 is communicatively connected to the memory 910 and the processor 920, and is used to display the relevant graphical user interface (GUI) of the sample detection method described in this application embodiment.
[0092] This application also provides a computer-readable storage medium storing a computer program. When executed by a processor, the program implements the sample detection method described in any embodiment of this application. Those skilled in the art will understand that all or part of the steps in the methods of the above embodiments can be implemented by a program instructing a processor. The program can be stored in a computer-readable storage medium, which is a non-transitory medium, such as random access memory, read-only memory, flash memory, hard disk, solid-state drive, magnetic tape, floppy disk, optical disk, and any combination thereof. The storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., digital video disc (DVD)), or a semiconductor medium (e.g., solid-state disk (SSD)).
[0093] As used in this specification, the terms "component," "module," "system," etc., are used to refer to computer-related entities, hardware, firmware, combinations of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, and / or a computer. As illustrated, applications running on computing devices and computing devices can both be components. One or more components may reside in a process and / or an execution thread, and components may be located on a single computer and / or distributed among two or more computers. Furthermore, these components can be executed from various computer-readable media on which various data structures are stored. Components can communicate, for example, via local and / or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, and / or a network, such as the Internet interacting with other systems via signals).
[0094] The descriptions of the processes or structures corresponding to the above figures each have their own emphasis. For parts of a process or structure that are not described in detail, please refer to the relevant descriptions of other processes or structures.
[0095] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A sample detection method, characterized in that, include: Acquire the sample image to be tested in the X-ray free electron laser single pulse experiment; The sample image to be tested is transformed to obtain a binary image of the sample; Perform contour recognition processing on the binary image of the sample to obtain at least one sample contour data; The sample contour data is filtered based on preset rules to obtain sample contour data that meets the conditions and generate a visualization image.
2. The sample detection method according to claim 1, characterized in that, The conversion process performed on the sample image to obtain a binary image of the sample includes: The sample image to be tested is converted to grayscale using a weighted average method to obtain the corresponding grayscale image. The grayscale image is denoised using Gaussian filtering to obtain a denoised grayscale image. An adaptive threshold segmentation process is performed on the denoised grayscale image to obtain the sample binary image.
3. The sample detection method according to claim 2, characterized in that, The process of performing adaptive thresholding segmentation on the denoised grayscale image to obtain the sample binary image includes: An adaptive thresholding algorithm is used to calculate the corresponding local threshold based on any neighborhood region of the denoised grayscale image. The sample binary image is obtained by processing according to the corresponding local threshold.
4. The sample detection method according to claim 1, characterized in that, Performing contour recognition processing on the binary image of the sample to obtain at least one sample contour data includes: The sample binary image is detected using a contour detection algorithm to extract the outermost contour points of the sample as the sample contour data.
5. The sample detection method according to claim 1, characterized in that, The sample contour data includes the number of contour pixels, contour point coordinates, contour area value, and / or contour centroid coordinates.
6. The sample detection method according to claim 1, characterized in that, The sample contour data is filtered based on preset rules to obtain sample contour data that meets the conditions, including: The sample contour data is processed to extract information to obtain the number of contour pixels and area of the sample. Based on a preset contour size, the number of contour pixels and area of the sample are filtered to obtain sample contour data that meets the conditions.
7. The sample detection method according to claim 6, characterized in that, Based on a preset contour size, the number of contour pixels and area of the sample are filtered to obtain sample contour data that meets the criteria, including: A size threshold for the actual sample is preset based on the size characteristics and image resolution of the actual sample. Based on the number of outline pixels and area of the sample, determine whether the size of the sample meets the size threshold. If yes, obtain the outline data corresponding to the sample as the sample outline data that meets the conditions. If no, discard the outline data corresponding to the sample.
8. A sample detection system, characterized in that, include: The image acquisition module is used to acquire the sample image to be tested in the X-ray free electron laser single pulse experiment; The image processing module is used to convert and process the sample image to obtain a binary image of the sample. A contour recognition module is used to perform contour recognition processing based on the binary image of the sample to obtain at least one sample contour data. The filtering processing module is used to filter the sample contour data based on preset rules to obtain sample contour data that meets the conditions and generate a visualization image.
9. An electronic device, characterized in that, The electronic device includes: Memory, used to store computer programs; A processor for executing a computer program stored in the memory to cause the electronic device to perform the sample detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the program implements the sample detection method according to any one of claims 1 to 7.
