Water area flow measurement area splicing method, flow measurement method, device, terminal and medium

By calculating the pixel offset and rounding processing, high-precision splicing of wide water images is achieved, solving the problem of image splicing in water speed measurement, and improving the accuracy and efficiency of water flow measurement.

CN120318068BActive Publication Date: 2025-08-22SECOND INST OF OCEANOGRAPHY MNR
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510788417.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-06-13
Publication Date
2025-08-22
Estimated Expiration
2045-06-13

AI Technical Summary

Technical Problem

In the prior art, stable and stationary control points cannot be set on wide waters such as oceans, making it difficult to splice the water images, affecting the accuracy of the water speed measurement.

Method used

By acquiring the pixel offset of the water image of adjacent frames, the initial pixel offset is calculated using the movement rate and time interval of the acquisition device, and the stitching pixel offset is rounded with the smallest integer multiple to realize cross-frame stitching.

Benefits of technology

The water image can be stitched with high accuracy without stationary control points, improving the accuracy and efficiency of flow measurement in wide water areas.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120318068B_ABST
    Figure CN120318068B_ABST
Patent Text Reader

Abstract

The present application provides a method for splicing water area flow measurement, a flow measurement method, an apparatus, a terminal and a medium, wherein the method for splicing water area flow measurement includes: collecting multiple frames of water area images of the water area to be measured in a time sequence; determining the distance offset of the water area images corresponding to adjacent collection moments in the collection direction, and determining the initial pixel offset based on the distance offset; based on the initial pixel offset, obtaining the splicing pixel offset and the number of interval frames, and performing cross-frame splicing on each water area image based on the number of interval frames and the splicing pixel offset, so as to obtain a spliced ​​water area image with a larger range and more accurate splicing for water area speed measurement. Furthermore, before splicing each water area image, the flare area in each water area image is removed by cutting to ensure that there is no flare on the spliced ​​water area image, thereby improving the accuracy of subsequent water area flow measurement.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of video image processing, and relates to a video image speed measurement technology, and in particular to a water area flow measurement area splicing method, flow measurement method, device, terminal and medium. Background Art

[0002] Water velocity monitoring refers to the process of measuring and recording water flow velocity within a water area. It is of great significance to hydrological research, ecological and environmental protection, water conservancy project management, and shipping safety. Because flow velocities in natural waters often vary from area to area, it is usually necessary to measure the flow velocity over a larger area.

[0003] To measure flow over a large area, existing technologies typically capture video of the water area based on a specific trajectory. Each frame of the video is then stitched together based on preset static control points to create a large-scale stitched image of the water area, allowing the flow velocity to be calculated. However, for larger areas of water, such as the ocean, it's impossible to set stable, static control points on the water surface, making stitching the frames difficult. This, in turn, affects the accuracy of velocity measurements.

[0004] Therefore, how to achieve accurate splicing of each frame of image in a wide water video is a technical problem that needs to be solved urgently by those skilled in the art. Summary of the Invention

[0005] The purpose of the present application is to provide a water area flow measurement area splicing method, flow measurement method, device, terminal and medium, which are used to solve the problem in the prior art that the splicing of water area images usually requires setting static control points, which cannot be achieved in wide water areas such as the ocean.

[0006] In a first aspect, the present application provides a method for stitching a water area flow measurement area, comprising: based on a preset acquisition direction, continuously acquiring the water area to be measured using an acquisition device to obtain a time-series continuous multi-frame water area image; determining the distance offset of two frames of water area images corresponding to adjacent acquisition moments in the acquisition direction; based on the distance offset, determining the number of pixels corresponding to the distance offset as the initial pixel offset between the two frames of water area images corresponding to adjacent acquisition moments; obtaining the minimum integer multiple of the initial pixel offset so that the product of the initial pixel offset and the minimum integer multiple meets the rounding requirement, and obtaining the stitching pixel offset based on the product of the initial pixel offset and the minimum integer multiple; using the minimum integer multiple as the interval frame number, and performing cross-frame stitching on each of the water area images based on the interval frame number and the stitching pixel offset; wherein the interval frame number is the number of images spaced between the two stitched water area images; the stitching pixel offset is expressed as the number of pixels offset between the two stitched water area images, and the stitching pixel offset is an integer.

[0007] In one embodiment of the present application, the distance offset in the acquisition direction between the two frames of water images corresponding to adjacent acquisition moments is the spatial distance difference between the two frames of water images corresponding to adjacent acquisition moments; the method of determining the distance offset in the acquisition direction between the two frames of water images corresponding to adjacent acquisition moments, and based on the distance offset, determining the number of pixels corresponding to the distance offset as the initial pixel offset between the water images corresponding to adjacent acquisition moments, includes: obtaining the moving speed and acquisition time interval of the acquisition device to calculate the spatial distance difference between the two frames of water images corresponding to adjacent acquisition moments; obtaining the spatial resolution of each of the water images; and calculating the initial pixel offset based on the spatial distance difference and in combination with the spatial resolution of each of the water images.

[0008] In one embodiment of the present application, if the same still object exists in the water images corresponding to adjacent acquisition moments, the distance offset of the water images corresponding to the adjacent acquisition moments in the acquisition direction is the still object motion vector of the still object on the water images corresponding to the adjacent acquisition moments; the step of determining the distance offset of the water images corresponding to the adjacent acquisition moments in the acquisition direction, and based on the distance offset, determining the number of pixels corresponding to the distance offset as the initial pixel offset between the water images corresponding to the adjacent acquisition moments includes: respectively extracting the still object pixel distribution of the water images corresponding to the adjacent acquisition moments, and obtaining the still object motion vector based on the still object pixel distribution; and obtaining the initial pixel offset based on the still object motion vector.

[0009] In one embodiment of the present application, obtaining the minimum integer multiple of the initial pixel offset so that the product of the initial pixel offset and the minimum integer multiple meets the rounding requirement, and obtaining the spliced ​​pixel offset based on the product of the initial pixel offset and the minimum integer multiple, includes: calculating the product of the initial pixel offset and the current integer multiple based on the initial pixel offset; if the difference between the product and the nearest integer is less than or equal to a preset error value threshold, using the current integer multiple as the minimum integer multiple, using the nearest integer as the spliced ​​pixel offset, and using the difference as the error value; otherwise, incrementing the current integer multiple to obtain a new integer multiple, and recalculating the product of the initial pixel offset and the new integer multiple.

[0010] In one embodiment of the present application, the cross-frame stitching is a cyclic stitching process, which includes: obtaining the current cumulative error, the current stitched water image and the current number of stitching times; the cumulative error is the sum of the errors accumulated after each stitching, and the current stitched water image is a stitched image formed by stitching the water images of each frame; based on the interval frame number and the current number of stitching times, the order of the second water images to be extracted is determined according to the order of the first water images; based on the order, it is judged whether the second water image can be extracted, and if so, the corresponding water image is used as the second water image; if not, the stitching is stopped; the first water image is the water image with the highest order among the stitched water images; the sum of the current cumulative error and the error value corresponding to the current stitching is used as the current error value; if the current error value is greater than or equal to the compensation pixel threshold, the first stitching strategy is executed, otherwise, the second stitching strategy is executed; the current number of stitching times is incremented, a new number of stitching times is obtained, and the next stitching is executed.

[0011] In one embodiment of the present application, executing the first splicing strategy includes:

[0012] splicing the second water area image onto the current spliced ​​water area image based on the compensation pixel threshold and the splicing pixel offset to obtain a new spliced ​​water area image;

[0013] Obtaining a new cumulative error based on the compensation pixel threshold and the current error value;

[0014] The executing the second splicing strategy includes:

[0015] splicing the second water area image onto the spliced ​​water area image based on the splicing pixel offset to obtain a new spliced ​​water area image;

[0016] The current error value is used as the new accumulated error.

[0017] In one embodiment of the present application, stitching the second water area image onto the stitched water area image includes:

[0018] Obtain the stitching position of the second water image; perform flare detection on each of the water images to detect whether there is flare in each of the water images; if so, based on the spatial distribution of the flare, cut out and remove the flare area of ​​the water image to obtain a replacement image; based on the stitching position of the second water image, stitch the replacement image onto the stitched water image.

[0019] In a second aspect, the present application provides a method for measuring water flow, including: obtaining the corresponding water body movement amount in each area to be measured based on the stitched water area image; obtaining the corresponding water body flow time based on the movement rate and spatial resolution of the acquisition device, combined with the number of image rows corresponding to each of the areas to be measured; obtaining the water body flow velocity corresponding to each of the areas to be measured based on the water body movement amount and the water body flow time; the stitched water area image is an image stitched and obtained based on the water area flow measurement area stitching method as described above.

[0020] In a third aspect, the present application provides a water area flow measurement area splicing device, comprising a water area image acquisition module, an initial pixel offset acquisition module, a splicing pixel offset acquisition module and a water area image splicing module; the water area image acquisition module is used to continuously acquire the target water area using an acquisition device based on a preset acquisition direction to obtain a multi-frame water area image that is continuous in time sequence; the initial pixel offset acquisition module is used to determine the distance offset of two frames of water area images corresponding to adjacent acquisition moments in the acquisition direction; based on the distance offset, the number of pixels corresponding to the distance offset is determined as the initial pixel offset between the two frames of water area images corresponding to adjacent acquisition moments; the splicing pixel offset is used to obtain the multi-frame water area image that is continuous in time sequence; the initial pixel offset acquisition module is used to determine the distance offset of two frames of water area images corresponding to adjacent acquisition moments in the acquisition direction; based on the distance offset, the number of pixels corresponding to the distance offset is determined as the initial pixel offset between the two frames of water area images corresponding to adjacent acquisition moments; the initial pixel offset is used to obtain the multi-frame water area image that is continuous in time sequence ... The displacement acquisition module is used to obtain the minimum integer multiple of the initial pixel offset so that the product of the initial pixel offset and the minimum integer multiple meets the rounding requirement, and obtain the splicing pixel offset based on the product of the initial pixel offset and the minimum integer multiple; the water area image splicing module is used to use the minimum integer multiple as the interval frame number, and based on the interval frame number and combined with the splicing pixel offset, perform cross-frame splicing on each of the water area images; wherein the interval frame number is the number of images spaced between the two spliced ​​water area images; the splicing pixel offset is expressed as the number of pixels offset between the two spliced ​​water area images, and the splicing pixel offset is an integer.

[0021] In a fourth aspect, the present application provides a terminal comprising: a processor and a memory, wherein the memory is communicatively connected to the processor; the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the water area flow measurement area splicing method or the water area flow measurement method as described above.

[0022] In a fifth aspect, the present application provides a computer storage medium storing a computer program, which, when executed by a processor, implements the water area flow measurement area splicing method or water area flow measurement method as described above.

[0023] As described above, the present application provides a water area flow measurement area splicing method, flow measurement method, device, terminal and medium, which obtains each frame of water area image to be spliced ​​by the interval frame number, and based on the splicing pixel offset between each frame image, that is, the number of offset pixels, there is no need to set a static control point on the water surface, and each frame image can be spliced ​​with high splicing accuracy, thereby realizing high-precision flow measurement in wide water areas and achieving good water area flow measurement effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 Shown is a flow chart of a method for splicing water area flow measurement areas described in an embodiment of the present application.

[0025] Figure 2 Shown is a flow chart of a method for obtaining the initial pixel offset between two frames of water area images corresponding to adjacent acquisition moments as described in an embodiment of the present application.

[0026] Figure 3 Shown is a flow chart of a method for calculating the initial pixel offset between two frames of water area images corresponding to adjacent acquisition moments with a still object as described in an embodiment of the present application.

[0027] Figure 4 Shown is a flowchart of another method for calculating the initial pixel offset between two frames of water area images corresponding to adjacent acquisition moments when no still objects exist, as described in an embodiment of the present application.

[0028] Figure 5 Shown is a flow chart of a method for obtaining a splicing pixel offset according to an embodiment of the present application.

[0029] Figure 6 Shown is a flowchart of a single execution of cross-frame splicing according to an embodiment of the present application.

[0030] Figure 7 Shown is a flow chart of a first splicing strategy described in an embodiment of the present application.

[0031] Figure 8Shown is a flow chart of a second splicing strategy described in an embodiment of the present application.

[0032] Figure 9 Shown is a flow chart of a flare removal method described in an embodiment of the present application.

[0033] Figure 10 Shown is a flow chart of a method for measuring flow in water area described in an embodiment of the present application.

[0034] Figure 11 Shown is a structural schematic diagram of a water area flow measurement area splicing device described in an embodiment of the present application.

[0035] Figure 12 Shown is a structural schematic diagram of a terminal described in an embodiment of the present application.

[0036] Description of Reference Numerals

[0037] 51: Water area image acquisition module; 52: Initial pixel offset acquisition module; 53: Stitching pixel offset acquisition module; 54: Water area image stitching module; 50: Terminal; 61: Processor; 62: Memory; 621: Operating system; 622: Application; 63: User interface; 64: Network interface; 65: Bus system. DETAILED DESCRIPTION

[0038] The following describes the embodiments of the present application through specific examples. Those skilled in the art can easily understand other advantages and effects of the present application from the content disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments. The details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other unless they conflict.

[0039] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application. Therefore, the illustrations only show components related to the present application and are not drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component can be changed at will, and the component layout type may also be more complicated.

[0040] Existing methods for measuring water currents often require setting up static control points to stitch together images of a larger area for velocity measurement. However, for wider waters, such as oceans, it's difficult to set up stable control points on the surface, making it difficult to stitch together images of a larger area, resulting in poor water current measurement results.

[0041] In response to the technical problems existing in the prior art, the following embodiments of the present application provide a water area flow measurement area splicing method, flow measurement method, device, terminal and medium. By obtaining the splicing pixel offset between each frame image, each frame image is then spliced ​​to obtain a larger range of water area images for water area speed measurement. The stitched image has high accuracy and the stitching process is simple to operate, achieving a good water area flow measurement effect.

[0042] The following embodiments of the present application provide a water area flow measurement area splicing method, flow measurement method, device, terminal and medium, including but not limited to applications in water flow velocity measurement in wide water areas. The following description will take the water flow velocity measurement in the ocean as an example.

[0043] The technical solutions in the embodiments of the present application will be described in detail below with reference to the accompanying drawings in the embodiments of the present application.

[0044] like Figure 1 As shown, this embodiment provides a method for splicing water area flow measurement areas, including:

[0045] S100 , based on a preset acquisition direction, continuously acquire water areas to be measured using an acquisition device to obtain a multi-frame water area image with a continuous time sequence.

[0046] Specifically, the acquisition device passes through the water area to be measured based on the acquisition direction, and acquires video or images of the water area, and extracts a plurality of continuous frames of images therefrom as the water area images.

[0047] Exemplarily, the acquisition device is a drone or an airplane equipped with a camera, and the camera collects videos or images of the water area while the drone or airplane is in navigation.

[0048] In some optional embodiments, the acquisition device performs uniform linear motion when acquiring each of the water area images, i.e., it performs uniform linear flight along the acquisition direction, so as to facilitate recording the movement rate of the acquisition device, simplify the subsequent calculation process, and thus improve the splicing efficiency of the water area flow measurement area.

[0049] In some optional embodiments, the acquisition direction of the acquisition device is perpendicular to the horizontal plane, so as to reduce the geometric deformation of the acquired water area image, thereby improving the accuracy of splicing the water area flow measurement area.

[0050] S200, determining the distance offset in the acquisition direction between two frames of water area images corresponding to adjacent acquisition moments, and based on the distance offset, determining the number of pixels corresponding to the distance offset as the initial pixel offset between the water area images corresponding to adjacent acquisition moments.

[0051] The distance offset is used to characterize the offset distance between two frames of water area images corresponding to adjacent acquisition moments; and the initial pixel offset is used to characterize the number of pixels offset between two frames of water area images corresponding to adjacent acquisition moments.

[0052] Exemplarily, the distance offset is the spatial distance difference between two frames of water area images corresponding to adjacent acquisition moments, that is, the distance between the two frames of water area images corresponding to adjacent acquisition moments in actual geographic space. The initial pixel offset is obtained by obtaining the relative spatial position of each of the water area images through the movement of the acquisition device, thereby obtaining the degree of offset between each of the water area images, so as to calculate the spatial distance difference between the two frames of water area images corresponding to adjacent acquisition moments, and obtain the initial pixel offset based on the conversion relationship between the pixels of the water area image and the distance size in actual space.

[0053] Furthermore, the movement of the acquisition device includes but is not limited to parameters such as the flight altitude, focal length, pixel size, movement rate and acquisition time interval of the acquisition device. Specifically, based on the movement rate and acquisition time interval of the acquisition device, the degree of offset between the actual spaces corresponding to each of the water images is calculated, and based on the flight altitude, focal length and pixel size of the acquisition device, the conversion relationship between the pixels of the water image and the distance in the actual space is obtained, thereby calculating the initial pixel offset of the two frames of the water image corresponding to adjacent acquisition moments.

[0054] Alternatively, the distance offset is the image offset between two frames of water area images corresponding to adjacent acquisition moments. For example, for two frames of water area images corresponding to adjacent acquisition moments with the same still object, the distance offset in the acquisition direction between the two frames of water area images corresponding to the adjacent acquisition moments is the still object motion vector of the still object on the two frames of water area images corresponding to the adjacent acquisition moments.

[0055] Specifically, the spatial distance difference is obtained by obtaining the actual distribution of objects captured in each of the water images, and then obtaining the relative positions between the water images based on these objects, thereby obtaining the degree of offset between the water images, and calculating the initial pixel offsets of the two frames of water images corresponding to adjacent capture moments. It should be noted that in order to more intuitively represent the offset between the water images, the actual distribution of still objects captured in each of the water images, that is, the spatial distribution features include the still object pixel distribution corresponding to each of the water images, so as to obtain the degree of offset between the water images based on the still object pixel distribution corresponding to each of the water images.

[0056] Furthermore, it should be noted that, for calculating the initial pixel offset based on the movement of the acquisition device, since the acquisition device is affected by the airflow, it will cause slight fluctuations in the various parameters of the acquisition device, thereby causing slight deviations in the calculation of the initial pixel offset; and for obtaining the initial pixel offset based on the spatial distribution characteristics of the still life in each of the water images, since it is necessary to extract the still life in each of the water images, and for wider water areas, there are usually no fixed objects in the central area of ​​the water surface. Therefore, this method is usually suitable for collecting the water images of the shore area, and its applicability is poor.

[0057] In some optional implementations, in order to improve the applicability of the water area flow measurement area splicing method and further improve the accuracy of the water area flow measurement area splicing, as shown in FIG. Figure 2 As shown, the method for obtaining the initial pixel offset between the two frames of the water area image corresponding to the adjacent acquisition moments includes:

[0058] S210: Detect whether there is a still object in each of the water area images.

[0059] Specifically, the trained semantic segmentation model is used to determine whether there is a still object in each water image.

[0060] S220 , for each of the consecutive frames of the water area images having still objects, based on the still object condition of each of the water area images, calculating initial pixel offsets of two frames of the water area images corresponding to adjacent acquisition moments.

[0061] S230 , for each of the consecutive frames of the water area image without any still objects, based on the movement of the acquisition device, calculating the initial pixel offsets of two frames of the water area image corresponding to adjacent acquisition moments.

[0062] Based on this, this embodiment detects whether there is a still object in each of the water area images, and based on this, adopts different methods to calculate the initial pixel offset, thereby avoiding the inability to calculate the water area image corresponding to the central area of ​​the water surface, and avoiding the calculation of each of the water area images corresponding to the shore area being affected by the air flow, thereby improving the applicability of the water area flow measurement area splicing method while further improving the accuracy of the water area flow measurement area splicing, thereby achieving good water area flow measurement area splicing.

[0063] Specifically, for step S220, if Figure 3 As shown, it specifically includes:

[0064] S221 , extracting still object pixel distributions of two frames of water area images corresponding to adjacent acquisition moments, and obtaining still object motion vectors based on the still object pixel distributions.

[0065] The still life pixel distribution refers to the distribution of the pixels constituting the still life in the water image. For example, the pixels constituting the still life in the water image are extracted using a trained semantic segmentation model to serve as the still life pixel distribution. It should be noted that the process of extracting the still life pixel distribution can be performed simultaneously with step S210 to improve efficiency.

[0066] The still object motion vector is used to represent the offset of each still object pixel point between two frames of the water area image corresponding to adjacent acquisition moments.

[0067] Exemplarily, the method for obtaining a still-life motion vector includes obtaining the pixel coordinates of the still-life pixel in each of the water images, for example, by using a trained semantic segmentation model to obtain the pixel coordinates, and obtaining the still-life motion vector based on the positional difference between the pixel coordinates of two frames of the water image corresponding to adjacent acquisition moments. The pixel coordinates represent the position of the still-life pixel in the water image. That is, if the still-life pixel corresponds to the pixel in the nth row and mth column of the water image, the pixel coordinates are (n, m).

[0068] Alternatively, the method for obtaining the still object motion vector is to obtain it based on optical flow calculation. Specifically, the two frames of the water area image corresponding to the adjacent acquisition moments are input into the optical flow motion analysis software to obtain the motion vector. Exemplarily, the optical flow motion analysis software is DeepFlow. It should be noted that after splicing the water area images, the optical flow method is used to measure the flow. Based on this, the optical flow method is used to calculate and obtain the motion vector, which is unified before and after, which is conducive to avoiding the uncertainty caused by various errors caused by different operation mechanisms and improving the accuracy of water flow speed measurement in the water area.

[0069] S222: Obtain the initial pixel offset based on the still object motion vector.

[0070] Specifically, the still object motion vector is converted into the number of image pixels to serve as the initial pixel offset. Those skilled in the art should be aware of the conversion method between the motion vector and the number of image pixels, which will not be explained in detail in this embodiment.

[0071] For step S230, Figure 4 As shown, it specifically includes:

[0072] S231, obtaining the movement speed and acquisition time interval of the acquisition device to calculate the spatial distance difference between two frames of water area images corresponding to adjacent acquisition moments;

[0073] The acquisition time interval is the interval between the acquisition times of two adjacent image frames. Exemplarily, the acquisition time interval is the inverse of the frame rate of the acquisition device.

[0074] The spatial distance difference is used to represent the distance between two frames of water area images corresponding to adjacent acquisition times in actual geographic space.

[0075] Specifically, the spatial distance difference is the product of the moving speed of the acquisition device and the acquisition time interval.

[0076] It should be noted that the product of the movement rate and the acquisition time interval is actually the actual distance flown by the acquisition device when acquiring the water area images corresponding to adjacent acquisition moments, that is, the size of the offset between the water area images corresponding to adjacent acquisition moments in actual space.

[0077] S232, obtaining the spatial resolution of each of the water area images.

[0078] The spatial resolution refers to the distance represented by the side length of a single pixel in the water area image in actual space.

[0079] Exemplarily, the acquisition height, focal length, and pixel size of the acquisition device are obtained to calculate the spatial resolution. Specifically, the spatial resolution is calculated as follows: spatial resolution = (pixel size * flight height) / focal length. The pixel size refers to the size of a single photosensitive unit in the acquisition device, that is, the pixel size is the ratio of the physical size of the image captured by the acquisition device to the total number of pixels in the captured image.

[0080] S233: Calculate the initial pixel offset based on the spatial distance difference and in combination with the spatial resolution of each of the water area images.

[0081] Specifically, a ratio of the spatial distance difference to the spatial resolution is obtained as the initial pixel offset.

[0082] Since the spatial resolution represents the conversion relationship between pixels and the distance in the actual space, the actual distance can be converted into the number of pixels on the image through the spatial resolution to obtain the initial pixel offset.

[0083] S300: Obtain a minimum integer multiple of the initial pixel offset so that the product of the initial pixel offset and the minimum integer multiple meets the rounding requirement, and obtain a splicing pixel offset based on the product of the initial pixel offset and the minimum integer multiple.

[0084] The stitching pixel offset is represented by the number of pixels offset between the two stitched frames of the water area image, and the stitching pixel offset is an integer.

[0085] The rounding requirement is that the product of the initial pixel offset and the minimum integer multiple is an integer, or that the product of the initial pixel offset and the minimum integer multiple is approximately an integer.

[0086] It should be noted that, since the initial pixel offset between the two frames of the water area image corresponding to adjacent acquisition moments is usually not an integer, and the minimum unit of image movement is one pixel, stitching the water area images based on the initial pixel offset will produce a large error. In order to improve the accuracy of the stitching of the water area images, the stitching pixel offset represented as an integer is obtained for stitching, thereby improving the stitching accuracy of the water area images and achieving a better stitching effect.

[0087] Specifically, the method for obtaining the stitching pixel offset includes: based on the initial pixel offset, obtaining the product of the initial pixel offset and each integer multiple; if the product is an integer, taking the corresponding integer multiple as the minimum integer multiple, and taking the product of the initial pixel offset and the integer multiple as the stitching pixel offset.

[0088] To facilitate understanding by those skilled in the art, the following describes an example of how to obtain the stitching pixel offset.

[0089] Exemplarily, if the initial pixel offset is 1.5 pixels, then 2 times it is 3 pixels, that is, 2 times it is an integer, based on this, the minimum integer multiple is 2, and the stitching pixel offset is 3 pixels; if the initial pixel offset is 1.25 pixels, then 4 times it is 5 pixels, that is, 4 times it is an integer, based on this, the minimum integer multiple is 4, and the stitching pixel offset is 5 pixels.

[0090] It should be noted that, if the initial pixel offset is an integer, that is, 1 times it is an integer, then the minimum integer multiple is 1, and the splicing pixel offset is the initial pixel offset.

[0091] It should be noted that since the stitching pixel offset is an integer multiple of the initial pixel offset, the stitching pixel offset is actually the offset between the intervals between the frames. Based on this, when stitching images, it is necessary to extract the intervals between the frames and stitch them based on the stitching offset.

[0092] Furthermore, if the stitching pixel offset is an integer, the minimum integer multiple is larger. In this case, when stitching is performed based on the stitching pixel offset, the number of images spaced apart between the two water images to be stitched is large, and the direct overlapping area between the two water images is small or even does not exist, resulting in a poor stitching effect or inability to stitch. For example, if the initial pixel offset is 2.11 pixels, 100 times of which is 211 pixels, then the minimum integer multiple is 100, and the stitching pixel offset is 211 pixels. At this time, it is necessary to extract the water image for stitching every 100 frames of the water image, and the two frames of images are offset by 211 pixels for stitching, and the overlapping area is small. If the total number of pixels in a row or column of the water image to be stitched is less than 211, there is no overlapping area between the two frames of images, and stitching cannot be performed.

[0093] Based on this, in some optional implementations, the rounding requirement is that the product of the initial pixel offset and the minimum integer multiple is approximately an integer, such as Figure 5 As shown, the method for obtaining the splicing pixel offset may also include:

[0094] S310: Calculate, based on the initial pixel offset, the product of the initial pixel offset and the current integer multiple.

[0095] The current integer is an integer multiple of the initial pixel offset in the current calculation.

[0096] Exemplarily, the current integer has an initial value of 1 and is incremented after each calculation.

[0097] S320, if the difference between the product and the nearest integer is less than or equal to a preset error value threshold, the current integer multiple is used as the minimum integer multiple, the nearest integer is used as the splicing pixel offset, and the difference is used as the error value; otherwise, the current integer multiple is incremented to obtain a new integer multiple, and the product of the initial pixel offset and the new integer multiple is recalculated.

[0098] The closest integer is the integer with the smallest difference from the product. It should be noted that if there are two values ​​with the same difference from the product, the smaller or larger one is used as the closest integer. For example, if the product is 3.5, the closest integer is 3, or the closest integer is 4.

[0099] The error threshold is the maximum stitching error value that does not affect the stitching effect of the two frames. Those skilled in the art will be aware of the image stitching effect requirements and the specific principles and methods for setting the corresponding maximum error value based on these requirements. This embodiment does not provide a detailed explanation here. For example, the error threshold is 0.1 pixel, which is one-tenth the size of a single pixel.

[0100] Based on this, when the difference between the product of the initial pixel offset and the current integer multiple and the closest integer does not exceed the error value threshold, the current integer multiple is used as the minimum integer multiple, and the closest integer is used as the stitching pixel offset; when the difference between the product and the closest integer exceeds the error value threshold, the image stitching effect requirement is not met, the current integer is incremented to obtain a new integer multiple, that is, 1 is added to the current integer as a new integer multiple, the product and the closest integer are repeatedly obtained, and it is determined whether they meet the image stitching effect requirement.

[0101] Furthermore, since there is an error between the stitching pixel offset and the actual offset degree between the images, that is, there is an error between the stitching pixel offset and the integer multiple of the initial pixel offset, as each frame of image is stitched together, the error of the integer multiple of the initial pixel offset will be accumulated, resulting in poor subsequent image stitching effect. Based on this, in this embodiment, the difference between the product, that is, the integer multiple of the initial pixel offset, and the nearest integer is used as an error value to supplement the error in the image stitching process.

[0102] It should be noted that the error value may be positive or negative, wherein a positive value indicates that during the image stitching process, the stitching pixel offset is smaller than the actual image deviation, and when compensating for the image stitching, the stitching pixel offset should be increased; a negative value indicates that during the image stitching process, the stitching pixel offset is larger than the actual image deviation, and when compensating for the image stitching, the stitching pixel offset should be reduced.

[0103] S400 , taking the minimum integer multiple as the interval frame number, and performing cross-frame stitching on each of the water area images based on the interval frame number and in combination with the stitching pixel offset.

[0104] The interval frame number is the number of images between the two spliced ​​water area images.

[0105] Specifically, another frame of the water area image that is separated from the image to be stitched by the interval number of frames is obtained, and the obtained water area image is moved backward by the number of pixels of the stitching pixel offset to stitch the two images as a new second water area image, and the above steps are repeated until the stitching of all the water area images separated by the interval number of frames is completed.

[0106] For example, if the image to be stitched is the water image of the first frame, the interval frame number is 10, and the stitching pixel offset is 13, then the water image of the 11th frame is extracted as another image to be stitched, and the water image of the 11th frame is moved backward by 13 pixels, so that the first row of pixels of the water image of the 11th frame overlaps with the fourteenth row of pixels of the water image of the first frame for stitching, and so on, until the stitching of the water images separated by 10 frames is completed.

[0107] It should be noted that since there may be an error between the stitching pixel offset and the actual image deviation, that is, the difference between the product of the initial pixel offset and the number of interval frames and the stitching pixel offset is not 0, the difference is used as the error value. At this time, as each frame image is stitched together, the integer multiple errors of the initial pixel offset will be accumulated, resulting in poor subsequent image stitching effects. Based on this, in some optional implementations, such as Figure 6 As shown, the cross-frame stitching is a cyclic stitching process. When performing a single stitching, the water area image is stitched and the error is compensated based on the error value, including:

[0108] S410, obtaining the current cumulative error, the current stitched water area image, and the current stitching times.

[0109] The accumulated error is the sum of the accumulated errors after each stitching, and the current stitched water area image is a stitched image formed by stitching together the water area images of each frame.

[0110] It should be noted that the cross-frame stitching is actually a cyclic stitching process. In a single stitching process, this embodiment obtains the image to be stitched based on the current number of stitching times, and stitches the image to be stitched onto the stitched image that has been stitched based on the current accumulated error size, thereby completing this stitching.

[0111] S420, based on the interval frame number and the current number of stitching times, according to the order of the first water area images, determine the order of the second water area images to be extracted; based on the order, determine whether the second water area image can be extracted; if so, use the corresponding water area image as the second water area image; if not, stop stitching.

[0112] The order is used to represent the order of the water area images in a continuous plurality of frames of water area images.

[0113] Specifically, the order of the water images required for the current stitching is determined based on the product of the interval frame number and the current number of stitching times, combined with the order of the first water image. The first water image refers to the water image that is ranked first among the stitched water images, i.e., the water image ranked first during the first stitching. Those skilled in the art may set the first water image based on actual needs, and this embodiment does not impose any specific limitations thereon.

[0114] If the numerical value of the order of the water area image does not exceed the total number of the collected water area images, the corresponding water area image is acquired; otherwise, the water area image for stitching cannot be acquired and the stitching is stopped.

[0115] In order to facilitate those skilled in the art to understand the stitching process of the water area images described in this embodiment, a specific example will be used below to illustrate.

[0116] If the order of the first water image is 1, the order of the water image corresponding to the current stitching is the product of the interval frame number and the current stitching number plus 1. For example, if the total number of water images is 100, the interval frame number is 10 frames, and the current stitching number is 10, then the order of the water image required for the current stitching is 101. If the total number of water images is exceeded and the corresponding water image cannot be obtained for stitching, the stitching is stopped.

[0117] If the order of the first water image is 3, the order of the water image corresponding to the current stitching is the product of the interval frame number and the current stitching number plus 3. For example, if the total number of the water images is 300, the interval frame number is 10 frames, and the current stitching number is 10, then the order of the water image required for the current stitching is 103, which does not exceed the total number of the water images. The corresponding water image, that is, the 103rd frame of the water image, is obtained, and subsequent steps are performed for stitching.

[0118] S430: Taking the sum of the current accumulated error and the error value corresponding to the current splicing as the current error value.

[0119] The current error value is the sum of errors of the current splicing.

[0120] It should be noted that, since the current splicing also causes errors, the sum of the error value and the accumulated error is taken as the total error in the current splicing, that is, the current error value.

[0121] S440: If the current error value is greater than or equal to the compensation pixel threshold, execute the first stitching strategy; otherwise, execute the second stitching strategy; increment the current stitching count, obtain a new stitching count, and execute the next stitching.

[0122] The compensation pixel threshold is an integer. For example, the compensation pixel threshold is 1 pixel, that is, if the accumulated value of the current error value exceeds 1 pixel, the current stitching process is compensated for 1 pixel.

[0123] It should be noted that when the current error value is greater than or equal to the compensation pixel threshold, the error has accumulated to a larger value. Based on this, in the current stitching process, the error needs to be compensated. Specifically, the first stitching strategy is executed to compensate; similarly, when the current error value is less than the compensation pixel threshold, the error accumulation is small. Based on this, in the current stitching process, the error compensation is not satisfied, and the second stitching strategy is executed.

[0124] In some optional embodiments, such as Figure 7 Said first splicing strategy includes:

[0125] S441a: Based on the compensation pixel threshold and the stitching pixel offset, stitch the second water area image onto the current stitching water area image to obtain a new stitching water area image.

[0126] Based on the compensation pixel threshold and the stitching pixel offset, an actual movement value of the second water area image is obtained to move the second water area image backward by the actual movement value, thereby stitching the two images.

[0127] It should be noted that the current error value may be positive or negative, and its positive or negative value is consistent with the error value. If the current error value is positive, the sum of the compensation pixel threshold and the stitching pixel offset is used as the actual movement value of the second water area image; if the current error value is negative, the difference between the stitching pixel offset and the compensation pixel threshold is used as the actual movement value of the second water area image.

[0128] For ease of understanding, the image stitching process described in this embodiment will be described below with reference to specific examples.

[0129] Exemplarily, the compensation pixel threshold is 1 pixel. If the current error value is 1.5 pixels, the second water area image moves backward by the number of pixels of the stitching pixel offset and moves backward by 1 pixel, that is, the actual number of pixels moved backward is the sum of the stitching pixel offset and 1, that is, the actual movement value is the sum of the compensation pixel threshold and the stitching pixel offset; the compensation pixel threshold is 1 pixel. If the current error value is -1.5 pixels, the second water area image moves backward by the number of pixels of the stitching pixel offset and moves forward by 1 pixel, that is, the actual number of pixels moved backward is the difference between the stitching pixel offset and 1, that is, the actual movement value is the difference between the compensation pixel threshold and the stitching pixel offset.

[0130] S442a: Obtain a new accumulated error based on the compensation pixel threshold and the current error value.

[0131] Specifically, since in the current stitching process, the accumulated error in the image stitching process is compensated by obtaining the actual number of moving rows based on the compensation pixel threshold and the stitching pixel offset, it is necessary to re-obtain the accumulated error based on the current error value and the compensation pixel threshold for performing the next stitching.

[0132] Furthermore, the numerical value of the accumulated error is the difference between the numerical value of the current error value and the compensation pixel threshold, and the positive and negative values ​​of the accumulated error are consistent with the current error value.

[0133] In some optional embodiments, such as Figure 8 Said second splicing strategy includes:

[0134] S441b: Based on the stitching pixel offset, stitch the second water area image onto the stitched water area image to obtain a new stitched water area image.

[0135] Exemplarily, the compensation pixel threshold is 1 pixel. When the accumulated current error value is less than 1 pixel, this embodiment does not compensate for the current error value because it is impossible to shift the water area image by a non-integer number. Therefore, the second water area image is shifted backward by the stitching pixel offset to stitch the two images together.

[0136] S442b: Use the current error value as a new accumulated error.

[0137] Specifically, a new stitched water area image is obtained based on the stitched image, and the current error value is used as a new accumulated error to perform the next stitching.

[0138] It should be noted that, during the next stitching, the water area image to be obtained is actually an image that is separated from the water area image obtained currently by the interval number of frames. Based on this, the current stitching count is incremented, that is, the current stitching count is added by 1 to obtain a new current stitching count, so as to obtain a new water area image.

[0139] Based on this, the water area flow measurement area stitching method provided in this embodiment obtains the cumulative value of the error value and compensates for the cumulative error in the stitching process of each water area image, thereby avoiding the subsequent image stitching effect from deteriorating to maintain a good image stitching effect, which is beneficial to improving the stitched water area image based on the stitching to achieve high-precision water area image flow measurement.

[0140] It should be noted that the collection time of each of the water area images is during the day. When the light is strong, flares will appear on the water surface due to reflection and other factors. These flares do not change position with the flow of water, which has a great interference with the subsequent use of the optical flow method to obtain the water body motion quantity, resulting in inaccurate water body motion quantity, and thus affecting the accuracy of water area flow measurement. Based on this, in this embodiment, in steps S441a and S441b, when the second water area image is spliced ​​onto the spliced ​​water area image, it is also necessary to remove flares from the spliced ​​water area image to improve the accuracy of subsequent water area flow measurement.

[0141] In some optional embodiments, such as Figure 9 As shown, the method for removing the flare includes:

[0142] S4411: Obtain a stitching position of the second water area image.

[0143] Specifically, the stitching position of the second water area image is the relative position between the second water area image and the current stitching water area image. Specifically, for step S430, based on the compensation pixel threshold and the stitching pixel offset, the actual number of rows moved in the second water area image is obtained, and the second water area image is shifted backward by the actual number of rows moved, thereby obtaining the stitching position of the second water area image. Alternatively, for step S440, based on the stitching pixel offset, the actual number of rows moved in the second water area image is obtained, and the second water area image is shifted backward by the stitching pixel offset, thereby obtaining the stitching position of the second water area image.

[0144] S4412, performing flare detection on each of the water area images to detect whether there is flare in each of the water area images; if so, based on the spatial distribution of the flare, cutting out the flare area of ​​the water area image to obtain a replacement image.

[0145] The spatial distribution of the flares represents the distribution of the flares in the second water area image. Specifically, the flare cutting line is a cutting line set based on the detected spatial distribution of the flares. Based on the flare cutting line, the portion of the water area image containing the flares is removed to obtain the replacement image without the flares.

[0146] Optionally, based on the spatial distribution of the flare, a flare cutting line is obtained, and based on the flare cutting line, the flare area of ​​the water area image is removed to obtain a replacement image.

[0147] The flare cutting line is obtained by obtaining the spatial distribution of flares in each of the water images based on an OTSU threshold calculation method; and setting the flare cutting line based on the spatial distribution of the flares so that all flares in the water images that affect optical flow calculations are on the same side of the flare cutting line. Based on this, all flares in the water images can be removed according to the flare cutting line.

[0148] The replacement image is the portion of the water area image that does not contain flare. By replacing the corresponding second water area image with the replacement image for stitching, the stitched water area image that does not contain flare can be obtained.

[0149] S4413: Based on the stitching position of the second water area image, stitch the replacement image onto the stitched water area image.

[0150] Specifically, based on the stitching position of the second water area image, the replacement image is placed at the corresponding position. That is, since the replacement image is actually part of the second water area image, the replacement image is located at the corresponding position in the second water area image to perform a retrieval. Based on this, flare in the stitched water area image can be removed.

[0151] It should be noted that, since the stitched water area image is formed by stitching together multiple water area images, and there is a spatially continuous overlapping part between each stitched image, based on this, after the water area image is replaced by the replacement image, the stitched water area image remains intact, so as to facilitate subsequent water area flow measurement based on the stitched water area image.

[0152] It should be noted that, for ease of understanding, the flare removal method of this embodiment is numbered as S4411-S4413. In fact, the flare removal method of this embodiment is executed in the process of stitching the second water area image onto the stitched water area image in steps S441a and S441b, so as to replace the second water area image with the replacement image with flare removed for stitching.

[0153] On the other hand, Figure 10 As shown, the present application also provides a method for measuring flow in a water area, comprising:

[0154] S10, based on the spliced ​​water area image, obtaining the corresponding water body movement amount in each area to be measured.

[0155] Wherein, the method for obtaining the stitched water area image may refer to the aforementioned water area flow measurement area stitching method, which will not be described in detail in this embodiment.

[0156] The measured area refers to the area with similar flow rates in the stitched water area image. The water motion refers to the sum of the water motion vectors in the measured area. Based on the ratio of the sum of the water motion vectors to the elapsed time, the actual velocity obtained is the average velocity within the measured area.

[0157] The test area is the area of ​​overlap between the remaining images in the stitched water image, after removing the first and last frames. This is because each row of pixels in the first water image is summed a limited number of times during the optical flow calculation, resulting in a very short time. When calculating the water velocity using the water's motion vector, using this time as the divisor can easily lead to significant calculation errors. Therefore, each test area does not include the first water image. Similarly, each test area does not include the last water image.

[0158] Exemplarily, the water body motion amount is obtained by optical flow calculation. Specifically, the water body motion amount can be obtained by inputting the spliced ​​water area image into optical flow motion analysis software. Exemplarily, the optical flow motion analysis software is DeepFlow.

[0159] S20, based on the movement speed and spatial resolution of the acquisition device and the number of image rows corresponding to each of the areas to be measured, obtain the corresponding flow time of each water body.

[0160] Specifically, the spatial resolution characterizes the conversion relationship between the image and the actual space. The ratio of the movement rate of the acquisition device to the spatial resolution is the number of pixel rows that the acquisition device flies over per unit time.

[0161] Based on the ratio of the number of image rows corresponding to each of the areas to be measured to the number of pixel rows flown by the acquisition device per unit time, the water flow time corresponding to each of the areas to be measured can be obtained.

[0162] S30, obtaining the water flow velocity corresponding to each of the areas to be measured based on the corresponding water body movement amount and the water body flow time.

[0163] Specifically, the water flow rate is the ratio of the water movement amount to the water flow time, that is, by ratioing the water movement amount corresponding to each of the tested areas to the water flow time, the water flow rate corresponding to each of the tested areas can be obtained.

[0164] Based on this, this embodiment calculates the water flow velocity of each of the measured areas by the optical flow method, which is simple to operate. Moreover, since the range of the stitched water area image is large and the stitching accuracy is high, it is possible to achieve flow measurement in a larger range of water areas with high accuracy, so as to facilitate the monitoring of water flow velocity in wide water areas.

[0165] like Figure 11 As shown, a water area flow measurement area splicing device provided in this embodiment includes a water area image acquisition module 51 , an initial pixel offset acquisition module 52 , a splicing pixel offset acquisition module 53 and a water area image splicing module 54 .

[0166] The water area image acquisition module 51 is used to continuously acquire the water area to be measured using an acquisition device based on a preset acquisition direction to obtain a multi-frame water area image that is continuous in time sequence.

[0167] The initial pixel offset acquisition module 52 is used to determine the distance offset in the acquisition direction between two frames of water area images corresponding to adjacent acquisition moments; based on the distance offset, the number of pixels corresponding to the distance offset is determined as the initial pixel offset between the two frames of water area images corresponding to adjacent acquisition moments.

[0168] The splicing pixel offset acquisition module 53 is used to obtain the minimum integer multiple of the initial pixel offset so that the product of the initial pixel offset and the minimum integer multiple meets the rounding requirement, and obtain the splicing pixel offset based on the product of the initial pixel offset and the minimum integer multiple.

[0169] The water area image stitching module 54 is configured to use the minimum integer multiple as the interval frame number, and perform cross-frame stitching on each of the water area images based on the interval frame number and the stitching pixel offset.

[0170] Based on the same technical concept, the water area flow measurement area splicing method or water area flow measurement method provided in the embodiment of the present invention can be implemented on the terminal side or the server side.

[0171] like Figure 12FIG2 shows an optional hardware structure diagram of a terminal provided in an embodiment of the present invention. The terminal 50 can be a mobile phone, a computer, a tablet device, a personal digital assistant, a factory backend processing device, or the like. The terminal 50 includes at least one processor 61, a memory 62, at least one network interface 64, and a user interface 63. The various components in the device are coupled together via a bus system 65. It will be appreciated that the bus system 65 is used to enable communication between these components. In addition to a data bus, the bus system 65 also includes a power bus, a control bus, and a status signal bus.

[0172] The user interface 63 may include a display, a keyboard, a mouse, a trackball, a click gun, keys, buttons, a touch pad or a touch screen.

[0173] It will be appreciated that the memory 62 may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory may be a read-only memory (ROM) or a programmable read-only memory (PROM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM) and synchronous static random access memory (SSRAM). The memory featured in the embodiments of the present invention is intended to include, but is not limited to, these and any other suitable types of memory.

[0174] The memory 62 in the embodiment of the present invention is used to store various categories of data to support the operation of the terminal. Examples of these data include: any executable program for operating on the terminal 50, such as an operating system 621 and an application 622; the operating system 621 includes various system programs, such as a framework layer, a core library layer, a driver layer, etc., for implementing various basic services and processing hardware-based tasks. The application 622 can include various applications, such as a media player (MediaPlayer), a browser (Browser), etc., for implementing various application services. The water area flow measurement area splicing method or water area flow measurement method provided in the embodiment of the present invention can be included in the application 622.

[0175] The method disclosed in the above embodiment of the present invention can be applied to the processor 61 or implemented by the processor 61. The processor 61 may be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method can be completed by the hardware integrated logic circuit in the processor 61 or by instructions in the form of software. The above processor may be a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The processor 61 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiment of the present invention. The processor 61 may be a microprocessor or any conventional processor, etc. The steps of the accessory optimization method provided in the embodiment of the present invention can be directly embodied as being executed by a hardware decoding processor, or can be executed by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium, which is located in a memory. The processor reads the information in the memory and completes the steps of the above method in combination with its hardware.

[0176] In an exemplary embodiment, the terminal 50 may be configured to execute the aforementioned method using one or more application specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), or complex programmable logic devices (CPLDs).

[0177] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the program is called by a processor, the method for splicing water area flow measurement areas or the method for measuring water area flow provided by the present invention is implemented.

[0178] Among them, a computer-readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. The computer-readable storage medium can be, for example, (but not limited to) an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, and a mechanical encoding device.

[0179] The computer-readable program characterized herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. A network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.

[0180] To sum up, this application achieves flow measurement in a larger range of water areas by obtaining the stitching pixel offset between each frame image, that is, the number of offset pixels, to stitch each frame image, and the stitching accuracy is high, which makes the calculated water area flow accuracy also high, and has high industrial application value.

[0181] The descriptions of the processes or structures corresponding to the above figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0182] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Anyone skilled in the art may modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by one of ordinary skill in the art without departing from the spirit and technical concepts disclosed in this application shall be covered by the claims of this application.

Claims

1. A method for splicing water area flow measurement areas, characterized in that: include: Based on the preset acquisition direction, the acquisition device is used to continuously acquire the water area to be measured to obtain a multi-frame water area image with continuous time sequence; Determine the distance offset in the acquisition direction between two frames of water area images corresponding to adjacent acquisition moments; based on the distance offset, determine the number of pixels corresponding to the distance offset as the initial pixel offset between the two frames of water area images corresponding to adjacent acquisition moments; wherein the distance offset in the acquisition direction between the two frames of water area images corresponding to adjacent acquisition moments is the spatial distance difference between the two frames of water area images corresponding to adjacent acquisition moments; the determining the distance offset in the acquisition direction between the two frames of water area images corresponding to adjacent acquisition moments, and based on the distance offset, determine the number of pixels corresponding to the distance offset as the initial pixel offset between the water area images corresponding to adjacent acquisition moments, comprises: obtaining the moving speed and acquisition time interval of the acquisition device to calculate the spatial distance difference between the two frames of water area images corresponding to adjacent acquisition moments; obtaining the spatial resolution of each of the water area images; and calculating the initial pixel offset based on the spatial distance difference and in combination with the spatial resolution of each of the water area images; Obtaining a minimum integer multiple of the initial pixel offset so that a product of the initial pixel offset and the minimum integer multiple meets a rounding requirement, and obtaining a splicing pixel offset based on the product of the initial pixel offset and the minimum integer multiple; Taking the minimum integer multiple as the interval frame number, and performing cross-frame splicing on each of the water area images based on the interval frame number and in combination with the splicing pixel offset; Among them, the interval frame number is the number of images between the two frames of the water area image spliced ​​together; the splicing pixel offset is expressed as the number of pixels offset between the two frames of the water area image spliced ​​together, and the splicing pixel offset is an integer.

2. The method according to claim 1, characterized in that If the same still object exists in the water area images corresponding to adjacent acquisition moments, the distance offsets of the water area images corresponding to the adjacent acquisition moments in the acquisition direction are the still object motion vectors of the still object in the water area images corresponding to the adjacent acquisition moments; The step of determining a distance offset in the acquisition direction between the water area images corresponding to adjacent acquisition moments, and determining, based on the distance offset, a number of pixels corresponding to the distance offset as an initial pixel offset between the water area images corresponding to the adjacent acquisition moments, includes: extracting still object pixel distributions of the water area image corresponding to adjacent acquisition moments respectively, and obtaining still object motion vectors based on the still object pixel distributions; The initial pixel offset is obtained based on the still object motion vector.

3. The method according to claim 1, characterized in that The obtaining of the minimum integer multiple of the initial pixel offset so that the product of the initial pixel offset and the minimum integer multiple meets the rounding requirement, and obtaining the splicing pixel offset based on the product of the initial pixel offset and the minimum integer multiple includes: Calculate the product of the initial pixel offset and the current integer multiple based on the initial pixel offset; If the difference between the product and the nearest integer is less than or equal to a preset error value threshold, the current integer multiple is used as the minimum integer multiple, the nearest integer is used as the splicing pixel offset, and the difference is used as the error value; otherwise, the current integer multiple is incremented to obtain a new integer multiple, and the product of the initial pixel offset and the new integer multiple is recalculated.

4. The method according to claim 3, characterized in that The cross-frame splicing is a cyclic splicing process, which includes: Obtaining a current cumulative error, a current stitched water area image, and a current number of stitching times; the cumulative error being the sum of the accumulated errors of each stitching time, and the current stitched water area image being a stitched image formed by stitching together the completed frames of the water area image; Based on the interval frame number and the current number of stitching times, the order of the second water area images to be extracted is determined according to the order of the first water area images; based on the order, it is determined whether the second water area image can be extracted; if so, the corresponding water area image is used as the second water area image; if not, the stitching is stopped; the first water area image is the water area image that is ranked first among the stitched water area images; The sum of the current accumulated error and the error value corresponding to the current splicing is taken as the current error value; If the current error value is greater than or equal to the compensation pixel threshold, the first stitching strategy is executed; otherwise, the second stitching strategy is executed; The current splicing times are incremented to obtain a new splicing times, and the next splicing is performed.

5. The method according to claim 4, characterized in that The executing the first splicing strategy includes: splicing the second water area image onto the current spliced ​​water area image based on the compensation pixel threshold and the splicing pixel offset to obtain a new spliced ​​water area image; Obtaining a new accumulated error based on the compensation pixel threshold and the current error value; The executing the second splicing strategy includes: splicing the second water area image onto the spliced ​​water area image based on the splicing pixel offset to obtain a new spliced ​​water area image; The current error value is used as the new accumulated error.

6. The method according to claim 5, characterized in that The step of stitching the second water area image onto the stitched water area image includes: Obtaining a stitching position of the second water area image; performing flare detection on each of the water area images to detect whether there is flare in each of the water area images; if so, cutting and removing the flare area of ​​the water area image based on the spatial distribution of the flare to obtain a replacement image; Based on the stitching position of the second water area image, the replacement image is stitched onto the stitched water area image.

7. A method for measuring flow in a water area, characterized in that: include: Based on the spliced ​​water area images, the corresponding water movement amount in each test area is obtained; Based on the movement rate and spatial resolution of the acquisition device and the number of image rows corresponding to each of the areas to be measured, the corresponding flow time of each water body is obtained; Based on the amount of water movement and the flow time of each water body, obtaining the water flow velocity corresponding to each of the areas to be measured; The stitched water area image is an image stitched and obtained based on the water area flow measurement area stitching method according to any one of claims 1 to 6.

8. A device for splicing water area flow measurement, characterized in that: It includes a water area image acquisition module, an initial pixel offset acquisition module, a splicing pixel offset acquisition module and a water area image splicing module; The water area image acquisition module is used to continuously acquire the target water area using an acquisition device based on a preset acquisition direction to obtain multiple frames of water area images with a continuous time sequence; The initial pixel offset acquisition module is used to determine the distance offset of two frames of water area images corresponding to adjacent acquisition moments in the acquisition direction; based on the distance offset, determine the number of pixels corresponding to the distance offset as the initial pixel offset between the two frames of water area images corresponding to adjacent acquisition moments; wherein the distance offset of the two frames of water area images corresponding to adjacent acquisition moments in the acquisition direction is the spatial distance difference between the two frames of water area images corresponding to adjacent acquisition moments; the determining of the distance offset of two frames of water area images corresponding to adjacent acquisition moments in the acquisition direction, and based on the distance offset, determining the number of pixels corresponding to the distance offset as the initial pixel offset between the water area images corresponding to adjacent acquisition moments, includes: obtaining the moving speed and acquisition time interval of the acquisition device to calculate the spatial distance difference between the two frames of water area images corresponding to adjacent acquisition moments; obtaining the spatial resolution of each of the water area images; and calculating the initial pixel offset based on the spatial distance difference and in combination with the spatial resolution of each of the water area images; The splicing pixel offset acquisition module is configured to acquire a minimum integer multiple of the initial pixel offset so that a product of the initial pixel offset and the minimum integer multiple meets a rounding requirement, and acquire a splicing pixel offset based on the product of the initial pixel offset and the minimum integer multiple; The water area image stitching module is configured to use the minimum integer multiple as the interval frame number, and perform cross-frame stitching on each of the water area images based on the interval frame number and the stitching pixel offset; Among them, the interval frame number is the number of images between the two frames of the water area image spliced ​​together; the splicing pixel offset is expressed as the number of pixels offset between the two frames of the water area image spliced ​​together, and the splicing pixel offset is an integer.

9. A terminal, characterized in that: include: a processor and a memory, wherein the memory is communicatively connected to the processor; The memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal executes the water area flow measurement area splicing method according to any one of claims 1 to 6 or the water area flow measurement method according to claim 7.

10. A computer storage medium storing a computer program, wherein: When the computer program is executed by a processor, the water area flow measurement area splicing method according to any one of claims 1 to 6 or the water area flow measurement method according to claim 7 is implemented.

Citation Information

Patent Citations

  • Video image splicing method and device

    CN112819694A

  • A method and system for stitching multispectral images from unmanned aerial vehicles (UAVs) for water areas

    CN114936971A