Image processing method, segmentation method, medium and electronic device

By acquiring the offset of the image from the scanning device and performing local matching and stitching, the problems of large computational load and slow speed in image stitching in the prior art are solved, and efficient and accurate image stitching is achieved.

CN115689952BActive Publication Date: 2026-04-14FUZHOU ROCKCHIP SEMICON
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
FUZHOU ROCKCHIP SEMICON
Filing Date
2021-07-21
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Existing scanning equipment involves complex and slow computations when stitching images, especially when the movement speed is slow.

Method used

By obtaining the offset between the first and second frame images, the gradient value and covariance matrix are used to determine whether the image is a straight line image. The offset is calculated and local matching is performed to reduce the amount of computation for full image matching.

Benefits of technology

It improves image stitching speed and accuracy, reduces computational load, and ensures stable and accurate image stitching even when the scanning device moves at high speeds.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115689952B_ABST
    Figure CN115689952B_ABST
Patent Text Reader

Abstract

The application provides an image processing method, a segmentation method, a medium and an electronic device. The image processing method comprises: acquiring a first frame image and a second frame image; acquiring a first offset; acquiring a second offset according to the first offset, the first frame image and the second frame image; and splicing the first frame image and the second frame image according to the first offset and the second offset. The image processing method can reduce the operation amount and is beneficial to improving the splicing speed.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to an image processing method, and more particularly to an image processing method, a segmentation method, a medium, and an electronic device. Background Technology

[0002] With the continuous development of technology, scanning devices are gradually becoming smaller and more intelligent. The working principle of existing scanning devices (such as miniature scanners, scanning pens, and reading pens) is as follows: the scanning device continuously scans the target object while moving, thereby obtaining multiple frames of images. Based on this, an image processor stitches the acquired multiple frames together to obtain a scanned image of the target object. However, in practical applications, the inventors have found that there are often overlapping areas between two or more consecutive frames acquired by the scanning device. Existing technologies typically perform full image matching when stitching frames, which increases computational load and reduces image stitching speed. Summary of the Invention

[0003] In view of the shortcomings of the prior art described above, the purpose of this invention is to provide an image processing method, segmentation method, medium, and electronic device to solve the problems of complex computation and low image stitching speed in the prior art.

[0004] To achieve the above and other related objectives, a first aspect of the present invention provides an image processing method, the image processing method comprising: acquiring a first frame image and a second frame image; acquiring a first offset; acquiring a second offset based on the first offset, the first frame image, and the second frame image; and stitching the first frame image and the second frame image together based on the first offset and the second offset.

[0005] In one embodiment of the first aspect, a method for obtaining the first offset includes: if the first frame image does not have a previous frame image, then the first offset is 0; if the first frame image has a previous frame image, then the first offset is the offset between the first frame image and its previous frame image.

[0006] In one embodiment of the first aspect, a method for obtaining the first offset includes: determining whether the first frame image and the second frame image are straight line images; and obtaining the first offset based on the determination result.

[0007] In one embodiment of the first aspect, the method for determining whether a frame image is a straight line image includes: the frame image being either the first frame image or the second frame image; obtaining the gradient values ​​of pixels in the frame image; obtaining a binarized gradient image based on the gradient values ​​of pixels in the frame image; obtaining a covariance matrix based on white pixels in the binarized gradient image; and determining whether the frame image is a straight line image based on the eigenvalues ​​of the covariance matrix.

[0008] In one embodiment of the first aspect, the method for obtaining the gradient value of the pixel at (x,y) in the frame image is G(x,y)=|dx(x,y)|+|dy(x,y)|, where dx(x,y)=I(x+1,y)-I(x,y), dy(x,y)=I(x,y+1)-I(x,y), and I(x,y) is the pixel value of the pixel at (x,y); and / or the method for obtaining the covariance matrix based on the white pixels in the binarized gradient image is C=[V0,V1,...,V N ]×[V0,V i ,...,V N ] T ,in, (X i ,Y i Let be the coordinates of the i-th white pixel. Let N be the average coordinates of each white pixel, and N be the number of white pixels in the binarized gradient image.

[0009] In one embodiment of the first aspect, the method for adjusting the first offset based on the judgment result includes: if the first frame image is not a straight image and the second frame image is a straight image, obtaining the starting point column of the overlapping region based on the vertical span of the white pixels in the first image, and obtaining the first offset based on the horizontal coordinate of the starting point column, wherein the first image is a binarized image of the first frame image; if the first frame image is a straight image and the second frame image is not a straight image, obtaining the ending point column of the overlapping region based on the vertical span of the white pixels in the second image, and obtaining the first offset based on the horizontal coordinate of the ending point column and the width of the second frame image, wherein the second image is a binarized image of the second frame image; if both the first frame image and the second frame image are straight images, obtaining the first offset based on the white region contour in the first image and the white region contour in the second image.

[0010] In one embodiment of the first aspect, the method for obtaining a second offset based on the first offset, the first frame image, and the second frame image includes: obtaining a sub-image of the first frame image, wherein the sub-image is located on the side of the first frame image away from the offset direction, and the width of the sub-image is determined by the difference between the width of the first frame image and the first offset; matching the sub-image with the second frame image, and obtaining the second offset based on the matching result.

[0011] In one embodiment of the first aspect, the method for matching the sub-image with the second frame image and obtaining the second offset based on the matching result includes: obtaining the cross power spectrum of the sub-image and the second frame image; obtaining the corresponding impulse response map based on the cross power spectrum; and obtaining the second offset based on the response value of the pixel in the impulse response map.

[0012] In one embodiment of the first aspect, after stitching the first frame image and the second frame image to obtain a stitched image, the image processing method further includes: using the second frame image as a new first frame image; obtaining a new second frame image, wherein the new second frame image refers to the next frame image of the new first frame image; obtaining a new first offset; obtaining a new second offset based on the new first offset, the new first frame image, and the new second frame image; and stitching the new second frame image with the stitched image based on the new first offset and the new second offset to obtain a new stitched image.

[0013] In one embodiment of the first aspect, after stitching the first frame image and the second frame image together, the image processing method further includes: obtaining connected regions in the stitched image, wherein the stitched image is obtained by stitching at least the first frame image and the second frame image together; obtaining the bounding rectangles of each of the connected regions; and segmenting the stitched image according to the bounding rectangles to obtain at least one image block, wherein each image block contains an integer number of the bounding rectangles.

[0014] In one embodiment of the first aspect, the method for segmenting the stitched image according to the circumscribed rectangle includes: obtaining a target rectangle according to the vertical position of the circumscribed rectangle, wherein the target rectangle refers to the circumscribed rectangle corresponding to the target row; selecting an integer number of the target rectangles on one side of the stitched image according to a preset width, and segmenting the stitched image according to the selection result to obtain one image block.

[0015] A second aspect of the present invention provides an image segmentation method, the image segmentation method comprising: acquiring an image to be segmented; acquiring a connected region in the image to be segmented; acquiring a bounding rectangle of the connected region; and segmenting the image to be segmented according to the bounding rectangle to obtain at least one image block, wherein each image block contains an integer number of the bounding rectangles.

[0016] A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image processing method according to any one of the first aspects of the present invention, and / or the image segmentation method according to the second aspect of the present invention.

[0017] A fourth aspect of the present invention provides an electronic device comprising: a memory storing a computer program; and a processor communicatively connected to the memory, wherein, when the computer program is invoked, the processor executes the image processing method according to any one of the first aspects of the present invention, and / or the image segmentation method according to the second aspect of the present invention.

[0018] As described above, the image processing method in one or more embodiments of the present invention has the following beneficial effects:

[0019] The image processing method can obtain a first offset and a second offset. Based on the first offset and the second offset, the total offset between the first frame image and the second frame image can be obtained. The stitching of the first frame image and the second frame image can then be achieved based on the total offset. Compared with existing technologies, this image processing method does not require full image matching of the first frame image and the second frame image, thus reducing computational load and improving stitching speed. Attached Figure Description

[0020] Figure 1A The flowchart shown is a specific embodiment of the image processing method described in this invention.

[0021] Figure 1B The image shown is a schematic diagram of a frame image in a specific embodiment of the image processing method described in this invention.

[0022] Figure 1C The image shown is a schematic diagram of a stitched image in a specific embodiment of the image processing method described in this invention.

[0023] Figure 2A The diagram shown is a detailed flowchart of step S12 in a specific embodiment of the image processing method described in this invention.

[0024] Figure 2B The image shown is an example of a straight line image in a specific embodiment of the image processing method described in this invention.

[0025] Figure 2C The diagram shows a detailed flowchart of step S121 of the image processing method described in this invention in a specific embodiment.

[0026] Figure 2D The image shown is an example of a frame image obtained in a specific embodiment of the image processing method described in this invention.

[0027] Figure 2E The image shown is an example of a binarized gradient image obtained in a specific embodiment of the image processing method described in this invention.

[0028] Figure 2F and Figure 2G The image shown is an example of a binarized image in a specific embodiment of the image processing method described in this invention.

[0029] Figure 2H The diagram shown is a detailed flowchart of step S122 in a specific embodiment of the image processing method described in this invention.

[0030] Figure 3A The diagram shows a detailed flowchart of step S13 in a specific embodiment of the image processing method described in this invention.

[0031] Figure 3B The image shown is a schematic diagram of a frame image in a specific embodiment of the image processing method described in this invention.

[0032] Figure 3C The diagram shown is a detailed flowchart of step S132 of the image processing method described in this invention in a specific embodiment.

[0033] Figure 3D The image shown is an example of an impact response map obtained in a specific embodiment of the image processing method described in this invention.

[0034] Figure 3E The diagram shows a detailed flowchart of step S1322 in a specific embodiment of the image processing method of the present invention.

[0035] Figure 3F The image shown is an example of a filtered image obtained in a specific embodiment of the image processing method described in this invention.

[0036] Figure 3G The flowchart shown is a key step of the image processing method described in this invention in a specific embodiment.

[0037] Figure 4A The flowchart shown is a key step of the image processing method described in this invention in a specific embodiment.

[0038] Figures 4B-4GThe image shown is a schematic diagram of a frame image in a specific embodiment of the image processing method described in this invention.

[0039] Figure 5 The flowchart shown is a key step of the image processing method described in this invention in a specific embodiment.

[0040] Figure 6A The image shown is an example of a stitched image obtained in a specific embodiment of the image processing method described in this invention.

[0041] Figure 6B The image shown is an example of a segmented image obtained from related technologies.

[0042] Figure 6C The flowchart shown is a key step of the image processing method described in this invention in a specific embodiment.

[0043] Figure 6D The image shown is an example of an outer rectangular frame obtained in a specific embodiment of the image processing method described in this invention.

[0044] Figure 6E The image shown is an example of a segmented image obtained by the image processing method described in this invention in a specific embodiment.

[0045] Figure 6F The diagram shows a detailed flowchart of step S63 in a specific embodiment of the image processing method described in this invention.

[0046] Figure 7 The flowchart shown is a specific embodiment of the image processing method described in this invention.

[0047] Figure 8 The flowchart shown is a specific embodiment of the image segmentation method described in this invention.

[0048] Figure 9 The diagram shown is a structural schematic of the electronic device described in a specific embodiment of the present invention.

[0049] Component designation explanation

[0050] 11 First frame image

[0051] 111 sub-images

[0052] 12 Second frame image

[0053] 900 electronic devices

[0054] 910 memory

[0055] 920 processor

[0056] 930 monitor

[0057] Steps S11 to S14

[0058] Steps S121~S122

[0059] Steps S1211~S1214

[0060] Steps S1221~S1223

[0061] Steps S131~S132

[0062] Steps S1321~S1323

[0063] Steps S13231~S13238

[0064] Steps S31 to S34

[0065] Steps S41 to S42

[0066] Steps S51 to S55

[0067] Steps S61 to S63

[0068] Steps S631~S632

[0069] S701~S712 Steps

[0070] Steps S81 to S84 Detailed Implementation

[0071] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that, unless otherwise specified, the following embodiments and features described therein can be combined with each other.

[0072] Existing technologies typically perform full-image matching when stitching frame images, which increases computational load and reduces image stitching speed, a problem that is particularly severe when the scanning device moves slowly. To address this issue, an embodiment of the present invention provides an image processing method; please refer to [link to relevant documentation]. Figure 1A The image processing method includes:

[0073] S11, acquire the first frame image and the second frame image, wherein the first frame image and the second frame image can be two consecutive frames scanned by the scanning device, or two frames with an interval of one or more frames.

[0074] S12, obtain the first offset, wherein the first offset is an estimated value used to roughly describe the actual offset between the first frame image and the second frame image.

[0075] S13, obtain a second offset based on the first offset, the first frame image, and the second frame image. The second offset is used to correct the first offset to obtain the total offset between the first frame image and the second frame image, which is the actual offset between them. Specifically, the total offset can be obtained by adding the first offset and the second offset, and the second offset can be positive or negative: when the second offset is positive, it indicates that the first offset is less than the actual offset, and the first offset needs to be corrected in the positive direction; when the second offset is negative, it indicates that the first offset is greater than the actual offset, and the second offset needs to be corrected in the negative direction.

[0076] S14, the first frame image and the second frame image are stitched together according to the first offset and the second offset.

[0077] Optionally, step S14 can obtain the total offset based on the first offset and the second offset, extract a sub-image with a width equal to the total offset from one side of the first frame image along the offset direction, and stitch this sub-image to the second frame image along the offset direction to obtain a stitched image of the first and second frames. Alternatively, extract a sub-image with a width equal to the total offset from one side of the second frame image away from the offset direction, and stitch this sub-image to the first frame image away from the offset direction to obtain a stitched image of the first and second frames. The offset direction is the opposite direction of the scanning device's movement direction, and is, for example, from left to right or from right to left. When the offset direction is from left to right, the side along the offset direction is the right side, and the side away from the offset direction is the left side; when the offset direction is from right to left, the side along the offset direction is the left side, and the side away from the offset direction is the right side.

[0078] For example, please see Figure 1B If the first offset obtained in step S12 is 1.5L and the second offset obtained in step S13 is 0.5L, then the total offset between the first frame image 11 and the second frame image 12 is 2L. Furthermore, Figure 1BThe scanning device moves from left to right, and therefore the offset direction is from right to left. Thus, a sub-image with a width of 2L can be extracted from the left side of the first frame image 11 and stitched to the left side of the second frame image 12 to obtain... Figure 1C The stitched image shown can also be obtained by extracting a sub-image with a width of 2L from the right side of the second frame image 12 and stitching it to the right side of the first frame image 11. Figure 1C The stitched image shown.

[0079] Optionally, step S14 may also obtain the total offset based on the first offset and the second offset, obtain the overlapping area between the first frame image and the second frame image based on the total offset, and stitch the second frame image into the first frame image in a manner that covers the overlapping area.

[0080] As described above, the image processing method of this embodiment can stitch the first and second frame images together without performing full image matching. Compared with existing technologies, this image processing method reduces computational load and increases image stitching speed. Furthermore, the image processing method enables more accurate matching during image stitching, resulting in a more accurate stitched image.

[0081] In particular, when the scanning device moves at a high speed, the non-overlapping area between the first and second frame images is large, which can lead to unstable stitching. The image processing method described in this embodiment has a high stitching speed, so the image processor can stitch each frame image in a timely manner, which helps to improve the accuracy of stitching and achieve stable stitching.

[0082] Optionally, after acquiring the first frame image and the second frame image, the image processing method in this embodiment further includes: performing perspective transformation pre-correction on the first frame image and the second frame image to make the text in the first frame image and the second frame image more balanced.

[0083] In one embodiment of the present invention, the first offset is obtained based on the first frame image and its previous frame image. The specific implementation method includes: if the first frame image does not have a previous frame image, then the first offset is 0; if the first frame image has a previous frame image, then the first offset is the offset between the first frame image and its previous frame image.

[0084] Please see Figure 2A In one embodiment of the present invention, the method for obtaining the first offset includes:

[0085] S121, determine whether the first frame image and the second frame image are straight line images. For example, when scanning paper documents using a scanning device, it often happens that one or more frames contain only horizontal or near-horizontal straight lines; such frame images are straight line images. Figure 2B As shown. It should be noted that in practical applications, the obtained straight line may be a horizontal straight line, an inclined straight line, or a vertical straight line, and the straight line may have inclination, horizontal displacement, or vertical displacement. Since the image processing method mainly focuses on the horizontal direction when obtaining the offset, this embodiment needs to determine whether the frame image contains only horizontal or approximately horizontal long straight lines through step S121, that is, to determine whether the frame image is a straight line image.

[0086] S122, obtain the first offset based on the judgment result. Specifically, when the first frame image and / or the second frame image are straight line images, the straight line portions in the first frame image and the second frame image can be considered to overlap. Therefore, the offset between the two can be obtained as the first offset based on the distribution of the straight line regions in the first frame image and the second frame image. When neither the first frame image nor the second frame image are straight line images, the first offset can be obtained based on the first frame image and its previous frame image, or a preset value can be selected as the first offset.

[0087] Optionally, please refer to Figure 2C In this embodiment, the method for determining whether a frame image (the first frame image or the second frame image) is a straight line image includes:

[0088] S1211, Obtain the gradient value of each pixel in the frame image. The gradient value of a pixel is used to identify the difference in pixel value between the pixel and its surrounding or adjacent pixels. Preferably, step S1211 can obtain the gradient value of each pixel in the frame image.

[0089] Optionally, for a pixel at coordinates (x,y) in a frame image, its gradient value is G(x,y)=|dx(x,y)|+|dy(x,y)|, where dx(x,y)=I(x+1,y)-I(x,y) represents the gradient of the pixel at coordinates (x,y) in the horizontal direction, dy(x,y)=I(x,y+1)-I(x,y) represents the gradient of the pixel at coordinates (x,y) in the vertical direction, and I(x,y) is the pixel value of the pixel at coordinates (x,y).

[0090] S1212, obtain a binarized gradient image based on the gradient values ​​of pixels in the frame image. Specifically, based on the relationship between the gradient value of each pixel and a gradient threshold, set the pixel value of each pixel to black (0) or white (255), wherein the gradient threshold can be set according to actual needs or experience. For example, please refer to... Figure 2D and Figure 2E ,in, Figure 2D The image shown is an example of the gradient image obtained in this embodiment. Figure 2E The image shown is an example of the corresponding binarized gradient image.

[0091] S1213, obtain the covariance matrix based on the white pixels in the binarized gradient image. Specifically, obtain white regions based on the white pixels in the binarized gradient image, and calculate the covariance matrix based on the coordinate set of points within the white regions. The covariance matrix is ​​used to reflect the relationship between different white pixels.

[0092] Optionally, the method for obtaining the covariance matrix C based on the white pixels in the binarized gradient image is C = [V0, V1, ..., V...]. N ]×[V0,V i ,...,V N ] T ,in, (X i ,Y i Let be the coordinates of the i-th white pixel. Let N be the average coordinates of each white pixel, and N be the number of white pixels in the binarized gradient image.

[0093] S1214, determine whether the frame image is a straight line image based on the eigenvalues ​​of the covariance matrix. Specifically, select a minimum eigenvalue t_min from the eigenvalues ​​of the covariance matrix, and determine whether the frame image is a straight line image based on the relationship between the minimum eigenvalue t_min and an eigenvalue threshold T_cov: if the minimum eigenvalue t_min is less than the eigenvalue threshold T_cov, then the frame image is a straight line image; otherwise, the frame image is not a straight line image. The eigenvalue threshold T_cov can be set according to actual needs or experience.

[0094] Optionally, in this embodiment, there are four combinations of whether the first frame image and the second frame image are straight line images. The first offset corresponding to each of these four combinations will be described in detail below.

[0095] If the first frame image is not a straight line image and the second frame image is a straight line image, then the starting point column of the overlapping area is obtained according to the vertical span of the white pixels in the first image, and the first offset is obtained according to the horizontal coordinate of the starting point column, wherein the first image is a binarized image of the first frame image.

[0096] Specifically, the binarized image of the first frame image is obtained as the first image, for example... Figure 2F As shown, along the offset direction (e.g.) Figure 2F Starting from the first column of the first image (from right to left), the vertical span of each white pixel in each column is obtained sequentially. When the vertical span of a white pixel in a column is greater than a span threshold, that column is the starting column of the overlapping region. The horizontal coordinate xi_bias of the starting column is obtained as the first offset. The span threshold can be set according to actual needs or experience.

[0097] Preferably, the span threshold is: Where max_span_y is the maximum span of white pixels in the vertical direction in the binarized gradient image corresponding to the first frame image. For example, the span of each column of white pixels in the vertical direction in the binarized gradient image corresponding to the first frame image can be obtained and a maximum value can be selected as max_span_y. T_cov is the feature value threshold and t_min is the minimum feature value.

[0098] If the first frame image is a straight line image and the second frame image is not a straight line image, then the endpoint of the overlapping region is obtained according to the vertical span of the white pixels in the second image, and the first offset is obtained according to the horizontal coordinate of the endpoint and the width of the second frame image, wherein the second image is a binarized image of the second frame image.

[0099] Specifically, the binarized image of the second frame image is obtained as the second image, for example... Figure 2G As shown, in the opposite direction of the offset direction (e.g.) Figure 2G Starting from the first column of the second image (from left to right), the vertical span of each white pixel in that column is obtained sequentially. When the vertical span of a white pixel in a column is greater than the span threshold corresponding to the first frame image, that column is the endpoint column of the overlapping region. The horizontal coordinate xi_bias of that endpoint column is obtained. The first offset is obtained based on the width img_w and xi_bias of the second frame image. For example, the first offset can be img_w minus xi_bias. The span threshold corresponding to the first frame image can be calculated using the formula for T_line mentioned above, or it can be an empirical value or a preset value.

[0100] If both the first frame image and the second frame image are straight line images, then the first offset is obtained based on the white region contours in the first image and the white region contours in the second image. For details, please refer to... Figure 2H One method for obtaining the first offset at this time includes:

[0101] S1221, obtain the outline of the white region in the first image, and obtain the maximum value max_x' and minimum value min_x' of the coordinates of the first white region outline in the horizontal direction along the opposite direction of the offset direction. For example, when the offset direction is from right to left, step S1221 obtains the maximum value and minimum value of the coordinates of the first white region outline on the left side of the first image in the horizontal direction as max_x' and min_x', respectively.

[0102] S1222, obtain the outline of the white region in the second image, and obtain the maximum value max_x and minimum value min_x of the coordinates of the first white region outline in the horizontal direction along the opposite direction of the offset direction. For example, when the offset direction is from right to left, step S1222 obtains the maximum value and minimum value of the coordinates of the first white region outline on the left side of the second image in the horizontal direction as max_x and min_x, respectively.

[0103] S1223, obtain the first offset based on the width img_w of the second frame image and the two maximum and two minimum values ​​mentioned above. Specifically, determine whether the first image and the second image satisfy the following conditions: If the conditions are met, the first offset is obtained based on max_x and max_x'. For example, the first offset can be max_x' - max_x. If the conditions are not met, the first offset is obtained in another way, such as obtaining the first offset based on the first frame image and its previous frame image, or selecting a preset value as the first offset. Here, α and β are two weight values, and their values ​​can be set according to actual needs. For example, α can be 0.75 and β can be 0.5.

[0104] If neither the first frame image nor the second frame image is a straight line image, the first offset can be obtained based on the first frame image and its previous frame image, or a preset value can be selected as the first offset.

[0105] As can be seen from the above description, this embodiment provides a method for obtaining the first offset. When the first frame image and / or the second frame image are straight line images, the method can obtain the first offset based on the distribution of the straight line (or line segment) region in the first frame image. The first offset obtained in this way is closer to the true offset and therefore has higher accuracy.

[0106] Please see Figure 3A In one embodiment of the present invention, the method for obtaining the second offset based on the first offset, the first frame image, and the second frame image includes:

[0107] S131, acquire a sub-image of the first frame image, wherein the sub-image is located on the side of the first frame image opposite to the offset direction, and the width of the sub-image is determined by the difference between the width of the first frame image and the first offset. Preferably, the width of the sub-image is the width of the first frame image minus the first offset. For example, please refer to... Figure 3B If the first offset is 1.5L, then a sub-image 111 with a width of 3.5L is selected on the right side of the first frame image 11.

[0108] S132, the sub-image is matched with the second frame image, and the second offset is obtained based on the matching result. For example, in Figure 3B In the process, after the sub-image 111 and the second frame image 12 are matched, the second offset 0.5L can be obtained by subtracting the length of the overlapping area 3L from the total length 5L of the second frame image and then subtracting the first offset 1.5L.

[0109] Optionally, please refer to Figure 3C In this embodiment, the method for matching the sub-image with the second frame image and obtaining the second offset based on the matching result includes:

[0110] S1321, Obtain the cross-power spectrum of the sub-image and the second frame image. Optionally, the cross-power spectrum is a normalized cross-power spectrum, and the method for obtaining the normalized cross-power spectrum is, for example: Wherein, F1(u,v) and F2(u,v) are the Fourier transforms of f1(x,y) and f2(x,y) respectively, f1(x,y) is the function representation of the first frame image, whose parameters are the coordinates of the points in the first frame image and whose function value is the pixel value of the corresponding point, and f2(x,y) is the function representation of the second frame image, whose parameters are the coordinates of the points in the second frame image and whose function value is the pixel value of the corresponding point.

[0111] S1322, Obtain the corresponding impulse response diagram based on the cross-power spectrum. Specifically, the impulse response diagram can be obtained by performing an inverse Fourier transform on the cross-power spectrum. For example, please refer to... Figure 3D The image shown is an example of an impact response diagram obtained in this embodiment.

[0112] S1323, obtain the second offset based on the response value of the pixel in the impact response map. For example, the pixel with the largest response value in the impact response map can be selected as the first pixel, and the distance from the first pixel to the center point of the impact response map can be obtained as the second offset.

[0113] Considering that directly selecting the pixel with the largest response value as the reference pixel in step S1323 may introduce errors, please refer to [link / reference]. Figure 3E In this embodiment, a preferred method for obtaining the second offset based on the response values ​​of pixels in the impact response map is as follows:

[0114] S13231, Obtain the first pixel in the impact response map, wherein the first pixel refers to the pixel with the largest response value in the impact response map. In practical applications, the first pixel can be obtained in the impact response map by traversal or other methods.

[0115] S13232, The impulse response map is filtered to obtain a filtered map, wherein the filtering is, for example, mean filtering, and the size of the filtered map can be the same as that of the impulse response map. (See also...) Figure 3F The image shown is an example of a filtered image obtained in this embodiment.

[0116] S13233, Obtain the second pixel in the filter graph, wherein the second pixel refers to the pixel with the largest response value in the filter graph. In practical applications, the second pixel can be obtained in the filter graph by traversal or other methods.

[0117] S13234, Obtain the third pixel in the impact response map, wherein the third pixel refers to the pixel in the impact response map that corresponds to the second pixel. For example, the third pixel can be a pixel in the impact response map that is at the same position as the second pixel.

[0118] S13235, obtain the total response value of all pixels within the first region, wherein the first region includes the first pixel. For example, a geometric region surrounding the first pixel, such as a 3×3 rectangular region, can be selected as the first region. Specifically, step S13235 can sum the response values ​​of all pixels within the first region to obtain the total response value of all pixels within the first region.

[0119] S13236, obtain the total response value of all pixels in the second region, wherein the second region includes the third pixel, and the shape, size, and position of the second region are the same as those of the first region. Specifically, step S13236 can sum the response values ​​of all pixels in the second region to obtain the total response value of all pixels in the second region.

[0120] S13237, a reference region is selected from the first region and the second region based on the total response value of all pixels in the first region and the total response value of all pixels in the second region. For example, the region with the largest total response value between the first region and the second region can be selected as the reference region.

[0121] S13238, the second offset is obtained based on the centroid coordinates of the reference region and the center coordinates of the impact response map. Specifically, if the reference region is the first region, the distance between the centroid of the first region and the center point of the impact response map is obtained as the second offset; if the reference region is the second region, the distance between the centroid of the second region and the center point of the filter map is obtained as the second offset.

[0122] As can be seen from the above description, steps S13231 to S13238 provide a method for obtaining the second offset, and the second offset obtained by this method has high accuracy.

[0123] Optionally, the actual image may develop moiré patterns after scaling, which could affect the accuracy of the second offset. For details on this issue, please refer to [link to relevant documentation]. Figure 3G The image processing method described in this embodiment further includes:

[0124] S31, a matching response value is obtained based on the total response value of all pixels within the reference area, and the width and height of the impact response map. The matching response value represents the degree of matching between the first frame image and the second frame image; a larger value indicates a higher degree of matching. In this embodiment, the matching response value is preferably... Wherein, sum_max is the total response value of all pixels in the reference area, and imgR_w and imgR_h are the width and height of the impact response map, respectively.

[0125] S32 determines whether the first frame image and the second frame image can be stitched together based on the matching response value and the second offset. Specifically, if the matching response value is greater than a response threshold and the second offset is greater than an offset threshold, then the first frame image and the second frame image are considered to be stitchable; otherwise, it is considered that the matching result of the first frame image and the second frame image has a large error and they cannot be stitched together. The response threshold and the offset threshold can be set according to actual needs or experience.

[0126] S33, if the first frame image and the second frame image can be stitched together, then the first frame image and the second frame image are stitched together according to the first offset and the second offset.

[0127] S34, if the first frame image and the second frame image cannot be stitched together, obtain the next frame of the second frame image as a new second frame image, and stitch the first frame image with the new second frame image. At this time, it is necessary to... Figure 1A The steps S12 to S14 shown are used to obtain a new first offset and a new second offset, and to stitch the first frame image and the new second frame image based on the new first offset and the new second offset.

[0128] As described above, this embodiment can determine whether to reselect a new second frame image based on the matching response value. This method can avoid stitching together mismatched frame images, thereby eliminating the interference of error factors such as moiré patterns, which is beneficial for obtaining a more accurate second offset.

[0129] Please see Figure 4A In one embodiment of the present invention, the offset direction is from right to left, and before acquiring the cross-power spectrum of the first frame image and the second frame image, the image processing method further includes:

[0130] S41, the left, top, and bottom sides of the first frame image and the second frame image are expanded.

[0131] S42, window the expanded first frame image and the second frame image, for example, add a Hamming window to the first frame image and the second frame image.

[0132] In this embodiment, step S41 expands the first frame image and the second frame image so that the windowing operation in step S42 does not affect the actual content of the first frame image and the second frame image. Furthermore, step S42, by windowing the first frame image and the second frame image, can prevent spectral leakage, thus enabling accurate acquisition of the cross-power spectrum of the first frame image and the second frame image.

[0133] It should be noted that when the offset direction is from left to right, step S41 can be modified to extend the right side, top and bottom of the first frame image and the second frame image.

[0134] Optionally, the method for expanding the left side of the first frame image in this embodiment includes: expanding the left side of the first frame image based on at least one column of pixels on the left side of the first frame image.

[0135] Specifically, the method for expanding the left side of the first frame image based on at least one column of pixels from the left side of the first frame image includes: copying at least one column of pixels from the left side of the first frame image at least once and then adding it to the left side of the first frame image. For example, please refer to... Figure 4B and Figure 4C ,in, Figure 4B An example image shown is of the first frame, containing pixels 11 to 89. Figure 4C This is an example image obtained by expanding the left side of the first frame image. Specifically, it shows... Figure 4B The first column of pixels is copied twice and added to the left side of the first frame image to complete the expansion of the left side of the first frame image. It should be noted that the above is only one example, but the invention is not limited thereto. For example, two or more columns of pixels from the left side of the first frame image can be copied and added to the left side of the first frame image. Furthermore, the number of times at least one column of pixels on the left side of the first frame image is copied can be set according to actual needs. Preferably, the width of the expanded area on the left side of the first frame image is 1 / 4 of the width of the first frame image.

[0136] Furthermore, the second frame image can also be implemented using a similar method as described above. Preferably, in order to improve the regional consistency and matching degree between the second frame image and the first frame image, in this embodiment, the left side of the second frame image can be expanded based on at least one column of pixels on the left side of the first frame image.

[0137] Specifically, one method for extending the left side of the second frame image based on at least one column of pixels from the left side of the first frame image includes: copying at least one column of pixels from the left side of the first frame image at least once and then adding it to the left side of the second frame image. For example, please refer to... Figure 4D and Figure 4E ,in, Figure 4D An example image shown is of the second frame, containing pixels 14 to 8C. Figure 4EThe image shown is an example of an image obtained by expanding the left side of the second frame image. Specifically, the first column of pixels in the first frame image is copied twice and then added to the left side of the second frame image. It should be noted that this is only one example, but the invention is not limited thereto. For example, two or more columns of pixels from the left side of the first frame image can be copied and added to the left side of the second frame image. Furthermore, the number of times at least one column of pixels from the left side of the first frame image is copied can be set according to actual needs. Preferably, the width of the expanded area on the left side of the second frame image is 1 / 4 of the width of the second frame image.

[0138] In addition, another implementation method for extending the left side of the second frame image based on at least one column of pixels on the left side of the first frame image includes copying the extended left area of ​​the first frame image to the left side of the second frame image.

[0139] Optionally, in this embodiment, the lower part of the first frame image is expanded based on the upper multi-row pixels in the first frame image, and the upper part of the first frame image is expanded based on the lower multi-row pixels in the first frame image. For example, please refer to... Figure 4F The bottom two rows of pixels in the first frame image can be copied to the top of the first frame image to expand the upper part of the first frame image, and the top two rows of pixels in the first frame image can be copied to the bottom of the first frame image to expand the lower part of the first frame image. It should be noted that the above is only one example, but the invention is not limited thereto. In practical applications, the top two or more rows of pixels in the first frame image can be copied to the bottom of the first frame image, or the bottom two or more rows of pixels in the first frame image can be copied to the top of the first frame image, depending on actual needs. Preferably, the height of the upper expansion area and / or the height of the lower expansion area of ​​the first frame image is 1 / 4 of the height of the first frame image.

[0140] Furthermore, in this embodiment, the lower part of the second frame image is expanded based on the upper multi-row pixels in the second frame image, and the upper part of the second frame image is expanded based on the lower multi-row pixels in the second frame image. The specific method is similar to that of the first frame image, and will not be described in detail here.

[0141] An example image obtained by expanding the left, top, and bottom of the first frame image in this embodiment is shown below. Figure 4GAs shown, windowing after expansion does not result in the loss of edge region information. Furthermore, this embodiment can expand the left side of the second frame image based on at least one column of pixels from the left side of the first frame image. This method can improve the matching degree between the expanded first and second frame images, thereby increasing the matching speed and stitching speed. Moreover, this method can also improve the matching score and stitching accuracy.

[0142] Please see Figure 5 In one embodiment of the present invention, after stitching the first frame image and the second frame image together, the image processing method further includes:

[0143] S51, the second frame image is used as the new first frame image.

[0144] S52, acquire a new second frame image, wherein the new second frame image refers to the next frame image after the new first frame image.

[0145] S53, obtain a new first offset, wherein the method for obtaining the new first offset is the same as in step S12 above.

[0146] S54, obtain a new second offset based on the new first offset, the new first frame image, and the new second frame image. The method for obtaining the new second offset is the same as in step S13 above.

[0147] S55, the new second frame image is stitched together with the stitched image according to the new first offset and the new second offset to obtain a new stitched image. Specifically, a sub-image can be extracted from the side of the new second frame image away from the offset direction and stitched onto the side of the current stitched image away from the offset direction to obtain a new stitched image, wherein the width of the sub-image is the sum of the new first offset and the new second offset.

[0148] It is understandable that after step S55, the above steps S51 to S55 can be executed repeatedly. In each iteration, the second frame image obtained in step S52 of the previous iteration is used as the new first frame image in step S51 of the current iteration. In this way, the frame images obtained by the scanning device are stitched together one by one to the stitched image, thereby obtaining the final stitched image.

[0149] In practical applications, stitching together frame images results in a long, strip-shaped stitched image, for example... Figure 6A As shown, the stitched image then needs to be segmented to obtain multiple image blocks, which are then sent to other modules, such as the text recognition module. However, in related technologies, when segmenting the stitched image, a single character is often split into two parts, for example... Figure 6B the character "Zhu" in it. Regarding this problem, please refer to Figure 6C , in an embodiment of the present invention, after splicing the first frame image and the second frame image, the image processing method further includes:

[0150] S61, obtaining connected regions in the spliced image, where the spliced image can be obtained by splicing the first frame image and the second frame image, or can be obtained by splicing the first frame image, the second frame image and one or more subsequent frames of images.

[0151] Optionally, the implementation method of obtaining the connected regions in the spliced image may include: obtaining the gradient map of the spliced image, and performing binarization processing on the gradient map. Thereafter, the contour of each independent block of the white region can be extracted in the gradient map by using the relevant algorithm of connected regions to obtain the connected regions in the spliced image. Preferably, after obtaining the white contour, independent blocks with smaller contours can also be deleted to reduce the influence of noise.

[0152] S62, obtaining the bounding rectangles of each of the connected regions. Specifically, the relevant algorithm of the bounding rectangle can be used to obtain the bounding rectangles of each of the connected regions. For example, please refer to Figure 6D , which shows an example diagram of the bounding rectangles obtained in this embodiment. Preferably, the row where the bounding rectangle is located can be determined according to the longitudinal position of the bounding rectangle, or the degree of overlap of adjacent rectangles in the longitudinal direction. In addition, bounding rectangles of different colors can also be used to represent different rows. Ideally, each of the bounding rectangles contains a complete character or punctuation mark.

[0153] S63, segmenting the spliced image according to the bounding rectangles to obtain at least one image block, where each of the image blocks contains an integer number of the bounding rectangles. For example, please refer to Figure 6E , which shows an example diagram of an image block obtained in this embodiment.

[0154] According to the above description, it can be known that this embodiment can ensure that the image blocks obtained after segmenting the spliced image contain an integer number of bounding rectangles, and thus can ensure that the text will not be split into two parts in the horizontal direction as much as possible, which is beneficial to the processing of the image blocks by other modules.

[0155] Optionally, please refer to Figure 6F , the implementation method of segmenting the spliced image according to the bounding rectangles includes:

[0156] S631, obtain the target rectangle based on the vertical position of the circumscribed rectangle, wherein the target rectangle refers to the circumscribed rectangle corresponding to the target row. Specifically, the target row can be specified by the user, or by default, it can be the row containing complete text in the spliced ​​image, for example... Figure 6B The first row is shown. The target rectangle can be obtained based on the relationship between the vertical position of the circumscribed rectangle and the vertical position of the target row.

[0157] S632, select an integer number of target rectangles on one side of the stitched image according to a preset width, and segment the stitched image according to the selection result to obtain one image block and a new stitched image. For example, it can be done in the opposite direction of the offset direction (e.g. Figure 6D From left to right, the distance between each target rectangle and the leftmost end of the stitched image is obtained sequentially. If the distance between a target rectangle and the leftmost end of the stitched image is greater than the preset width, then any vertical line between the right side of the previous target rectangle and the left side of the target rectangle is selected as the dividing line to divide the stitched image to obtain one image block and a new stitched image.

[0158] It is understandable that the above step S632 can be executed cyclically. Specifically, in each cycle, the new stitched image obtained in the previous cycle is used as the stitched image for the current cycle. An integer number of the target rectangles are selected on one side of the stitched image for the current cycle according to the preset width. The stitched image for the current cycle is then divided according to the selection result to obtain an image block and a new stitched image.

[0159] Please see Figure 7 In one embodiment of the present invention, the scanning device moves from left to right, and the image processing method includes:

[0160] S701, acquire a first frame image and a second frame image, wherein the first frame image and the second frame image are, for example, images of two adjacent frames. Optionally, after acquiring the first frame image and the second frame image, the image processing method further includes: performing perspective transformation pre-correction on the first frame image and the second frame image to make the text size in the first frame image and the second frame image more balanced.

[0161] S702, determine whether the first frame image and the second frame image are straight line images, and obtain the first offset based on the determination result. Specifically, this can be achieved by... Figure 2CThe steps S1211 to S1214 shown are used to determine whether the first frame image and the second frame image are straight line images. When the first frame image and / or the second frame image are straight line images, the first offset is obtained according to the distribution of the straight line area. Otherwise, the offset between the first frame image and its previous frame image is used as the first offset. When the first frame image does not have a previous frame image, the first offset is 0.

[0162] S703, a sub-image is obtained on the right side of the first frame image, the width of the sub-image being the width of the first frame image minus the first offset.

[0163] S704, the left, top, and bottom edges of the sub-image and the second frame image are expanded, and the expanded sub-image and the second frame image are windowed. Step S704 can be performed using... Figure 4A The extension is implemented in the manner shown in step S41.

[0164] S705, match the sub-image with the second frame image, and obtain the second offset based on the matching result. Step S705 can be implemented using... Figure 3A The steps shown in step S132 are implemented as described.

[0165] S706, the first frame image and the second frame image are stitched together according to the first offset and the second offset to obtain a stitched image.

[0166] S707, the second frame image is used as the new first frame image, and the next frame of the new first frame image is obtained as the new second frame image.

[0167] S708, obtain a new first offset and a new second offset, wherein the method of obtaining the new first offset is the same as in step S702, and the method of obtaining the new second offset is the same as in steps S703 to S705.

[0168] S709, the stitched image and the new second frame image are stitched together according to the new first offset and the new second offset to obtain a new stitched image.

[0169] S710, repeat steps S707 to S709. In each iteration, step S708 obtains the new second frame image from the previous iteration as the new first frame image for the current iteration.

[0170] S711, obtain the connected regions in the stitched image, and obtain the bounding rectangle of each connected region.

[0171] S712, the stitched image is segmented according to the circumscribed rectangle to obtain one or more image blocks.

[0172] It should be noted that steps S711 to S712 can be performed after the complete stitched image is acquired, or they can be performed simultaneously with steps S707 to S710. When performed simultaneously, steps S707 to S710 continuously stitch new image frames into the stitched image, while steps S711 to S712 continuously divide the stitched image into one or more image blocks and send them to other modules, thereby achieving synchronization of scanning and processing.

[0173] This invention also provides an image segmentation method; for details, please refer to [link to relevant documentation]. Figure 8 In one embodiment of the present invention, the image segmentation method includes: S81, acquiring an image to be segmented, wherein the image to be segmented is, for example, a stitched image acquired by a scanning device. Preferably, the image to be segmented is obtained using... Figure 1A or Figure 7 The image processing method shown is as follows: S82, obtain the connected regions in the image to be segmented. S83, obtain the bounding rectangles of the connected regions. S84, segment the image to be segmented according to the bounding rectangles to obtain at least one image block, wherein each image block contains an integer number of bounding rectangles.

[0174] Among them, the above steps S82 to S84 and Figure 6C Steps S61 to S63 are similar, except that step S84 can also be performed using... Figure 6F The steps S631 to S632 shown are implemented, and will not be elaborated on here to save space in the manual.

[0175] Based on the above description of the image processing method and the image segmentation method, the present invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement... Figure 1A or Figure 7 The image processing methods shown, and / or Figure 8 The image segmentation method shown.

[0176] Based on the above description of the image processing method and the image segmentation method, the present invention also provides an electronic device. Specifically, please refer to... Figure 9 The electronic device 900 includes a memory 910 and a processor 920. The memory 910 stores a computer program, and the processor 920 is communicatively connected to the memory 910 for executing the computer program. Figure 1A or Figure 7 The image processing methods shown, and / or Figure 8 The image segmentation method shown.

[0177] Optionally, the electronic device 900 further includes a display 930, which is communicatively connected to the memory 910 and the processor 920, and is used to display the relevant GUI interactive interface of the image processing method and / or image segmentation method.

[0178] Optionally, the electronic device is a scanning pen, which includes an imaging sensor and an image processor, wherein the imaging sensor is used to acquire frame images, and the image processor is used to employ... Figure 1A or Figure 7 The image processing method shown stitches together frame images and / or employs... Figure 8 The image segmentation method shown is used to segment a stitched image.

[0179] Optionally, the electronic device is a scanning pen, which includes a light source emitter, an optical imaging sensor, and an image processor. The light source emitter and the optical imaging sensor are used to acquire frame images optically, and the image processor is used to... Figure 1A or Figure 7 The image processing method shown stitches together frame images and / or employs... Figure 8 The image segmentation method shown is used to segment a stitched image.

[0180] Optionally, the scanning pen also includes a transparent dust cover.

[0181] The scope of protection for the image processing method and the image segmentation method described in this invention is not limited to the order of steps listed in this embodiment. Any solution implemented by adding, subtracting, or replacing steps in the prior art based on the principles of this invention is included within the scope of protection of this invention.

[0182] The image processing method provided in one or more embodiments of the present invention can achieve product-level stitching results by estimating inter-frame offset, expanding frame images, improving the calculation method of offset between two frames, and filtering inter-frame offset results. Under normal usage conditions, it is virtually error-free. Simultaneously, the image processing method can significantly reduce stitching time, reducing it to a few milliseconds on a single Cortex-A7 processor, ensuring real-time stitching performance.

[0183] Furthermore, the image processing method described above can significantly improve the matching accuracy of the image stitching process while reducing the amount of matching calculations.

[0184] In summary, this invention effectively overcomes the various shortcomings of the prior art and has high industrial application value.

[0185] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. An image processing method, characterized in that, The image processing method includes: Acquire the first frame image and the second frame image; Determine whether the first frame image and the second frame image are straight line images, and obtain the first offset based on the determination result; The second offset is obtained based on the first offset, the first frame image, and the second frame image; and The first frame image and the second frame image are stitched together based on the first offset and the second offset. The determination of whether the first frame image and the second frame image are straight line images includes: obtaining the gradient values ​​of pixels in the first frame image and the second frame image; obtaining a binarized gradient image based on the gradient values ​​of the pixels; obtaining a covariance matrix based on the white pixels in the binarized gradient image; and determining whether the frame image is a straight line image based on the eigenvalues ​​of the covariance matrix. The process of obtaining the first offset based on the judgment result includes: If the first frame image is not a straight line image and the second frame image is a straight line image, the starting point column of the overlapping area is obtained according to the vertical span of the white pixels in the first image, and the first offset is obtained according to the horizontal coordinate of the starting point column. The first image is a binarized image of the first frame image. If the first frame image is a straight line image and the second frame image is not a straight line image, the endpoint column of the overlapping area is obtained according to the vertical span of the white pixels in the second image, and the first offset is obtained according to the horizontal coordinate of the endpoint column and the width of the second frame image. The second image is a binarized image of the second frame image. If both the first frame image and the second frame image are straight line images, the first offset is obtained based on the white region contours in the first image and the white region contours in the second image.

2. The image processing method according to claim 1, characterized in that, Obtaining the first offset includes: If the first frame image does not have a previous frame image, then the first offset is 0; If the first frame image has a previous frame image, then the first offset is the offset between the first frame image and its previous frame image.

3. The image processing method according to claim 1, characterized in that: Obtain the frame image The method for calculating the gradient value of a pixel is as follows: ,in, , , for The pixel value of the pixel at that location; and / or The method for obtaining the covariance matrix based on the white pixels in the binary gradient image is as follows: ,in, , For the first The coordinates of the white pixel Here are the average coordinates of each white pixel. The number of white pixels in the binarized gradient image.

4. The image processing method according to claim 1, characterized in that, Obtaining the second offset based on the first offset, the first frame image, and the second frame image includes: Obtain a sub-image of the first frame image, wherein the sub-image is located on the side of the first frame image away from the offset direction, and the width of the sub-image is determined by the difference between the width of the first frame image and the first offset. The sub-image is matched with the second frame image, and the second offset is obtained based on the matching result.

5. The image processing method according to claim 4, characterized in that, Matching the sub-image with the second frame image and obtaining the second offset based on the matching result includes: Obtain the cross-power spectrum of the sub-image and the second frame image; The corresponding impact response diagram is obtained based on the cross power spectrum. The second offset is obtained based on the response value of the pixel in the impact response diagram.

6. The image processing method according to any one of claims 1 to 5, characterized in that, After stitching the first frame image and the second frame image to obtain the stitched image, the image processing method further includes: Use the second frame image as the new first frame image; Acquire a new second frame image, wherein the new second frame image refers to the frame image following the new first frame image; Get the new first offset; A new second offset is obtained based on the new first offset, the new first frame image, and the new second frame image; The new second frame image is stitched together with the stitched image based on the new first offset and the new second offset to obtain a new stitched image.

7. The image processing method according to any one of claims 1 to 5, characterized in that, After stitching the first frame image and the second frame image together, the image processing method further includes: Obtain connected regions in the stitched image, wherein the stitched image is obtained by stitching together at least the first frame image and the second frame image; Obtain the bounding rectangle of each of the connected regions; The stitched image is segmented according to the circumscribed rectangle to obtain at least one image block, wherein each image block contains an integer number of the circumscribed rectangles.

8. The image processing method according to claim 7, characterized in that, Segmenting the stitched image based on the circumscribed rectangle includes: The target rectangle is obtained based on the vertical position of the circumscribed rectangle, wherein the target rectangle refers to the circumscribed rectangle corresponding to the target row; An integer number of target rectangles are selected on one side of the stitched image according to a preset width, and the stitched image is divided according to the selection results to obtain one image block.

9. An image segmentation method, characterized in that, The image segmentation method includes: Obtain an image to be segmented, wherein the image to be segmented is a stitched image obtained by the image processing method according to any one of claims 1 to 8; Obtain the connected regions in the image to be segmented; Obtain the bounding rectangle of the connected region; The image to be segmented is segmented according to the bounding rectangle to obtain at least one image block, wherein each image block contains an integer number of the bounding rectangles.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by the processor, it implements the image processing method of any one of claims 1 to 8, and / or the image segmentation method of claim 9.

11. An electronic device, characterized in that, The electronic device includes: A memory that stores a computer program; The processor, which is communicatively connected to the memory, executes the image processing method of any one of claims 1 to 8 and / or the image segmentation method of claim 9 when the computer program is invoked.

Citation Information

Patent Citations

  • Image processing method and device

    CN109685060A

  • Image processing method and device

    CN113112398A