CN117333368A - Image stitching method, device and storage medium based on local edge analysis - Google Patents
Image stitching method, device and storage medium based on local edge analysis Download PDFInfo
- Publication number
- CN117333368A CN117333368A CN202311302952.4A CN202311302952A CN117333368A CN 117333368 A CN117333368 A CN 117333368A CN 202311302952 A CN202311302952 A CN 202311302952A CN 117333368 A CN117333368 A CN 117333368A
- Authority
- CN
- China
- Prior art keywords
- image
- connected domain
- overlapping region
- block
- matching
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000004458 analytical method Methods 0.000 title claims abstract description 22
- 239000011159 matrix material Substances 0.000 claims abstract description 31
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 7
- 230000001131 transforming effect Effects 0.000 claims abstract description 7
- 238000004364 calculation method Methods 0.000 claims description 10
- 238000010586 diagram Methods 0.000 claims description 6
- 238000004590 computer program Methods 0.000 claims description 3
- 238000004891 communication Methods 0.000 claims description 2
- 230000004044 response Effects 0.000 claims 1
- 230000006978 adaptation Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000009466 transformation Effects 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000003708 edge detection Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000002349 favourable effect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T3/00—Geometric image transformation in the plane of the image
- G06T3/40—Scaling the whole image or part thereof
- G06T3/4038—Scaling the whole image or part thereof for image mosaicing, i.e. plane images composed of plane sub-images
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/50—Image enhancement or restoration by the use of more than one image, e.g. averaging, subtraction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/187—Segmentation; Edge detection involving region growing; involving region merging; involving connected component labelling
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/10—Image acquisition modality
- G06T2207/10004—Still image; Photographic image
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20172—Image enhancement details
- G06T2207/20192—Edge enhancement; Edge preservation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20212—Image combination
- G06T2207/20221—Image fusion; Image merging
Abstract
The invention discloses an image stitching method, device and storage medium based on local edge analysis, which comprises the following steps: acquiring a first image and a second image, and respectively calculating a homography matrix of the first image and a homography matrix of the second image; determining an overlapping region of the first image and an overlapping region of the second image according to the homography matrix of the first image and the homography matrix of the second image; performing image stitching according to the overlapping region of the first image and the overlapping region of the second image to obtain a stitching graph; extracting a connected domain of a first image overlapping region and a connected domain of a second image overlapping region in the mosaic; calculating similar connected domains of the first image overlapping region and the second image overlapping region according to a weighted nearest neighbor algorithm, and splicing the connected domains of the overlapping regions into one connected domain according to the similar connected domains; transforming the coordinates of the spliced connected domain into the coordinates of a spliced graph, and complementing the missing pixel part; outputting the target spliced image.
Description
Technical Field
The invention relates to the technical field of image stitching, in particular to an image stitching method, device and storage medium based on local edge analysis.
Background
Image stitching is the process of combining multiple images into a seamless image, commonly used in creating panoramic, medical image stitching, virtual reality, and other applications.
The current image stitching method mainly focuses on the correctness of global coordinates, but omits accurate stitching of edge details, which causes errors when stitching detail parts such as edges, and when the edges are extracted by using a traditional edge detection method, errors or noise can be introduced, the errors or noise can be transmitted to the stitching process, inaccurate edge information can be caused, and the problem of stitching the edges is more complex for objects which are deformed or transformed in the stitched image, which can be solved by using a more advanced transformation model and stitching technology.
Due to the above problems, the accuracy of object detection may be seriously affected by errors in image stitching, and the errors may cause the position and shape of the object to change, which may make it difficult for the object detection method to correctly recognize the object.
Disclosure of Invention
The technical purpose is that: aiming at the defects of the prior art, the invention discloses an image splicing method, equipment and a storage medium based on local edge analysis, which can better splice edge overlapping parts and greatly increase the target counting and recognition conditions of the edge parts.
The technical scheme is as follows: in order to achieve the technical purpose, the invention adopts the following technical scheme:
an image stitching method based on local edge analysis comprises the following steps:
s1, acquiring a first image and a second image, and respectively calculating a homography matrix of the first image for the second image and a homography matrix of the second image for the first image;
s2, respectively determining an overlapping area of the first image and an overlapping area of the second image according to the homography matrix of the first image and the homography matrix of the second image;
s3, performing image stitching on the first image and the second image according to the overlapping area of the first image and the overlapping area of the second image to obtain a stitching graph;
s4, respectively extracting a connected domain of the first image overlapping region and a connected domain of the second image overlapping region in the splice diagram of the step S3;
s5, calculating similar connected domains of the first image overlapping region and the second image overlapping region according to a weighted nearest neighbor algorithm, and splicing the connected domains of the two overlapping regions into a connected domain according to the similar connected domains;
s6, transforming the coordinates of the spliced connected domain into the coordinates of the spliced graph in the step S3, and complementing the pixel part lacking in the connected domain after transforming the coordinates by a nearest neighbor interpolation method;
s7, outputting the target spliced image.
Preferably, the calculating the similar connected domain of the first image overlapping region and the connected domain of the second image overlapping region according to the weighted nearest neighbor algorithm includes the following steps:
s51, dividing the connected domain of the first image overlapping region and the connected domain of the second image overlapping region into a plurality of blocks;
s52, randomly assigning an initial matching block for the blocks in the connected domain of the first image overlapping region, wherein the matching block is positioned in the connected domain of the second image overlapping region;
s53, iteratively calculating an optimal matching block of the connected domain blocks of the first image overlapping region;
s54, calculating to obtain similar connected domains of the connected domain of the first image overlapping region and the connected domain of the second image overlapping region according to the blocks in the connected domain of the first image overlapping region and the optimal matching blocks.
Preferably, the calculating the optimal matching block of the block in the connected domain of the first image overlapping region includes the steps of:
s531, obtaining a block in a communication domain of the first overlapping region and an adjacent block adjacent to the block;
s532, calculating an offset value between a block in the connected domain of the first overlapping region and a matching block thereof, and then calculating an offset value between an adjacent block in the connected domain of the first overlapping region and a matching block thereof, wherein the offset value has the following calculation formula:
f(x,y)=afgmin f [D(x,y),D(x 1 ,y 1 ),D(c 2 ,y 2 )]
wherein f (x, y) represents a first graphOffset values between blocks (x, y) in a connected domain like an overlapping region and matching blocks (x ', y') in a connected domain like a second image overlapping region, x, y representing x-axis and y-axis coordinate values of the blocks (x, y) in the connected domain of the first image overlapping region, x 'and y' representing x-axis and y-axis coordinate values of the matching blocks (x ', y') in the connected domain of the second image overlapping region, (x) 1 ,y 1 ) Representing the adjacent block to the left of block (x, y), (x) 2 ,y 2 ) Representing adjacent blocks above the blocks (x, y), D (x, y) representing a matching error between the blocks (x, y) in the connected domain of the first image overlap region and the matching blocks (x ', y') in the connected domain of the second image overlap region;
s533, comparing the magnitude relation of the offset values calculated in the step S532 to obtain an optimal matching block of the connected domain block of the first overlapping region;
s534, randomly searching and matching for a plurality of times in a radius area with continuous digit attenuation by taking the optimal matching block obtained in the step S533 as a center until the radius is smaller than 1 pixel, and calculating the distance between the block in the connected domain of the first image overlapping area and the randomly searched matching block, wherein the distance formula between the block in the connected domain of the first image overlapping area and the randomly searched matching block is as follows:
u i =f i (x,y)+wα i R i
wherein u is i Representing the relative position of the block (x, y) in the connected domain of the first image overlapping region in the i-th randomly searched matched block in the connected domain of the second image overlapping region, f i (x, y) represents an offset value between a block (x, y) in a connected domain of the first image overlapping region and a matching block of the ith random search in a connected domain of the second image overlapping region, w represents a maximum search radius whose value is a length of a longest side of the image, α represents an exponential decay factor fixed between 0 and 1, R i The representation is located at [ -1,1]×[-1,1]The middle server is used for uniformly distributing two-dimensional random numbers, i represents the number of random searches, and i is increased until the current searching radius w alpha i Less than 1;
s535, judging the size relation between the distance between the block in the connected domain of the first image overlapping region and the matching block searched randomly and the offset value between the block in the connected domain of the first overlapping region and the best matching block, if the distance between the block in the connected domain of the first image overlapping region and the matching block searched randomly is smaller than the offset value between the block in the connected domain of the first overlapping region and the best matching block, taking the matching block searched randomly at present as the best matching block; if the distance between the block in the connected domain of the first image overlapping region and the randomly searched matching block is larger than the offset value between the block in the connected domain of the first overlapping region and the optimal matching block, keeping the original optimal matching block unchanged;
s536, outputting the optimal matching block of the connected domain blocks of the first image overlapping region.
Preferably, a calculation formula of the matching error D (x, y) between the connected domain block (x, y) of the first image overlapping region and the matching block (x ', y') of the second image overlapping region is as follows:
where x, y represent the x-axis and y-axis coordinate values of the block (x, y) in the connected domain of the first image overlapping region, and x 'and y' represent the x-axis and y-axis coordinate values of the matching block (x ', y') in the connected domain of the second image overlapping region.
Preferably, randomly assigning an initial matching block to a block in the connected domain of the first image overlap region comprises two ways, namely a completely random assignment and an assignment adding a priori information.
Preferably, the iterative calculation includes an odd number of iterations, each column of blocks in the connected domain of the first overlapping region being scanned line by line from top to bottom, each row being scanned from left to right, and an even number of iterations, each column of blocks in the connected domain of the first image overlapping region being scanned from bottom to top, each row being scanned from right to left.
Preferably, the process of random search can be terminated in advance according to the calculated value of the matching error.
Preferably, the calculating the homography matrix of the first image for the second image and the homography matrix corresponding to the second image for the first image respectively includes the following steps:
s11, respectively extracting edge characteristic points of the edge areas of the first image and the second image, and then carrying out characteristic point matching on the edge characteristic points of the two images to obtain matching pairs of the edge characteristic points of the two images;
s12, selecting a plurality of matching pairs of edge feature points, and respectively calculating a homography matrix of the first image aiming at the second image and a homography matrix of the second image aiming at the first image.
The invention also provides an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing an image stitching method based on local edge analysis as described above when executing the program.
The present invention also provides a computer-readable storage medium storing computer-executable instructions for performing an image stitching method based on local edge analysis as described above.
The beneficial effects are that: the image stitching method, the device and the storage medium based on the local edge analysis have the following beneficial effects:
1. the method adopts a mode of extracting the image edge characteristics firstly and then extracting the homography matrix for transformation, is favorable for splicing edge parts, can obviously reduce the splicing error of the edge area and can obviously increase the counting and identification accuracy of the edge part targets compared with the traditional method.
2. By means of connected domain analysis, the method and the device can extract the connected domain parts of the overlapped parts of the two images in the spliced graph, so that the integrity of the object can be maintained during splicing, the position of the spliced connected domain is ensured to be accurate, and especially when the object is deformed or overlapped in the image, dislocation of the object can be effectively avoided.
3. The invention also carries out interpolation complement on the pixel points of the missing part caused by splicing, which is helpful for further improving the visual quality and continuity of splicing.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
FIG. 1 is a block diagram of the overall steps of image stitching of the present invention;
FIG. 2 is a block diagram illustrating steps for calculating similar connected domains according to the present invention;
FIG. 3 is a block diagram of the steps of the calculation of the optimal matching block of the present invention;
fig. 4 is a schematic view of image stitching according to the present invention.
Detailed Description
The present invention will now be described more fully hereinafter with reference to the accompanying drawings, in which preferred embodiments of the invention are shown, but in which the invention is not so limited.
As shown in fig. 1-4, an image stitching method based on local edge analysis includes the following steps:
s1, acquiring a first image and a second image, and respectively calculating a homography matrix of the first image for the second image and a homography matrix of the second image for the first image.
Preferably, the calculating the homography matrix of the first image for the second image and the homography matrix corresponding to the second image for the first image respectively includes the following steps:
s11, respectively extracting edge characteristic points of the edge areas of the first image and the second image, and then carrying out characteristic point matching on the edge characteristic points of the two images to obtain matching pairs of the edge characteristic points of the two images;
s12, selecting a plurality of matching pairs of edge feature points, and respectively calculating a homography matrix of the first image aiming at the second image and a homography matrix of the second image aiming at the first image.
In one embodiment of the present application, an A image and a B image are acquired, and a plurality of A image edge regions are extracted respectivelyThe edge feature points of the A, B image are subjected to feature point matching to obtain a plurality of matching pairs of the edge feature points, and a homography matrix H of the A image for the B image is calculated according to the matching pairs 1 And B image homography matrix H for A image 2 。
S2, according to the homography matrix of the first image and the homography matrix of the second image, an overlapping area of the first image and an overlapping area of the second image are respectively determined.
S3, performing image stitching on the first image and the second image according to the overlapping area of the first image and the overlapping area of the second image to obtain stitched images, wherein the edge parts of the stitched images are likely to be misaligned, and the obtained stitched images need to be processed more finely.
And splicing the overlapping area of the image A and the overlapping area of the image B, and obtaining a spliced image C after the overlapping areas are fused.
S4, respectively extracting the connected domain of the first image overlapping region and the connected domain of the second image overlapping region in the splice diagram in the step S3.
S5, calculating similar connected domains of the first image overlapping region and the second image overlapping region according to a weighted nearest neighbor algorithm, and splicing the connected domains of the two overlapping regions into one connected domain according to the similar connected domains.
As shown in fig. 2, the calculating the similar connected domain of the first image overlapping region and the connected domain of the second image overlapping region according to the weighted nearest neighbor algorithm includes the following steps:
s51, dividing the connected domain of the first image overlapping area and the connected domain of the second image overlapping area into a plurality of blocks.
S52, randomly assigning an initial matching block for the blocks in the connected domain of the first image overlapping region, wherein the matching block is located in the connected domain of the second image overlapping region.
In a specific embodiment, the randomly assigning an initial matching block to the block in the connected domain of the first image overlapping area includes two ways, namely, completely random assignment and assignment of adding prior information, where the assignment of adding prior information specifically refers to that if the position relationship between the matching block and the block is known in advance when the block in the connected domain of the first image overlapping area is matched, for example, knowing the x coordinate or y coordinate of the matching block, then there is no need to randomly match the known coordinate, and only the matching of unknown coordinates is required.
S53, iteratively calculating an optimal matching block of the connected domain blocks of the first image overlapping region.
The iterative computation includes an odd number of iterations, each column of blocks in the connected domain of the first overlap region being scanned line by line from top to bottom, each row being scanned from left to right, and an even number of iterations, each column of blocks in the connected domain of the first image overlap region being scanned from bottom to top, each row being scanned from right to left.
In a specific embodiment, as shown in fig. 3, the calculating the optimal matching block of the connected domain blocks of the first image overlapping region includes the following steps:
s531, obtaining a block in the connected domain of the first overlapping region and an adjacent block adjacent to the block, wherein if the current iteration is calculated as an odd number of iterations, the left adjacent block and the upper adjacent block of the current block in the connected domain of the first overlapping region are all the blocks which have already obtained and calculated the best matching block.
S532, calculating an offset value between a block in the connected domain of the first overlapping region and a matching block thereof, and then calculating an offset value between an adjacent block in the connected domain of the first overlapping region and a matching block thereof, wherein the offset value has the following calculation formula:
f(x,y)=afgmin f [D(x,y),D(x 1 ,y 1 ),D(x 2 ,y 2 )]
wherein f (x, y) represents an offset value between a block (x, y) in the connected domain of the first image overlapping region and a matching block (x ', y') in the connected domain of the second image overlapping region, x, y represent x-axis and y-axis coordinate values of the block (x, y) in the connected domain of the first image overlapping region, and x 'and y' represent the first image overlapping regionCoordinate values of x-axis and y-axis of the matching block (x ', y') in the two-image overlapping region connected domain, (x) 1 ,y 1 ) Representing the adjacent block to the left of block (x, y), (x) 2 ,y 2 ) Representing adjacent blocks above the block (x, y), and D (x, y) representing a matching error between the block (x, y) in the connected domain of the first image overlap region and the matching block (x ', y') in the connected domain of the second image overlap region.
The coordinates of the blocks are a plurality of, and the coordinates of the blocks selected in the related calculation are unified as the coordinates of the center point, so that the coordinates of other positions of the blocks can be selected to represent the positions of the blocks under different conditions.
In a specific embodiment, the calculation formula of the matching error D (x, y) between the connected domain block (x, y) of the first image overlapping region and the matching block (x ', y') of the second image overlapping region is as follows:
where x, y represent the x-axis and y-axis coordinate values of the block (x, y) in the connected domain of the first image overlapping region, and x 'and y' represent the x-axis and y-axis coordinate values of the matching block (x ', y') in the connected domain of the second image overlapping region.
S533, comparing the magnitude relation of the offset values calculated in the step S532, and taking the matching block with the smallest offset value as the optimal matching block of the current block in the connected domain of the first image overlapping region to obtain the optimal matching block of the current block in the connected domain of the first image overlapping region.
In one particular embodiment of the present application, when the iterative calculation is an odd number of iterations, the block (x, y) in the a image overlap region connected domain is being scanned, then the adjacent block (x-1, y) to the left of this block and the adjacent block (x, y-1) above this block are both already scanned blocks, and their corresponding offset values are f (x-1, y) and f (x, y-1), which represent their distance relative to themselves of the matching blocks in the B image overlap region connected domain. Then, the current block (x, y) can borrow the matching blocks of the adjacent block on the left side and the adjacent block on the upper side, and the matching blocks of the block are added, the three pairs of matching blocks are compared, which pair of matching blocks has the best matching result, and after the result is obtained, the matching block of the current block is directly changed into the optimal matching block with the best matching result.
S534, randomly searching and matching for a plurality of times in a radius area with continuous digit attenuation by taking the optimal matching block obtained in the step S533 as a center until the radius is smaller than 1 pixel, and calculating the distance between the block in the connected domain of the first image overlapping area and the randomly searched matching block, wherein the distance formula between the block in the connected domain of the first image overlapping area and the randomly searched matching block is as follows:
u i =f i (x,y)+wα i R i
wherein u is i Representing the relative position of the block (x, y) in the connected domain of the first image overlapping region in the i-th randomly searched matched block in the connected domain of the second image overlapping region, f i (x, y) represents an offset value between a block (x, y) in a connected domain of the first image overlapping region and a matching block of the ith random search in a connected domain of the second image overlapping region, w represents a maximum search radius whose value is a length of a longest side of the image, α represents an exponential decay factor fixed between 0 and 1, R i The representation is located at [ -1,1]×[-1,1]The middle server is used for uniformly distributing two-dimensional random numbers, i represents the number of random searches, and i is increased until the current searching radius w alpha i Less than 1.
S535, judging the size relation between the distance between the block in the connected domain of the first image overlapping region and the matching block searched randomly and the offset value between the block in the connected domain of the first overlapping region and the best matching block, if the distance between the block in the connected domain of the first image overlapping region and the matching block searched randomly is smaller than the offset value between the block in the connected domain of the first overlapping region and the best matching block, taking the matching block searched randomly at present as the best matching block; if the distance between the block in the connected domain of the first image overlapping region and the randomly searched matching block is larger than the offset value between the block in the connected domain of the first overlapping region and the optimal matching block, the original optimal matching block is kept unchanged.
The current block (x, y) may be optimized for its matching block after the matching pass process described above, but may not yet be the optimal solution. Then, a random search is continuously carried out on the block, and whether the best matching block which is more matched than the current block can be found or not is judged: the matching relation of the current block is updated along with the random matching in the radius area with continuous digit attenuation by taking the matching block (x+f (x, y) and y+f (x, y)) of the current block as a center, and ending the process after the radius is reduced to 1 pixel or less, if the random searching in the plurality of times finds better matching.
Preferably, the random search process can be terminated in advance according to the calculated value of the matching error, for example, when a certain random search is being performed and the relative distance is calculated, if the calculated value is worse than the original value, the random search can be terminated in advance.
S536, outputting the optimal matching block of the connected domain blocks of the first image overlapping region.
S54, calculating to obtain similar connected domains of the connected domain of the first image overlapping region and the connected domain of the second image overlapping region according to the blocks in the connected domain of the first image overlapping region and the optimal matching blocks.
S6, transforming the coordinates of the spliced connected domain into the coordinates of the spliced graph in the step S3, and complementing the pixel part lacking in the connected domain after transforming the coordinates by a nearest neighbor interpolation method.
At this time, after the edge parts of the first image and the second image in the mosaic are subjected to connected domain analysis, the phenomena of misalignment and the like are well improved.
S7, outputting the target spliced image.
As shown in fig. 4, an embodiment of the image stitching method according to the present invention is shown, where edge portions of two images can be fused well after stitching is completed.
The invention provides an electronic device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein the processor realizes any image splicing method based on local edge analysis when executing the program. The memory may be various types of memory, such as random access memory, read only memory, flash memory, etc. The processor may be various types of processors, such as a central processing unit, a microprocessor, a digital signal processor, or an image processor, etc.
The invention also provides a computer readable storage medium storing computer executable instructions for performing any one of the above image stitching methods based on local edge analysis. The storage medium includes: a usb disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk, etc.
The foregoing is only a preferred embodiment of the invention, it being noted that: it will be apparent to those skilled in the art that various modifications and adaptations can be made without departing from the principles of the present invention, and such modifications and adaptations are intended to be comprehended within the scope of the invention.
Claims (10)
1. The image stitching method based on the local edge analysis is characterized by comprising the following steps of:
s1, acquiring a first image and a second image, and respectively calculating a homography matrix of the first image for the second image and a homography matrix of the second image for the first image;
s2, respectively determining an overlapping area of the first image and an overlapping area of the second image according to the homography matrix of the first image and the homography matrix of the second image;
s3, performing image stitching on the first image and the second image according to the overlapping area of the first image and the overlapping area of the second image to obtain a stitching graph;
s4, respectively extracting a connected domain of the first image overlapping region and a connected domain of the second image overlapping region in the splice diagram of the step S3;
s5, calculating similar connected domains of the first image overlapping region and the second image overlapping region according to a weighted nearest neighbor algorithm, and splicing the connected domains of the two overlapping regions into a connected domain according to the similar connected domains;
s6, transforming the coordinates of the spliced connected domain into the coordinates of the spliced graph in the step S3, and complementing the pixel part lacking in the connected domain after transforming the coordinates by a nearest neighbor interpolation method;
s7, outputting the target spliced image.
2. The image stitching method according to claim 1, wherein the calculating similar connected domains of the connected domain of the first image overlapping region and the connected domain of the second image overlapping region according to the weighted nearest neighbor algorithm comprises the steps of:
s51, dividing the connected domain of the first image overlapping region and the connected domain of the second image overlapping region into a plurality of blocks;
s52, randomly assigning an initial matching block for the blocks in the connected domain of the first image overlapping region, wherein the matching block is positioned in the connected domain of the second image overlapping region;
s53, iteratively calculating an optimal matching block of the connected domain blocks of the first image overlapping region;
s54, calculating to obtain similar connected domains of the connected domain of the first image overlapping region and the connected domain of the second image overlapping region according to the blocks in the connected domain of the first image overlapping region and the optimal matching blocks.
3. The image stitching method according to claim 2, wherein calculating the optimal matching block of the connected domain blocks of the first image overlapping region comprises the steps of:
s531, obtaining a block in a communication domain of the first overlapping region and an adjacent block adjacent to the block;
s532, calculating an offset value between a block in the connected domain of the first overlapping region and a matching block thereof, and then calculating an offset value between an adjacent block in the connected domain of the first overlapping region and a matching block thereof, wherein the offset value has the following calculation formula:
f(x,y)=argmin f [D(x,y),D(x 1 ,y 1 ),D(x 2 ,y 2 )]
wherein f (x, y) represents an offset value between a block (x, y) in the connected domain of the first image overlapping region and a matching block (x ', y') in the connected domain of the second image overlapping region, x, y represent coordinate values of x-axis and y-axis of the block (x, y) in the connected domain of the first image overlapping region, x 'and y' represent coordinate values of x-axis and y-axis of the matching block (x ', y') in the connected domain of the second image overlapping region, (x) 1 ,y 1 ) Representing the adjacent block to the left of block (x, y), (x) 2 ,y 2 ) Representing adjacent blocks above the blocks (x, y), D (x, y) representing a matching error between the blocks (x, y) in the connected domain of the first image overlap region and the matching blocks (x ', y') in the connected domain of the second image overlap region;
s533, comparing the magnitude relation of the offset values calculated in the step S532 to obtain an optimal matching block of the connected domain block of the first overlapping region;
s534, randomly searching and matching for a plurality of times in a radius area with continuous digit attenuation by taking the optimal matching block obtained in the step S533 as a center until the radius is smaller than 1 pixel, and calculating the distance between the block in the connected domain of the first image overlapping area and the randomly searched matching block, wherein the distance formula between the block in the connected domain of the first image overlapping area and the randomly searched matching block is as follows:
u i =f i (x,y)+wα i R i
wherein u is i Representing the relative position of the block (x, y) in the connected domain of the first image overlapping region in the i-th randomly searched matched block in the connected domain of the second image overlapping region, f i (x, y) represents an offset value between a block (x, y) in a connected domain of the first image overlapping region and a matching block of the ith random search in a connected domain of the second image overlapping region, w represents a maximum search radius whose value is a length of a longest side of the image, α represents an exponential decay factor fixed between 0 and 1, R i The representation is located at [ -1,1]×[-1,1]The middle server is used for uniformly distributing random numbers from two dimensions, i represents the number of random searches, and the increment of i is up to the current searching radius w alpha i Less than 1;
s535, judging the size relation between the distance between the block in the connected domain of the first image overlapping region and the matching block searched randomly and the offset value between the block in the connected domain of the first overlapping region and the best matching block, if the distance between the block in the connected domain of the first image overlapping region and the matching block searched randomly is smaller than the offset value between the block in the connected domain of the first overlapping region and the best matching block, taking the matching block searched randomly at present as the best matching block; if the distance between the block in the connected domain of the first image overlapping region and the randomly searched matching block is larger than the offset value between the block in the connected domain of the first overlapping region and the optimal matching block, keeping the original optimal matching block unchanged;
s536, outputting the optimal matching block of the connected domain blocks of the first image overlapping region.
4. A method of image stitching based on local edge analysis as claimed in claim 3, wherein the calculation formula of the matching error D (x, y) between the connected domain blocks (x, y) of the first image overlapping region and the matching blocks (x ', y') of the second image overlapping region is as follows:
where x, y represent the x-axis and y-axis coordinate values of the block (x, y) in the connected domain of the first image overlapping region, and x 'and y' represent the x-axis and y-axis coordinate values of the matching block (x ', y') in the connected domain of the second image overlapping region.
5. The method of image stitching based on local edge analysis as recited in claim 2, wherein randomly assigning an initial matching block to a block in a connected domain of the first image overlap region comprises two methods, namely, completely random assignment and assignment of information added a priori.
6. The image stitching method based on local edge analysis of claim 2 wherein the iterative computation includes an odd number of iterations of scanning each column of blocks in the connected domain of the first overlap region progressively from top to bottom, each row scanning from left to right, and an even number of iterations of scanning each column of blocks in the connected domain of the first image overlap region from bottom to top, each row scanning from right to left.
7. A method of image stitching based on local edge analysis as claimed in claim 3 wherein the random search process is terminated in advance in response to the calculated match error value.
8. The image stitching method based on local edge analysis according to claim 1, wherein the calculating of the homography matrix of the first image for the second image and the homography matrix of the second image for the first image respectively includes the following steps:
s11, respectively extracting edge characteristic points of the edge areas of the first image and the second image, and then carrying out characteristic point matching on the edge characteristic points of the two images to obtain matching pairs of the edge characteristic points of the two images;
s12, selecting a plurality of matching pairs of edge feature points, and respectively calculating a homography matrix of the first image aiming at the second image and a homography matrix of the second image aiming at the first image.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing a local edge analysis based image stitching method according to any of claims 1-8 when executing the program.
10. A computer readable storage medium having stored thereon computer executable instructions for performing a local edge analysis based image stitching method according to any of claims 1-8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311302952.4A CN117333368A (en) | 2023-10-10 | 2023-10-10 | Image stitching method, device and storage medium based on local edge analysis |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311302952.4A CN117333368A (en) | 2023-10-10 | 2023-10-10 | Image stitching method, device and storage medium based on local edge analysis |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117333368A true CN117333368A (en) | 2024-01-02 |
Family
ID=89292745
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311302952.4A Pending CN117333368A (en) | 2023-10-10 | 2023-10-10 | Image stitching method, device and storage medium based on local edge analysis |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117333368A (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040069454A (en) * | 2003-01-29 | 2004-08-06 | 주식회사 일리시스 | Method for producing the global image mosaic |
CN106558072A (en) * | 2016-11-22 | 2017-04-05 | 重庆信科设计有限公司 | A kind of method based on SIFT feature registration on remote sensing images is improved |
CN110992263A (en) * | 2019-11-27 | 2020-04-10 | 国网山东省电力公司电力科学研究院 | Image splicing method and system |
CN111028155A (en) * | 2019-12-17 | 2020-04-17 | 大连理工大学 | Parallax image splicing method based on multiple pairs of binocular cameras |
CN111047510A (en) * | 2019-12-17 | 2020-04-21 | 大连理工大学 | Large-field-angle image real-time splicing method based on calibration |
CN112801870A (en) * | 2021-01-28 | 2021-05-14 | 中南大学 | Image splicing method based on grid optimization, splicing system and readable storage medium |
CN113724135A (en) * | 2021-08-25 | 2021-11-30 | 上海浦东发展银行股份有限公司 | Image splicing method, device, equipment and storage medium |
-
2023
- 2023-10-10 CN CN202311302952.4A patent/CN117333368A/en active Pending
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
KR20040069454A (en) * | 2003-01-29 | 2004-08-06 | 주식회사 일리시스 | Method for producing the global image mosaic |
CN106558072A (en) * | 2016-11-22 | 2017-04-05 | 重庆信科设计有限公司 | A kind of method based on SIFT feature registration on remote sensing images is improved |
CN110992263A (en) * | 2019-11-27 | 2020-04-10 | 国网山东省电力公司电力科学研究院 | Image splicing method and system |
CN111028155A (en) * | 2019-12-17 | 2020-04-17 | 大连理工大学 | Parallax image splicing method based on multiple pairs of binocular cameras |
CN111047510A (en) * | 2019-12-17 | 2020-04-21 | 大连理工大学 | Large-field-angle image real-time splicing method based on calibration |
US20220044356A1 (en) * | 2019-12-17 | 2022-02-10 | Dalian University Of Technology | Large-field-angle image real-time stitching method based on calibration |
CN112801870A (en) * | 2021-01-28 | 2021-05-14 | 中南大学 | Image splicing method based on grid optimization, splicing system and readable storage medium |
CN113724135A (en) * | 2021-08-25 | 2021-11-30 | 上海浦东发展银行股份有限公司 | Image splicing method, device, equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
ACHALA PANDEY ET AL.: "Image mosaicing: A deeper insight", 《IMAGE AND VISION COMPUTING》, 2 August 2019 (2019-08-02), pages 236 - 257, XP085809155, DOI: 10.1016/j.imavis.2019.07.002 * |
张晶晶;翟东海;黄莉芝;喻强;: "基于特征分块的视差图像拼接算法", 计算机工程, no. 05, 12 May 2017 (2017-05-12) * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Li et al. | A novel inshore ship detection via ship head classification and body boundary determination | |
US8805117B2 (en) | Methods for improving image search in large-scale databases | |
CN108334879B (en) | Region extraction method, system and terminal equipment | |
CN111369495B (en) | Panoramic image change detection method based on video | |
CN111461113B (en) | Large-angle license plate detection method based on deformed plane object detection network | |
CN112712518B (en) | Fish counting method and device, electronic equipment and storage medium | |
CN116542945B (en) | Wafer image segmentation processing method, electronic equipment and storage medium | |
US9077926B2 (en) | Image processing method and image processing apparatus | |
CN108960247B (en) | Image significance detection method and device and electronic equipment | |
CN110827189A (en) | Method and system for removing watermark of digital image or video | |
Chen et al. | A novel Fourier descriptor based image alignment algorithm for automatic optical inspection | |
CN112200191B (en) | Image processing method, image processing device, computing equipment and medium | |
CN111915645B (en) | Image matching method and device, computer equipment and computer readable storage medium | |
CN113506288A (en) | Lung nodule detection method and device based on transform attention mechanism | |
JP2004508641A (en) | Digital image segmentation | |
CN117333368A (en) | Image stitching method, device and storage medium based on local edge analysis | |
CN115619678B (en) | Correction method and device for image deformation, computer equipment and storage medium | |
CN114387353A (en) | Camera calibration method, calibration device and computer readable storage medium | |
CN114781417A (en) | Two-dimensional code identification method, two-dimensional code identification device and electronic equipment | |
CN109242894B (en) | Image alignment method and system based on mobile least square method | |
CN114078245A (en) | Image processing method and image processing device | |
CN113255405A (en) | Parking space line identification method and system, parking space line identification device and storage medium | |
CN117115275B (en) | Distortion parameter determination method and device and computer equipment | |
CN112149675B (en) | Method for acquiring chart information data, electronic equipment and readable storage medium | |
CN116363031B (en) | Imaging method, device, equipment and medium based on multidimensional optical information fusion |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |