OCT-based deep scan information splicing method
By using the depth scanning information stitching method of OCT, the problems of low data processing efficiency and unintuitive information display in OCT laser welding are solved, achieving efficient data compression and image visualization, and improving the efficiency and reliability of welding quality assessment.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN DADE LASER TECH CO LTD
- Filing Date
- 2025-02-18
- Publication Date
- 2026-05-05
AI Technical Summary
Existing technologies in OCT laser welding suffer from low data processing efficiency, unintuitive information display, and discontinuous effective depth information, which affect welding quality assessment and data processing efficiency.
The method employs an OCT-based depth scan information stitching approach. It receives raw data from laser tomography scans, divides it into groups, extracts the maximum value to form a compressed data matrix, normalizes it to the range of 0-255, creates grayscale or pseudo-color images, and adds a depth scale bar to the right side of the image. It supports saving in multiple image formats and captures and handles abnormal situations during the saving process.
It significantly improves data processing speed, reduces memory usage, achieves a data compression ratio of 64:1, improves storage efficiency, provides high image clarity, supports multiple display modes, facilitates observation and analysis, is easy to integrate into other systems, and has good compatibility and scalability.
Smart Images

Figure CN120107064B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of laser welding technology, and in particular to a method for stitching depth scanning information based on OCT. Background Technology
[0002] Optical coherence tomography (OCT) technology plays a crucial role in laser welding, with its core advantage being its ability to achieve high-precision, real-time weld penetration detection and quality monitoring. However, in practical applications, OCT technology also faces some challenges. The sheer volume of data acquired by OCT leads to lengthy data processing times, which limits its efficiency in real-time detection scenarios. The effective depth information acquired by OCT is often discontinuous, making it difficult to intuitively display the overall weld penetration and hindering accurate weld quality assessment. To address these issues, depth information stitching has emerged. This method rationally integrates the acquired depth information based on welding speed and length, compressing invalid depth data and amplifying effective depth data, thus providing a more intuitive representation of weld penetration depth. By adjusting relevant parameters, depth information stitching can generate a fitting curve that more closely approximates the true depth curve, providing strong support for accurate weld quality monitoring. However, it still suffers from drawbacks such as low data processing efficiency, unintuitive information display, and discontinuous effective depth information.
[0003] Existing technology 1, application number: CN202411024475.4, discloses a scanning laser welding penetration depth prediction method based on independent temporal multi-feature fusion. This method collects visual image information during the scanning laser welding process, employs a deep learning-based semantic segmentation method and image processing algorithm to extract static and dynamic features of the keyhole and weld pool from the visual signal, and uses the image processing algorithm to extract the weld penetration depth as the input and output of the penetration depth prediction model. The penetration depth prediction model is constructed by inputting temporal static and dynamic features in parallel. The Transformer's Encoder unit independently fits the relationship between each temporal feature and the penetration depth. A fully connected approach is used for feature fusion, outputting the prediction result of the scanning laser welding penetration depth regression model, with a prediction error of only 0.03 mm. While this method ensures welding stability and significantly improves the quality and performance of the weld joint, using a model for data processing and prediction results in a large amount of sample data required for model training, which reduces data processing efficiency to some extent.
[0004] Prior art 2, application number: CN202410914787.6, discloses a lithium battery production process and system that eliminates the helium detection process, including: cell assembly; pressing the cell into a cell shell; welding the cell shell and top cover, wherein the welding beam includes a welding laser and a detection light, the welding laser irradiates the connection between the cell shell and the top cover to form a keyhole, the detection light is separated into a first detection light and a second detection light by a beam splitter, the first detection light is coupled with the welding laser and irradiates the bottom of the keyhole, the first detection light irradiates the weld; the penetration depth of the keyhole is obtained based on the first detection light and the second detection light; the standard penetration depth is compared with the obtained penetration depth, and the weld is judged to be qualified. Although the helium detection process is eliminated and the weld is judged to be qualified by detecting the weld penetration depth, its judgment method is relatively simple, relying on laser judgment, which requires the precision of laser installation and debugging, and has significant limitations in practical applications.
[0005] Prior art three, application number: CN202411238714.6, discloses a method for use in cover plate assemblies and batteries. The cover plate assembly includes: a cover plate, a terminal post, a sealing ring, and a welding ring. The outer contour of the first segment of the terminal post is larger than the outer contour of the second segment. The first segment is confined to the first side of the cover plate. A welding ring is provided on the second side of the cover plate and welded to the second segment. During the assembly of the cover plate assembly, it is only necessary to weld the welding ring to the second segment, simplifying the assembly process. By limiting the range of the weld penetration depth A to 1.2PM / D≤A≤0.8T, the weld penetration depth is correlated with the full life cycle pressure P of the sealing ring, the ratio M of the contact area between the sealing ring and the welding ring to the circumference of the inner ring of the welding ring, the shear strength D of the weld, and the thickness T of the welding ring. While it can ensure sufficient welding strength and avoid melting the sealing ring, thus guaranteeing airtightness and controlling product quality by controlling the weld penetration depth, the lack of visualization methods for weld penetration depth leads to an uncontrollable production process and hinders process improvement.
[0006] Current technologies 1, 2, and 3 suffer from low data processing efficiency, unintuitive information display, and discontinuous acquisition of effective depth information. Therefore, this invention provides a depth scan information stitching method based on OCT. Summary of the Invention
[0007] To address the aforementioned technical problems, this invention provides a method for stitching depth scan information based on OCT, comprising the following steps:
[0008] Receive raw data from laser tomography scans and input a floating-point data matrix; divide each row of data into a group, extract the maximum value in each group, and form a compressed data matrix; use the ProcessedResults class to manage the processed data;
[0009] Normalize the values of the compressed data matrix to the range of 0-255; create an 8-bit grayscale image that supports both grayscale and pseudo-color display modes; rotate the grayscale image; add a depth scale bar to the right of the grayscale image and draw scale lines and unit labels on the scale bar.
[0010] Save grayscale images with added scale bars, selecting the save path and filename; it also supports capturing and handling abnormal situations during the file saving process, providing clear error messages.
[0011] Optionally, the process of managing processed data using the ProcessedResults class includes the following steps:
[0012] The raw data of each frame of laser tomography scan is a 1024×1024 floating-point matrix, representing 1024 rows of data, each row containing 1024 pixels. The 1024 rows of data are divided into 16 groups, each group containing 64 rows.
[0013] For each group of 64 rows of data, process column by column. For each column, extract the maximum value from the 64 rows. Store the 1024 maximum values extracted from each group as a 1×1024 row vector. Stack the 16 extracted row vectors in order to form a 16×1024 compressed data matrix.
[0014] In the ProcessGroup method of the DataProcessor class, a two-dimensional array result is defined to store the final compressed data matrix. The size of result is RESULT_ROWS rows and ROW_LENGTH columns. The processing tasks of 16 sets of data are assigned to multiple threads or computing units. Each thread independently processes a set of 64 rows of data, extracts the maximum value and fills it into the corresponding row of result.
[0015] Optionally, the process of forming a 16×1024 compressed data matrix includes the following steps:
[0016] The 1024 rows of data were divided into 16 groups, with 64 rows in each group, using a dynamic grouping strategy. The group size was dynamically adjusted based on the local characteristics of the laser tomography data. A clustering strategy was used to pre-analyze the laser tomography data and automatically determine the grouping strategy.
[0017] Multiple feature values are extracted from each column, including the maximum, minimum, and average laser reflection intensity and the variance of the scattering coefficient; a multidimensional feature vector is generated by calculating the laser reflection intensity and scattering coefficient.
[0018] Based on the local characteristics of laser tomography data, the compression weights are dynamically adjusted by calculating the laser reflection intensity and scattering coefficient.
[0019] Optionally, the process of distributing the processing tasks of the 16 sets of data to multiple threads or computing units includes the following steps:
[0020] Each thread independently processes a set of 64 rows of data, calculates the gradient of the laser reflection intensity and the gradient of the scattering coefficient, and multiplies the two gradients to calculate the gradient product of each set of data.
[0021] The gradient products of each set of data need to be summed. The gradient products of all sets of data are summed, and the sum of the gradient products of each set of data is divided by the total sum of the gradient products.
[0022] Storage parameters are introduced to adjust the range of storage levels. Based on the calculated storage levels, each group of data is assigned to a different storage level.
[0023] Optionally, the process of drawing scale lines and unit markings on a scale includes the following steps:
[0024] Normalize each data point in the compressed data matrix to scale all data points to the range of 0-1.
[0025] The normalized gray values of the data points are converted into a gray level, the processed data is assigned to the corresponding position in the grayscale image, and the grayscale image is converted into a grayscale image used by the pseudo-color image; after setting the rotation angle using the RotateTransform method of the Graphics object, the original image is drawn to the new position using the DrawImage method of the Graphics object, and the rotation transformation is applied at the same time.
[0026] Determine the scale range of the scale based on the minimum and maximum gray values of the data, and draw the scale on the image using the Graphics object.
[0027] Optionally, the process of scaling all data points to the range of 0-1 includes the following steps:
[0028] Numerical characteristics of each data point are extracted from the compressed data matrix, including its original grayscale value and the overall distribution characteristics of the dataset; the value range of the data is determined by analyzing the minimum and maximum grayscale values of the data points.
[0029] The original grayscale value of each data point is offset and adjusted by subtracting the minimum grayscale value of the dataset to align the starting point of the data to zero; the offset data points are scaled using the value range; and the numerical range of the data points is compressed to between 0 and 1 by dividing the offset data points by the value range, thereby achieving data normalization.
[0030] The normalized data points were verified, and the values were found to be within the range of 0 to 1.
[0031] Optionally, the process of setting the rotation angle using the RotateTransform method of the Graphics object includes the following steps:
[0032] The normalized value is then converted to a gray level, which is an integer between 0 and 255; the processed data is assigned to the corresponding position in the image by multiplying the normalized value by 255 and ensuring that the result is between 0 and 255.
[0033] For each pixel in the grayscale image, a corresponding pseudocolor is selected based on its grayscale value. The selection of the pseudocolor is achieved through a color mapping function, which sets the selected pseudocolor to the corresponding position in the new color image.
[0034] After setting the rotation angle using the RotateTransform method of the Graphics object, use the DrawImage method of the Graphics object to draw the original image to the new position, while applying the rotation transformation.
[0035] Optionally, the process of drawing a scale bar on an image using a Graphics object includes the following steps:
[0036] Input the minimum grayscale value, maximum grayscale value, scale width, scale height, and scale interval; determine the scale range based on the minimum and maximum grayscale values; calculate the scale interval based on the scale height and scale range; calculate the total number of scales based on the scale range and scale interval; generate scale label values based on the scale interval and scale range.
[0037] Use a Graphics object to create a new image or canvas for drawing the scale; draw vertical lines to represent the scale lines according to the height and scale intervals of the scale; draw the scale lines using the DrawLine method of the Graphics object; draw scale labels next to each scale line using the DrawString method of the Graphics object, with the label content being the scale label value; draw unit labels at the top or bottom of the scale; draw unit labels using the DrawString method of the Graphics object.
[0038] Use the RotateTransform method of the Graphics object to set the rotation angle to 90 degrees; use the DrawImage method of the Graphics object to draw the rotated scale to the target position; save the drawn scale image as a file or display it on the interface.
[0039] Optionally, the process of drawing scale lines, scale labels, and unit identifiers includes the following steps:
[0040] Calculate the vertical position of each scale line based on the height and scale intervals of the scale; draw the vertical line using the Graphics.DrawLine method, with the color of the scale line contrasting with the main color tone of the tomographic scan image; the thickness of the scale line is dynamically adjusted according to the width of the scale.
[0041] The scale labels are used to indicate the grayscale or depth value corresponding to each scale line. Spacing is left to the right or left of each scale line for label drawing. The vertical position of the label is aligned with the scale line, and the horizontal position is dynamically adjusted according to the scale width. The scale label value is generated based on the scale range and interval. The labelValue is formatted as a string, retaining the decimal places. The label is drawn using the Graphics.DrawString method, with a sans-serif font selected, and the label color matching the scale line color.
[0042] The unit identifier is used to indicate the unit of the scale and is placed at the top or bottom of the scale, depending on the image layout. If the scale is long, the unit identifier is placed in the middle. Depending on the specific application of laser tomography, the unit identifier is either a grayscale value or a depth value.
[0043] Optionally, use the Graphics.DrawString method to draw unit labels, with the font larger than the scale labels and the same color as the scale labels; use a grayscale gradient in the background of the scale bar, from the minimum grayscale value to the maximum grayscale value, consistent with the grayscale distribution of the tomographic scan image.
[0044] This invention employs parallel computing technology, significantly improving data processing speed; it effectively reduces memory usage through a grouping processing strategy; and it achieves data compression with a compression ratio of 64:1, significantly improving storage efficiency. It retains key depth information, ensuring the integrity of image data; it supports both grayscale and pseudo-color display modes to meet different observation needs; the images have high clarity and strong detail representation, facilitating observation and analysis. It supports output in multiple image formats to meet diverse application requirements; it can store multiple sets of data for comparative analysis and research; and it is easily integrated into other systems, exhibiting good compatibility and scalability. Operation is simple and convenient, requiring no professional training for users; the processing is highly automated, reducing manual intervention and errors; and a comprehensive error handling mechanism ensures stable system operation.
[0045] Other features and advantages of the invention will be set forth in the following description, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description and the accompanying drawings.
[0046] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description
[0047] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:
[0048] Figure 1 This is a flowchart of the depth scan information stitching method based on OCT in Embodiment 1 of the present invention;
[0049] Figure 2 This is a schematic diagram of the depth scan information stitching method based on OCT in Embodiment 1 of the present invention;
[0050] Figure 3 This is a flowchart illustrating the process of managing processed data using the ProcessedResults class in Embodiment 2 of the present invention.
[0051] Figure 4 This is a process diagram of forming a 16×1024 compressed data matrix in Embodiment 3 of the present invention;
[0052] Figure 5 This is a flowchart illustrating the process of allocating the processing tasks of 16 sets of data to multiple threads or computing units in Embodiment 4 of the present invention.
[0053] Figure 6 This is a process diagram of drawing scale lines and unit markings on a scale bar in Embodiment 5 of the present invention;
[0054] Figure 7 This is a diagram illustrating the process of scaling all data points to the range of 0-1 in Embodiment 6 of the present invention.
[0055] Figure 8 This is a diagram illustrating the process of setting the rotation angle using the RotateTransform method of the Graphics object in Embodiment 7 of the present invention.
[0056] Figure 9 This is a diagram illustrating the process of selecting pseudo-color through a color mapping function in Embodiment 8 of the present invention.
[0057] Figure 10 This is a diagram illustrating the process of drawing a scale bar on an image using a Graphics object in Embodiment 9 of the present invention.
[0058] Figure 11 This is a process diagram of drawing scale lines, drawing scale labels, and drawing unit identifiers in Embodiment 10 of the present invention. Detailed Implementation
[0059] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0060] The terminology used in the embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the embodiments of this application. The singular forms “a,” “the,” and “the” used in the embodiments of this application are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0061] In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application. In the description of this application, it should be understood that the terms "first," "second," "third," etc., are used only to distinguish similar objects and are not necessarily used to describe a specific order or sequence, nor should they be construed as indicating or implying relative importance. Those skilled in the art can understand the specific meaning of the above terms in this application according to the specific circumstances.
[0062] Example 1: As Figure 1 As shown, this embodiment of the invention provides a method for stitching depth scan information based on OCT, comprising the following steps:
[0063] S100: Receives raw data from laser tomography scans, inputting a floating-point data matrix of size 1024×1024; divides the data into 16 groups of 64 rows each, extracts the maximum value from each group, and forms a compressed data matrix of 16×1024; uses the ProcessedResults class to manage the processed data.
[0064] S200: Normalizes the values of the compressed data matrix to the range of 0-255; creates an 8-bit grayscale image, supporting both grayscale and pseudo-color display modes, and rotates the grayscale image by 90 degrees; adds a depth scale bar to the right side of the grayscale image, with a default depth range of 0-3000 micrometers, and draws scale lines and unit labels on the scale bar.
[0065] S300: Saves grayscale images with added scale bars in PNG, JPEG, and BMP formats, allowing users to select the save path and filename; it also supports capturing and handling abnormal situations during the file saving process, providing clear error messages.
[0066] The working principle and beneficial effects of the above technical solution are as follows: This embodiment first receives the raw data from laser tomography, inputting a floating-point data matrix of size 1024×1024; divides the data into groups of 64 rows each, for a total of 16 groups, extracts the maximum value in each group, and forms a compressed data matrix of 16×1024; uses the ProcessedResults class to manage the processed data; secondly, normalizes the values of the compressed data matrix to the range of 0-255; creates an 8-bit grayscale image, supporting both grayscale and pseudo-color display modes, and rotates the grayscale image by 90 degrees; adds a depth scale bar to the right side of the grayscale image, with a default depth range of 0-3000 micrometers, and draws scale lines and unit labels on the scale bar; finally, saves the grayscale image with the added scale bar in formats such as PNG, JPEG, and BMP, selecting the save path and filename; simultaneously supports capturing and handling abnormal situations during the file saving process, providing clear error prompts (the principle is described in the appendix). Figure 2 Step S100 of the above scheme significantly reduces the amount of data while retaining key depth information; the ProcessedResults class is used to uniformly manage the compressed data, supporting the storage, access, and clearing of multiple sets of data, improving the flexibility and scalability of data processing. Significance: By extracting the maximum value, the amount of data is greatly reduced while retaining key information, saving computing resources for processing; data management through classes facilitates calling and analysis, improving the automation level of the overall process. Step S200 Image Conversion and Visualization: The values of the compressed data matrix are normalized to the range of 0-255 to facilitate the generation of 8-bit grayscale images; an 8-bit grayscale image is created, supporting both grayscale and pseudo-color display modes to meet the visualization needs of different scenarios; the image is rotated 90 degrees to optimize the display effect and facilitate observation and analysis; a depth scale bar is added to the right side of the image, with a default range of 0-3000 micrometers, and scale lines and unit labels are drawn to enhance the readability and scientific nature of the image. Significance: By normalizing and generating images, abstract depth data is transformed into intuitive images, facilitating rapid data understanding; adding scale bars and graduations enhances the scientific value of the images, aiding in quantitative analysis and comparison. Step S300: Image saving and error handling supports saving in multiple formats such as PNG, JPEG, and BMP, providing a file saving dialog box that allows users to select the save path and filename; it captures and handles abnormal situations during the file saving process, providing clear error messages to ensure a smooth saving process. Significance: Saving processed images in multiple formats facilitates use, sharing, and archiving; error handling and prompting functions improve system robustness and user-friendliness, preventing data loss due to saving failures.
[0067] Performance advantages of this embodiment: Parallel computing technology significantly improves data processing speed; group processing strategy effectively reduces memory usage; data compression is implemented with a compression ratio of 64:1, significantly improving storage efficiency. Image quality advantages: It retains key depth information, ensuring image integrity; it supports both grayscale and pseudo-color display modes to meet different observation needs; the image clarity is high, with strong detail representation, facilitating observation and analysis. System scalability: It supports output of multiple image formats to meet different application requirements; it can store multiple sets of data for comparative analysis and research; it is easy to integrate into other systems, possessing good compatibility and scalability. Practicality: Operation is simple and convenient; users can use it without professional training; the processing process is highly automated, reducing manual intervention and errors; a comprehensive error handling mechanism ensures stable system operation.
[0068] In summary, this embodiment achieves efficient data compression and management; transforms data into intuitive images with scientific annotations to enhance readability and analytical value; and ensures the persistence and reliability of processing results, improving user experience. The overall process, from data reception and processing to visualization and storage, forms a complete closed loop, suitable for the efficient stitching and analysis of OCT depth scan information, and has significant research and clinical application value.
[0069] Example 2: Figure 3 As shown, based on Example 1, the process of managing processed data using the ProcessedResults class provided in this embodiment of the invention includes the following steps:
[0070] S101: The raw data of each frame of laser tomography scan is a 1024×1024 floating-point matrix, representing 1024 rows of data, each row containing 1024 pixels. The 1024 rows of data are divided into 16 groups, each group containing 64 rows.
[0071] S102: For each group of 64 rows of data, process column by column. For each column, extract the maximum value from the 64 rows. Store the 1024 maximum values extracted from each group as a 1×1024 row vector. Stack the 16 groups of extracted row vectors in order to form a 16×1024 compressed data matrix.
[0072] S103: In the ProcessGroup method of the DataProcessor class, define a two-dimensional array result to store the final compressed data matrix. The size of result is RESULT_ROWS rows (16 rows) and ROW_LENGTH columns (1024 columns). Distribute the processing tasks of 16 sets of data to multiple threads or computing units. Each thread independently processes a set of 64 rows of data, extracts the maximum value and fills it into the corresponding row of result.
[0073] The ProcessedResults class defines TOTAL_ROWS as the total number of rows, MERGE_GROUP_SIZE as the number of columns merged in each group, and RESULT_ROWS as the number of result rows (calculated by dividing the total number of rows by the number of columns merged in each group). The ProcessGroup method defines an input array sourceData and a two-dimensional array result for storing the processing results. A Parallel.For loop processes RESULT_ROWS (the number of result rows) in parallel. In each iteration, the flipped row index flippedRow is calculated, and each column is traversed. During column traversal, an inner loop iterates over MERGE_GROUP_SIZE (the number of columns merged in each group), reading the value at the corresponding position from the input array sourceData and finding the maximum value within that group. The found maximum value is stored in the flipped position flippedRow and the current column col of the result array result. After parallel processing is complete, the processed result array result is added to _results (a result set of type ProcessedResults) using the AddResult method.
[0074] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the raw data of each frame of laser tomography scan is a 1024×1024 floating-point matrix, representing 1024 rows of data, each row containing 1024 pixels. The 1024 rows of data are divided into 16 groups, each group containing 64 rows. Secondly, for each group of 64 rows of data, the data is processed column by column. For each column, the maximum value is extracted from the 64 rows. The 1024 maximum values extracted from each group are stored as a 1×1024 row vector. The 16 groups of extracted row vectors are stacked in order to form a 16×1024 compressed data matrix. Finally, in the ProcessGroup method of the DataProcessor class, a two-dimensional array result is defined to store the final compressed data matrix. The size of result is RESULT_ROWS rows (16 rows) and ROW_LENGTH columns (1024 columns). The processing tasks of the 16 groups of data are assigned to multiple threads or computing units. Each thread independently processes a group of 64 rows of data, extracts the maximum value, and fills it into the corresponding row of result. Step S101 of the above scheme involves data grouping, dividing the original 1024×1024 floating-point matrix into 16 groups, each containing 64 rows of data. This grouping method decomposes large-scale data into smaller units, facilitating parallel processing. Significance: By dividing the data into smaller units, the amount of data processed at one time is reduced, lowering computational complexity; after grouping, each group of data can be processed independently, laying the foundation for multi-threaded or distributed computing; after grouping, memory usage is more controllable, avoiding memory overflow caused by loading too much data at once. Step S102 involves data compression, processing each of the 64 rows of data column by column, extracting the maximum value of each column, and generating a 1×1024 row vector; the 16 groups of row vectors are stacked sequentially to form a 16×1024 compressed data matrix. Significance: By extracting the maximum value, the 64 rows of data are compressed into one row, significantly reducing the data volume; maximum value extraction preserves the important features of each column, ensuring that the compressed data still reflects the key information of the original data; the compressed data matrix is smaller in size, facilitating storage and transmission. Step S103 utilizes multi-threaded or distributed computing to fully leverage computing resources and significantly shorten processing time; through thread-safe design, it ensures that no data conflicts occur when multiple threads operate on the result array simultaneously; and it encapsulates data processing tasks in the ProcessGroup method for easy code reuse and maintenance.
[0075] In summary, the ProcessedResults class in this embodiment achieves efficient management and processing of large-scale laser tomography data; reduces computational complexity, providing a foundation for parallel processing; reduces data volume, retains key information, and improves storage and transmission efficiency; fully utilizes computing resources, improves processing efficiency, and ensures data consistency. It not only optimizes the data processing flow but also provides high-quality input data for data analysis, visualization, or further operations.
[0076] Example 3: As Figure 4 As shown, based on Example 2, the process of forming a 16×1024 compressed data matrix provided in this embodiment of the invention includes the following steps:
[0077] S1021: The 1024 rows of data are divided into 16 groups, with 64 rows in each group, using a dynamic grouping strategy; the group size is dynamically adjusted based on the local characteristics of the laser tomography data (such as reflection intensity, scattering coefficient, etc.); a clustering strategy is used to pre-analyze the laser tomography data and automatically determine the grouping strategy;
[0078] Calculate the group size using the following formula:
[0079]
[0080] In the formula, (G_i) represents the group size of the i-th group; I(x ij I(x) represents the laser reflection intensity of the j-th row of the i-th group; ik () represents the laser reflection intensity of the k-th row of the i-th group; α represents the variance of the scattering coefficient of the j-th row of the i-th group; α, β, γ, δ represent dynamic adjustment parameters used to control the range of group size; the dynamic grouping strategy dynamically adjusts the group size by calculating the local features of laser tomography data (such as reflection intensity and scattering coefficient); it can automatically optimize the group size according to the degree of data change, improving the flexibility and efficiency of data processing;
[0081] Calculate the group optimization weights using the following formula:
[0082]
[0083] In the formula, W i C(x) represents the grouping optimization weight of the i-th group; ij D(x) represents the cluster center of laser reflection intensity in the j-th row of the i-th group; ij) represents the distance from the j-th row of the i-th group to the cluster center; η, θ, κ, λ represent optimization parameters used to control the range of group optimization weights; the group optimization algorithm dynamically adjusts the group optimization weights by calculating the cluster centers and distances of the laser tomography scan data; it can automatically optimize the grouping strategy according to the distribution characteristics of the data, improving the intelligence level of data processing;
[0084] S1022: Extract multiple feature values from each column, including the maximum, minimum, and average values of laser reflection intensity and the variance of the scattering coefficient; generate a multi-dimensional feature vector by calculating the laser reflection intensity and scattering coefficient;
[0085] Calculate multiple feature vectors using the following formula:
[0086]
[0087] In the formula, F i S(x) represents the multiple feature vectors of the i-th group; ij S(x) represents the scattering coefficient of the j-th row of the i-th group. ik ) represents the scattering coefficient of the i-th group and k-th row of data; μ,ν,ξ,ρ represent feature extraction parameters used to control the range of multiple feature vectors; it can more comprehensively reflect the characteristics of laser tomography data and avoid information loss that may be caused by a single feature;
[0088] S1023: Based on the local characteristics of laser tomography data, the compression weight is dynamically adjusted by calculating the laser reflection intensity and scattering coefficient;
[0089] Calculate the compression weights using the following formula:
[0090]
[0091] In the formula, C i φ represents the compression weight of the i-th group; φ, ψ, ω, χ represent compression parameters used to control the range of compression weights; the adaptive compression algorithm dynamically adjusts the compression weights by calculating the laser reflection intensity and scattering coefficient; it can dynamically adjust the compression strategy according to the data characteristics to achieve a balance between compression efficiency and data quality.
[0092] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the 1024 rows of data are first divided into 16 groups, with 64 rows in each group, using a dynamic grouping strategy; the group size is dynamically adjusted according to the local characteristics of the laser tomography data (such as reflection intensity, scattering coefficient, etc.); a clustering strategy is used to pre-analyze the laser tomography data to automatically determine the grouping strategy; secondly, multiple feature values are extracted from each column, including the maximum, minimum, and average values of laser reflection intensity and the variance of scattering coefficient; a multi-dimensional feature vector is generated by calculating the laser reflection intensity and scattering coefficient; finally, the compression weight is dynamically adjusted according to the local characteristics of the laser tomography data by calculating the laser reflection intensity and scattering coefficient. Step S1021 of the above solution is the dynamic grouping strategy. Based on the local characteristics of laser tomography data (such as reflection intensity and scattering coefficient), the group size is dynamically adjusted to avoid resource waste or information loss that may result from fixed grouping. The grouping strategy is dynamically optimized by calculating the rate of change of reflection intensity and the variance of the scattering coefficient, ensuring the uniformity and representativeness of each group. Clustering algorithms are used to pre-analyze the data, calculate grouping optimization weights, and dynamically adjust the grouping strategy. The grouping strategy is further optimized by calculating the cluster centers of laser reflection intensity and the distance from the data points to the cluster centers, improving the intelligence level of data processing. The significance is that the dynamic grouping strategy can automatically adjust the group size according to the local characteristics of the data, adapting to the needs of different data distributions; through cluster analysis and grouping optimization weight calculation, computational resources are rationally allocated, avoiding resource waste; and the dynamic grouping strategy can adapt to complex and variable laser tomography data, improving the robustness of the algorithm. Step S1022 involves multi-feature extraction, extracting multiple feature values from each column (such as the maximum, minimum, and average laser reflection intensity, and the variance of the scattering coefficient) to generate a multi-dimensional feature vector. By calculating the rate of change of reflection intensity and scattering coefficient, the feature extraction strategy is dynamically adjusted to ensure that the extracted features comprehensively reflect the characteristics of the data. This multi-feature extraction mechanism avoids the information loss problem that may result from a single feature, ensuring that the compressed data matrix retains the key information of the original data. The significance of this step is that the multi-dimensional feature vector can more comprehensively describe the characteristics of laser tomography data, providing richer information for subsequent analysis and processing; by extracting multiple feature values, the compressed data matrix can support various application scenarios (such as target recognition and feature analysis); and the multi-feature extraction mechanism avoids the limitations that may arise from a single feature, improving the reliability of data processing. Step S1023, the adaptive compression algorithm, dynamically adjusts the compression weights based on the local characteristics of the laser tomography data to ensure a balance between compression efficiency and data quality; it dynamically adjusts the compression strategy by calculating the rate of change of reflection intensity and scattering coefficient to achieve adaptive compression; the adaptive compression algorithm can dynamically adjust the compression strategy according to data characteristics to ensure that the compressed data matrix is both efficient and accurate; and it achieves a balance between compression efficiency and data quality by controlling the compression parameters.Significance achieved: Adaptive compression algorithms can dynamically adjust compression strategies based on data characteristics, significantly improving compression efficiency; by dynamically adjusting compression weights, they ensure that the compressed data matrix retains the key information of the original data, avoiding data distortion; Adaptive compression algorithms can adapt to the needs of different scenarios, improving the practicality and versatility of the algorithm.
[0093] In summary, this embodiment, through dynamic grouping strategies, multi-feature extraction, and adaptive compression algorithms, achieves the following technical effects and significance in forming a 16×1024 compressed data matrix: It improves the flexibility and efficiency of data processing; the dynamic grouping strategy and adaptive compression algorithm can dynamically adjust the processing strategy according to data characteristics, significantly improving the efficiency and flexibility of data processing. It enhances the representational ability and usability of data; the multi-feature extraction mechanism can comprehensively reflect the characteristics of laser tomography data, ensuring that the compressed data matrix can support various application scenarios. It optimizes resource allocation and data quality; by dynamically adjusting the group size, feature extraction strategy, and compression weights, it achieves efficient resource utilization and optimized data quality. This not only improves the intelligence level of laser tomography data processing but also provides a solid foundation for data analysis and application.
[0094] Example 4: Figure 5 As shown, based on Embodiment 2, the process of allocating the processing task of 16 sets of data to multiple threads or computing units provided in this embodiment of the invention includes the following steps:
[0095] S1031: Each thread independently processes a set of 64 rows of data, calculates the gradient of the laser reflection intensity and the gradient of the scattering coefficient, and multiplies the two gradients to calculate the gradient product of each set of data.
[0096] Calculate the gradient of laser reflection intensity. For each set of data i, calculate the laser reflection intensity I(x) row by row. ij The gradient of ).
[0097]
[0098] In the formula, x ij This represents the coordinate value of the j-th row of the i-th group;
[0099] Calculate the gradient of the scattering coefficients, and calculate the scattering coefficients S(x) row by row. ij gradient of )
[0100]
[0101] To calculate the gradient product, multiply the two gradients together.
[0102]
[0103] S1032: The gradient product of each set of data needs to be summed. The gradient product of all sets of data is summed, and the result of the summation of the gradient product of each set of data is divided by the total summation of the gradient product.
[0104] For each set of data i, multiply the gradient product G ij Summation:
[0105]
[0106] In the formula, V = 64, which represents the number of rows in each group of data;
[0107] Sum the gradient products over all groups of data:
[0108]
[0109] In the formula, W = 16, representing the total number of groups;
[0110] Divide the sum of the gradient products of each set of data by the sum of the total gradient products:
[0111]
[0112] The goal is to eliminate the impact of data size and ensure the rationality of the storage hierarchy;
[0113] S1033: Introduce storage parameters to adjust the range of storage levels, and allocate each group of data to different storage levels according to the calculated storage levels;
[0114] Computational storage hierarchy:
[0115]
[0116] In the formula, ι,κ,λ,μ are storage parameters used to control the range of storage levels; ι and κ are used to expand the range of storage levels; λ and μ are used to shrink the range of storage levels. These parameters can be adjusted according to actual needs to achieve dynamic optimization of the storage levels; if L i A larger value indicates a significant trend in the data set, suggesting it can be allocated to high-speed storage media (such as memory); if L... i A smaller value indicates that the data set shows a gentle trend of change and can be allocated to a low-speed storage medium (such as a hard drive).
[0117] The processing results for each set of data are filled into the corresponding row of the two-dimensional array result:
[0118] result[i][j]=max(x i1 ,x i2 ,…,x i64 )
[0119] In the formula, max represents the maximum value extracted from 64 rows of data.
[0120] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, each thread independently processes a set of 64 rows of data, calculates the gradient of laser reflection intensity and the gradient of scattering coefficient, and multiplies the two gradients to calculate the gradient product of each set of data; secondly, the gradient product of each set of data needs to be summed, and the gradient products of all sets of data are summed, and the sum of the gradient products of each set of data is divided by the total sum of the gradient products; finally, storage parameters are introduced to adjust the range of storage levels, and each set of data is allocated to different storage levels according to the calculated storage levels. Step S1031 of the above solution involves gradient calculation and gradient product, where each thread independently processes a set of 64 rows of data, making full use of the parallel capabilities of multi-threading or computing units to significantly improve computational efficiency; by calculating the gradients of laser reflection intensity and scattering coefficient row by row, the changing trend of the data is extracted; the two gradients are multiplied to obtain the gradient product, which is used to quantify the comprehensive effect of data changes. Significance: Gradient calculation can effectively capture the changing characteristics of data, providing a basis for data storage and optimization; by allocating tasks through multi-threading, the computation time is greatly shortened, making it suitable for large-scale data processing scenarios. Step S1032: Gradient Product Summation and Normalization. After summing the gradient products of each data set, the result is divided by the total gradient product summation. This eliminates the influence of data size and ensures comparability between different data sets. Significance: This lays the foundation for dynamic allocation of storage levels, ensuring the rationality and efficiency of data storage. Step S1033: Storage Level Allocation and Result Filling. By introducing storage parameters, the range of storage levels is dynamically adjusted to optimize the allocation of storage resources. Based on the size of the storage level value, data is allocated to high-speed storage media (such as memory) or low-speed storage media (such as hard disks) to improve data access efficiency. The maximum value of each data set is filled into the two-dimensional array `result` for easy analysis and use. Significance: By dynamically adjusting the storage level, storage resources are rationally allocated, reducing storage costs while improving data access speed. By extracting the maximum value of each data set, data redundancy is reduced, facilitating subsequent analysis and processing.
[0121] In summary, this embodiment achieves efficient processing and storage optimization for large-scale data through parallel computing, gradient analysis, normalization, and dynamic storage allocation. Multi-threaded parallelism and data feature extraction significantly shorten computation time; dynamic hierarchical storage allocation enables efficient utilization of storage resources, providing a high-quality data foundation for data analysis. It fully embodies the synergistic optimization of computing and storage, making it suitable for applications requiring efficient processing of large-scale data. Multi-threaded processing improves data processing efficiency, while the hierarchical storage mechanism further optimizes storage resource allocation, avoiding storage bottlenecks. Gradient information from laser reflection intensity and scattering coefficients allows for more flexible allocation of storage resources, adapting to different data trends. This not only improves data processing efficiency but also optimizes storage resource utilization, making it suitable for large-scale data processing scenarios. This embodiment, by combining hierarchical storage mechanisms with multi-threaded processing, significantly improves the efficiency and quality of data processing. It possesses high technical value and market potential, suitable for scenarios requiring efficient storage and processing, such as laser tomography, image processing, and big data analysis.
[0122] Example 5: Figure 6 As shown, based on Example 1, the process of drawing scale lines and unit markings on a scale provided by this embodiment of the invention includes the following steps:
[0123] S201: Normalize each data point in the compressed data matrix to scale all data points to the range of 0-1;
[0124] S202: Convert the gray values of the normalized data points into a gray level, assign the processed data to the corresponding position in the grayscale image, and convert the grayscale image into a grayscale image used by the pseudo-color image; after setting the rotation angle (90 degrees) using the RotateTransform method of the Graphics object, use the DrawImage method of the Graphics object to draw the original image to the new position, and apply the rotation transformation at the same time.
[0125] S203: Determine the scale range of the scale bar based on the minimum and maximum gray values of the data, and draw the scale bar on the image using the Graphics object.
[0126] The working principle and beneficial effects of the above technical solution are as follows: First, each data point in the compressed data matrix is normalized, scaling all data points to the range of 0-1. Second, the grayscale values of the normalized data points are converted into a grayscale level, and the processed data is assigned to the corresponding position in the grayscale image, converting the grayscale image into a grayscale image used for pseudo-color images. After setting the rotation angle (90 degrees) using the RotateTransform method of the Graphics object, the DrawImage method of the Graphics object is used to draw the original image to the new position, while applying the rotation transformation. Finally, the scale range of the scale bar is determined based on the minimum and maximum grayscale values of the data, and the scale bar is drawn on the image using the Graphics object. Step S201, data normalization calculation, ensures that all data points are within the same numerical range. Significance: Normalization can eliminate the dimensional differences between different data points, making the data comparable; normalized data is easier to perform operations such as grayscale mapping and pseudo-color conversion, improving processing efficiency; normalized data can more clearly show the trend of change in the image. Step S202: Grayscale conversion and image rotation. Pseudo-color conversion can display subtle changes in a grayscale image as more intuitive color differences, facilitating observation and analysis. Image rotation can adjust the display orientation of the image to better suit the needs of practical application scenarios (e.g., adjusting horizontal data to vertical display). Through grayscale mapping and pseudo-color conversion, image processing becomes more flexible and can meet the needs of different scenarios. Step S203: Scale bar drawing. Based on the minimum and maximum grayscale values of the data, determine the scale range of the scale. Calculate the scale interval and total number of scale divisions based on the scale width, minimum depth, and maximum depth. Use the Graphics object to draw vertical lines on the image as scale lines and label the scale at appropriate locations. Significance: The scale bar provides users with a quantitative reference for the data, facilitating the understanding of the specific meaning of grayscale or depth values in the image. Through scale lines and labels, users can intuitively understand the distribution range and changing trends of the data. Drawing the scale bar makes the image more professional while ensuring the accurate transmission of data.
[0127] In summary, this embodiment unifies the data range, eliminates the influence of units, and simplifies subsequent processing; enhances visual effects, adapts to different needs, and improves the flexibility of image processing; provides data references, enhances image readability, and improves professionalism and accuracy. This makes image processing and depth scale generation more efficient, intuitive, and professional, providing users with a better data visualization experience.
[0128] Example 6: As Figure 7 As shown, based on Example 5, the process of scaling all data points to the range of 0-1 provided in this embodiment of the invention includes the following steps:
[0129] S2011: Extract the numerical characteristics of each data point from the compressed data matrix, including its original gray value and the overall distribution characteristics of the dataset; determine the value range of the data by analyzing the minimum and maximum gray values of the data points;
[0130] S2012: The original grayscale value of each data point is offset and adjusted. By subtracting the minimum grayscale value of the dataset, the starting point of the data is aligned to zero. The offset data points are scaled using the value range. By dividing the offset data points by the value range, the numerical range of the data points is compressed to between 0 and 1, thereby achieving data normalization.
[0131] S2013: Verify the normalized data points, with values ranging from 0 to 1.
[0132] The working principle and beneficial effects of the above technical solution are as follows: This embodiment first extracts the numerical characteristics of each data point from the compressed data matrix, including its original grayscale value and the overall distribution characteristics of the dataset; by analyzing the minimum and maximum grayscale values of the data points, the value range of the data is determined; secondly, the original grayscale value of each data point is offset and adjusted by subtracting the minimum grayscale value of the dataset, aligning the starting point of the data to zero; the value range is used to scale the offset-adjusted data points; by dividing the offset data points by the value range, the numerical range of the data points is compressed to between 0 and 1, achieving data normalization; finally, the normalized data points are verified, and the values are within the range of 0 to 1. Step S2011 of the above solution extracts the numerical characteristics of the data points and determines the value range, extracts the original grayscale value of each data point from the dataset, and analyzes the distribution characteristics of the entire dataset. By calculating the minimum and maximum grayscale values, the value range of the data (i.e., the range of data values) is determined. Significance: Determining the value range is the basis of normalization. Only by knowing the range of data values can offset and scaling operations be performed; this ensures the accuracy and consistency of data processing and avoids bias caused by uneven data distribution. Step S2012, offset adjustment and scaling, aligns the starting point of the data to zero by subtracting the minimum gray value of the dataset, eliminating the influence of the minimum value on subsequent calculations; the value range is then used to scale the offset-adjusted data, compressing it to between 0 and 1. Significance: Offset adjustment and scaling eliminate the influence of data dimensions, allowing data with different features to be compared and analyzed on the same scale. Normalized data is more suitable for machine learning algorithms, especially those sensitive to data scale (such as gradient descent, K-nearest neighbors, etc.). Normalization can also accelerate the convergence speed of the model and improve its stability. Step S2013, verifying the normalization results, verifies the normalized data to ensure that the value of each data point is within the range of 0 to 1; if some data points are found to be outside this range, it indicates that there may be a problem with the normalization process, and the calculation steps need to be rechecked. Significance: The purpose of validating normalization results is to ensure the correctness and reliability of data processing; only validated data can be used for modeling and analysis to avoid model performance degradation or result bias due to data processing errors.
[0133] In summary, the data in this embodiment is standardized to the range of 0 to 1, eliminating the influence of data dimensions and making the data more suitable for processing by machine learning algorithms. Normalization is a key step in data preprocessing, which can improve the training efficiency and performance of the model, while ensuring the comparability and consistency of the data.
[0134] Example 7: As Figure 8As shown, based on Example 5, the process of setting the rotation angle using the RotateTransform method of the Graphics object provided in this embodiment of the invention includes the following steps:
[0135] S2021: The normalized value is then converted to a gray level, which is an integer between 0 and 255; the processed data is assigned to the corresponding position in the image by multiplying the normalized value by 255 and ensuring that the result is between 0 and 255 (achieved through Math.Max(0,Math.Min(1,normalizedValue))).
[0136] S2022: For each pixel in the grayscale image, select a corresponding pseudocolor based on its grayscale value (R component, since the grayscale image only has the R component, the G and B components are the same as the R component); the selection of the pseudocolor is achieved through a color mapping function (GetHeatMapColor), which sets the selected pseudocolor to the corresponding position in the new color image (colorBitmap);
[0137] S2023: After setting the rotation angle (90 degrees) using the RotateTransform method of the Graphics object, use the DrawImage method of the Graphics object to draw the original image to the new position, while applying the rotation transformation.
[0138] The working principle and beneficial effects of the above technical solution are as follows: In this embodiment, the normalized value is first converted into a grayscale level, which is an integer between 0 and 255. By multiplying the normalized value by 255 and ensuring that the result is between 0 and 255 (achieved through Math.Max(0,Math.Min(1,normalizedValue))), the processed data is assigned to the corresponding position in the image. Secondly, for each pixel in the grayscale image, a corresponding pseudocolor is selected based on its grayscale value (R component, since the grayscale image only has the R component, the G and B components are the same as the R component). The selection of the pseudocolor is achieved through a color mapping function (GetHeatMapColor), which sets the selected pseudocolor to the corresponding position in the new color image (colorBitmap). Finally, after setting the rotation angle (90 degrees) using the RotateTransform method of the Graphics object, the DrawImage method of the Graphics object is used to draw the original image to the new position, while applying the rotation transformation. Step S2021 of the above scheme, converting the normalized grayscale value to pseudo-color rendering, provides the basic data. The calculation of grayscale values ensures that the brightness information of the image can be accurately mapped to the pseudo-color image, thus providing clear input data for further image processing (such as rotation). Step S2022, pseudo-color rendering of the grayscale image, makes the information in the grayscale image more intuitive and easier to understand. By mapping grayscale values to color, details or changes in specific areas of the image can be observed more clearly; for example, in thermal imaging or medical images, pseudo-color rendering can help quickly identify temperature changes or lesion areas. Step S2023, image rotation transformation, allows the image to be displayed at different angles, which is very useful in image processing; for example, in image editing, computer vision, or graphical interface design, rotating the image can help users better observe or analyze image content. In addition, rotation transformation can also be used for image correction, such as adjusting a tilted image to a horizontal orientation.
[0139] In summary, this embodiment converts normalized values into grayscale values; through pseudo-color rendering, it converts the grayscale image into a color image, enhancing the visual effect; and through rotation transformation, it changes the display orientation of the image to meet specific display or analysis needs. It achieves grayscale conversion, pseudo-color rendering, and rotation transformation of the image, ultimately generating a processed color image.
[0140] Example 8: As Figure 9 As shown, based on Example 7, the pseudo-color selection provided in this embodiment of the invention is implemented through a color mapping function, and includes the following steps:
[0141] S20221: The calculation of the red component is based on the sine function, using phase shift and grayscale scaling; the output range of the sine function is [-1,1], which is mapped to the [0,1] interval by adding 1 and dividing by 2; the intensity of the nonlinear mapping is adjusted by the exponential parameter, so that the red component exhibits a smooth transition when the grayscale value changes;
[0142] S20222: The calculation of the green component is based on the cosine function, using phase shift and grayscale scaling; the output range of the cosine function is [-1,1], which is mapped to the [0,1] interval by adding 1 and dividing by 2; the exponent parameter is used to adjust the nonlinear mapping intensity of the green component, and the green component exhibits a smooth transition when the grayscale value changes;
[0143] S20223: The calculation of the blue component is based on the hyperbolic tangent function, using scaling and offset of gray values; the output range of the hyperbolic tangent function is [-1,1], which is mapped to the [0,1] interval by adding 1 and dividing by 2; the exponent parameter is used to adjust the nonlinear mapping intensity of the blue component to ensure that the blue component presents a smooth transition when the gray value changes.
[0144] The calculation of the red component R is as follows:
[0145]
[0146] Calculation of the green component G:
[0147]
[0148] Calculation of blue component B:
[0149]
[0150] In the formula, g represents the input grayscale value, ranging from 0 to 255, and is the input parameter of the color mapping function, representing the grayscale value of a pixel in the grayscale image; π represents pi, approximately equal to 3.1415926535, used for trigonometric function calculations; (sin(x)), (cos(x)), and (tanh(x)) are the sine, cosine, and hyperbolic tangent functions, respectively, used to generate smooth color transition effects; α, β, and γ represent exponential parameters used to adjust the nonlinear mapping of color components, which can control the intensity changes of color components. This function rounds down to the nearest integer, ensuring that the RGB value is between 0 and 255. 2 represents the phase offset and scaling parameters, used to adjust the phase and amplitude of the trigonometric function, thereby affecting the distribution of color components; through the above complex color mapping function, grayscale values can be mapped to pseudocolor; the trigonometric functions and exponential parameters in the formula make the color transition smoother and more natural.
[0151] The working principle and beneficial effects of the above technical solution are as follows: First, the calculation of the red component is based on the sine function, using phase shift and grayscale scaling. The output range of the sine function is [-1, 1], which is mapped to the [0, 1] interval by adding 1 and dividing by 2. The intensity of the nonlinear mapping is adjusted by the exponential parameter, so that the red component exhibits a smooth transition when the grayscale value changes. Second, the calculation of the green component is based on the cosine function, using phase shift and grayscale scaling. The output range of the cosine function is [-1, 1], which is mapped to the [0, 1] interval by adding 1 and dividing by 2. The exponential parameter is used to adjust the nonlinear mapping intensity of the green component, so that the green component exhibits a smooth transition when the grayscale value changes. Finally, the calculation of the blue component is based on the hyperbolic tangent function, using grayscale scaling and shift. The output range of the hyperbolic tangent function is [-1, 1], which is mapped to the [0, 1] interval by adding 1 and dividing by 2. The exponential parameter is used to adjust the nonlinear mapping intensity of the blue component, ensuring that the blue component exhibits a smooth transition when the grayscale value changes. In step S20221 of the above scheme, the calculation of the red component, through the periodic variation of the sine function, presents rich color levels in the image, enhancing the visual expressiveness of the image; different gray values are mapped to different red intensities, which helps to highlight certain specific areas or details in the image; the adjustment of the exponential parameter ensures a smooth transition of the red component when gray values change, avoiding abrupt color changes and making the image more natural. In step S20222, the calculation of the green component, the introduction of the green component complements the red component, enriching the color expression of the image and enhancing its color balance; through the periodic variation of the cosine function, the green component can better reflect the detailed information in the image, especially in areas with large gray value changes; similar to the red component, the green component also achieves a smooth transition through the exponential parameter, making the image color changes more natural. Step S20223 Calculation of the blue component: The introduction of the blue component further enriches the color performance of the image, especially in the low grayscale value area, where the blue component can provide more color variations; the characteristics of the hyperbolic tangent function make the blue component more obvious in the high contrast area, which helps to highlight the bright or shadow parts in the image; the blue component also achieves a smooth transition through the exponential parameter, ensuring the continuity of the image color changes.
[0152] In summary, this embodiment uses pseudo-color processing technology to convert grayscale images into color images by calculating the red, green, and blue components. This not only enhances the visual effect of the image but also highlights key information through color changes. The calculation of each color component is based on a different mathematical function, and the intensity of the nonlinear mapping is adjusted by an exponential parameter, ensuring a smooth transition in color changes.
[0153] Example 9: As Figure 10As shown, based on Example 5, the process of drawing a scale bar on an image using a Graphics object provided in this embodiment of the invention includes the following steps:
[0154] S2031: Input the minimum grayscale value, maximum grayscale value, scale width, scale height, and scale interval; determine the scale range of the scale based on the minimum and maximum grayscale values; calculate the scale interval based on the scale height and scale range; calculate the total number of scales based on the scale range and scale interval; generate scale label values based on the scale interval and scale range.
[0155] S2032: Create a new image or canvas using a Graphics object to draw a scale bar; draw vertical lines representing tick marks based on the scale bar's height and tick intervals; draw tick marks using the Graphics object's DrawLine method; draw tick labels next to each tick mark using the Graphics object's DrawString method, with the label content being the tick label value (tickLabels); draw unit identifiers (e.g., "grayscale value" or "depth value") at the top or bottom of the scale bar; draw unit identifiers using the Graphics object's DrawString method.
[0156] S2033: Use the RotateTransform method of the Graphics object to set the rotation angle to 90 degrees; use the DrawImage method of the Graphics object to draw the rotated scale to the target position; save the drawn scale image as a file or display it on the interface.
[0157] The working principle and beneficial effects of the above technical solution are as follows: This embodiment first inputs the minimum grayscale value, the maximum grayscale value, the width of the scale, the height of the scale, and the scale interval; based on the minimum and maximum grayscale values, the scale range of the scale is determined; based on the height of the scale and the scale range, the scale interval is calculated; based on the scale range and the scale interval, the total number of scales is calculated; based on the scale interval and the scale range, scale label values are generated; secondly, a new image or canvas is created using a Graphics object for drawing the scale; based on the height of the scale and the scale interval, vertical lines are drawn to represent the scale lines; the DrawLine method of the Graphics object is used to draw the scale lines; at each scale line... Next to the scale, draw tick labels using the `DrawString` method of the `Graphics` object. The label content is the tick label value (tickLabels). Draw unit identifiers (e.g., "grayscale value" or "depth value") at the top or bottom of the scale. Use the `DrawString` method of the `Graphics` object to draw the unit identifiers. Finally, use the `RotateTransform` method of the `Graphics` object to set the rotation angle to 90 degrees. Use the `DrawImage` method of the `Graphics` object to draw the rotated scale to the target position. Save the completed scale image as a file or display it on the interface. Step S2031 of the above scheme determines the scale range and generates tick label values. By inputting the minimum grayscale value, maximum grayscale value, scale width, height, and tick interval, the scale range of the scale can be determined. Based on the height and scale range of the scale, calculate a suitable tick interval to ensure that the tick lines are evenly distributed and easy to read. Based on the scale range and tick interval, generate tick label values, which will be used to mark specific values on the scale. Significance: By calculating the scale intervals and generating scale label values, the scale ensures that the scale accurately reflects the grayscale or depth distribution in the image; reasonable scale intervals and label values make the scale easy to read, allowing users to quickly understand the numerical distribution in the image. Step S2032: Draw the scale. Create a new image or canvas using a Graphics object to draw the scale; draw vertical lines to represent the scale lines according to the height and scale intervals of the scale, using the DrawLine method; draw scale labels next to each scale line, using the DrawString method to draw the label content; draw unit identifiers, such as "grayscale value" or "depth value," at the top or bottom of the scale, using the DrawString method. Significance: By drawing scale lines and labels, the scale can intuitively display the numerical distribution in the image; the addition of unit identifiers makes the scale information more complete, allowing users to clearly understand the physical quantity represented by the scale.Step S2033: Rotate the scale bar and draw it to the target position. Use the RotateTransform method to set the rotation angle to 90 degrees so that the scale bar can be displayed vertically. Use the DrawImage method to draw the rotated scale bar to the target position, ensuring that the scale bar is aligned with the image. Save the completed scale bar image as a file or display it on the interface for easy viewing and use by the user. Significance: By rotating the scale bar, the display direction of the scale bar can be adjusted as needed to adapt to different image layouts; drawing the scale bar to the target position and saving or displaying it ensures that the scale bar is closely integrated with the image, facilitating subsequent analysis by the user.
[0158] In summary, this embodiment can create an accurate, readable, and aesthetically pleasing scale bar, helping users better understand the grayscale or depth distribution in an image; ensuring the functionality and practicality of the scale bar.
[0159] Example 10: As Figure 11 As shown, based on Example 9, the process of drawing scale lines, drawing scale labels, and drawing unit identifiers provided in this embodiment of the invention includes the following steps:
[0160] S20321: Calculate the vertical position of each scale line based on the height and scale intervals of the scale; draw the vertical line using the Graphics.DrawLine method, with the color of the scale line contrasting with the main color tone of the tomographic scan image; the thickness of the scale line is dynamically adjusted according to the width of the scale.
[0161] S20322: Scale labels are used to indicate the grayscale or depth value corresponding to each scale line. A certain spacing is left on the right or left side of each scale line for drawing the label; the vertical position of the label is aligned with the scale line, and the horizontal position is dynamically adjusted according to the scale width; the scale label value is generated according to the scale range and scale interval; the labelValue is formatted as a string, retaining the decimal places; the label is drawn using the Graphics.DrawString method, the font is a sans-serif font, and the label color is the same as the scale line color;
[0162] S20323: Unit identifiers are used to indicate the units of the scale. They are placed at the top or bottom of the scale, with the specific position adjusted according to the image layout. If the scale is long, place the unit identifier in the middle. Depending on the specific application of laser tomography, the unit identifier may be "grayscale value," "depth value (mm)," or other relevant units. Use the Graphics.DrawString method to draw the unit identifier, with a font larger than the scale label and the same color as the scale label. Use a grayscale gradient in the background of the scale, from the minimum grayscale value to the maximum grayscale value, consistent with the grayscale distribution of the tomographic image.
[0163] The working principle and beneficial effects of the above technical solution are as follows: First, this embodiment calculates the vertical position of each scale line based on the height and scale interval of the scale; the vertical line is drawn using the Graphics.DrawLine method, with the color of the scale line contrasting with the main color tone of the tomographic scan image; the thickness of the scale line is dynamically adjusted according to the width of the scale; second, scale labels are used to annotate the grayscale or depth value corresponding to each scale line, leaving a certain gap on the right or left side of each scale line for drawing the label; the vertical position of the label is aligned with the scale line, and the horizontal position is dynamically adjusted according to the width of the scale; scale label values are generated based on the scale range and scale interval; the labelValue is formatted as a string, retaining decimals. Number of digits; use the Graphics.DrawString method to draw the labels, select a sans-serif font, and make the label color the same as the scale line color; finally, the unit label is used to indicate the unit of the scale, placed at the top or bottom of the scale, the specific position is adjusted according to the image layout; if the scale is long, place the unit label in the middle; depending on the specific application of laser tomography, the unit label is "grayscale value", "depth value (mm)" or other relevant units; use the Graphics.DrawString method to draw the unit label, the font is larger than the scale label, and the color is the same as the scale label; use a grayscale gradient in the background of the scale, from the minimum grayscale value to the maximum grayscale value, consistent with the grayscale distribution of the tomographic image. Step S20321 of the above scheme involves drawing scale lines*. Based on the height of the scale and the scale intervals, the vertical position of each scale line is precisely calculated to ensure a one-to-one correspondence between the scale lines and the grayscale or depth values in the image. This calculation method ensures a uniform scale distribution, accurately reflecting numerical changes in the image. The color of the scale lines contrasts with the main color tone of the tomographic image (e.g., white or light gray), making the scale lines clearly visible. The design avoids confusion between the scale lines and image content, improving the readability of the scale. The thickness of the scale lines is dynamically adjusted according to the width of the scale, with thicker main scale lines and thinner secondary scale lines. This dynamic adjustment ensures the scale maintains good visual quality in images of different resolutions or sizes. The significance of this is that the position and distribution of the scale lines strictly correspond to numerical changes in the image, ensuring users can accurately read grayscale or depth values. Through color contrast and dynamic thickness adjustment, the scale lines remain clearly visible even in complex tomographic images. The dynamic adjustment design allows the scale to adapt to images of different sizes and resolutions, improving its versatility.Step S20322: Draw scale labels, leaving a gap to the right or left of each scale line to ensure the labels do not overlap with the scale lines; align the vertical position of the labels with the scale lines, and dynamically adjust the horizontal position according to the scale width to ensure a neat label layout; generate scale label values based on the scale range and intervals, and format them as strings (e.g., retaining two decimal places); the formatting method ensures the accuracy and consistency of the label content; use a sans-serif font (such as Arial or Helvetica) to ensure the labels are clear and legible in high-resolution images; the label color matches the scale line color, maintaining the visual uniformity of the scale. Significance achieved: The label content is clear and accurate, allowing users to quickly understand the value corresponding to each scale line; the font and color of the labels match the scale lines, avoiding visual confusion; the label position and layout are carefully designed, making the overall scale aesthetically pleasing and practical. Step S20323: Draw unit labels. These labels are placed at the top, bottom, or center of the scale bar, with the specific position dynamically adjusted according to the image layout. This flexibility ensures that the unit labels do not obscure important image content. Depending on the specific application of laser tomography, the unit labels can be "grayscale value," "depth value (mm)," or other relevant units. This design closely links the unit labels to the image content, enhancing the professionalism of the scale bar. The font size of the unit labels is slightly larger than the scale labels, and the color matches the scale labels, ensuring that the unit labels are eye-catching but not obtrusive. This design gives the unit labels appropriate visual weight within the scale bar. A grayscale gradient is used in the background of the scale bar, from the minimum grayscale value to the maximum grayscale value, consistent with the grayscale distribution of the tomographic image. This design visually integrates the scale bar with the image content, improving overall harmony. The significance achieved is that the unit labels are closely related to the image content, reflecting the professionalism and specificity of the scale; the font and color design of the unit labels make them clearly visible in the scale, ensuring that users can quickly understand the units of the scale; the gradient background design makes the scale and image content more visually harmonious, enhancing the overall aesthetics.
[0164] In summary, the precise drawing of the scale lines and labels in this embodiment ensures that users can accurately read the grayscale or depth values in the image; the design of the labels and unit markings makes the scale content clear and easy to read, and consistent with the image content; the gradient background and dynamic adjustment design make the scale visually integrated with the image content, enhancing the overall aesthetics; the scale design is closely combined with the application scenarios of laser tomography, reflecting professionalism and practicality. Through the above design, the scale is not only a functional tool, but also an indispensable visual aid element in image analysis.
[0165] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of equivalents of this invention, this invention is also intended to include these modifications and variations.
Claims
1. A method for stitching depth scan information based on OCT, characterized in that, Includes the following steps: Receive the raw data from laser tomography and input a floating-point data matrix; divide each row of data into a group, extract the maximum value in each group, and form a compressed data matrix; Use the ProcessedResults class to manage the processed data; Normalize the values of the compressed data matrix to the range of 0-255; create an 8-bit grayscale image that supports both grayscale and pseudo-color display modes; rotate the grayscale image; add a depth scale bar to the right of the grayscale image and draw scale lines and unit labels on the scale bar. Save grayscale images with added scale bars, selecting the save path and filename; it also supports capturing and handling abnormal situations during the file saving process, providing clear error messages; The process of managing processed data using the ProcessedResults class includes the following steps: The raw data of each frame of laser tomography scan is a 1024×1024 floating-point matrix, representing 1024 rows of data, each row containing 1024 pixels. The 1024 rows of data are divided into 16 groups, each group containing 64 rows. For each group of 64 rows of data, process column by column. For each column, extract the maximum value from the 64 rows. Store the 1024 maximum values extracted from each group as a 1×1024 row vector. Stack the 16 extracted row vectors in order to form a 16×1024 compressed data matrix. In the ProcessGroup method of the DataProcessor class, a two-dimensional array result is defined to store the final compressed data matrix. The size of result is RESULT_ROWS rows and ROW_LENGTH columns. The processing tasks of 16 sets of data are assigned to multiple threads or computing units. Each thread independently processes a set of 64 rows of data, extracts the maximum value and fills it into the corresponding row of result.
2. The OCT-based depth scan information stitching method as described in claim 1, characterized in that, The process of forming a 16×1024 compressed data matrix includes the following steps: The 1024 rows of data were divided into 16 groups, with 64 rows in each group, using a dynamic grouping strategy. The group size was dynamically adjusted based on the local characteristics of the laser tomography data. A clustering strategy was used to pre-analyze the laser tomography data and automatically determine the grouping strategy. Multiple feature values are extracted from each column, including the maximum, minimum, and average laser reflection intensity and the variance of the scattering coefficient; a multidimensional feature vector is generated by calculating the laser reflection intensity and scattering coefficient. Based on the local characteristics of laser tomography data, the compression weights are dynamically adjusted by calculating the laser reflection intensity and scattering coefficient.
3. The OCT-based depth scan information stitching method as described in claim 1, characterized in that, The process of assigning the processing tasks of 16 sets of data to multiple threads or computing units includes the following steps: Each thread independently processes a set of 64 rows of data, calculates the gradient of the laser reflection intensity and the gradient of the scattering coefficient, and multiplies the two gradients to calculate the gradient product of each set of data. The gradient products of each set of data need to be summed. The gradient products of all sets of data are summed, and the sum of the gradient products of each set of data is divided by the total sum of the gradient products. Storage parameters are introduced to adjust the range of storage levels. Based on the calculated storage levels, each group of data is assigned to a different storage level.
4. The OCT-based depth scan information stitching method as described in claim 1, characterized in that, The process of drawing scale lines and unit markings on a scale includes the following steps: Normalize each data point in the compressed data matrix to scale all data points to the range of 0-1. The normalized gray values of the data points are converted into a gray level, the processed data is assigned to the corresponding position in the grayscale image, and the grayscale image is converted into a grayscale image used by the pseudo-color image; after setting the rotation angle using the RotateTransform method of the Graphics object, the original image is drawn to the new position using the DrawImage method of the Graphics object, and the rotation transformation is applied at the same time. Determine the scale range of the scale based on the minimum and maximum gray values of the data, and draw the scale on the image using the Graphics object.
5. The OCT-based depth scan information stitching method as described in claim 4, characterized in that, The process of scaling all data points to the range of 0-1 includes the following steps: Extract the numerical characteristics of each data point from the compressed data matrix, including its original grayscale value and the overall distribution characteristics of the dataset; The value range of the data is determined by analyzing the minimum and maximum gray values of the data points; The original grayscale value of each data point is offset and adjusted by subtracting the minimum grayscale value of the dataset, aligning the starting point of the data to zero. Scale the offset-adjusted data points using the value range; By dividing the offset data points by the value range, the numerical range of the data points is compressed to between 0 and 1, thus achieving data normalization. The normalized data points were verified, and the values were found to be within the range of 0 to 1.
6. The OCT-based depth scan information stitching method as described in claim 4, characterized in that, The process of setting the rotation angle using the RotateTransform method of the Graphics object includes the following steps: The normalized value is then converted to a gray level, which is an integer between 0 and 255; the processed data is assigned to the corresponding position in the image by multiplying the normalized value by 255 and ensuring that the result is between 0 and 255. For each pixel in the grayscale image, a corresponding pseudocolor is selected based on its grayscale value. The selection of the pseudocolor is achieved through a color mapping function, which sets the selected pseudocolor to the corresponding position in the new color image. After setting the rotation angle using the RotateTransform method of the Graphics object, use the DrawImage method of the Graphics object to draw the original image to the new position, while applying the rotation transformation.
7. The OCT-based depth scan information stitching method as described in claim 4, characterized in that, The process of drawing a scale bar on an image using a Graphics object includes the following steps: Input the minimum grayscale value, maximum grayscale value, scale width, scale height, and scale interval; determine the scale range based on the minimum and maximum grayscale values; calculate the scale interval based on the scale height and scale range; calculate the total number of scales based on the scale range and scale interval; generate scale label values based on the scale interval and scale range. Use a Graphics object to create a new image or canvas for drawing the scale; draw vertical lines to represent the scale lines according to the height and scale intervals of the scale; draw the scale lines using the DrawLine method of the Graphics object; draw scale labels next to each scale line using the DrawString method of the Graphics object, with the label content being the scale label value; draw unit labels at the top or bottom of the scale. Use the DrawString method of the Graphics object to draw the unit identifier; Use the RotateTransform method of the Graphics object to set the rotation angle to 90 degrees; use the DrawImage method of the Graphics object to draw the rotated scale to the target position; save the drawn scale image as a file or display it on the interface.
8. The OCT-based depth scan information stitching method as described in claim 7, characterized in that, The process of drawing scale lines, scale labels, and unit identifiers includes the following steps: Calculate the vertical position of each scale line based on the height and scale intervals of the scale; draw the vertical line using the Graphics.DrawLine method, with the color of the scale line contrasting with the main color tone of the tomographic scan image; the thickness of the scale line is dynamically adjusted according to the width of the scale. The scale labels are used to indicate the grayscale or depth value corresponding to each scale line. Spacing is left to the right or left of each scale line for label drawing. The vertical position of the label is aligned with the scale line, and the horizontal position is dynamically adjusted according to the scale width. The scale label value is generated based on the scale range and interval. The labelValue is formatted as a string, retaining the decimal places. The label is drawn using the Graphics.DrawString method, with a sans-serif font selected, and the label color matching the scale line color. The unit identifier is used to indicate the unit of the scale and is placed at the top or bottom of the scale, depending on the image layout. If the scale is long, the unit identifier is placed in the middle. Depending on the specific application of laser tomography, the unit identifier is either a grayscale value or a depth value.
9. The OCT-based depth scan information stitching method as described in claim 8, characterized in that, Use the Graphics.DrawString method to draw unit labels, with the font larger than the scale labels and the color matching the scale labels; use a grayscale gradient in the background of the scale bar, from the minimum grayscale value to the maximum grayscale value, consistent with the grayscale distribution of the tomographic scan image.
Citation Information
Patent Citations
Independent sequential multi-feature fusion-based scanning laser welding penetration prediction method
CN118587205A
Cover plate assembly and battery
CN118763366A
Lithium battery production process and system without helium detection process
CN118888939A
A method for quickly and automatically extracting a rectangular scanning part from a digital photograph
CN109359652A
Medical image adjusting method and digital pathological section browsing system
CN110163820A