Image-based curvature estimation method and related device
By allocating parallel computing threads to each pixel in the integral image on the device side and using a box convolutional unit to calculate the image normal curvature, the problems of long computation time and low efficiency in the prior art are solved, and fast and accurate image normal curvature calculation is achieved.
Patent Information
- Application Number
- CN202311327613.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-13
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2043-10-13
AI Technical Summary
Existing image-based curvature calculation methods are time-consuming and inefficient, especially in large-scale, high-resolution image scenarios where computational resources are heavily consumed, primarily due to their CPU usage.
On the device side, a thread for parallel computation of normal curvature is assigned to each pixel in the integral image. First and second-order partial derivatives are calculated using a box convolution, and the normal curvature of the image is calculated in combination with the normalized direction vector.
It achieves fast and accurate image-based curvature calculation, reduces computation time and memory access latency, and improves computational efficiency.
Smart Images

Figure CN117291963B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision technology, and in particular to an image-based curvature estimation method and related equipment. Background Technology
[0002] In differential geometry, normal curvature is a quantity that describes the degree of curvature of a surface in a certain direction. In computer vision, extending normal curvature to image processing, image normal curvature characterizes the degree of texture change along a certain direction within a pixel-centered square window (hereinafter referred to as a pixel window). Compared to gradient information describing the first derivative of image brightness changes, image normal curvature utilizes both the first and second derivatives, along with a given direction, to calculate the degree of curvature of the image surface along that direction—that is, the texture change characteristics along that direction. Therefore, compared to traditional low-level image features such as RGB color values / grayscale values, texture, edges, and first-order gradient information, image normal curvature provides richer and more abstract image feature information, theoretically capable of characterizing the texture change of a pixel window along any direction. Specifically, image curvature can express the local texture features (such as convexity, concavity, etc.) of a pixel window along a certain direction. It is a higher-level image texture feature with greater flexibility, which helps to achieve more accurate and robust computational image processing tasks, such as object recognition and segmentation, target detection, tracking, and 3D reconstruction.
[0003] However, higher-level image features often come with more computation and longer processing time, and image normal curvature is no exception. Calculating normal curvature requires calculating the second derivative of the pixel window and traversing the grayscale value of each pixel within the window. Therefore, the computational load is very large, and it increases with the size of the pixel window and the image resolution. It requires a lot of time and computing resources. Furthermore, in the current field of computer vision, the calculation of image normal curvature is mainly performed on the Central Processing Unit (CPU). Compared with the Graphics Processing Unit (GPU), the CPU's computing resources are relatively limited, making the CPU's calculation of the first and second derivatives of the image relatively time-consuming. This problem of image normal curvature calculation time becomes even more prominent in large-scale, high-resolution image scenarios.
[0004] In summary, existing image-based curvature calculation methods suffer from technical problems such as long computation time and low computational efficiency. Summary of the Invention
[0005] This invention provides an image normal curvature estimation method and related equipment, which aims to solve the technical problems of long calculation time and low efficiency of existing normal curvature calculation methods.
[0006] To achieve the above objectives, the present invention provides an image-based curvature estimation method, comprising:
[0007] Step 1: Assign a thread for parallel calculation of normal curvature to each pixel in the integral image corresponding to the target distribution network equipment image;
[0008] Step 2: Using each pixel in the integral image as the center, set the pixel window size to construct multiple pixel windows smaller than the target power distribution network equipment image, and construct the normalized direction vector of each pixel window in the target direction;
[0009] Step 3: Perform convolution on each pixel in the integral image using a box convolutional converter to calculate the partial derivatives in the first and second order directions.
[0010] Step 4: Combine the normalized direction vector, the partial derivatives of the first-order direction, and the partial derivatives of the second-order direction to calculate the normal curvature of the target distribution network equipment image in the target direction within the pixel window. The normal curvature is used to characterize the texture change features of the target distribution network equipment image in the target direction within the pixel window.
[0011] Furthermore, step 1 includes:
[0012] On the host side, the image of the target power distribution network equipment is converted into a normalized grayscale image using the image format conversion function of the OpenCV library;
[0013] The normalized grayscale image is converted into an integral image, which corresponds to the target power distribution network equipment image. The integral image stores the sum of the grayscale values of all pixels in the rectangular region formed by each pixel in the target power distribution network equipment image and the starting point at the top left corner of the image.
[0014] Copy the integral image by row and column, and store the copy results in an array on the device.
[0015] On the device side, a texture object is created for the integral image, and a thread is assigned to each pixel in the integral image for parallel computation of normal curvature.
[0016] Furthermore, creating a texture object for the integral map includes:
[0017] By employing linear filtering, element-type data reading mode, and wrap addressing mode, texture coordinates are mapped to arbitrary positions on the integral image, creating texture objects for the integral image.
[0018] Furthermore, assigning a thread to each pixel in the integral image for parallel computation of the normal curvature includes:
[0019] Set the thread block size; a thread block consists of multiple computing threads on the device side.
[0020] Set the grid size; the grid contains multiple thread blocks.
[0021] The index of the computation thread is set to the coordinates of each pixel, and a computation thread on the device is allocated to each pixel to calculate the normal curvature.
[0022] Furthermore, step 4 includes:
[0023] Centered on each pixel, set the length and width of the pixel window to a preset size to construct multiple pixel windows smaller than the target power distribution network equipment image;
[0024] Construct a normalized direction vector for each pixel window in the target direction;
[0025] The integral image is input into a box convolutional module. Convolution is performed on each pixel in the integral image and the texture object is found. The partial derivatives in the first x direction, the first y direction, the second x direction, the second yy direction, and the second xy direction are calculated respectively.
[0026] By simultaneously solving the normalized direction vector, the first-order partial derivatives in the x-direction, the first-order partial derivatives in the y-direction, the second-order partial derivatives in the x-direction, the second-order partial derivatives in the y-direction, and the second-order partial derivatives in the xy-direction, the normal curvature of the target distribution network equipment image in the target direction within the pixel window is obtained.
[0027] Furthermore, the integral image is input into a box convolutional module. Convolution is performed on each pixel in the integral image, and the texture object is located. The partial derivatives in the first x-direction, first y-direction, second x-direction, second yy-direction, and second xy-direction are calculated respectively, including:
[0028] The box convolution is square, and the coordinates of the top left pixel of the box convolution are defined as (0, 0);
[0029] The integral image is input into a box convolutional module. The box convolutional module performs a convolution operation on each pixel in the integral image and finds the texture object to obtain the first-order partial derivative I in the x-direction. x The first-order partial derivative in the y-direction I y Second-order partial derivatives I in the x-direction xx The second-order partial derivative I in the y-direction yy Second-order partial derivatives I in the xy direction xy .
[0030] Furthermore, the normal curvature of the pixel window in the target direction is:
[0031]
[0032] Among them, NC uv Let (u,v) represent the normalized curvature, and I represent the normalized direction vector. x I represents the first-order partial derivative in the x-direction. y I represents the first-order partial derivative in the y-direction. xx I represents the second-order partial derivative in the x-direction. yy I represents the second-order partial derivative in the y-direction. xy This represents the second-order partial derivative in the xy direction.
[0033] The present invention also provides an image-based curvature estimation device, comprising:
[0034] The allocation module is used to allocate threads for parallel computation of normal curvature to each pixel in the integral graph corresponding to the target distribution network equipment image;
[0035] The module is used to construct multiple pixel windows smaller than the target power distribution network equipment image, centered on each pixel point in the integral image and setting the pixel window size, and to construct the normalized direction vector of each pixel window in the target direction.
[0036] The processing module is used to perform convolution processing on each pixel in the integral image using a box convolutioner, and to calculate the partial derivatives in the first and second order directions.
[0037] The calculation module is used to simultaneously normalize the direction vector, the partial derivatives of the first-order direction, and the partial derivatives of the second-order direction to calculate the normal curvature of the target distribution network equipment image in the target direction within the pixel window. The normal curvature is used to characterize the texture change features of the target distribution network equipment image in the target direction within the pixel window.
[0038] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements an image-based curvature estimation method.
[0039] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement an image-based curvature estimation method.
[0040] The above-described solution of the present invention has the following beneficial effects:
[0041] This invention allocates a thread for parallel calculation of normal curvature to each pixel in the integral image corresponding to the target power distribution network equipment image; constructs multiple pixel windows smaller than the target power distribution network equipment image, centered on each pixel in the integral image, and constructs a normalized direction vector for each pixel window in the target direction; performs convolution processing on each pixel in the integral image using a box convolutioner to calculate the partial derivatives in the first and second directions; and calculates the normal curvature of the target power distribution network equipment image in the target direction within the pixel window. The normal curvature is used to characterize the texture change features of the target power distribution network equipment image in the target direction within the pixel window. Compared with the prior art, this invention deploys the creation of the integral image and the calculation of normal curvature on the device side. By utilizing the integral image and the box convolutioner to calculate the partial derivatives in the first and second directions, it achieves fast and accurate image normal curvature calculation, greatly reducing computation time and memory access latency, and improving computational efficiency.
[0042] Other beneficial effects of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0043] Figure 1 This is a flowchart illustrating an embodiment of the present invention. Detailed Implementation
[0044] To make the technical problems, solutions, and advantages of this invention clearer, a detailed description will be provided below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0045] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0046] In the description of this invention, it should be noted that, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a locking connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.
[0047] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0048] This invention addresses existing problems by providing an image-based curvature estimation method and related equipment.
[0049] like Figure 1 As shown, an embodiment of the present invention provides an image-based curvature estimation method, comprising:
[0050] Step 1: Assign a thread for parallel calculation of normal curvature to each pixel in the integral image corresponding to the target distribution network equipment image;
[0051] Step 2: Using each pixel in the integral image as the center, set the pixel window size to construct multiple pixel windows smaller than the target power distribution network equipment image, and construct the normalized direction vector of each pixel window in the target direction;
[0052] Step 3: Perform convolution on each pixel in the integral image using a box convolutional converter to calculate the partial derivatives in the first and second order directions.
[0053] Step 4: Combine the normalized direction vector, the partial derivatives of the first-order direction, and the partial derivatives of the second-order direction to calculate the normal curvature of the target distribution network equipment image in the target direction within the pixel window. The normal curvature is used to characterize the texture change features of the target distribution network equipment image in the target direction within the pixel window.
[0054] Specifically, step 1 includes:
[0055] On the host side, the image format conversion function of the OpenCV library is used to convert the target power distribution network equipment image into a normalized grayscale image. In this embodiment of the invention, the target power distribution network equipment image is an RGB image, that is, the RGB image is converted into a normalized grayscale image.
[0056] The normalized grayscale image is converted into an integral image Sum0, which corresponds to the target power distribution network image. The integral image Sum0 stores the sum of the grayscale values of all pixels in the rectangular region formed by each pixel in the target power distribution network equipment image and the starting point at the top left corner of the image. For example, Sum0(3,4) represents the sum of the grayscale values of all pixels in the rectangular region formed by pixel (3,4) and the starting point at the top left corner of the image (0,0). The integral image Sum0 is used for subsequent lookup operations.
[0057] The integral image is copied row by row and column by column, and the copy results are stored in an array on the device side. Specifically, the 2D integral image Sum0 is copied row by row and column by column, and the copy results are stored in an array on the device side. At the same time, each copied element is stored as a 32-bit floating-point number.
[0058] On the device side, a texture object is created for the integral image, and a thread is assigned to each pixel in the integral image for parallel computation of normal curvature.
[0059] Specifically, creating a texture object for the integral image includes:
[0060] By employing linear filtering, element-type data reading mode, and wrap addressing mode, texture coordinates are mapped to arbitrary positions on the integral image, creating texture objects for the integral image.
[0061] In this embodiment of the invention, before creating the texture object, parameters need to be allocated and space initialized for the integral image. Since the texture is based on a two-dimensional image array, it is necessary to create a channel description, allocate device memory, set the texture description, and determine the texture attributes, such as addressing mode, filtering mode, data reading mode, coordinate range, etc. Linear filtering and element-type data reading mode are adopted, and the wrap addressing mode is used to map the texture coordinates to any position on the integral image. After the parameters are set, the integral image texture object Sum for data lookup on the device can be created. The data stored in Sum and Sum0 are consistent.
[0062] In this embodiment of the invention, the copy operation and initialization space process are mainly for efficient access and processing of image pixels on the device side, while the purpose of creating a texture object for the integral image is to improve processing efficiency and reduce memory access latency, so that the integral image can be used on the device side to quickly calculate the normal curvature of the image.
[0063] Specifically, a thread for calculating the normal curvature is assigned to each pixel in the integral image, including:
[0064] Set the thread block size; a thread block consists of multiple computing threads on the device side.
[0065] Set the grid size; the grid contains multiple thread blocks.
[0066] The index of the computation thread is set to the coordinates of each pixel, and a computation thread on the device is allocated to each pixel to calculate the normal curvature.
[0067] In this embodiment of the invention, the normal curvature is calculated on the device side by looking up the texture object Sum of the integral image Sum0; since image data is being processed, the grid and thread block sizes only require the two-dimensional dimensions of the device length and width; the length and width of the thread block are set to 32 and 16 respectively, and the grid size is obtained by dividing the image length (width) and image width (height) by the length and width of the thread block and rounding up. The grid size's length (grid size_width) and width (grid size_weight) are specifically as follows:
[0068] grid size_width=(width+32-1) / 32
[0069] grid size_weight=(weight+16-1) / 16
[0070] Because the grid size may exceed the image size, a technique of adding 1 and then subtracting 1 is used when calculating the grid length and width to ensure that the grid does not exceed the image's boundaries.
[0071] Specifically, step 4 includes:
[0072] Centered on each pixel, the length and width of the pixel window are both set to a preset size to construct multiple pixel windows smaller than the target power distribution network equipment image. In this embodiment of the invention, the length and width of the pixel window are both set to 9 pixels.
[0073] Construct a normalized direction vector for each pixel window in the target direction;
[0074] The integral image is input into a box convolutional module. Convolution is performed on each pixel in the integral image and the texture object is found. The partial derivatives in the first x direction, the first y direction, the second x direction, the second yy direction, and the second xy direction are calculated respectively.
[0075] By simultaneously solving the normalized direction vector, the first-order partial derivative in the x-direction, the first-order partial derivative in the y-direction, the second-order partial derivative in the x-direction, the second-order partial derivative in the y-direction, and the second-order partial derivative in the xy-direction, the normal curvature of the target distribution network equipment image in the target direction within the pixel window is obtained.
[0076] Since the calculation of image normal curvature involves the second-order partial derivatives of image texture, it is quite sensitive to noise in the image. The calculated results may be unstable under high noise conditions, requiring appropriate optimization and suppression. Therefore, in traditional algorithms, the image needs to be filtered to suppress high-frequency noise before calculating normal curvature, such as Gaussian blur filtering. After Gaussian blur filtering, the first and second-order partial derivatives of the filtered image texture are calculated using a partial derivative convolution kernel. Specifically, a Gaussian partial derivative convolution kernel is directly constructed, and the image is convolved by the Gaussian partial derivative convolution kernel to calculate the first and second-order texture partial derivatives. This achieves a similar effect to first filtering the image and then using a partial derivative convolution kernel to calculate the first and second-order texture partial derivatives, while reducing the algorithm complexity and computation time.
[0077] However, calculating the first and second-order texture partial derivatives using a Gaussian partial derivative convolution kernel still requires traversing the grayscale information of all pixels within the entire pixel window. It also necessitates calculating distance weights for pixels at different positions within the window and assigning different weights, followed by weighted summation of the grayscale values of these pixels to obtain the first and second-order texture partial derivatives. The computational load remains enormous, and the computation time is already considerable. Therefore, this invention proposes a box-shaped convolution kernel, which approximates a standard Gaussian partial derivative convolution kernel. The weights of pixels within the box-shaped convolution kernel are consistent across regions. Since the pixel weights are consistent, performing convolution on an image using the box-shaped convolution kernel is equivalent to repeatedly calculating the sum of the grayscale values of all pixels in a certain region of the image. Therefore, using the box-shaped convolution kernel proposed in this invention can save significant computational resources and effectively reduce computation time. Due to the consistent pixel weights across regions within the box-shaped convolution kernel, the operation of performing convolution on an image using the box-shaped convolution kernel can be transformed into a simple operation of finding the integral image without deviation, effectively reducing computational complexity and, more importantly, saving computational resources and reducing computation time.
[0078] Specifically, the integral image is input into a box convolutional module, which performs convolution on each pixel and locates the texture object. The partial derivatives in the first x-direction, first y-direction, second x-direction, second yy-direction, and second xy-direction are then calculated, including:
[0079] A box-shaped convolutional module is constructed to calculate the first-order partial derivative in the x-direction. The module is a rectangle with a length and width of 9 pixels, and the top-left corner is defined as (0, 0). The weighted regions inside the box-shaped convolutional module are two rectangular regions: region 1 has four vertices at coordinates (0, 0), (0, 3), (8, 0), and (8, 3), with each pixel having a weight of 1; region 2 has four vertices at coordinates (0, 5), (0, 8), (8, 5), and (8, 8), with each pixel having a weight of -1. Convolving the target power distribution network equipment image using the box-shaped convolutional module is equivalent to calculating the weight of each pixel in the integral image with the same weighted region. Therefore, an unbiased alternative convolution operation can be found for the texture object. The first-order partial derivative in the x-direction, I, is calculated. x for:
[0080] I x =1*(Sum(0,0)+Sum(8,3)-Sum(0,3)-Sum(8,0))+(-1)*(Sum(0,5)+Sum(8,8)-Sum(0,8)-Sum(8,5))
[0081] A box-shaped convolutional module is constructed to calculate the first-order y-direction partial derivative. The module is a rectangle with a length and width of 9 pixels, and the top-left corner is defined as (0, 0). The weighted regions inside the box-shaped convolutional module are two rectangular regions: region 1 has four vertices at coordinates (0, 0), (0, 8), (3, 0), and (3, 8), with each pixel having a weight of 1; region 2 has four vertices at coordinates (5, 0), (5, 8), (8, 0), and (8, 8), with each pixel having a weight of -1. Convolving the target power distribution network equipment image using the box-shaped convolutional module is equivalent to calculating the weight of each pixel in the integral image with the same weighted region. Therefore, an unbiased alternative convolution operation can be found for the texture object. The first-order y-direction partial derivative I is calculated. y for:
[0082] I y =1*(Sum(0,0)+Sum(3,8)-Sum(0,8)-Sum(3,0))+(-1)*(Sum(5,0)+Sum(8,8)-Sum(5,8)-Sum(8,0))
[0083] A box-shaped convolutional module is constructed to calculate the second-order partial derivative in the x-direction. The module is a rectangle with a length and width of 9 pixels. The coordinates of the top-left corner pixel are defined as (0, 0). The weighted regions inside the box-shaped convolutional module are three rectangular regions: Region 1 has four vertices with coordinates (2, 0), (2, 2), (6, 0), and (6, 2), and each pixel in this region has a weight of 1; Region 2 has four vertices with coordinates (2, 3), (2, 5), (6, 3), and (6, 5), and each pixel in this region has a weight of -2; Region 3 has four vertices with coordinates (2, 6), (2, 8), (6, 6), and (6, 8), and each pixel in this region has a weight of 1. Convolving the target power distribution network equipment image with the box-shaped convolutional module is equivalent to calculating the weight of each pixel in the integral image with regions of equal weight. Therefore, an unbiased alternative convolution operation can be found for the texture object. The second-order partial derivative in the x-direction, I, is calculated. xx for:
[0084] I xx =1*(Sum(2,0)+Sum(6,2)-Sum(2,2)-Sum(6,0))+(-2)*(Sum(2,3)+Sum(6,5)-Sum(2,5)-Sum(6,3))+1*(Sum(2,6)+Sum(6,8)-Sum(2,8)-Sum(6,6))
[0085] A box-shaped convolutional module is constructed to calculate the second-order partial derivative in the y-direction. The module is a square with a length and width of 9 pixels. The top-left corner of the convolutional module is defined as (0, 0). The weighted regions inside the box-shaped convolutional module are three rectangular regions: Region 1 has four vertices with coordinates (0, 2), (0, 6), (2, 2), and (2, 6), and each pixel in this region has a weight of 1; Region 2 has four vertices with coordinates (3, 2), (3, 6), (5, 2), and (5, 6), and each pixel in this region has a weight of -2; Region 3 has four vertices with coordinates (6, 2), (6, 6), (8, 2), and (8, 6), and each pixel in this region has a weight of 1. Convolving the target power distribution network equipment image with the box-shaped convolutional module is equivalent to calculating the weight of each pixel in the integral image with regions of equal weight. Therefore, an unbiased alternative convolution operation can be found for the texture object. The second-order partial derivative I in the y-direction is calculated. yy for:
[0086] I yy=1*(Sum(0,2)+Sum(2,6)-Sum(2,2)-Sum(0,6))+(-2)*(Sum(3,2)+Sum(5,6)-Sum(3,6)-Sum(5,2))+1*(Sum(6,2)+Sum(8,6)-Sum(8,2)-Sum(6,6))
[0087] Construct a box-shaped convolutional module for calculating the second-order xy-direction partial derivatives. The module is a square with a length and width of 9 pixels. The coordinates of the top left corner of the convolutional module are defined as (0, 0). The area inside the box-shaped convolutional module containing weight information consists of four rectangular regions: the coordinates of the four vertices of rectangular region 1 are (1, 1), (1, 3), (3, 1), and (3, 3), and the weight of the pixels in this region is 1; the coordinates of the four vertices of rectangular region 2 are (1, 5), (1, 7), (3, 5), and (3, 7), and the weight of the pixels in this region is -1. The coordinates of the four vertices of rectangular region 3 are (5, 1), (5, 3), (7, 1), and (7, 3), and the weight of each pixel in this region is -1. The coordinates of the four vertices of rectangular region 4 are (5, 5), (5, 7), (7, 5), and (7, 7), and the weight of each pixel in this region is 1. Convolving the target power distribution network equipment image using a box convolution is equivalent to calculating each pixel in the integral image with the same weight region. Therefore, an unbiased alternative convolution operation can be found for the texture object. The second-order partial derivatives I in the xy direction are calculated. xy for:
[0088] I xy =1*(Sum(1,1)+Sum(3,3)-Sum(1,3)-Sum(3,1))+(-1)*(Sum(1,5)+Sum(3,7)-Sum(1,7)-Sum(3,5)) +(-1)*(Sum(5,1)+Sum(7,3)-Sum(5,3)-Sum(7,1))+1*(Sum(5,5)+Sum(7,7)-Sum(5,7)-Sum(7,5)).
[0089] Specifically, using the normalized direction vector (u, v) of the target direction and the five partial derivatives mentioned above, the normal curvature of the pixel window in the target direction can be calculated as follows:
[0090]
[0091] Among them, NC uv Let (u,v) represent the normalized direction vector, and (u,v) be a user-defined direction vector. x I represents the first-order partial derivative in the x-direction. yI represents the first-order partial derivative in the y-direction. xx I represents the second-order partial derivative in the x-direction. yy I represents the second-order partial derivative in the y-direction. xy This represents the second-order partial derivative in the xy direction.
[0092] Finally, after calculating the normal curvature of all pixels in the target power distribution network equipment image on the device side, the normal curvature is copied to the host side, and all video memory and RAM involved in the device side calculation are released.
[0093] This invention, in its embodiments, allocates a thread for parallel calculation of normal curvature to each pixel in the integral image corresponding to the target power distribution network equipment image; constructs multiple pixel windows smaller than the target power distribution network equipment image, centered on each pixel in the integral image, and constructs a normalized direction vector for each pixel window in the target direction; performs convolution processing on each pixel in the integral image using a box convolutional module to calculate the partial derivatives in the first and second directions; and calculates the normal curvature of the target power distribution network equipment image in the target direction within the pixel window. The normal curvature characterizes the texture variation features of the target power distribution network equipment image in the target direction within the pixel window. Compared with existing technologies, this invention deploys both the creation of the integral image and the calculation of normal curvature on the device side. By utilizing the integral image and the box convolutional module to calculate the partial derivatives in the first and second directions, it achieves fast and accurate image normal curvature calculation, greatly reducing computation time and memory access latency, and improving computational efficiency.
[0094] This invention also provides an image-based curvature estimation device, comprising:
[0095] The allocation module is used to allocate threads for parallel computation of normal curvature to each pixel in the integral graph corresponding to the target distribution network equipment image;
[0096] The module is used to construct multiple pixel windows smaller than the target power distribution network equipment image, centered on each pixel point in the integral image and setting the pixel window size, and to construct the normalized direction vector of each pixel window in the target direction.
[0097] The processing module is used to perform convolution processing on each pixel in the integral image using a box convolutioner, and to calculate the partial derivatives in the first and second order directions.
[0098] The calculation module is used to simultaneously normalize the direction vector, the partial derivatives of the first-order direction, and the partial derivatives of the second-order direction to calculate the normal curvature of the target distribution network equipment image in the target direction within the pixel window. The normal curvature is used to characterize the texture change features of the target distribution network equipment image in the target direction within the pixel window.
[0099] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0100] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0101] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements an image-based curvature estimation method.
[0102] This invention provides a computer program product that, when run on a mobile terminal, enables the mobile terminal to implement the steps described in the above-described method embodiments.
[0103] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to the constructed image curvature estimation device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0104] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement an image-based curvature estimation method.
[0105] The terminal device can be a desktop computer, laptop, handheld computer, server, server cluster, or cloud server, etc. This terminal device may include, but is not limited to, a processor and memory.
[0106] The processor referred to can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0107] In some embodiments, the memory may be an internal storage unit of the terminal device, such as a hard drive or RAM. In other embodiments, the memory may be an external storage device of the terminal device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital Card (SD), or Flash Card. Furthermore, the memory may include both internal and external storage units of the terminal device. The memory is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory can also be used to temporarily store data that has been output or will be output.
[0108] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.
[0109] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0110] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method of image-based curvature estimation, characterized in that The method comprises the following steps: Step 1: assigning a thread for parallel calculation of curvature to each pixel point in an integral image corresponding to a target power grid equipment image; The step 1 comprises: Converting the target power grid equipment image into a normalized grayscale image by using an image format conversion function of an OpenCV library on a host side; Converting the normalized grayscale image into an integral image corresponding to the target power grid equipment image, and storing the sum of the grayscale values of all pixel points in a rectangular region formed by each pixel point in the target power grid equipment image and the top-left starting point of the image in the integral image; Copying the integral image by rows and columns, and storing the copying result in an array on a device side; Creating a texture object for the integral image on the device side, and assigning a thread for parallel calculation of curvature to each pixel point in the integral image; Step 2: setting a pixel window size to construct a plurality of pixel windows smaller than the target power grid equipment image with each pixel point in the integral image as the center, and constructing a normalized direction vector of each pixel window in a target direction; Step 3: performing convolution processing on each pixel point in the integral image by using a box-shaped convolver to calculate a first-order directional partial derivative and a second-order directional partial derivative; Step 4: calculating a normal curvature of the target power grid equipment image in the target direction within the pixel window by combining the normalized direction vector, the first-order directional partial derivative and the second-order directional partial derivative, wherein the normal curvature is used to represent a texture change feature of the target power grid equipment image in the target direction within the pixel window; The step 4 comprises: Setting the length and width of the pixel window size to a preset size to construct a plurality of pixel windows smaller than the target power grid equipment image with each pixel point as the center; Constructing a normalized direction vector of each pixel window in a target direction; Inputting the integral image into the box-shaped convolver to perform convolution processing on each pixel point in the integral image and searching the texture object, and respectively calculating a first-order x-directional partial derivative, a first-order y-directional partial derivative, a second-order xx-directional partial derivative, a second-order yy-directional partial derivative and a second-order xy-directional partial derivative; Combining the normalized direction vector, the first-order x-directional partial derivative, the first-order y-directional partial derivative, the second-order xx-directional partial derivative, the second-order yy-directional partial derivative and the second-order xy-directional partial derivative to obtain the normal curvature of the target power grid equipment image in the target direction within the pixel window.
2. The image-based curvature estimation method of claim 1, wherein, Creating a texture object for the integral image comprises: Mapping the texture coordinates to any position on the integral image by using a linear filter and an element type data reading mode and a wrap addressing mode to create the texture object for the integral image.
3. The image-based curvature estimation method of claim 2, wherein, Assigning a thread for parallel calculation of curvature to each pixel point in the integral image comprises: Setting a thread block size, wherein the thread block is composed of a plurality of computing threads on the device side; Setting a grid size, wherein the grid comprises a plurality of thread blocks; The index of the operation thread is set as the coordinate of each pixel point, and one computing thread of the device is allocated to each pixel point for calculating the normal curvature.
4. The image-based curvature estimation method of claim 3, wherein, The integral graph is input into the box-shaped convolver, each pixel point in the integral graph is convolved and the texture object is searched, and first-order x-direction partial derivative, first-order y-direction partial derivative, second-order xx-direction partial derivative, second-order yy-direction partial derivative and second-order xy-direction partial derivative are calculated respectively, including: The box-shaped convolver is square, and the pixel point coordinate of the upper left corner of the box-shaped convolver is defined as (0, 0); inputting the integral image into the box convolver, performing convolution operation on each pixel point in the integral image by using the box convolver and searching the texture object, to obtain a first-order x-direction partial derivative I x a first-order y-direction partial derivative I y a second-order xx-direction partial derivative I xx a second-order yy-direction partial derivative I yy a second-order xy-direction partial derivative I xy .
5. The image-based curvature estimation method of claim 4, wherein, The normal curvature of the pixel window in the target direction is: where NC uv denotes the normal curvature, (u, v) denotes the normalized direction vector, I x denotes the first order x-direction partial derivative, I y denotes the first order y-direction partial derivative, I xx denotes the second order xx-direction partial derivative, I yy denotes the second order yy-direction partial derivative, I xy denotes the second order xy-direction partial derivative.
6. An image normal curvature estimation apparatus for executing the image normal curvature estimation method according to claim 1, characterized by comprising: Including: The allocation module is configured to allocate a thread for parallel calculation of the normal curvature to each pixel point in an integral graph corresponding to a target power distribution network equipment image. The construction module is configured to set a pixel window size to construct a plurality of pixel windows smaller than the target power distribution network equipment image with each pixel point in the integral graph as the center, and construct a normalized direction vector of each pixel window in a target direction. The processing module is configured to perform convolution processing on each pixel point in the integral graph through a box-shaped convolver to calculate first-order directional partial derivative and second-order directional partial derivative. The calculation module is configured to calculate the normal curvature of the target power distribution network equipment image in the target direction within the pixel window by simultaneously considering the normalized direction vector, the first-order directional partial derivative and the second-order directional partial derivative, and the normal curvature is used to represent the texture change feature of the target power distribution network equipment image in the target direction within the pixel window.
7. A computer-readable storage medium storing a computer program, wherein the computer program comprises the following steps of: receiving a request for a resource from a client; determining whether the client is authorized to access the resource; and if the client is authorized to access the resource, providing the resource to the client. The computer program is executed by the processor to implement the image normal curvature estimation method of any one of claims 1 to 5.
8. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the image normal curvature estimation method of any one of claims 1 to 5.
Citation Information
Patent Citations
Improved SURF algorithm based on gradient amplitude pre-operation
CN110135438A
Feature extraction method for identifying and tracking moving target
CN110222661A
Cited By
A pouring frame and a pouring form and a design method thereof
CN122257573A