Wave element correction method
By binarizing wave and grid images and removing outliers, combined with the pixel count change rate, the distortion problem in wave element calculation was solved, enabling fast and accurate acquisition of wave element data.
Patent Information
- Application Number
- CN202211271981.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-18
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2042-10-18
AI Technical Summary
Existing technologies for acquiring wave elements using image capture are easily affected by perspective and curvature distortion, resulting in low calculation accuracy and difficulty in accurately reproducing wave element parameters.
By binarizing the wave image and the grid image, outlier data at the intersection of grid lines is removed, and the corrected grid lines are obtained. The actual data of wave height and wavelength are calculated by combining the rate of change of the number of pixels on both sides of the grid where the wave height or wavelength is located.
It enables the rapid and accurate acquisition of corrected wave element data, reduces errors caused by image distortion, and improves calculation accuracy.
Smart Images

Figure CN115546064B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of photogrammetry technology, and in particular to a method for wave element correction. Background Technology
[0002] Ocean waves are a very common phenomenon in marine activities. In most cases, sea states are influenced by both wind and waves, but the external manifestations and internal mechanisms of wind and waves differ greatly. Under different coastal waters and meteorological conditions, wind and waves typically exhibit bimodal or multimodal patterns in the wave spectrum. The combined effect of both leads to changes in wave parameters such as wave direction, wave height, and wave period.
[0003] Wind waves are water surface fluctuations caused by the direct action of wind; this is an extremely complex process, and rigorous quantitative analysis is very difficult. Waves, on the other hand, are fluctuations formed after wind waves leave the area where the wind was blowing. Compared to wind waves, waves have a more regular shape, are more orderly arranged, have longer crests, and smoother surfaces, closely resembling the shape of a sine wave. They can be considered as the superposition of many sine wave components with unequal amplitudes, frequencies, propagation directions, and random initial phases.
[0004] Currently, many laboratory experimental systems for simulating real ocean waves, currents, and tides are being gradually improved. Small wave tanks, compared to large wave-generating tanks, offer advantages such as smaller footprint, lower cost, and easier mobility. Therefore, more and more small, open wave tanks are being used in laboratories. These tanks simulate different wave shapes through the reciprocating motion of mechanical wave-generating plates, providing the possibility for experimental research simulating the real ocean. For these laboratory experiments simulating real ocean waves, currents, and tides, calculations are performed through image capture; however, the actual size of the wave elements can vary depending on the imaging instrument and the shooting angle.
[0005] Therefore, when acquiring wave elements through photography, the resulting images often suffer from geometric distortion caused by perspective and curvature. Directly using such distorted standard mesh images for wave element calculations results in low accuracy. Various image processing methods have been proposed to address this issue, but most require extensive and complex calculations, consuming vast computational resources. They often fail to reliably reconstruct the image and do not accurately reproduce the wave element parameters. Instead, they correct the distorted mesh, causing the wave elements within the mesh to also become distorted, leading to errors in wave element data calculations. Summary of the Invention
[0006] Therefore, it is necessary to provide a wave element correction method that can quickly and accurately obtain corrected wave element data to address the above-mentioned technical problems.
[0007] A wave element correction method, the method comprising:
[0008] Binarize the wave image and the grid image to obtain wave lines and grid lines;
[0009] Based on the changes in pixel data across multiple width ranges along the length of each line within the grid, outlier data at grid line intersections is removed.
[0010] The corrected grid lines are obtained by using the coordinates of the two endpoints along the width direction of each line within the grid.
[0011] The rate of change of the number of pixels on both sides of the grid where the wave height or wavelength is located is obtained. Combined with the position of the wave height or wavelength in the grid and the number of pixels occupied, the wave height and wavelength data are obtained.
[0012] In one embodiment, the binarization of the wave image and the grid image is preceded by:
[0013] Convert the wave image into an RGB three-component grayscale image;
[0014] Convert the grid image to the HSV color model.
[0015] In one embodiment, the binarization of the wave image and the grid image to obtain wave lines and grid lines includes:
[0016] Set grayscale thresholds for the waves and the background, and set pixels with RGB values less than the grayscale threshold to black and pixels with RGB values greater than the grayscale threshold to white, thus obtaining the wave lines of the wave image;
[0017] By utilizing the difference in brightness between the black grid and the white background, the grid lines of the grid image are obtained by finding the point with the largest gradient in brightness data.
[0018] In one embodiment, removing abnormal data at grid line intersections based on changes in pixel data across multiple width ranges along the length of each line within the grid includes:
[0019] Obtain the number of pixels across multiple width ranges along the length of a line within a grid.
[0020] Extract the number of pixels that appear most frequently in the length direction of the line (an odd number of occurrences) as the standard width of the line;
[0021] Calculate the difference in the number of pixels between adjacent width ranges along the length of the line;
[0022] If the difference is greater than or equal to two, it is judged as abnormal data, and the nearest standard width is assigned to the abnormal data location.
[0023] In one embodiment, obtaining the corrected grid lines based on the coordinates of the two endpoints in the width direction of each line within the grid includes:
[0024] Obtain the coordinates of the two ends of multiple width ranges along the length of a line within a grid;
[0025] Calculate the center coordinates between the two points based on the coordinates of the pixels at both ends;
[0026] Connect the multiple center coordinates along the length of the line to obtain the centerline of the line;
[0027] By combining the centerlines of each line within the grid, the corrected grid lines are obtained.
[0028] In one embodiment, obtaining the corrected grid lines further includes:
[0029] Calculate the minimum distance from each point on the horizontal line to each point on the vertical line within the grid, and obtain the two points with the minimum distance;
[0030] Calculate the sum of the minimum distances from each point to the four points closest to the horizontal and vertical lines, respectively.
[0031] The intersection of the two lines can be determined by the magnitude of the sum of the two values.
[0032] In one embodiment, obtaining the rate of change of the number of pixels on either side of the grid where the wave height or wavelength is located includes:
[0033] Obtain the number of pixels on the two sides of the grid where the wave height or wavelength is located, and combine this with the change in the number of pixels from the left side to the right side to obtain the rate of change of the number of pixels per unit grid.
[0034] In one embodiment, obtaining wave height and wavelength data by combining the location of the wave height or wavelength within the grid and the number of pixels occupied includes:
[0035] Get the number of pixels whose wave height or wavelength is far from the side of the grid in which it is located;
[0036] By combining the rate of change in the number of pixels, the change in pixel length at the location of the wave height or wavelength can be obtained.
[0037] In one embodiment, the step of obtaining wave height and wavelength data by combining the location of the wave height or wavelength within the grid and the number of pixels occupied further includes:
[0038] By combining the pixel length of one side of the reference grid, the pixel length of the wave height or wavelength is obtained.
[0039] In one embodiment, the step of obtaining wave height and wavelength data by combining the location of the wave height or wavelength within the grid and the number of pixels occupied further includes:
[0040] By combining the pixel length at the location of the wave height or wavelength with the number of pixels occupied by the wave height or wavelength in the grid, the actual length of the wave height or wavelength in a single grid is obtained.
[0041] By combining the number of grids through which the wave height or wavelength passes, the actual length of the wave height or wavelength can be obtained.
[0042] The aforementioned wave element correction method highlights the wave lines and grid lines by binarizing the wave image and grid image. Then, based on the changes in pixel data within the width range along the length of each line in the grid, it removes abnormal data at the intersections of grid lines, ensuring that the grid lines do not have intersection coordinates that deviate from the straight line. Next, it obtains the center line of the grid lines to make the grid lines more refined. Finally, it combines the rate of change of the wave height or wavelength relative to the two sides of the grid to obtain the distortion ratio of the two sides of the grid. By using the number of pixels between the wave height or wavelength and the side of the grid where it is located, it obtains the pixel change at the grid position where the wave height or wavelength is located. Based on this change and the number of pixels and grids, it obtains the actual data of the wave height and wavelength. This method is accurate and fast in data calculation. Attached Figure Description
[0043] Figure 1 This is a step diagram of a wave element correction method according to an embodiment of this application;
[0044] Figure 2 This is a partial step diagram of a wave element correction method according to another embodiment of this application;
[0045] Figure 3 This is another part of the steps of the wave element correction method according to another embodiment of this application;
[0046] Figure 4 This is a structural layout diagram of the wave image and grid image acquisition method in a wave element correction method according to an embodiment of this application;
[0047] Figure 5 The wave image is captured in a wave element correction method according to an embodiment of this application.
[0048] Figure 6 This is the original grid image during the binarization process in the wave element correction method of one embodiment of this application;
[0049] Figure 7 This is a processed grid image from a wave element correction method according to an embodiment of this application;
[0050] Figure 8 This is a grid image composed of pixels after binarization processing in a wave element correction method according to an embodiment of this application;
[0051] Figure 9 This is a corrected grid intersection image from a wave element correction method according to an embodiment of this application.
[0052] Figure 10 This is a schematic diagram of wave crests and troughs in a wave element correction method according to an embodiment of this application;
[0053] Figure 11 This is a schematic diagram of the actual length of the corrected wave element in a wave element correction method according to an embodiment of this application. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0055] It should be noted that when a component is referred to as being "fixed to" or "set on" another component, it can be directly on the other component or there may be an intermediate component. When a component is considered to be "connected to" another component, it can be directly connected to the other component or there may be an intermediate component present. The terms "vertical," "horizontal," "upper," "lower," "left," "right," and similar expressions used in this application's specification are for illustrative purposes only and do not represent the only possible implementation.
[0056] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0057] In this application, unless otherwise expressly specified and limited, "above" or "below" the second feature can mean that the first feature is in direct contact with the second feature, or that the first feature and the second feature are in indirect contact through an intermediate medium. Furthermore, "above," "over," and "on top" the second feature can mean that the first feature is directly above or diagonally above the second feature, or simply indicates that the first feature is at a higher horizontal level than the second feature. "Below," "below," and "under" the second feature can mean that the first feature is directly below or diagonally below the second feature, or simply indicates that the first feature is at a lower horizontal level than the second feature.
[0058] Unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The term "and / or" as used in this application includes any and all combinations of one or more of the associated listed items.
[0059] like Figure 1 As shown, in one embodiment, a wave element correction method includes the following steps:
[0060] Step S110: Binarize the wave image and the grid image to obtain wave lines and grid lines. That is, set the grayscale value of the pixels in the image to 0 or 255, so that the entire image presents a clear visual effect of only black and white, in order to highlight the wave lines and grid lines.
[0061] Step S120 involves removing outlier data at grid line intersections based on the changes in pixel data across multiple width ranges along the length of each line within the grid. This is because horizontal and vertical lines intersect each other in the grid. When acquiring individual horizontal or vertical line data, some raised data from the intersection is retained, resulting in abnormally protruding pixels. If no outlier handling is performed at these intersections, the intersection coordinates will deviate significantly from the straight line.
[0062] Specifically, the system combines the number of pixels within multiple line width ranges along the grid line length direction with the changes in the number of pixels within multiple adjacent width ranges to make a judgment, thereby removing abnormal data at the intersection points.
[0063] Step S130: Based on the coordinates of the two endpoints along the width direction of each line within the grid, the corrected grid lines are obtained. This involves determining the centerline of the grid lines through their two edges, resulting in finer grid lines.
[0064] Step S140: Obtain the rate of change of the number of pixels on both sides of the grid where the wave height or wavelength is located, and combine the position of the wave height or wavelength in the grid with the number of pixels occupied to obtain the data of wave height and wavelength.
[0065] Specifically, by obtaining the rate of change of the wave height or wavelength relative to both sides of the grid, the distortion ratio of both sides of the grid can be determined. Then, by using the number of pixels between the wave height or wavelength and one side of the grid, the pixel change at the grid position of the wave height or wavelength can be determined. Based on this change and the number of pixels and grids, the actual data of the wave height and wavelength can be obtained.
[0066] The aforementioned wave element correction method highlights the wave lines and grid lines by binarizing the wave image and grid image. Then, based on the changes in pixel data within the width range along the length of each line in the grid, it removes abnormal data at the intersections of grid lines, ensuring that the grid lines do not have intersection coordinates that deviate from the straight line. Next, it obtains the center line of the grid lines to make the grid lines more refined. Finally, it combines the rate of change of the wave height or wavelength relative to the two sides of the grid to obtain the distortion ratio of the two sides of the grid. By using the number of pixels between the wave height or wavelength and the side of the grid where it is located, it obtains the pixel change at the grid position where the wave height or wavelength is located. Based on this change and the number of pixels and grids, it obtains the actual data of the wave height and wavelength. This method is accurate and fast in data calculation.
[0067] like Figure 2 and Figure 3 As shown, in one embodiment, a wave element correction method includes the following steps:
[0068] Step S210: Convert the wave image into an RGB three-component grayscale image.
[0069] Specifically, RGB is a widely used color system. R represents red, G represents green, and B represents blue. The RGB color system obtains various colors by superimposing the three color channels. During the process, information from the R, G, and B layers is first obtained. Then, the image is converted into an RGB three-component grayscale image. Subsequently, one component of the grayscale image is selected for processing. In the matrix, n*m represents the image size, and the numbers within the matrix represent the RGB values of each layer. The values range from 0 to 255, referring to the grayscale level of the image. The larger the value, the higher the grayscale level; that is, when all three layers are 255, it is white.
[0070] Step S220: Convert the grid image into the HSV color model.
[0071] Specifically, HSV (Hue, Saturation, Value) is a color space created based on the intuitive characteristics of color, also known as the hexagonal pyramid model. In this model, the parameters for color are hue (H), saturation (S), and value (V). Hue (H) is measured in angles, ranging from 0° to 360°, calculated counter-clockwise starting with red (0°), green (120°), and blue (240°). Saturation (S) represents how close a color is to a spectral color; it can be seen as the result of mixing a spectral color with white. The greater the proportion of the spectral color, the closer the color is to the spectral color, and the higher the saturation. High saturation results in a deep and vibrant color. Spectral colors have zero white light component, reaching their highest saturation. Typically, the value ranges from 0% to 100%, with higher values indicating more saturated colors. Value (V) represents the brightness of a color, typically ranging from 0% for black to 100% for white.
[0072] Formula for converting RGB to HSV:
[0073] R′=R / 255
[0074] G′=G / 255
[0075] B′=B / 255
[0076] C max =max(R′,G′,B′)
[0077] C min =min(R′,G′,B′)
[0078] Δ=C max -C min
[0079] Specifically, first, the RGB values are normalized by dividing the R, G, and B values by 255 to obtain percentages R′, G′, and B′, and then finding the maximum value C. max and minimum value C min And calculate the difference between the maximum and minimum values as Δ.
[0080] H calculation:
[0081]
[0082] Specifically, H represents the angle of rotation around the center point to distinguish colors, with a value ranging from 0° to 360°, calculated counterclockwise starting from red. The value of H has four cases: when the difference Δ between the maximum and minimum values is 0, when R′ is the maximum value, when G′ is the maximum value, and when B′ is the maximum value.
[0083] S calculation:
[0084]
[0085] Specifically, S is the ratio of the difference between the maximum and minimum values to the maximum value.
[0086] V calculation:
[0087] V = C max
[0088] Specifically, the value of V is the maximum value C among R′, G′, and B′. max .
[0089] It should be noted that the shooting method and structural arrangement of wave images and grid images are as follows: Figure 4 As shown; the captured wave image is as follows Figure 5 As shown.
[0090] Step S230: Set the grayscale thresholds for the waves and the background, and set the pixels with RGB values less than the grayscale threshold to black and the pixels with RGB values greater than the grayscale threshold to white, thereby obtaining the wave lines of the wave image.
[0091] Specifically, after converting the read wave image into an RGB three-component grayscale image, the image is binarized using the difference between the black waves and the white background. This polarizes the image colors, highlighting the boundaries and obtaining clear wave lines. For example, a grayscale threshold of 100 is initially determined for the waves and background. Pixels with RGB values less than 100 are set to black (0), and pixels with RGB values greater than 100 are set to white (255). After binarization, a wave image with distinct boundaries is obtained. Subsequently, the binarized image is analyzed. Starting from the top left corner of the image, the pixel value of each pixel is read from top to bottom and left to right. The coordinates of the first black pixel are found, obtaining the boundary point between the wave and the background in the first column of data. This process is repeated to obtain the coordinates of the first black pixel in each other column. Connecting these first black pixels yields the wave lines of the wave image.
[0092] Step S240: Utilizing the brightness difference between the black grid and the white background, the grid lines of the grid image are obtained by finding the point with the largest brightness data gradient.
[0093] Specifically, after converting the read RGB grid image to an HSV color model, the grid data is binarized using its lightness (V) space. For example, the lightness difference between the black grid and the white background in a grayscale image of a standard 2cm grid paper is first used to perform edge processing on the lightness data of the 2cm grid paper. The lightness data of the grid paper is approximated using the derivative of Roberts' algorithm, finding the points with the largest lightness gradient to locate edges, thus polarizing the image colors. The black grid lines in the grid paper are represented by white, and the background by black, thus obtaining clear grid lines. The original grid image during the binarization process is shown below. Figure 6 As shown, the processed grid image is as follows Figure 7 As shown.
[0094] The wave and grid images obtained through shooting and reading have too much interference. If the lines in the image are read directly, the result will be significantly different from the actual wave lines and grid. Therefore, it is necessary to eliminate the interference of factors such as the image background in the image so that the image becomes a simple wave curve and grid line.
[0095] It should be noted that the grid lines in a grid image are composed of multiple pixels, such as... Figure 8 As shown, since the correction of wave elements requires high-precision data, the standard grid paper used to determine the specific location of wave elements also needs to be further processed, that is, the center line of the grid line is obtained to represent the specific location of the grid.
[0096] First, the grid data is represented using horizontal and vertical lines. One approach is to traverse the entire grid from top to bottom and left to right. To extract the vertical lines, one can read a row of data from left to right, recording any white pixels as columns. However, at the intersections of horizontal and vertical lines, only the two ends of the table are identified, resulting in missing columns and discontinuous data. This can be addressed by truncating the data. For example, identify the leftmost and rightmost pixels of each vertical line, and the top and bottom pixels of each horizontal line, thus dividing the grid data into horizontal and vertical lines. The truncated horizontal and vertical lines are then processed separately, resolving the discontinuity at intersections. This method splits the complete grid data into multiple horizontal and vertical lines. However, at intersections, the boundaries between horizontal and vertical lines are difficult to distinguish, requiring further processing of each line.
[0097] Specifically, all horizontal and vertical line data are split to obtain individual lines. Since the camera's focus is on the center of the grid paper, as the lens's field of view increases, the aberrations of the same color light caused by the different refraction effects of different parts of the lens become more pronounced in the actual optical system. Different parts of an object at the same distance have different magnifications, resulting in distortion. Therefore, the edges of the grid paper will produce a certain degree of distortion, and the vertical and horizontal lines of the grid will also be tilted. The horizontal distance between each row of pixels that makes up the vertical line data will also be offset. If the horizontal and vertical line data are directly divided equally according to the number of lines to obtain individual lines, data may be missing at the intersections of the line segments, making it impossible to obtain complete data for the intersections. Therefore, taking the extraction of a single vertical line as an example, the minimum row coordinate x for extracting a single vertical line data can be used here. min and the maximum row coordinate x max The solution is to obtain the range of row coordinates [x] of the vertical line. min ,x max In this method, all vertical lines in the overall grid are divided into multiple independent vertical lines. At the intersection of each vertical line, some of the raised data from when the horizontal line passed through is retained. The error at the intersection of the horizontal and vertical lines will be further reduced, thereby reducing the amount of data to be calculated later.
[0098] It is important to note that there may be abnormally protruding pixels at the intersection of grid lines. If outliers are not handled at the intersections, the coordinates of the intersection points will deviate from the straight line.
[0099] Step S250: Obtain the number of pixels in multiple width ranges along the length of a line within the grid.
[0100] Specifically, the method of selecting the line width with the highest probability is used. For example, the width of a vertical line is composed of multiple pixels, so the number of pixels that make up the width of a vertical line is counted, that is, the number of pixels in each row of a vertical line is recorded from top to bottom as a1, a2, a3, ..., a n .
[0101] Step S260: Extract the number of pixels that appear most frequently in the length direction of the line (odd number) as the standard width of the line.
[0102] Specifically, the number of odd numbers that appear most frequently in the data is extracted as the standard width b1 of the vertical line.
[0103] It should be noted that if only the most frequent occurrences are extracted as the standard width without restricting odd or even numbers, the line will shift to the left or right, causing the position of the center line to change.
[0104] Step S270: Calculate the difference in the number of pixels in adjacent width ranges along the length of the line.
[0105] Specifically, subtract the column number of the leftmost pixel in the next row from the column number of the leftmost pixel in each row of the vertical line, e1, to obtain the horizontal distance difference between a row of the vertical line and the adjacent row, E1 = e1 - e2.
[0106] In step S280, if the difference is greater than or equal to two, it is determined to be abnormal data, and the nearest standard width is assigned to the abnormal data location.
[0107] Specifically, since the vertical lines are continuous, the absolute value of the horizontal distance difference E1 should normally be 0 or 1. 0 indicates no offset between the previous and next rows, while 1 indicates the previous row is offset to the left or right by one pixel compared to the next row. Therefore, data with a horizontal distance difference greater than or equal to 2 are considered abnormal data. The abnormal data is then removed by assigning the range of both ends of the nearest standard-width row to that row.
[0108] Step S290: Obtain the coordinates of the two ends of multiple width ranges along the length of a line within the grid.
[0109] For example, extract the leftmost coordinate of each row of a single vertical line. and the rightmost coordinate Extract the top coordinates of each column of a horizontal line. and the bottom
[0110] Step S2100: Calculate the center coordinates between the two points based on the coordinates of the pixels at both ends.
[0111] For example, take the leftmost coordinate. and the rightmost coordinate The average value can be used to obtain the coordinates of the midpoint. Take the coordinates of the topmost point and the lowest coordinate The average value can be used to obtain the coordinates of the midpoint.
[0112] Step S2110: Connect the coordinates of multiple centers along the length of the line to obtain the centerline of the line. That is, connect the coordinates of all the midpoints of each line.
[0113] Step S2120: Combine the centerlines of each line in the grid to obtain the corrected grid lines.
[0114] Step S2130: Calculate the minimum distance from each point on the horizontal line to each point on the vertical line within the grid, and obtain the two points with the minimum distance.
[0115] Specifically, the point where the corrected horizontal and vertical centerlines coincide is the intersection of the two lines. However, since some horizontal and vertical centerlines do not coincide, the minimum distance extraction method of the four nearest neighbors is used to solve this problem. First, for the non-coincident intersections, the minimum distance from each point on the horizontal line to each point on the vertical line is calculated, and the two points with the minimum distance are obtained and denoted as points on the horizontal line L1. and the point on vertical line L2
[0116] Step S2140: Calculate the sum of the minimum distances between two points and the four points closest to the horizontal and vertical lines, respectively.
[0117] Specifically, calculation The distances d1 and d2 from the two points closest to the horizontal line L1, and The distances d3 and d4 between the two points closest to the vertical line L2 are obtained. The sum of the minimum distances to the four closest points to the horizontal and vertical lines is D1 = d1 + d2 + d3 + d4, and so on, to calculate... The sum of the minimum distances to the four nearest points to the horizontal and vertical lines is D2.
[0118] Step S2150: Determine the intersection of the two lines based on the magnitude of the sum of the two sums.
[0119] Specifically, by comparing the values of D1 and D2, and obtaining the minimum value between D1 and D2, the point closest to the horizontal and vertical lines is found; this point is the intersection of the two lines. The intersection points within the corrected grid are shown below. Figure 9 As shown.
[0120] Step S2160: Obtain the number of pixels on the two sides of the grid where the wave height or wavelength is located, and combine the change in the number of pixels on the left side to the number of pixels on the right side to obtain the rate of change of the number of pixels in a unit grid.
[0121] Specifically, taking wave height as an example, wave height is the vertical distance between adjacent wave crests and troughs. In the extracted accurate wave line, the pixel coordinates (x1, y1) and (x2, y2) of the wave crests and troughs are obtained, and a certain wave height h1 = |y1 - y2| is obtained by subtracting them.
[0122] A standard grid consists of 2cm squares. When shooting the grid, the focus is on the center, so the squares at the center are not distorted. The number of pixels (n1) occupied by the 2cm square at the center is extracted from the video. The length of the square (r1) is 2cm. The actual length represented by a single pixel at the center is Z1 = r1 / n1, thus obtaining the conversion ratio of the square at the center. The wave height (h1) is calculated by multiplying the wave height (h1) by the conversion ratio (Z1), where H1 = h1 × Z1. Therefore, because the camera focus is on the center of the grid, as the lens field of view increases, the magnification of different parts of an object at the same distance varies, causing distortion. The squares at the center and edges of the grid are not completely consistent. Without further correction, the length of the wave element not at the center of the image calculated using this ratio will deviate from the actual wave element length. Therefore, further correction of the wave element data is necessary.
[0123] To calculate wave height, firstly, obtain the grid positions of adjacent crests and troughs. This involves extracting the nearest grid intersections to adjacent crests and troughs. Using the relative position of a crest or trough with the nearest intersection (e.g., if the nearest intersection is to the upper left of a crest), the grid containing that crest is composed of that nearest intersection, its first point to the right, its first point below, and its nearest point in the lower right corner), the grid position of the crest or trough is determined. Secondly, correct the grids traversed by the vertical distance between adjacent crests and troughs. The intersection of the vertical line containing the crest and the horizontal line containing the trough is one endpoint of the wave height. The distance between this endpoint and the crest is the wave height, and the grids traversed by this wave height are the grids to be corrected. Then, calculate the side length of each grid, which is the distance between the intersections of the grids. The distance between each grid and the intersection of the wave height is the wave height within that grid. Similarly, to calculate the wavelength, it is necessary to correct the squares traversed by the horizontal distance between two adjacent wave crests. That is, the intersection of the vertical line containing the first wave crest and the horizontal line containing the second wave crest is one endpoint of the wavelength. The distance between this point and the second wave crest is the wavelength, and the squares traversed by this wavelength are the squares that need to be corrected. (Refer to...) Figure 10 and Figure 11 .
[0124] The left side of the square has G1 pixels, and the square length is 2cm. Therefore, the length of each pixel on the left side of the square is g1cm, where g1 = 2 / G1. The right side of the square has G2 pixels, and the length of each pixel on the right side of the square is g2cm, where g2 = 2 / G2. Using the distance j1 pixels between the left and right sides of the square, we can obtain the rate of change α1 of the number of pixels on the left side to the number of pixels on the right side in a unit square:
[0125] α1=(g1-g2) / j1
[0126] Step S2170: Obtain the number of pixels whose wave height or wavelength is far from the side of the grid in which it is located.
[0127] For example, the distance d from the wave height data in each grid to the left side of the grid is calculated. h 1 pixel.
[0128] Step S2180: Combine the pixel number change rate to obtain the pixel length change at the position of the wave height or wavelength.
[0129] Specifically, using this distance d h The change in the length of each pixel in the column containing the wave height data, c1, can be obtained by multiplying it by the rate of change α1 from the number of pixels on the left side to the number of pixels on the right side of the unit square.
[0130] c1=α1×d h
[0131] Step S2190: Combine the pixel length of one side of the reference grid to obtain the pixel length of the wave height or wavelength.
[0132] Specifically, the wave height data has a pixel length c2 of its corresponding square:
[0133] c2 = c1 + g1
[0134] Step S2200: Combine the pixel length of the position of the wave height or wavelength with the number of pixels occupied by the wave height or wavelength in the grid to obtain the actual length of the wave height or wavelength in a single grid.
[0135] Specifically, the number of pixels occupied by the wave height in a single square is d. p Therefore, the actual length of the wave height in a single square is M1:
[0136] M1 = c2 × d p
[0137] Step S2210: Combine the number of grids through which the wave height or wavelength passes to obtain the actual length of the wave height or wavelength.
[0138] Specifically, if the wave height passes through n grids, then the actual length H2 of the wave height is:
[0139] H2=M1+M2+…+M n
[0140] Taking a set of data from actual correction processing as an example, the uncorrected wave height H1 = 12.4017 cm, while the actual wave height is H2 = 12.1871 cm. The deviation rate is calculated as (actual value - theoretical value) / theoretical value * 100%. Therefore, there is a 1.7609% error between the uncorrected and actual wave heights. Similarly, there is a 2.7622% error between the uncorrected and actual wavelengths. If the grid distortion during shooting is greater, the error will be even greater.
[0141] The aforementioned wave element correction method binarizes the wave and grid images to highlight the wave lines and grid lines. Then, based on the changes in the number of pixels and their differences across multiple width ranges along the length of each line within the grid, it removes outlier data at grid line intersections, ensuring that grid lines do not have intersection coordinates that deviate significantly from the straight line. Next, it acquires the centerline of the grid lines to refine them. For horizontal and vertical lines within the grid, it determines their intersection point by identifying the closest point between them. Finally, it combines the rate of change of wave height or wavelength relative to both sides of the grid to obtain the final grid line. The distortion ratio on both sides is obtained by measuring the number of pixels between the wave height or wavelength and the side of the grid where it is located. This yields the pixel change at the grid position of the wave height or wavelength. Based on this change and the number of pixels and grids, the actual data of the wave height and wavelength are obtained. This method can be applied to situations where high wave element data is required. It can quickly and accurately obtain corrected wave element data. Experimental data obtained by using this method is also more standardized and accurate. Wave element data can be directly obtained through visualization processing of physical simulations of wind and waves, so as to facilitate the observation, data acquisition and analysis of wind and waves.
[0142] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0143] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.
Claims
1. A wave element correction method characterized by, The method comprises: The wave image and the grid image are binarized to obtain wave lines and grid lines; According to the changes of pixel data of multiple width ranges in the length direction of each line in the grid, abnormal data at the intersection of the grid lines is removed; According to the coordinates of the two end points in the width direction of each line in the grid, the corrected grid lines are obtained; The pixel number change rate of the relative two sides of the grid where the wave height or wavelength is located is obtained, and the data of the wave height and wavelength are obtained by combining the position and the occupied pixel number of the wave height or wavelength in the grid.
2. The wave element correction method according to claim 1, characterized by, Before the wave image and the grid image are binarized, the method further comprises: The wave image is converted into an RGB three-component grayscale image; The grid image is converted into an HSV color model.
3. The wave element correction method according to claim 2, characterized by, The wave image and the grid image are binarized to obtain wave lines and grid lines, which comprises: The grayscale threshold of the wave and the background is set, the pixel points with an RGB value less than the grayscale threshold in the wave image are set to black, and the pixel points with an RGB value greater than the grayscale threshold are set to white, so that the wave lines of the wave image are obtained; By using the brightness difference between the black grid and the white background, the grid lines of the grid image are obtained by finding the point with the maximum brightness data gradient.
4. The wave element correction method according to claim 3, characterized by, According to the changes of pixel data of multiple width ranges in the length direction of each line in the grid, abnormal data at the intersection of the grid lines is removed, which comprises: The pixel number data of multiple width ranges in the length direction of a line in the grid are obtained; The pixel number with the most occurrences in the length direction of the line is extracted as the standard width of the line; The pixel number difference of adjacent width ranges in the length direction of the line is calculated; If the difference is greater than or equal to two, it is judged to be abnormal data, and the nearest standard width is assigned to the abnormal data.
5. The wave element correction method according to claim 4, characterized by, According to the coordinates of the two end points in the width direction of each line in the grid, the corrected grid lines are obtained, which comprises: The coordinates of the two end pixel points of multiple width ranges in the length direction of a line in the grid are obtained; The center coordinates between the two end pixel points are calculated according to the two end pixel point coordinates; The center coordinates of multiple width ranges in the length direction of the line are connected to obtain the center line of the line; The center lines of each line in the grid are combined to obtain the corrected grid lines.
6. The wave element correction method according to claim 5, characterized by, After the corrected grid lines are obtained, the method further comprises: The minimum distances from each point on the horizontal line to each point on the vertical line in the grid are calculated, and the two points with the minimum distances are obtained; The sum of the minimum distances of the four points closest to the horizontal line and the vertical line from the two points is calculated respectively; According to the size of the two sum values, the intersection of the two lines is judged.
7. The wave element correction method according to claim 6, characterized by, The pixel number change rate of the relative two sides of the grid where the wave height or wavelength is located is obtained, which comprises: The pixel number of the relative two sides of the grid where the wave height or wavelength is located is obtained, and the pixel number change rate in the unit grid is obtained by combining the change of the pixel number from the left side to the right side.
8. The wave element correction method according to claim 7, characterized by, The pixel number change rate of the relative two sides of the grid where the wave height or wavelength is located is obtained, which comprises: The pixel number of the relative two sides of the grid where the wave height or wavelength is located is obtained, and the pixel number change rate in the unit grid is obtained by combining the change of the pixel number from the left side to the right side. The pixel number change rate of the relative two sides of the grid where the wave height or wavelength is located is obtained, which comprises: The pixel number of the relative two sides of the grid where the wave height or wavelength is located is obtained, and the pixel number change rate in the unit grid is obtained by combining the change of the pixel number from the left side to the right side.
9. The wave element correction method according to claim 8, characterized by, The data of wave height and wavelength obtained by combining the position of wave height or wavelength in the grid and the number of occupied pixels further comprises: The pixel length of the position of wave height or wavelength obtained by combining the pixel length of one side of the referenced grid.
10. The wave element correction method according to claim 9, characterized by, The data of wave height and wavelength obtained by combining the position of wave height or wavelength in the grid and the number of occupied pixels further comprises: The actual length of wave height or wavelength in a single grid obtained by combining the pixel length of the position of wave height or wavelength and the number of pixels occupied by wave height or wavelength in the grid; The actual length of wave height or wavelength obtained by combining the number of grids passed by wave height or wavelength.
Citation Information
Patent Citations
Fisheye lens image distortion correction method and apparatus
CN106127701A
Binary image correction method based on morphology and grid construction
CN107194389A