A rock polarized light microscopic image position offset correction method based on improved SIFT

By combining the improved SIFT algorithm with FLANN and RANSAC algorithms, the problem of positional offset in rock thin section images acquired by polarizing microscope was solved, achieving precise image alignment and high-quality stitching, thus ensuring the accuracy and consistency of subsequent analysis.

CN122199896APending Publication Date: 2026-06-12NORTHWEST INST OF NUCLEAR TECH +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NORTHWEST INST OF NUCLEAR TECH
Filing Date
2024-12-12
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

The positional shift of rock thin section images acquired by polarizing microscopes due to factors such as mechanical vibration and polarization rotation affects the accuracy of image stitching and analysis.

Method used

An improved SIFT algorithm is used for feature detection and description, combined with an optimized FLANN algorithm for feature matching, and the RANSAC algorithm is used to remove outlier matching points. The affine transformation matrix is ​​solved by the least squares method for image registration, and the image is cropped based on edge information to correct positional offset.

🎯Benefits of technology

Precise alignment of polarized light microscopic images of rock thin sections was achieved, improving the accuracy and consistency of the stitched images and providing high-quality basic data for subsequent analysis.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199896A_ABST
    Figure CN122199896A_ABST
Patent Text Reader

Abstract

The application provides a rock polarized light microscopic image position offset correction method based on improved SIFT, and relates to the technical field of image processing. The method comprises the following steps: acquiring a plurality of original images, performing feature detection and description on each original image by using an improved SIFT algorithm to generate feature points and feature descriptors; according to the feature descriptors, performing matching on the feature points of adjacent original images by using an optimized FLANN algorithm to obtain matched feature point pairs; removing abnormal matching points in the feature point pairs by using a RANSAC algorithm, and solving an affine transformation matrix between the adjacent original images by using a least square method according to the removed feature point pairs to register the adjacent original images; calculating a unified clipping region according to edge information of the plurality of registered images and clipping to obtain a plurality of clipping images; and calculating the similarity of each clipping image and a corresponding original image, and determining that the clipping image is corrected in the case that the similarity is higher than a set similarity threshold.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a method for correcting positional offset in rock polarized micrographs based on an improved SIFT. Background Technology

[0002] Rock polarized light microscopy has wide applications in petroleum exploration and geological research, playing an irreplaceable role, especially in the exploration and development of oil and gas. For example, thin-section rock microscopy analysis helps geologists analyze the lithology, porosity characteristics, and hydrocarbon reservoir capacity of strata. Observing the microstructure of rocks through a polarized light microscope can reveal the sedimentary environment and diagenesis, which is of great guiding significance for oil and gas exploration. In the field of geology, rock image analysis under a microscope is also widely used to identify mineral composition and study the genesis and metamorphic processes of rocks. These techniques are of great importance for understanding geological structures, the distribution of oil and gas reservoirs, and assessing resource development potential.

[0003] Polarized light microscopic images of rock thin sections are obtained by scanning rock thin sections with a polarizing microscope. It is an important tool for studying the internal structure and mineral composition of rocks. Since a polarizing microscope can only acquire a portion of the rock thin section at magnification, multiple consecutive acquisitions are usually required to obtain a complete image of the entire section. Each acquisition yields only a single-view sequence image, and adjacent sequences have a quarter-overlapping portion to facilitate stitching together a complete, high-resolution image of the rock thin section in subsequent image processing. Polarizing microscopes offer acquisition modes including single-polarization and crossed-polarization modes. In engineering, crossed-polarization modes at 0°, 15°, 30°, 45°, 60°, and 75° are commonly used, resulting in seven acquisition methods. Each acquisition method requires acquiring a complete image of the rock thin section, therefore the number of sequential images is the same for each method. These image sets, acquired in different modes but from the same location on the rock thin section, theoretically only differ in brightness and color due to polarization rotation. However, due to factors such as mechanical vibration and changes in light, these images inevitably experience positional shifts during acquisition. Because the rock thin section images acquired by polarized light are of uniform size, this positional offset not only manifests as shifts in the positions of corresponding grains and textures between images, but also causes differences in image edges. This hinders subsequent stitching of rock thin section image sequences and consequently affects the overall analysis of the rock thin section images, such as mineral composition identification and grain segmentation. Therefore, when performing image stitching and subsequent image analysis and processing, it is necessary to first correct the positional offset of these image sequences. Summary of the Invention

[0004] In view of this, the present invention provides a method for correcting the positional shift of rock polarized light microscopic images based on an improved SIFT, which can solve the problem of image positional shift caused by mechanical vibration of the acquisition equipment and polarization rotation in rock thin section images acquired by polarizing microscope.

[0005] This invention provides a method for correcting positional shifts in rock polarized light microscopic images based on an improved SIFT algorithm, comprising: Step S1, acquiring multiple original images, performing feature detection and description on each original image using an improved SIFT algorithm to generate feature points and feature descriptors, wherein the multiple original images are a sequence of rock thin section images acquired by a polarizing microscope; Step S2, matching feature points of adjacent original images using an optimized FLANN algorithm based on the feature descriptors to obtain matched feature point pairs; Step S3, removing outlier matching points from the feature point pairs using the RANSAC algorithm, and solving the affine transformation matrix between adjacent original images using the least squares method based on the removed feature point pairs to register the adjacent original images; Step S4, calculating a uniform cropping region based on the edge information of the multiple registered images and cropping to obtain multiple cropped images; Step S5, calculating the similarity between each cropped image and the corresponding original image, and determining that the cropped image has been corrected if the similarity is higher than a set similarity threshold.

[0006] Compared with existing technologies, the rock polarized light microscopy image position shift correction method based on improved SIFT provided by this invention has at least the following beneficial effects:

[0007] (1) It can achieve precise alignment of rock thin section polarized light microscopic sequence images acquired under different modes, ensuring the accuracy and consistency of the stitching, and providing high-quality basic data for subsequent image analysis;

[0008] (2) The present invention can effectively correct the positional offset problem of rock polarized light microscopic images, improve the accuracy of stitched images, and facilitate the processing and analysis of rock image particle segmentation, etc.

[0009] (3) The method provided by the present invention can not only improve the accuracy of the stitched images, but also provide a reliable image basis for subsequent rock microscopic analysis, mineral component extraction and quantitative analysis. Attached Figure Description

[0010] The above and other objects, features and advantages of the present invention will become more apparent from the following description of embodiments of the invention with reference to the accompanying drawings, in which:

[0011] Figure 1 A flowchart illustrating a method for correcting positional offset of rock polarized light micrographs based on an improved SIFT according to an embodiment of the present invention is shown.

[0012] Figure 2 The schematic diagram illustrates the principle of a method for correcting positional offset of rock polarized light micrographs based on an improved SIFT according to an embodiment of the present invention;

[0013] Figure 3 A flowchart illustrating the generation of feature points and feature descriptors according to an embodiment of the present invention is shown schematically;

[0014] Figure 4 This schematically illustrates a flowchart of feature point matching according to an embodiment of the present invention;

[0015] Figure 5 A flowchart illustrating the solution of the affine transformation matrix according to an embodiment of the present invention is shown schematically.

[0016] Figure 6 This schematically illustrates a flowchart of cropping a registered image according to an embodiment of the present invention;

[0017] Figure 7 A flowchart illustrating the correction of a cropped image according to an embodiment of the present invention is shown. Detailed Implementation

[0018] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to specific embodiments and accompanying drawings.

[0019] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the invention. The terms “comprising,” “including,” etc., as used herein indicate the presence of the stated features, steps, operations, and / or components, but do not exclude the presence or addition of one or more other features, steps, operations, or components.

[0020] All terms used herein, including technical and scientific terms, have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein are to be interpreted in a manner consistent with the context of this specification, and not in an idealized or overly rigid way.

[0021] This invention provides a method for correcting the positional shift of rock polarized light microscopy images based on an improved SIFT, aiming to solve the problem of image positional shift in rock thin section images acquired by polarizing microscopes due to factors such as mechanical vibration of the acquisition equipment and polarization rotation. This method enables precise alignment of sequence images of rock thin section polarized light microscopy acquired in different modes, ensuring the accuracy and consistency of stitching and providing high-quality basic data for subsequent image analysis.

[0022] Before describing specific embodiments of the present invention in detail, technical terms will first be explained to facilitate a better understanding of the present invention.

[0023] SIFT, or Scale-invariant feature transform, is a descriptor used in image processing. This descriptor is scale-invariant and can detect key points in an image; it is a type of local feature descriptor.

[0024] FLANN, or Fast Library for Approximate Nearest Neighbors, is a collection of algorithms for performing nearest neighbor searches on large datasets and high-dimensional features.

[0025] RANSAC, or Random Sample Consensus, is an algorithm that calculates mathematical model parameters of a dataset containing outliers to obtain valid sample data.

[0026] Figure 1 A flowchart illustrating a method for correcting positional offset in rock polarized micrographs based on an improved SIFT according to an embodiment of the present invention is shown. Figure 2 The schematic diagram illustrates the principle of a method for correcting positional offset of rock polarized light micrographs based on an improved SIFT according to an embodiment of the present invention.

[0027] like Figure 1 and Figure 2 As shown, the method for correcting the positional offset of rock polarized micrographs based on improved SIFT according to this embodiment may include steps S1 to S5.

[0028] Step S1: Acquire multiple original images, and use the improved SIFT algorithm to perform feature detection and description on each original image to generate feature points and feature descriptors. The multiple original images are rock thin section sequence images acquired by polarizing microscope.

[0029] Understandably, the sequence of rock thin section images acquired by a polarizing microscope is a set of images, i.e., it consists of multiple original images. After obtaining multiple original images, an improved SIFT algorithm is used to perform feature detection and description on each original image, generating at least one feature point for each original image and a feature descriptor corresponding to each feature point.

[0030] Figure 3 The flowchart illustrating the generation of feature points and feature descriptors according to an embodiment of the present invention is shown schematically.

[0031] like Figure 3As shown, in this embodiment, in step S1, the improved SIFT algorithm is used to perform feature detection and description on each original image to generate feature points and feature descriptors, including steps S11 to S16.

[0032] Step S11: Perform Gaussian blur processing on each original image at different scales to obtain the Gaussian blur result of the original image.

[0033] This step represents the original image in scale space by constructing a Gaussian pyramid. For example, for each original image I(x,y) among multiple original images, Gaussian blurring is applied at different scales, as shown in the formula:

[0034]

[0035] Where (x,y) represents pixels. Represents a two-dimensional Gaussian kernel function. This is a parameter representing the scale, and * indicates the convolution operation. It is the result of Gaussian blurring, and can also be called a Gaussian blurred image.

[0036] By changing The value of can generate multiple smoothed images at different scales. These Gaussian blurred images at different scales constitute the scale-space representation of the original image.

[0037] Step S12: Based on the Gaussian blur result, calculate the Gaussian difference image of the original image at each scale.

[0038] The Difference of Gaussian (DOG) image of the original image is calculated at each scale. The formula for calculating the DOG image is as follows:

[0039]

[0040] Where k is a constant proportionality coefficient. and These represent the Gaussian blur results at two adjacent scales.

[0041] This differential calculation can detect feature points with different scales in the original image.

[0042] Step S13: In the Gaussian difference image, feature points are detected by searching for local extrema of each pixel at adjacent scale locations and adjacent spatial locations.

[0043] Specifically, for each pixel (x, y) in the DOG image, it is checked whether it is a local extremum among the 26 pixels at adjacent scale locations and the current scale's adjacent spatial locations. If a pixel yields a maximum or minimum value after comparison with its 26 neighboring pixels, then that pixel is considered a feature point.

[0044] It is understandable that the 26 neighboring pixels include 8 adjacent pixels of the same scale and 18 adjacent pixels of 9×2 of the adjacent scales above and below.

[0045] To reduce computational load and improve the accuracy of subsequent feature matching, after detecting feature points, the SIFT algorithm is improved according to steps S14 to S16 by introducing neighborhood constraints, orientation and scale filtering mechanisms to further improve the stability of feature point matching.

[0046] Step S14: For the multiple detected feature points, calculate the Euclidean distance between each feature point and other feature points in its neighborhood; compare the Euclidean distance with a set threshold, and perform preliminary screening of the multiple detected feature points based on the comparison results.

[0047] The Euclidean distance between a feature point and other feature points in its neighborhood is calculated using the following formula:

[0048]

[0049] in, and These are the coordinates of two feature points.

[0050] For multiple detected feature points, the Euclidean distance is compared with a set threshold. If the Euclidean distance is greater than the threshold, the feature point is retained; otherwise, it is deleted. For example, if the threshold is set to 50 pixels, the feature point is retained only if the Euclidean distance is greater than the threshold. If the pixel size is less than 50 pixels, the feature point is retained; otherwise, the feature point is deleted.

[0051] In this way, the multiple feature points detected in step S13 above are initially screened.

[0052] Step S15: For the multiple feature points initially selected, calculate the orientation difference and scale ratio between each feature point and other feature points in its neighborhood; compare the orientation difference and scale ratio with the corresponding set thresholds respectively, and further select the multiple feature points initially selected based on the comparison results.

[0053] Calculate the orientation difference Δθ and scale ratio r between each feature point and other feature points in its neighborhood using the following formulas. s :

[0054]

[0055]

[0056] Where θ1 and θ2 are the orientation angles of the two feature points, Δθ ≤ 20°, and s1 and s2 are the scales of the feature points, with a scale ratio of 0.8 ≤ r. s ≤1.2.

[0057] In this way, the multiple feature points initially selected in step S14 are further filtered. After this second filtering, the remaining feature points have higher similarity in both space and scale, thereby improving the accuracy of subsequent matching.

[0058] Step S16: Select the multiple feature points that have been filtered again as feature points of the original image, and construct a feature descriptor for each feature point of the original image.

[0059] At this point, this step generates at least one feature point for each original image, and then constructs a feature descriptor corresponding to each feature point.

[0060] In this embodiment, step S16, which constructs a feature descriptor for each feature point in the original image, includes: calculating the gradient magnitude and direction of the neighboring pixels of the feature point; dividing the neighboring pixels of the feature point into multiple sub-regions, and calculating the gradient direction histogram of each pixel in each sub-region according to the gradient magnitude and direction; and performing multi-dimensional vector representation of the feature point based on the multiple gradient direction histograms to obtain the feature descriptor of the feature point.

[0061] Specifically, for each feature point in the original image, its orientation is assigned using the gradient information of that point. First, the gradient magnitude m(x,y) and orientation of the neighboring pixels of the feature point are calculated. The calculation formulas are as follows:

[0062]

[0063]

[0064] Here, I(x,y) represents the gray value of the image at point (x,y). By calculating the gradient direction of each feature point, the feature descriptor of the feature point is ensured to have rotation invariance.

[0065] Then, the neighborhood pixels of the feature point are divided into multiple sub-regions, and a gradient direction histogram is calculated for each pixel within each sub-region based on the gradient magnitude and direction. To maintain the scale invariance and rotation invariance of the feature descriptor, gradient information relative to the feature point's direction is used to construct the feature descriptor. Finally, each feature point is represented as a 128-dimensional vector, i.e., a multi-dimensional vector, which serves as the feature descriptor for subsequent feature matching.

[0066] Step S2: Based on the feature descriptors, the optimized FLANN algorithm is used to match the feature points of adjacent original images to obtain matched feature point pairs.

[0067] Figure 4 The flowchart illustrating feature point matching according to an embodiment of the present invention is shown schematically.

[0068] like Figure 4 As shown, in this embodiment, step S2 includes steps S21 to S23.

[0069] Step S21: Sort the multiple original images according to polarization mode and polarization angle.

[0070] In this embodiment, the polarization mode includes single polarization mode and cross polarization mode, and the polarization angle includes 0 degrees, 15 degrees, 30 degrees, 45 degrees, 60 degrees and 75 degrees in the cross polarization mode.

[0071] Considering that the conversion from single-polarization mode to cross-polarization mode in rock thin section image sequences acquired by polarizing microscope results in the most significant mechanical jitter and light changes caused by polarization rotation, leading to the largest image shift; images acquired at different angles under cross-polarization also show smaller shifts. To improve the matching success rate, feature matching is performed between two adjacent original images.

[0072] By sorting multiple original images according to their polarization mode and polarization angle, adjacent original images can be obtained. For example, first sort the original images by polarization mode (single polarization mode and orthogonal polarization mode), and then sort them by polarization angle from smallest to largest.

[0073] Step S22: Using any of the first-ranked original images as the reference image and the next image immediately following any original image as the target image, calculate the Euclidean distance between the feature descriptors of the reference image and the target image.

[0074] For example, for a single-polarized image and a cross-polarized 0-degree image, the single-polarized image is used as the reference image, and the cross-polarized 0-degree image is used as the target image. For a cross-polarized 0-degree image and a cross-polarized 15-degree image, the cross-polarized 0-degree image is used as the reference image, and the cross-polarized 15-degree image is used as the target image. And so on, any two adjacent original images can be determined from multiple original images.

[0075] Calculate the Euclidean distance for the feature descriptors of each feature point. Given two feature descriptors d1 and d2, calculate their Euclidean distance. The calculation formula is:

[0076]

[0077] in, and These are the i-th components in the feature descriptor.

[0078] Step S23: Based on the Euclidean distance, use the optimized FLANN algorithm to match feature points between the reference image and the target image.

[0079] This step uses an optimized FLANN algorithm to perform nearest neighbor matching on all feature points. The FLANN algorithm accelerates the nearest neighbor search in high-dimensional space by constructing an approximate tree structure, thereby finding the pair of feature points that are closest to the current feature point, and then filtering them based on the matching distance value.

[0080] To ensure matching accuracy, the improved FLANN algorithm employs a ratio-based filtering strategy and spatial consistency constraints.

[0081] In this embodiment, step S23 above, which uses an optimized FLANN algorithm to match feature points between the reference image and the target image, includes:

[0082] For any reference feature point in the reference image, search for the two feature points in the target image that are closest to the reference feature point in terms of Euclidean distance, and denot them as the nearest neighbor and the second nearest neighbor.

[0083] Calculate the distance ratios between the nearest neighbor and the second nearest neighbor and the reference feature point, respectively. If the distance ratio is less than a set threshold, retain the nearest neighbor and the second nearest neighbor.

[0084] Calculate the Euclidean distance between the nearest neighbor and the second nearest neighbor in the image space. If the Euclidean distance is less than a set threshold, retain the nearest neighbor and the second nearest neighbor.

[0085] Calculate the orientation difference and scale ratio between the nearest neighbor and the second nearest neighbor. When the orientation difference and scale ratio meet the corresponding set thresholds, retain the nearest neighbor and the second nearest neighbor.

[0086] For any nearest neighbor of the nearest and second nearest neighbors, calculate the distance between the nearest neighbor and the reference feature point. When the distance is less than a set threshold, retain the nearest neighbor and use it and the reference feature point as a matching feature point pair.

[0087] For example, firstly, for any reference feature point d1 in the reference image, calculate the distance ratio R between its nearest neighbor d2 and second nearest neighbor d3 and feature point d1, respectively, using the following formula:

[0088]

[0089] Where D(d1,d2) and D(d1,d3) are the Euclidean distances between feature point d1 and its nearest neighbor d2 and second nearest neighbor d3, respectively.

[0090] For example, a threshold of 0.7 can be set. A matching point pair (i.e., the nearest neighbor and the second nearest neighbor) is retained only if the distance ratio R is less than the set threshold. This ratio-based filtering strategy ensures that only the optimal matching point pair is retained.

[0091] Next, spatial consistency constraints are introduced. For matching point pairs p1(x1,y1) and p2(x2,y2), their Euclidean distance in the image space is calculated. If the Euclidean distance is less than a set threshold (e.g., 50 pixels), the matching point pair is retained. Then, the orientation difference Δθ and scale ratio r of the matching point pairs are further filtered. s , and scale ratio r s Controlled within 0.8 ≤ r s Within the range of ≤1.2, to ensure that the scale variation of the matching point pairs is within a reasonable range.

[0092] Finally, set the distance threshold D. threshold When the distance between feature point pairs is less than a threshold, the matching point pair is retained, and a matching point set M is generated. In this way, it is ensured that only matching point pairs with small distances and high similarity are retained, providing reliable feature points for subsequent image registration and affine transformation.

[0093] Step S3: Use the RANSAC algorithm to remove outlier matching points from feature point pairs. Based on the removed feature point pairs, use the least squares method to solve the affine transformation matrix between adjacent original images to register the adjacent original images.

[0094] This step uses the RANSAC algorithm to remove outlier matching points and solves the affine transformation matrix between images using the least squares method to achieve image registration and alignment.

[0095] Figure 5 A flowchart illustrating the solution of the affine transformation matrix according to an embodiment of the present invention is shown.

[0096] like Figure 5 As shown, in this embodiment, in step S3, the least squares method is used to solve the affine transformation matrix between adjacent original images based on the removed feature point pairs, including steps S31 to S33.

[0097] Step S31: Establish an affine transformation matrix with the scaling parameter removed, wherein the affine transformation matrix contains multiple parameters to be solved.

[0098] First, assume an initial transformation matrix H, which has the following form:

[0099]

[0100] Where a and d represent the scaling factors in the x and y directions of the image, respectively, b and c control the rotation and cropping of the image, and t x and t y These are the translation parameters.

[0101] Since the polarized light microscopic images of different modes of rock thin sections were acquired at the same magnification using a polarizing microscope, their sizes are identical. Therefore, the initial transformation matrix H can be improved by using only rotation and translation parameters, ignoring scaling parameters. This reduces the degrees of freedom, improving registration accuracy and stability, and also reduces computational load to some extent. (Affine transformation matrix with scaling parameters removed) as follows:

[0102]

[0103] Step S32: For any pair of feature points after removal, calculate the reprojection error between the feature point pairs, and use the least squares method to establish an objective function associated with the reprojection error and the affine transformation matrix.

[0104] Step S33: Solve for multiple parameters in the affine transformation matrix by minimizing the objective function.

[0105] For example, the rotation angle θ is calculated using matrix elements a and b, as shown in the following formula:

[0106]

[0107] The affine transformation matrix is ​​solved by minimizing the reprojection error of the feature points in the point set M. This objective function... for:

[0108]

[0109] Where, k i and k j These are two matched feature points.

[0110] To ensure the robustness of the solution process, the RANSAC algorithm is used to remove outlier matching points. RANSAC estimates the affine transformation matrix by randomly selecting a subset of matching points in multiple iterations and evaluating the model quality based on the number of interior points calculated each time. Through continuous iteration, the model with the most interior points is finally selected as the optimal affine transformation matrix, ensuring that the transformation matrix maintains high accuracy and stability even in the presence of mismatches.

[0111] To avoid excessive rotation or excessively large or small rotation of the image after affine transformation, the rotation angle is limited to ±45°, enhancing the robustness of the algorithm. This optimization process effectively improves the accuracy of matching points and the registration effect of the image.

[0112] Step S4: Calculate a uniform cropping region based on the edge information of multiple registered images and crop it to obtain multiple cropped images.

[0113] This step calculates the uniform cropping region of the image based on the registration results and crops out images of consistent size.

[0114] Figure 6 The flowchart illustrating cropping of a registered image according to an embodiment of the present invention is shown schematically.

[0115] like Figure 6 As shown, in this embodiment, step S4 includes steps S41 to S43.

[0116] Step S41: Calculate the effective region of each registered image.

[0117] Step S42: Determine a unified cropping region based on multiple valid regions of multiple registered images.

[0118] Step S43: Crop multiple registered images according to a unified cropping area to obtain multiple cropped images.

[0119] First, the registered images are processed to calculate the effective region of each image, i.e., the part of the image containing important information. To ensure consistency between the registered images, a unified cropping region needs to be determined. This cropping region is determined by the minimum bounding rectangle, and the calculation formula is as follows:

[0120]

[0121] Where, x min and y min Indicates the cropping area The coordinates of the top left corner are given, where ω and h are the width and height of the cropping area, respectively.

[0122] The size of the cropping region is determined based on the effective area of ​​all registered images to ensure that important image information is not lost during the cropping process. Since the offset of the rock polarized light sequence images is very small, the cropping amount can be set to no more than 10% of the original image. This not only meets the image correction requirements but also avoids excessive image loss due to excessive cropping.

[0123] Step S5: Calculate the similarity between each cropped image and the corresponding original image. If the similarity is higher than the set similarity threshold, determine that the cropped image has been corrected.

[0124] For example, the similarity between the cropped image and the original image can be calculated using a color histogram. If the similarity meets a predetermined standard, the current cropping result is retained; otherwise, the area of ​​the previously successfully cropped image is used as a replacement cropping area.

[0125] Figure 7 A flowchart illustrating the correction of a cropped image according to an embodiment of the present invention is shown.

[0126] like Figure 7 As shown, in this embodiment, step S5 includes steps S51 to S53.

[0127] Step S51: Convert each cropped image and its corresponding original image to the HSV color space, and calculate the color histogram of each cropped image and its corresponding original image in the HSV color space.

[0128] The cropped image and the original image are converted to the HSV color space. The HSV color space better describes the hue, saturation, and brightness characteristics of an image, making the color comparison process more accurate. After conversion to the HSV color space, color histograms are calculated for both the cropped and original images. Color histograms effectively describe the color distribution in an image, and their similarity is measured by comparing the color histograms of the two images.

[0129] Step S52: Using the two color histograms, the similarity between each cropped image and the corresponding original image is calculated using the Bach distance.

[0130] To quantitatively compare the similarity between images, the Bach distance is used to calculate the difference between color histograms. This is a commonly used method for measuring the similarity between two probability distributions, and its calculation formula is:

[0131]

[0132] Here, H1 and H2 represent the color histograms of the cropped image and the original image, respectively. The smaller the Bach distance, the more similar the color distributions of the two images are.

[0133] Step S53: Determine whether the similarity is higher than the set similarity threshold. If so, retain the current cropped image; otherwise, crop the current cropped image according to the cropping region information of the previous successfully cropped image.

[0134] Based on a set similarity threshold, if the similarity is higher than the threshold, the cropped image is considered to have a high similarity to the original image, and the current cropped region is retained. If the similarity is lower than the threshold, the cropped region information from the previous successfully cropped image is used as a replacement crop. This ensures that the content of the cropped image remains consistent with the original image, ultimately resulting in an image set with consistent cropping size and eliminated positional offset.

[0135] In summary, the embodiments of this invention propose a method for correcting positional offsets in rock polarized light microscopy images based on an improved SIFT. This method effectively solves the offset problems caused by equipment errors, mechanical jitter, and polarization rotation between images, enabling precise stitching and processing of polarized light microscopy images. Through this method, precise alignment of sequence images of rock thin sections acquired under different modes can be achieved, ensuring the accuracy and consistency of the stitching and providing high-quality basic data for subsequent image analysis.

[0136] The method provided by this invention can not only improve the accuracy of stitched images, but also provide a reliable image basis for subsequent rock microscopic analysis, mineral component extraction and quantitative analysis.

[0137] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0138] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this invention, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements.

[0139] It should also be noted that the directional terms mentioned in the embodiments, such as "up," "down," "front," "back," "left," and "right," are only for reference to the directions in the accompanying drawings and are not intended to limit the scope of protection of the present invention. Throughout the accompanying drawings, the same elements are represented by the same or similar reference numerals. Conventional structures or constructions will be omitted where they may cause confusion in understanding the present invention.

[0140] The embodiments of the present invention have been described above. However, these embodiments are merely illustrative and not intended to limit the scope of the invention. Although various embodiments have been described above, this does not mean that the measures in the various embodiments cannot be used advantageously in combination. Various substitutions and modifications can be made by those skilled in the art without departing from the scope of the invention, and all such substitutions and modifications should fall within the scope of the invention.

Claims

1. A method for correcting positional shift in rock polarized light micrographs based on improved SIFT, characterized in that, include: Step S1: Acquire multiple original images, and use the improved SIFT algorithm to perform feature detection and description on each original image to generate feature points and feature descriptors. The multiple original images are a sequence of rock thin section images acquired by a polarizing microscope. Step S2: Based on the feature descriptor, the optimized FLANN algorithm is used to match the feature points of adjacent original images to obtain matched feature point pairs; Step S3: Use the RANSAC algorithm to remove abnormal matching points in the feature point pairs. Based on the removed feature point pairs, use the least squares method to solve the affine transformation matrix between the adjacent original images in order to register the adjacent original images. Step S4: Calculate and crop a uniform cropping region based on the edge information of multiple registered images to obtain multiple cropped images; Step S5: Calculate the similarity between each cropped image and the corresponding original image. If the similarity is higher than a set similarity threshold, determine that the cropped image has been corrected.

2. The method according to claim 1, characterized in that, In step S1, the step of using the improved SIFT algorithm to perform feature detection and description on each of the original images, generating feature points and feature descriptors, includes: Gaussian blurring is performed on each of the original images at different scales to obtain the Gaussian blurred results of the original images; Based on the Gaussian blur result, calculate the Gaussian difference image of the original image at each scale; In the difference-of-Gaussian image, feature points are detected by searching for local extrema of each pixel at adjacent scale locations and adjacent spatial locations; For multiple detected feature points, calculate the Euclidean distance between each feature point and other feature points in its neighborhood; compare the Euclidean distance with a set threshold, and perform preliminary screening of the multiple detected feature points based on the comparison results; For the multiple feature points initially selected, calculate the orientation difference and scale ratio between each feature point and other feature points in its neighborhood; compare the orientation difference and scale ratio with the corresponding set thresholds, and further select the multiple feature points initially selected based on the comparison results; The multiple feature points selected again are used as feature points of the original image, and a feature descriptor is constructed for each feature point of the original image.

3. The method according to claim 2, characterized in that, Constructing a feature descriptor for each feature point of the original image includes: Calculate the gradient magnitude and direction of the neighboring pixels of the feature point; The neighboring pixels of the feature point are divided into multiple sub-regions, and a gradient direction histogram of each pixel is calculated in each sub-region according to the gradient magnitude and direction. The feature points are represented by multidimensional vectors based on multiple gradient direction histograms to obtain feature descriptors for the feature points.

4. The method according to claim 1, characterized in that, Step S2 includes: The multiple original images are sorted according to polarization mode and polarization angle; Using any of the first-ranked original images as a reference image and the next image immediately following that original image as a target image, calculate the Euclidean distance between the feature descriptors of the reference image and the target image. Based on the Euclidean distance, the optimized FLANN algorithm is used to match feature points of the reference image and the target image.

5. The method according to claim 4, characterized in that, The step of matching feature points of the reference image and the target image using the optimized FLANN algorithm includes: For any reference feature point in the reference image, based on the Euclidean distance, search in the target image for the two feature points in the target image that are closest to the reference feature point in terms of the Euclidean distance, and denot them as the nearest neighbor and the second nearest neighbor. Calculate the distance ratios between the nearest neighbor and the second nearest neighbor and the reference feature point, respectively. When the distance ratio is less than a set threshold, retain the nearest neighbor and the second nearest neighbor. Calculate the Euclidean distance between the nearest neighbor and the second nearest neighbor in the image space. When the Euclidean distance is less than a set threshold, retain the nearest neighbor and the second nearest neighbor. Calculate the orientation difference and scale ratio between the nearest neighbor and the second nearest neighbor. When the orientation difference and scale ratio respectively meet the corresponding set thresholds, retain the nearest neighbor and the second nearest neighbor. For any nearest neighbor of the nearest neighbor and the second nearest neighbor, calculate the distance between the nearest neighbor and the reference feature point. When the distance is less than a set threshold, retain the nearest neighbor and use it and the reference feature point as a matching feature point pair.

6. The method according to claim 4, characterized in that, In step S3, based on the removed feature point pairs, the affine transformation matrix between the adjacent original images is solved using the least squares method, including: Establish an affine transformation matrix with scaling parameters removed, wherein the affine transformation matrix contains multiple parameters to be solved; For any pair of feature points after removal, calculate the reprojection error between the feature point pairs, and use the least squares method to establish an objective function associated with the reprojection error and the affine transformation matrix; The multiple parameters in the affine transformation matrix are solved by minimizing the objective function.

7. The method according to claim 1, characterized in that, Step S4 includes: Calculate the effective region of each registered image; A unified cropping region is determined based on the multiple effective regions of the multiple registered images; The registered images are cropped according to the unified cropping area to obtain multiple cropped images.

8. The method according to claim 1, characterized in that, Step S5 includes: Each cropped image and its corresponding original image are converted to the HSV color space, and a color histogram of each cropped image and its corresponding original image is calculated in the HSV color space. Using the two color histograms, the similarity between each cropped image and the corresponding original image is calculated using the Bach distance. Determine whether the similarity is higher than a set similarity threshold. If it is, retain the current cropped image; otherwise, crop the current cropped image according to the cropping region information of the previous successfully cropped image.