Direction-aware dual-path offset decision and continuity recovery method and applications thereof

By establishing a direction-aware dual-path offset decision under serpentine scanning conditions, dynamically constructing horizontal and vertical candidate paths and triggering adjacency inheritance, the problems of image patch splicing misalignment and state breakage are solved, and stable and continuous image patch recovery is achieved.

CN122199258APending Publication Date: 2026-06-12SHENZHEN SHENGQIANG TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHENZHEN SHENGQIANG TECH
Filing Date
2026-05-18
Publication Date
2026-06-12

AI Technical Summary

Technical Problem

Under serpentine scanning conditions, existing technologies are prone to causing misalignment of image blocks and breakage of the continuity of the entire image, lacking an effective local positioning replacement and restoration mechanism.

Method used

Establish predecessor relationships based on the actual scanning direction, dynamically construct horizontal and vertical candidate paths, select effective paths through matching calculation and deterministic rules, and trigger adjacency inheritance and successor backfilling mechanisms to maintain state continuity.

Benefits of technology

It eliminates reverse scanning misjudgments, avoids state gaps across the entire area, ensures stable system behavior, and is suitable for online continuous scanning scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122199258A_ABST
    Figure CN122199258A_ABST
Patent Text Reader

Abstract

The application provides a direction-aware double-path offset decision and continuity recovery method and application thereof, and aims at the problems of misalignment caused by scanning direction reversal and fault caused by single path failure, and establishes a predecessor relationship based on a real scanning direction, and dynamically constructs a transverse and longitudinal candidate path; through matching calculation, an effective path is selected according to a deterministic rule to determine the final cumulative offset state of the image block; when the double paths fail, adjacent inheritance is triggered to maintain state propagation, and when the successor succeeds, single-hop backfilling is used to repair the predecessor failure state. The application eliminates the misjudgment of reverse scanning and avoids the whole-state fault.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of digital slice image processing technology, and in particular to a direction-aware dual-path offset decision and continuity restoration method and its application. Background Technology

[0002] In digital slide and fluorescence digital slide equipment for pathology, scanning is typically performed by acquiring images in blocks according to the field of view and then stitching them together to form a complete image. To reduce mechanical return time and maintain continuous scanning throughput, the equipment often uses a serpentine scanning path, i.e., acquiring one row from left to right and the next row from right to left. While this acquisition method can improve continuous scanning efficiency, it also causes the preceding relationships between image blocks to no longer maintain a fixed linear structure.

[0003] For standard fixed-direction scanning, the current image block typically only needs to be processed for lateral stitching according to a fixed left or right adjacency relationship, and the interpretation of the displacement sign remains unchanged. However, in a serpentine scanning scenario, the scanning directions of adjacent rows are opposite, and the actual predecessor of the current image block in this row will switch with the row direction. During lateral matching, the order of the source image and the template image will also change, and the interpretation of the positive and negative directions of lateral displacement will change accordingly. If a fixed adjacency relationship and a fixed sign interpretation method are still used, it is easy to produce offset direction errors in the reverse scanning rows, which will then produce obvious stitching seams at the row boundaries and induce continuous drift of subsequent image blocks.

[0004] Existing splicing solutions typically have the following shortcomings:

[0005] (1) Many schemes rely on a single path for localization. When the single path fails due to insufficient local texture, local noise, local brightness changes or too few sample areas, the current image block lacks a stable alternative localization basis. (2) Although some schemes calculate the matching results in multiple directions at the same time, they do not establish clear path selection rules and failure continuation rules around the current image block. They often just make empirical choices on multiple results, which makes it difficult for the offset state to be continuously propagated after a local failure. (3) In an online serpentine scanning pipeline, the system usually cannot backtrack to the entire row or the entire area to perform global optimization because a local image block fails. Therefore, a local state decision-making mechanism that can instantly complete direction judgment, path selection, failure rollback and subsequent continuation at the current image block is needed.

[0006] Therefore, the real technical problem that needs to be solved is not simply expanding the image stitching capability, but rather: under serpentine scanning conditions, how to establish a dual-path offset decision mechanism for the current image block around the actual scanning direction, and maintain the continuous recovery capability of the entire image block when a local path fails. Summary of the Invention

[0007] This invention provides a direction-aware dual-path offset decision-making and continuity restoration method and its application. It addresses the problems of existing technologies that, when applying a fixed adjacency model in serpentine scanning scenarios, easily lead to misalignment of reverse scan rows, and lack of local positioning replacement and restoration mechanisms after a single matching path fails, which can easily cause the continuity of the entire row or entire area of ​​the splicing state to break.

[0008] The core technology of this invention is to establish predecessor relationships based on the actual scanning direction and dynamically construct horizontal and vertical candidate paths; through matching calculations, effective paths are selected according to deterministic rules to determine the final cumulative offset state of the image block; when both paths fail, adjacency inheritance is triggered to maintain state propagation, and single-hop backfilling is used to repair the failed predecessor state when the successor succeeds. This invention eliminates reverse scanning misjudgments and avoids state discontinuities across the entire area.

[0009] In a first aspect, the present invention provides a direction-aware dual-path offset decision-making and continuity recovery method, the method comprising the following steps: The scanning sequence predecessor relationship of the current image block is established based on the actual scanning direction of the current scan line, and the horizontal and vertical candidate paths of the current image block are constructed. The image source order and displacement symbol interpretation of the horizontal candidate paths are dynamically switched according to the actual scanning direction. The horizontal and vertical candidate paths are matched and calculated to obtain the path determination results. The effective positioning path is selected from the path determination results according to the preset deterministic optimization rules to determine the final cumulative offset state of the current image block. When both horizontal and vertical candidate paths fail, the adjacency inheritance mechanism is triggered to maintain the continuous propagation of the accumulated offset state. When a valid positioning path exists for the current image block and its predecessor image block fails, a subsequent backfilling mechanism is triggered to repair the state of the predecessor image block using the final cumulative offset state of the current image block.

[0010] Furthermore, the steps of establishing the scanning sequence predecessor relationship of the current image block based on the actual scanning direction of the current scan line, and constructing the lateral candidate path of the current image block, include: If the current image block is not the first image block of the row, determine the actual scanning direction of the current scan row; If it is a forward scan, the preceding image block is used as the source image and the current image block is used as the template image; If it is a reverse scan, the current image block is used as the source image, the previous image block is used as the template image, and the obtained local lateral displacement is interpreted with a sign reversal.

[0011] Furthermore, the step of constructing vertical candidate paths for the current image patch includes: Determine whether the current image patch is the top edge image patch and whether there is a valid reference cache in the same column of the previous row; If both are negative and a valid reference cache exists, then the cache reference region in the same column of the previous row, organized by column, is used as the source image, and the corresponding vertical matching region in the current image block is used as the template image to construct a vertical candidate path. If the image is a top edge patch or there is no valid reference cache, the vertical candidate path is marked as an invalid path.

[0012] Furthermore, the path determination result includes at least the global matching residual, the local worst residual, and the proportion of effective samples; the steps of performing matching calculations on the horizontal and vertical candidate paths to obtain the path determination result include: Divide the template region corresponding to the candidate path into multiple local segments along a preset direction; Traverse candidate displacements within a preset search window, align the template region with the source image region after displacement, and calculate residuals only for pixels within the effective overlapping region to obtain global matching residuals and local worst residuals that measure the degree of mismatch in the worst local segments. The effective sample ratio is obtained by counting the number of valid pixels within the template area that meet the preset grayscale background threshold and local gradient threshold, and calculating their proportion to the total number of pixels. If the global matching residual of a candidate path is less than or equal to the preset global residual threshold, the local worst residual is less than or equal to the preset local residual threshold, and the proportion of valid samples is greater than or equal to the preset sample proportion threshold, the path is considered successful; otherwise, the path is considered unsuccessful.

[0013] Further, the step of selecting a valid positioning path from the path determination results based on a preset deterministic optimization rule to determine the final cumulative offset state of the current image block includes: When only one of the horizontal and vertical candidate paths is successful, the successful path is directly selected as the valid positioning path. When both horizontal and vertical candidate paths are successful, the candidate path with the higher percentage of valid samples is selected as the valid positioning path; if the percentage of valid samples of the two candidate paths is the same, the vertical candidate path is selected as the valid positioning path. When a vertical candidate path is selected as the effective positioning path, the relative displacement calculated by the vertical candidate path is superimposed on the cumulative offset state of the image block in the same column of the previous row; when a horizontal candidate path is selected as the effective positioning path, the relative displacement calculated by the horizontal candidate path is superimposed on the cumulative offset state of the preceding image block in the current row.

[0014] Furthermore, the step of triggering the adjacency inheritance mechanism to maintain the continuous propagation of the cumulative offset state includes: if the current image block is the first image block of the row, then the cumulative offset state of the previous row and column image block is inherited as the final cumulative offset state of the current image block; if it is not the first image block of the row, then the cumulative offset state of the preceding image block in the current row is inherited as the final cumulative offset state of the current image block. The step of triggering the successor backfill mechanism to repair the state of the predecessor image block using the final cumulative offset state of the current image block includes: backfilling the final cumulative offset state of the current image block to its direct predecessor image block, and limiting the backfill execution step size to 1, so as to repair the state faults of the failed predecessor image blocks one by one in reverse scan order through single-hop backfill.

[0015] Furthermore, after determining the final cumulative offset state of the current image patch, the process also includes: Obtain auxiliary correction information that includes at least the channel fixed correction amount and the closed-loop motor correction amount, superimpose the auxiliary correction information onto the final cumulative offset state, and perform amplitude limiting processing on the corrected offset state according to the preset maximum offset range; Based on the final cumulative offset state after amplitude limiting, the boundary enhancement processing module is invoked to perform local stitching and result writeback on the horizontal and vertical overlapping areas.

[0016] Secondly, the present invention provides a direction-aware dual-path offset decision-making and continuity recovery device, comprising: The dual-path construction module is used to establish the predecessor relationship of the scanning order of the current image block based on the actual scanning direction of the current scan line, and to construct the horizontal and vertical candidate paths of the current image block; the image source order and displacement symbol interpretation of the horizontal candidate path are dynamically switched according to the actual scanning direction. The optimal decision module is used to perform matching calculations on horizontal and vertical candidate paths to obtain path determination results, and select an effective positioning path from the path determination results according to the preset deterministic optimization rules to determine the final cumulative offset state of the current image block. The adjacency inheritance module is used to trigger the adjacency inheritance mechanism to maintain the continuous propagation of the accumulated offset state when both the horizontal and vertical candidate paths fail. The successor backfill module is used to trigger the successor backfill mechanism to repair the state of the predecessor image block by using the final cumulative offset state of the current image block when a valid positioning path exists for the current image block and its predecessor image block fails.

[0017] Thirdly, the present invention provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the above-described direction-aware dual-path offset decision and continuity recovery method.

[0018] Fourthly, the present invention provides a readable storage medium storing a computer program, the computer program including program code for controlling a process to execute the process, the process including the direction-aware dual-path offset decision and continuity recovery method described above.

[0019] The main contributions and innovations of this invention are as follows: 1. This invention incorporates the actual scanning direction directly into the state modeling process of the current image block, enabling the interpretation of lateral predecessor relationships, source order, and displacement symbols to switch synchronously with the row direction. Therefore, it can solve the problems of misjudgment of adjacency relationships and misjudgment of offset direction that are prone to occur in reverse scanning rows.

[0020] 2. This invention does not simply place horizontal and vertical matching side by side, but instead establishes two candidate paths at the current image block and completes the final state selection with executable residual calculation, sample proportion calculation and threshold determination rules. Therefore, the system behavior is more stable, more reproducible and easier to implement.

[0021] 3. This invention forms a continuous recovery chain through adjacency inheritance and single-hop successor backfilling, so that local failures will not directly evolve into a whole state fault, which is especially suitable for online continuous scanning scenarios.

[0022] 4. This invention reduces motion correction, channel correction, local stitching, and parallel processing to enhancement measures executed after the core state decision, thereby enabling flexible adaptation to different devices and different output links without changing the main line.

[0023] Details of one or more embodiments of the present invention are set forth in the following drawings and description, so that other features, objects and advantages of the invention will be more readily understood. Attached Figure Description

[0024] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this invention, illustrate exemplary embodiments of the invention and are used to explain the invention, but do not constitute an undue limitation of the invention. In the drawings: Figure 1 This is a flowchart of a direction-aware dual-path offset decision-making and continuity recovery method according to an embodiment of the present invention; Figure 2 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0025] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatuses and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.

[0026] It should be noted that the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification in other embodiments. In some other embodiments, the methods may include more or fewer steps than described in this specification. Furthermore, a single step described in this specification may be broken down into multiple steps in other embodiments; and multiple steps described in this specification may be combined into a single step in other embodiments.

[0027] To facilitate understanding of the technical solution of the present invention, the key terms and objects involved in the present invention will be defined before describing the specific embodiments in detail: An image block model refers to a data object corresponding to a single scan field of view, which at least includes image data, row and column indices, channel numbers, focal plane numbers, edge markers, current row scan direction markers, and references to preceding images determined according to the actual scan order.

[0028] The predecessor relationship in the scan order refers to the relationship between the current image block and the previous image block in the actual acquisition order of the current line. This relationship is not fixed and equivalent to geometric left or geometric right neighbor, but changes with the scanning direction of the current line.

[0029] The lateral candidate path refers to the relative displacement observation path between the current image block and the real preceding image block in the same row. The order of the source image and the template image and the interpretation of the displacement sign are determined by the current row scanning direction.

[0030] The vertical candidate path refers to the relative displacement observation path between the current image patch and the image patch in the same column of the previous row, which is used to provide the current image patch with a second positioning basis independent of the preceding image patch in the same row.

[0031] The path determination result refers to the result information such as displacement, global matching residual, local worst residual, effective sample ratio, and success flag obtained for horizontal or vertical candidate paths.

[0032] The cumulative offset state matrix is ​​a matrix object that records the final offset state of each image block according to the layout of the entire image block.

[0033] The adjacency inheritance rule refers to the rule that when both the horizontal and vertical candidate paths fail, the cumulative offset state of the image block in the same column of the previous row or the cumulative offset state of the preceding image block in the current row is inherited, depending on whether the current image block is the first in the row.

[0034] The subsequent backfilling rule refers to the rule that when the current image block has at least one successful path, and the horizontal and vertical candidate paths of its predecessor image block both fail, the final cumulative offset state of the current image block is backfilled to the predecessor image block to repair the local state tomography.

[0035] Auxiliary correction information refers to the correction information that is superimposed after the core state decision is completed. It may include at least the channel fixed correction amount, the closed-loop motor correction amount, the filter switching correction amount, and the offset limiting parameter.

[0036] The boundary enhancement processing module refers to the enhancement module that performs local stitching, write-back, and subsequent output processing on the horizontal and vertical overlapping regions after the core state decision is completed.

[0037] Example 1 This invention provides a direction-aware dual-path offset decision-making and continuity restoration method for serpentine scanning digital slides, primarily applied to online continuous scanning pipelines in pathological digital slide and fluorescence digital slide devices. In such devices, a serpentine scanning path is typically used to reduce mechanical retrace time (e.g., odd-numbered rows are acquired from left to right, and even-numbered rows from right to left), causing the preceding relationships between image blocks to no longer maintain a fixed linear geometric structure.

[0038] like Figure 1 As shown, the method includes the following steps: Step S1: Establish the predecessor relationship of the scanning order of the current image block based on the actual scanning direction of the current scan line, and construct the horizontal and vertical candidate paths of the current image block; the image source order and displacement sign interpretation of the horizontal candidate paths dynamically switch with the actual scanning direction. Specifically, firstly, an image block model is established for each image block, recording its row and column indices, channel number, focal plane number, edge state, current row scanning direction marker, and predecessor image reference. The predecessor image reference is determined according to the actual scanning order. Based on the image block model, a predecessor relationship for the scanning order is established, enabling the system to complete direction determination before entering the lateral path processing, clearly identifying which adjacent image block in the current row is the direct predecessor of the current image block in the acquisition order. A cumulative offset state matrix is ​​established as the state carrier for the entire image block. The final positioning result of each subsequent image block is written into this state matrix so that subsequent image blocks in the same column or row can read and continue to propagate it.

[0039] When constructing lateral candidate paths, if the current image block is not the first image block of a row, the lateral candidate path is constructed based on the predecessor relationship of the scanning order. If the current row scans from left to right (forward scan), the predecessor image block is used as the source image, and the current image block is used as the template image; if the current row scans from right to left (reverse scan), the current image block is used as the source image, the predecessor image block is used as the template image, and the obtained local lateral displacement is interpreted with a sign reversal. In the lateral candidate path, the displacement sign interpretation method switches synchronously with the source order. The reverse scan row cannot continue to use the displacement positive and negative definitions of the forward scan row; otherwise, even if the matching position is correct, an incorrect offset direction will be introduced during state accumulation.

[0040] To illustrate that this orientation-aware displacement interpretation is not simply a matter of swapping the source and template images, the following example can be provided: Let the horizontal search window expand by 48 pixels in the X direction, and the x-coordinate of the optimal point obtained in a certain horizontal match be 52. Then the local horizontal displacement can be written as: When the current action scans from left to right, the current image block is located to the right of the preceding image block, so the final lateral displacement is recorded as +4; while when the current action scans from right to left, the current image block is located to the left of the preceding image block, although the local search results are still obtained... However, it must be recorded as -4 when written to the global state matrix. If it is mistakenly recorded as +4 at this time, the cumulative offset of adjacent image blocks will be shifted by an additional 8 pixels in that row, thereby continuously amplifying the error in subsequent state accumulation.

[0041] When constructing vertical candidate paths, it is determined whether the current image block is a top edge image block and whether there is a valid reference cache in the same column of the previous row. If the current image block is not a top edge image block and there is a valid reference cache in the same column of the previous row, the cache reference area in the same column of the previous row organized by column is used as the source image, and the corresponding vertical matching area in the current image block is used as the template image to construct the vertical candidate path. If it is a top edge image block or there is no valid reference cache, the vertical candidate path is marked as an invalid path.

[0042] Preferably, a column-organized reference cache of the previous row is established for the vertical candidate paths. Let the cache slot of the x-th column be denoted as... Its width is taken as the current field of view width W, and its height is taken as... ,in The vertical template height, This represents the expansion of the vertical search band in the Y direction. For each non-bottom edge image patch, after completing the basic matching for that patch, a reference region of the corresponding height is extracted from the lower boundary of the image patch and overwritten. Therefore, at any given time, the cache only retains the reference area of ​​the most recent row and column position.

[0043] Step S2: Perform matching calculations on the horizontal and vertical candidate paths respectively to obtain the path determination results: Specifically, matching calculations are performed on both the horizontal and vertical candidate paths to obtain their respective path determination results. The path determination results include at least the global matching residual, the local worst residual, and the percentage of valid samples.

[0044] Suppose the region to be compared is divided into K local segments (where K is the total number of local segments in the currently calculated path; specifically, when performing calculations on lateral candidate paths). When performing calculations on vertical candidate paths The i-th local sub-segment is denoted as The expansion of the preset search window corresponding to the current path in the X and Y directions is denoted as follows: and Then the candidate displacement Values ​​are retrieved only within a limited search window, satisfying... , Let the grayscale value of the source image be denoted as . The grayscale value of the template image is denoted as , If the maximum grayscale value corresponds to the current image bit depth, then during the calculation process, the template image T is shifted... The image is then aligned with the source image S in the same local coordinate system, and residual calculation is performed only on pixels within the effective overlapping region. The calculation formula is as follows:

[0045] in In the residual calculation formula, the position of the denominator is... This represents the total number of pixels within the i-th local sub-segment. The summation term is the absolute value of the grayscale difference between the source image and the aligned template image. The global matching residual is then calculated. and the local worst residual, which measures the degree of mismatch in the worst local sub-segment. :

[0046]

[0047] At the same time, effective pixels are selected using the local gradient calculation formula. :

[0048] Calculate the percentage of valid samples :

[0049] in, This represents the total number of pixels in the template region included in the statistics. This indicates that the template region simultaneously satisfies and The number of effective pixels, This indicates the preset grayscale background threshold. This represents the preset local gradient threshold.

[0050] The judgment rule is: when the global matching residual of a candidate path Less than or equal to the preset global residual threshold and the local worst residual Less than or equal to the preset local residual threshold, and the proportion of valid samples If the sample proportion is greater than or equal to the preset sample proportion threshold, the path is considered successful and is selected as a candidate for a valid location path; otherwise, the path is considered to have failed.

[0051] Step S3: Select a valid positioning path from the path determination results according to the preset deterministic optimization rules to determine the final cumulative offset state of the current image block: When only one of the horizontal and vertical candidate paths is successful, the successful path is directly selected as the valid positioning path.

[0052] When both horizontal and vertical candidate paths are successful, the candidate path with the higher percentage of valid samples is selected as the effective positioning path; if the percentage of valid samples for the two candidate paths is the same, the vertical candidate path is selected as the effective positioning path.

[0053] When a vertical candidate path is selected as the effective positioning path, the relative displacement calculated by the vertical candidate path is superimposed on the cumulative offset state of the image block in the same column of the previous row; when a horizontal candidate path is selected as the effective positioning path, the relative displacement calculated by the horizontal candidate path is superimposed on the cumulative offset state of the preceding image block in the current row.

[0054] Step S4: When both the horizontal and vertical candidate paths fail, trigger the adjacency inheritance mechanism to maintain the continuous propagation of the accumulated offset state. When both horizontal and vertical candidate paths fail, the adjacency inheritance rule is triggered. If the current image patch is the first image patch in a row, it inherits the cumulative offset state of the image patch in the same column of the previous row as the final cumulative offset state of the current image patch; if it is not the first image patch in a row, it inherits the cumulative offset state of the preceding image patch in the same row as the final cumulative offset state of the current image patch. Through this step, the handling method after local failure is changed from "no result for the current image patch" to "the current image patch inherits the most recent stable state", allowing the cumulative offset state to continue to propagate forward without being directly interrupted at the failure position.

[0055] Step S5: When a valid positioning path exists for the current image block and its predecessor image block fails, trigger the successor backfilling mechanism to repair the state of the predecessor image block using the final cumulative offset state of the current image block. When at least one path of the current image block succeeds, while both the horizontal and vertical candidate paths of its predecessor image block fail, the subsequent backfilling rule is triggered. The final cumulative offset state of the current image block is backfilled to its direct predecessor image block, with the backfilling execution step size limited to 1. This allows for the repair of state discontinuities in failed predecessor image blocks one by one along the reverse scan order via single-hop backfilling. If multiple consecutive failed image blocks exist, the state repair will propagate forward in reverse scan order in a "one-hop-one-repair" manner as subsequent image blocks gradually obtain successful paths. This forms a state repair chain of "predecessor failure, successor success, single-hop backfilling, and continuous recovery".

[0056] Step S6: Obtain auxiliary correction information and overlay the enhanced processing output: After determining the final cumulative offset state of the current image block, auxiliary correction information containing at least channel fixed correction amount and closed-loop motor correction amount is obtained. The auxiliary correction information is superimposed on the final cumulative offset state, and the corrected offset state is subjected to amplitude limiting processing according to the preset maximum offset range.

[0057] Let the cumulative offset of the current image patch after the core state decision be... The current channel is c, and the reference stitching channel is... The fixed correction amount for the channel can be obtained from the pre-calibration table. The closed-loop motor correction can be written as:

[0058]

[0059] in, and This represents the pulse position of the current channel c. and For the reference channel pulse position, and Here are the pixel conversion factors. The final corrected offset is obtained using the following formula:

[0060]

[0061] in, Represents the amplitude limiting function. , These represent the maximum allowable offset ranges in the X and Y directions, respectively.

[0062] Based on the final cumulative offset state after amplitude limiting, the boundary enhancement processing module is invoked to perform local stitching and result write-back on the horizontal and vertical overlapping regions. The boundary enhancement processing module can employ linear weighting, piecewise weighting, cosine gradient, or other gradual fusion methods to reduce brightness abrupt changes and texture mutations. The final target image patch can be output to compression, storage, pyramid construction, real-time display, or subsequent analysis modules.

[0063] Example 2 Based on the same concept, this invention also proposes a direction-aware dual-path offset decision-making and continuity recovery device, the system architecture of which strictly corresponds to the method steps of Embodiment 1. The device includes: The dual-path construction module is used to establish the predecessor relationship of the scanning order of the current image block based on the actual scanning direction of the current scan row, and to construct the horizontal and vertical candidate paths of the current image block. The dual-path construction module includes direction interpretation logic, which allows the image source order and displacement sign interpretation method of the horizontal candidate paths to dynamically switch strictly with the actual scanning direction.

[0064] The optimal decision module is used to calculate the matching residuals and sample proportions of horizontal and vertical candidate paths using the template matching core. Based on the preset deterministic rules (priority is given to the proportion of effective samples, and vertical priority is given when the proportions are equal), it selects the only valid positioning path from the judgment results and generates the final cumulative offset state of the current image block.

[0065] The adjacency inheritance module is activated when both candidate positioning criteria for the current block are detected to be invalid. It dynamically inherits the cumulative offset status of the previous row and column or the predecessor in the current row based on the position of the image block.

[0066] The subsequent backfill module has a built-in single-hop backfill constraint, which is used to perform reverse state overwrite repair of the state fault of the previous node with a step size of 1 when the current block is successfully located but the previous scan node fails.

[0067] The specific implementation methods of each module in this device are the same as those of the corresponding steps in Embodiment 1, and will not be repeated here.

[0068] Example 3 This embodiment also provides an electronic device, see reference. Figure 2 It includes a memory 404 and a processor 402, wherein the memory 404 stores a computer program and the processor 402 is configured to run the computer program to perform the steps in any of the above method embodiments.

[0069] Specifically, the processor 402 may include a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement embodiments of the present invention.

[0070] Memory 404 may include a mass storage device for data or instructions. For example, and not limitingly, memory 404 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), flash memory, an optical disk drive, a magneto-optical disk drive, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 404 may include removable or non-removable (or fixed) media. Where appropriate, memory 404 may be internal or external to a data processing device. In a particular embodiment, memory 404 is non-volatile memory. In a particular embodiment, memory 404 includes read-only memory (ROM) and random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable read-only memory (PROM), an erasable read-only memory (EPROM), an electrically erasable read-only memory (EEPROM), an electrically alterable read-only memory (EAROM), or flash memory, or a combination of two or more of these. Where appropriate, the RAM can be Static Random-Access Memory (SRAM) or Dynamic Random-Access Memory (DRAM). DRAM can be Fast Page Mode Dynamic Random-Access Memory (FPMDRAM), Extended Data Out Dynamic Random-Access Memory (EDODRAM), Synchronous Dynamic Random-Access Memory (SDRAM), etc.

[0071] The memory 404 can be used to store or cache various data files that need to be processed and / or communicated, as well as possible computer program instructions executed by the processor 402.

[0072] The processor 402 reads and executes computer program instructions stored in the memory 404 to implement any of the direction-aware dual-path offset decision and continuity recovery methods in the above embodiments.

[0073] Optionally, the electronic device may further include a transmission device 406 and an input / output device 408, wherein the transmission device 406 is connected to the processor 402, and the input / output device 408 is connected to the processor 402.

[0074] The transmission device 406 can be used to receive or send data via a network. Specific examples of the network described above may include wired or wireless networks provided by the communication provider of the electronic device. In one example, the transmission device includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 406 may be a Radio Frequency (RF) module used for wireless communication with the Internet.

[0075] Input / output device 408 is used to input or output information.

[0076] Example 4 This embodiment also provides a readable storage medium storing a computer program, the computer program including program code for controlling a process to execute the process, the process including the direction-aware dual-path offset decision and continuity recovery method according to Embodiment 1.

[0077] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.

[0078] Generally, various embodiments can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. Some aspects of the invention can be implemented in hardware, while others can be implemented by firmware or software executed by a controller, microprocessor, or other computing device, but the invention is not limited thereto. Although various aspects of the invention may be shown and described as block diagrams, flowcharts, or using some other graphical representation, it should be understood that, by way of non-limiting example, these blocks, apparatuses, systems, techniques, or methods described herein can be implemented in hardware, software, firmware, dedicated circuitry or logic, general-purpose hardware or controllers or other computing devices, or some combination thereof.

[0079] Embodiments of the present invention can be implemented by computer software, which may be executable by a data processor of a mobile device, such as a processor entity, or by hardware, or by a combination of software and hardware. Computer software or programs (also referred to as program products) including software routines, applets, and / or macros can be stored in any device-readable data storage medium, and they include program instructions for performing specific tasks. The computer program product may include one or more computer-executable components configured to perform the embodiments when the program is run. The one or more computer-executable components may be at least one piece of software code or a portion thereof. Additionally, it should be noted in this respect that, as Figure 1 Any box in the logical flow can represent a program step, or interconnected logic circuits, boxes and functions, or a combination of program steps and logic circuits, boxes and functions. Software can be stored on physical media such as memory chips or blocks of storage implemented within a processor, magnetic media such as hard disks or floppy disks, and optical media such as DVDs and their data variants, CDs, etc. The physical medium is a non-transient medium.

[0080] Those skilled in the art should understand that the technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments have been described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0081] The above embodiments are merely illustrative of several implementations of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the appended claims.

Claims

1. A direction-aware dual-path offset decision-making and continuity recovery method, characterized in that, Includes the following steps: Based on the actual scanning direction of the current scan line, the scanning sequence predecessor relationship of the current image block is established, and the horizontal candidate path and vertical candidate path of the current image block are constructed; the image source order and displacement symbol interpretation method of the horizontal candidate path are dynamically switched according to the actual scanning direction; Matching calculations are performed on the horizontal candidate path and the vertical candidate path respectively to obtain path determination results, and a valid positioning path is selected from the path determination results according to a preset deterministic optimization rule to determine the final cumulative offset state of the current image block. When both the horizontal and vertical candidate paths fail, the adjacency inheritance mechanism is triggered to maintain the continuous propagation of the accumulated offset state. When a valid positioning path exists for the current image block and its predecessor image block fails, a follow-up backfilling mechanism is triggered to repair the state of the predecessor image block using the final cumulative offset state of the current image block.

2. The direction-aware dual-path offset decision-making and continuity recovery method according to claim 1, characterized in that, The steps of establishing the scan sequence predecessor relationship of the current image block based on the actual scan direction of the current scan line, and constructing the lateral candidate path of the current image block, include: When the current image block is not the first image block of a row, determine the actual scanning direction of the current scan line; If it is a forward scan, the preceding image block is used as the source image and the current image block is used as the template image; If it is a reverse scan, the current image block is used as the source image, the preceding image block is used as the template image, and the obtained local lateral displacement is interpreted with a sign reversal.

3. The direction-aware dual-path offset decision-making and continuity recovery method according to claim 1, characterized in that, The step of constructing the vertical candidate path of the current image patch includes: Determine whether the current image block is the top edge image block and whether there is a valid reference cache in the same column of the previous row; If both are negative and a valid reference cache exists, then the cache reference area in the same column of the previous row, organized by column, is used as the source image, and the corresponding vertical matching area in the current image block is used as the template image to construct the vertical candidate path. If the image is a top edge block or there is no valid reference cache, the vertical candidate path is marked as an invalid path.

4. The direction-aware dual-path offset decision-making and continuity recovery method according to claim 1, characterized in that, The path determination result includes at least the global matching residual, the local worst residual, and the proportion of effective samples; the step of performing matching calculations on the horizontal candidate paths and the vertical candidate paths to obtain the path determination result includes: Divide the template region corresponding to the candidate path into multiple local segments along a preset direction; Within the preset search window, candidate displacements are traversed, and the template region is aligned with the source image region after displacement. Residuals are calculated only for pixels within the effective overlapping region to obtain the global matching residual and the local worst residual that measures the degree of mismatch of the worst local segment. The effective sample ratio is obtained by counting the number of valid pixels within the template area that meet the preset grayscale background threshold and local gradient threshold, and calculating their proportion to the total number of pixels. The path is considered successful when the global matching residual of a candidate path is less than or equal to a preset global residual threshold, the local worst residual is less than or equal to a preset local residual threshold, and the proportion of effective samples is greater than or equal to a preset sample proportion threshold; otherwise, the path is considered to have failed.

5. The direction-aware dual-path offset decision-making and continuity recovery method according to claim 4, characterized in that, The step of selecting a valid positioning path from the path determination results based on a preset deterministic optimization rule to determine the final cumulative offset state of the current image block includes: When only one of the horizontal and vertical candidate paths is successful, the successful path is directly selected as the valid positioning path. When both the horizontal and vertical candidate paths are successful, the candidate path with the higher percentage of valid samples is selected as the valid positioning path; if the percentage of valid samples of the two candidate paths is the same, the vertical candidate path is selected as the valid positioning path. When the vertical candidate path is selected as the effective positioning path, the relative displacement calculated by the vertical candidate path is superimposed on the cumulative offset state of the image block in the same column of the previous row; when the horizontal candidate path is selected as the effective positioning path, the relative displacement calculated by the horizontal candidate path is superimposed on the cumulative offset state of the preceding image block in the current row.

6. The direction-aware dual-path offset decision-making and continuity recovery method according to claim 1, characterized in that, The steps of triggering the adjacency inheritance mechanism to maintain the continuous propagation of the cumulative offset state include: if the current image block is the first image block of the row, then inherit the cumulative offset state of the image block in the same column of the previous row as the final cumulative offset state of the current image block; if it is not the first image block of the row, then inherit the cumulative offset state of the preceding image block in the current row as the final cumulative offset state of the current image block. The triggering subsequent backfilling mechanism utilizes the final cumulative offset state of the current image block to repair the state of the predecessor image block, including: backfilling the final cumulative offset state of the current image block to its direct predecessor image block, and limiting the backfilling execution step size to 1, so as to repair the state discontinuity of the failed predecessor image block one by one in reverse scan order through single-hop backfilling.

7. The direction-aware dual-path offset decision-making and continuity recovery method according to claim 1, characterized in that, After determining the final cumulative offset state of the current image block, the method further includes: Obtain auxiliary correction information that includes at least channel fixed correction amount and closed-loop motor correction amount, superimpose the auxiliary correction information onto the final cumulative offset state, and perform amplitude limiting processing on the corrected offset state according to the preset maximum offset range; Based on the final cumulative offset state after amplitude limiting, the boundary enhancement processing module is invoked to perform local stitching and result writeback on the horizontal and vertical overlapping areas.

8. A direction-aware dual-path offset decision-making and continuity recovery device, characterized in that, include: The dual-path construction module is used to establish the predecessor relationship of the scanning order of the current image block based on the real scanning direction of the current scan line, and to construct the horizontal candidate path and the vertical candidate path of the current image block; the image source order and displacement symbol interpretation method of the horizontal candidate path are dynamically switched according to the real scanning direction. The optimal decision module is used to perform matching calculations on the horizontal candidate path and the vertical candidate path respectively to obtain path determination results, and select an effective positioning path from the path determination results according to the preset deterministic optimization rules, so as to determine the final cumulative offset state of the current image block. The adjacency inheritance module is used to trigger the adjacency inheritance mechanism to maintain the continuous propagation of the cumulative offset state when both the horizontal candidate path and the vertical candidate path fail. The follow-up backfill module is used to trigger the follow-up backfill mechanism to repair the state of the predecessor image block by using the final cumulative offset state of the current image block when the current image block has a valid positioning path and its predecessor image block fails.

9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the direction-aware dual-path offset decision and continuity recovery method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which includes program code. When the program code is executed by a processor, it implements the direction-aware dual-path offset decision and continuity recovery method as described in any one of claims 1 to 7.