Tone and gray edge detection method and system based on adaptive fusion method
Through the adaptive fusion method, combined with grayscale and hue information, the edge fusion weight is dynamically adjusted to solve the problem of inaccurate edge detection under extreme lighting conditions and achieve a more accurate and robust edge extraction effect.
Patent Information
- Application Number
- CN202410783919.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-18
- Publication Date
- 2024-10-18
AI Technical Summary
The existing technology is difficult to accurately extract image edges in complex scenes, especially under extreme lighting conditions, and is easily interfered by noise, resulting in inaccurate edge detection.
The hue and grayscale edge detection method based on the adaptive fusion method is adopted. By converting the color image into HSV space, extracting the hue channel, performing median filtering and Gaussian blur processing, using the Sobel operator to extract edge information, and based on the local part of the image The brightness feature dynamically adjusts the edge fusion weight, performs pixel-level correction and normalization processing, and generates the final fused edge image.
It improves the accuracy and robustness of edge detection, can selectively emphasize grayscale or tonal edges in different brightness areas, eliminates noise interference, and significantly improves the accuracy of detection results.
Smart Images

Figure CN118799348A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of numerical image processing, and in particular to a tone and grayscale edge detection method and system based on an adaptive fusion method. Background Art
[0002] In digital image processing, edge detection is a key step in extracting image features and is widely used in tasks such as image segmentation, target recognition, and feature extraction. Traditional edge detection methods mainly use operators such as Canny, Log, and Sobel, which rely on the information of grayscale images, but ignore the important role of hue information in edge detection. However, in complex scenes, especially when the lighting conditions are poor or the image quality is low, it is often difficult to accurately extract edges by relying solely on grayscale information.
[0003] Research has shown that using traditional edge detection operators directly in the grayscale domain can easily cause the loss of some edges. Experiments have found that under extreme lighting conditions, the difference in image grayscale information is too small, making it difficult to extract edges in the grayscale domain.
[0004] To solve this problem, scholars have proposed a variety of methods to extract edges under extreme lighting conditions. Some scholars enhance edge information through image preprocessing modules to improve the accuracy of edge detection, while others try to expand the detection domain and introduce new information as conditions for edge extraction to enhance the robustness of edge detection. However, these methods still have some limitations. Some methods may cause edge loss or inaccurate detection, while others may be very sensitive to noise and lack robustness to complex scenes.
[0005] In recent years, some researchers have tried to introduce hue information into edge detection to improve the accuracy of detection. However, directly using hue information for edge detection is easily interfered by noise, resulting in inaccurate detection results. Therefore, how to effectively combine hue and grayscale information to achieve accurate and robust edge detection is an urgent problem to be solved in the current image processing field. Summary of the invention
[0006] In view of the above-mentioned deficiencies in the prior art, the object of the present invention is to provide a hue and grayscale edge detection method and system based on an adaptive fusion method, aiming to solve the problem of inaccurate edge detection and susceptibility to noise interference in the prior art.
[0007] In order to achieve the above object, the present invention adopts the following technical solutions:
[0008] In a first aspect, a hue and grayscale edge detection method based on an adaptive fusion method comprises the following steps:
[0009] Step 1: Convert the input color image into a grayscale image;
[0010] Step 2: Convert the color image from RGB space to HSV space and extract the hue channel;
[0011] Step 3: Perform median filtering and Gaussian blur processing on the grayscale image and the tone image;
[0012] Step 4: Use the Sobel operator to perform convolution operations on the grayscale image and the hue channel to extract grayscale edge information and hue edge information respectively;
[0013] Step 5: Create a zero matrix with the same shape and data type as the grayscale edge image to store the final fusion result;
[0014] Step 6: By traversing each block of the image, dynamically calculating the fusion weight of the H channel edge image and the grayscale edge image according to the brightness mean of each block in the V channel image, and performing weighted fusion on the H channel edge image and the grayscale edge image of each block to generate a preliminary fused edge image;
[0015] Step 7: Set a threshold to perform pixel-level correction on the edge image after preliminary fusion. When the intensity of the grayscale edge image and the hue edge image at the same position exceeds the threshold, the intensity of the position is set to the maximum value.
[0016] Step 8: Normalize the corrected edge image to obtain the final fused edge image.
[0017] Furthermore, in step 2, the color image is converted from RGB space to HSV space to extract the hue channel. In this process, the cv2.cvtColor function is used for conversion, and the image[:,:,0] function is used to extract the hue dimension, and the hue array is normalized to map it to a fixed value range:
[0018]
[0019] Where H and V are the values of the image hue channel and brightness channel, and R, G, and B are the values of the image in the red, green, and blue color channels respectively.
[0020] The color image is converted into a tone array and the tone channel is extracted; the extracted image pixel information is converted into tone domain information, and the tone difference is extracted to obtain image information whose grayscale difference is too small under extreme lighting.
[0021] Furthermore, in step three, median filtering and Gaussian blur processing are performed on the grayscale image and the tone image to eliminate noise interference; the image is median filtered using the cv2.medianBlur function, the middle value is taken as the new value and assigned to the original image, the target pixel and its surrounding information are extracted, and then Gaussian blur technology is applied, and the image is smoothed using the cv2.Gaussian-Blur function to make the image data tend to nearby data.
[0022] Furthermore, in step 4, the input image is converted from the BGR space to the grayscale space, and the Sobel operator is applied to perform convolution operation on the grayscale image, and the gradient image in the x direction and the y direction is obtained by passing through the grayscale image, and the Sobel edge detection result based on the grayscale domain is obtained by calculating the magnitude and direction of the gradient;
[0023] Use the Sobel operator to perform convolution operation on the grayscale image, calculate the image gradient amplitude and gradient direction, extract the grayscale edge information, and use cv2.Sobel and cv2.Sobel functions to implement the calculation method of grayscale edge information extraction:
[0024]
[0025]
[0026]
[0027]
[0028]
[0030] Where A x and A y Respectively represent the convolution kernels for measuring the edges in the x-axis direction and the y-axis direction, G x and G y Represents the image edge in the x-axis direction and the edge in the y-axis direction obtained after the image is convolved. G represents the complete image edge information after the image edges in the two directions are fused.
[0031] Furthermore, in step 5, a zero matrix fused_edges_init with the same shape and data type as gray_edges_norm is created to store the final fusion result.
[0032] Further, in step six, first, the zero matrix fused_edges_init is passed through two nested for loops to traverse each block of the image, where block_height and block_width define the height and width of each block respectively. For each block, its end row number block_end_row and column number block_end_col are calculated, and the data of the current block is extracted from the normalized V channel image v_channel_norm, and its mean v_mean is calculated. According to the value of v_mean, the weight weight_h of the H channel edge image h_edges_norm in the block is calculated by the weight_function function. Then, the weight weight_gray of the gray edge image gray_edges_norm is calculated, which is 1 minus weight_h. The weight is obtained by the following calculation formula:
[0033]
[0034] Among them, v is the mean brightness of the V channel, and k is the fusion ratio of the two edge images;
[0035] Extract the data of the current block from the normalized grayscale edge image gray_edges_norm and the H channel edge image h_edges_norm to obtain gray_edges_block and h_edges_block respectively. Use the weights calculated above to perform weighted fusion on the two extracted block edge images. The result is stored in fused_edges_init at the current block position. The calculation formula for weighted fusion is as follows:
[0036] fusedblock=k×grayblock+(1-k)×hueblock
[0037] Furthermore, in step seven, the pixel-level correction is performed by comparing the intensity of each pixel in the grayscale edge image and the hue edge image. When both exceed a preset threshold, the intensity of the pixel in the fused image is set to a maximum value.
[0038] Furthermore, in step eight, the normalization process uses the cv2.normalize function of OpenCV to normalize the corrected edge image to a specified value range, and specifies the data type of the output image.
[0039] In a second aspect, a system is provided for a hue and grayscale edge detection method based on an adaptive fusion method as described above, the system comprising an image conversion module, a hue extraction module, a preprocessing module, a grayscale edge extraction module, a hue edge extraction module, a block fusion module and a pixel correction module, the hue extraction module being connected to the image conversion module, the preprocessing module being connected to the hue extraction module, the grayscale edge extraction module and the hue edge extraction module being connected in parallel to the preprocessing module and being connected to the block fusion module, and the pixel correction module being connected to the block fusion module.
[0040] The technical solution adopted by the present invention has the following beneficial effects:
[0041] In this application, the adaptive fusion algorithm dynamically adjusts the fusion weights of grayscale edges and hue edges according to the local brightness characteristics of the image, so that the algorithm can selectively emphasize grayscale edges or hue edges in different brightness areas. The pixel correction step further improves the accuracy of edge detection and makes the detection result more accurate by eliminating the interference of non-edge information. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 It is a flow chart of the hue and grayscale edge detection method based on the adaptive fusion method of the present invention;
[0043] Figure 2 It is a system module structure block diagram of the tone and grayscale edge detection method based on the adaptive fusion method of the present invention;
[0044] Figure 3 It is a logic structure diagram of the program implementation of the tone and grayscale edge detection method based on the adaptive fusion method of the present invention;
[0045] Figure 4 It is a logic structure block diagram of the fusion algorithm of the tone and grayscale edge detection method based on the adaptive fusion method of the present invention;
[0046] Figure 5 For comparison of processing results of the hue and grayscale edge detection method based on the adaptive fusion method of the present invention;
[0047] Figure 6 is an embodiment of the present invention, wherein (a) is the original image, (b) is the enlarged image of the details, (c) is the detection result of the traditional edge detection on the details, and (d) is the detection result of the algorithm proposed in this study on the details;
[0048] Figure 7 The processing time of a single picture using the present invention varies with the block size. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solution and effect of the present invention clearer and more specific, the present invention is further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0050] It should be noted that when a component is referred to as being "fixed to" or "disposed on" another component, it can be directly on the other component or indirectly on the other component. When a component is referred to as being "connected to" another component, it can be directly connected to the other component or indirectly connected to the other component.
[0051] It should also be noted that the same or similar numbers in the drawings of the embodiments of the present invention correspond to the same or similar parts; in the description of the present invention, it should be understood that if the terms "upper", "lower", "left", "right" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the drawings, it is only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific direction, be constructed and operated in a specific direction. Therefore, the terms describing the positional relationship in the drawings are only used for illustrative purposes and cannot be understood as limitations on this patent. For ordinary technicians in this field, the specific meanings of the above terms can be understood according to specific circumstances.
[0052] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.
[0053] In the embodiments of the present invention, please refer to Figure 1-Figure 6 , provides a hue and grayscale edge detection method based on an adaptive fusion method, the specific steps are as follows:
[0054] Step 1: Grayscale image extraction:
[0055] Convert the input color image (such as RGB image) to a grayscale image. The conversion process is implemented by the cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) function in the OpenCV library.
[0056] Step 2: Hue domain image extraction:
[0057] Convert the color image from RGB space to HSV space and extract the hue channel. In this process, you can use the cv2.cvtColor function to convert and use the image[:,:,0] function to extract the hue dimension. In order to perform subsequent gradient calculations, the hue array needs to be normalized and mapped to a fixed value range.
[0058]
[0059] The color image is converted into a tone array and the tone channel is extracted; the extracted image pixel information is converted into tone domain information, and the tone difference is extracted to obtain image information whose grayscale difference is too small under extreme lighting.
[0060] Step 3: Image preprocessing:
[0061] The grayscale image and the tone image are subjected to median filtering and Gaussian blur processing to eliminate noise interference; the present invention first adopts the median filtering technology, uses the cv2.medianBlur function to perform median filtering on the image, takes the middle value as the new value to assign to the original image, extracts the target pixel and its surrounding information, so as to effectively remove the salt and pepper noise and maintain the edge details of the image. Then the Gaussian blur technology is applied, and the cv2.Gaussian-Blur function is used to smooth the image, so that the image data tends to the nearby data, so as to further reduce the Gaussian noise in the image.
[0062] Median filtering and Gaussian blurring are performed on grayscale and tonal images. Gaussian blurring uses the cv2.GaussianBlur function to reduce the impact of noise on edge detection by weighted averaging each pixel in the image.
[0063] Step 4: Grayscale edge information extraction:
[0064] The input image is converted from BGR space to grayscale space, and then the Sobel operator is applied to perform convolution operation on the grayscale image, and the gradient image in the x and y directions is obtained by passing through the grayscale image. Finally, the Sobel edge detection result based on the grayscale domain is obtained by calculating the magnitude and direction of the gradient.
[0065] Use the Sobel operator to perform convolution operation on the grayscale image, calculate the image gradient amplitude and gradient direction, and extract the grayscale edge information. Use cv2.Sobel(image,cv2.CV_64F,0,1,ksize=5) and cv2.Sobel(image,cv2.CV_64F,1,0,ksize=5) functions to implement it. The calculation method for grayscale edge information extraction is:
[0066]
[0067]
[0068]
[0069]
[0070]
[0071] Step 5: Tone edge extraction:
[0072] The input image is converted from BGR space to HSV space and the hue channel is extracted. Then, the hue channel is normalized and its pixel value range is adjusted to between 0 and 255 for subsequent gradient calculation. Then, the Sobel operator is applied to the normalized hue channel and the gradients in the x and y directions are calculated across the hue array. By calculating the magnitude of the gradient and performing normalization and inverting brightness processing, the Sobel edge detection result based on the hue domain is obtained.
[0073] That is to say, the Sobel operator is used to perform convolution operation on the normalized hue channel, and the amplitude of the hue value difference gradient of each pixel and its neighborhood in the x and y directions is calculated respectively, and normalization and inversion brightness processing are performed to obtain the Sobel edge detection result based on the hue domain. The same is implemented using cv2.Sobel(image,cv2.CV_64F,0,1,ksize=5) and cv2.Sobel(image,cv2.CV_64F,1,0,ksize=5) functions. This algorithm is the same as the calculation method of hue edge.
[0074] Step 6: Block fusion of edge images:
[0075] First, create a zero matrix fused_edges_init of the same shape and data type as gray_edges_norm to store the final fusion result. Use two nested for loops to traverse each block of the image. Here, block_height and block_width define the height and width of each block, respectively. For each block, calculate its ending row number block_end_row and column number block_end_col to ensure that it does not exceed the actual range of the image. Extract the data of the current block from the normalized V channel image v_channel_norm and calculate its mean v_mean. According to the value of v_mean, calculate the weight weight_h of the H channel edge image (h_edges_norm) in the block through the weight_function function. Then, calculate the weight weight_gray of the gray edge image (gray_edges_norm), which is 1 minus weight_h. The weight is obtained by the following calculation formula:
[0076]
[0077] Extract the data of the current block from the normalized grayscale edge image gray_edges_norm and the H channel edge image h_edges_norm to obtain gray_edges_block and h_edges_block respectively. Use the weights calculated above to perform weighted fusion on the two extracted block edge images, and store the result in fused_edges_init at the current block position. The calculation formula for weighted fusion is as follows:
[0078] fusedblock==k×grayblock+1k)×hueblock
[0079] The purpose of this function is to dynamically adjust the fusion weights of the edge images of the H channel and the gray channel according to the brightness information of the V channel. When the brightness of the V channel is higher, the edge information of the H channel is more likely to be used; otherwise, it is more dependent on the edge information of the gray channel. In this way, a fused edge image that combines edge information from two different sources can be obtained; that is, each block of the gray image and the hue domain image is traversed and processed respectively, and the two extracted block edge images are weightedly fused according to the calculated weights to obtain a preliminary fused image, which is then corrected at the pixel level to obtain the final complete edge image.
[0080] Step 7: Perform pixel-level correction on the edge image after preliminary fusion:
[0081] First, a threshold threshold is set, which is used to determine the intensity of pixels in the grayscale edge image gray_edges_norm and the H channel edge image h_edges_norm. The np.copy function is used to copy the initial fused image fused_edges_init to fused_edges so that subsequent correction operations can be performed without affecting the original data. Subsequently, two nested for loops are used to traverse each pixel in fused_edges. For each pixel, if its value in gray_edges_norm and h_edges_norm is greater than the set threshold threshold, the value of the point in fused_edges is set to 255. This operation means that only when the two edge images have significant edge strength at the same position, the fused image will have the maximum edge strength at that position. The corrected edge image fused_edges is normalized using OpenCV's cv2.normalize function. Here, alpha = 0 and beta = 255 specify the range of values after normalization, norm_type = cv2.NORM_MINMAX indicates the use of minimum-maximum normalization, and dtype = cv2.CV_8U specifies that the data type of the output image is an 8-bit unsigned integer. The normalized image can be used directly for display or subsequent processing.
[0082] Through the above steps, the adaptive fusion method of the present invention can selectively emphasize the grayscale edge or hue edge according to the brightness characteristics of different regions, so as to more accurately extract the edge information of the image. The experimental results show that the hue and grayscale edge detection algorithm based on the adaptive fusion method proposed in this study can achieve excellent edge detection effects in different brightness regions. Compared with traditional methods, this algorithm not only improves the accuracy of edge detection, but also enhances the robustness of the algorithm, enabling it to work stably in various complex scenes.
[0083] Specifically, in the second aspect, the present invention also provides a hue and grayscale edge detection system based on an adaptive fusion method, the system including an image conversion module, a hue extraction module, a preprocessing module, a grayscale edge extraction module, a hue edge extraction module, a block fusion module and a pixel correction module, each module collaborates according to the method steps described above to achieve image edge detection.
[0084] The block fusion module is used to dynamically calculate the fusion weights of the H channel edge image and the grayscale edge image according to the brightness mean of the V channel, and perform weighted fusion of the blocks; the pixel correction module is used to perform pixel-level correction on the edge image after preliminary fusion.
[0085] The system used in the hue and grayscale edge detection method based on the adaptive fusion method proposed in the present invention includes an image conversion module, a hue extraction module, a preprocessing module, a grayscale edge extraction module, a hue edge extraction module, a block fusion module and a pixel correction module. The system module connection relationship is as follows: Figure 2 shown.
[0086] The specific implementation logic of the present invention is as follows Figure 3 shown. Figure 3 (a) describes the specific content of the Sobel edge detection algorithm used in the present invention. The original image is convolved with the convolution kernels in the x-axis and y-axis directions to obtain the edge in the y-axis direction and the edge in the x-axis direction respectively. The two edges are fused to obtain all the edges of the image. Figure 3 (b) describes the fusion step of the present invention. First, the original image is converted into hue domain and grayscale domain images, and the edge detection of the two images is performed using the Sobel edge detection algorithm to obtain the hue domain edge and the grayscale domain edge. Subsequently, the fusion is performed using the adaptive fusion algorithm proposed in the present invention that performs weight calculation based on block brightness, and finally a complete edge image is obtained.
[0087] The steps of the adaptive fusion algorithm for weight calculation based on block brightness V proposed by the present invention are as follows: Figure 4 The calculation of weight k in this article is as follows.
[0088]
[0089] The algorithm processing effect proposed by the present invention is as follows Figure 5 As shown, the processing effect on the details is as follows Figure 6 As shown in the figure. By comparing with the traditional edge detection effect, it can be proved that the proposed algorithm is superior to the traditional edge detection algorithm in terms of processing effect.
[0090] Regarding the selection of block size, the present invention conducts a large number of experimental measurements by comparing the image processing time corresponding to different block sizes, and finally obtains the appropriate block size. The experimental results are recorded as follows Figure 7 shown.
[0091] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the schemes disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the claims.
Claims
1. A hue and grayscale edge detection method based on an adaptive fusion method, characterized in that: The following steps are involved: Step 1: Convert the input color image into a grayscale image; Step 2: Convert the color image from RGB space to HSV space and extract the hue channel; Step 3: Perform median filtering and Gaussian blur processing on the grayscale image and the tone image; Step 4: Use the Sobel operator to perform convolution operations on the grayscale image and the hue channel to extract grayscale edge information and hue edge information respectively; Step 5: Create a zero matrix with the same shape and data type as the grayscale edge image to store the final fusion result; Step 6: By traversing each block of the image, dynamically calculating the fusion weight of the H channel edge image and the grayscale edge image according to the brightness mean of each block in the V channel image, and performing weighted fusion on the H channel edge image and the grayscale edge image of each block to generate a preliminary fused edge image; Step 7: Set a threshold to perform pixel-level correction on the edge image after preliminary fusion. When the intensity of the grayscale edge image and the hue edge image at the same position exceeds the threshold, the intensity of the position is set to the maximum value. Step 8: Normalize the corrected edge image to obtain the final fused edge image.
2. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step 2, the color image is converted from RGB space to HSV space to extract the hue channel. In this process, the cv2.cvtColor function is used for conversion, and the image[:,:,0] function is used to extract the hue dimension. The hue array is normalized and mapped to a fixed value range: Where H and V are the values of the image hue channel and brightness channel, and R, G, and B are the values of the image in the red, green, and blue color channels respectively; The color image is converted into a tone array and the tone channel is extracted; the extracted image pixel information is converted into tone domain information, and the tone difference is extracted to obtain image information whose grayscale difference is too small under extreme lighting.
3. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step three, median filtering and Gaussian blur processing are performed on the grayscale image and the tone image to eliminate noise interference; the image is median filtered using the cv2.medianBlur function, the middle value is taken as the new value and assigned to the original image, the target pixel and its surrounding information are extracted, and then Gaussian blur technology is applied, and the image is smoothed using the cv2.Gaussian-Blur function to make the image data tend to nearby data.
4. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step 4, the input image is converted from BGR space to grayscale space, and the Sobel operator is applied to perform convolution operation on the grayscale image. The gradient image in the x direction and y direction is obtained by passing through the grayscale image. By calculating the magnitude and direction of the gradient, the Sobel edge detection result based on the grayscale domain is obtained. Use the Sobel operator to perform convolution operation on the grayscale image, calculate the image gradient amplitude and gradient direction, extract the grayscale edge information, and use cv2.Sobel and cv2.Sobel functions to implement the calculation method of grayscale edge information extraction: Where A x and A y Respectively represent the convolution kernels for measuring the edges in the x-axis direction and the y-axis direction, G x and G y It represents the image edge in the x-axis direction and the edge in the y-axis direction obtained after the image is convolved, and G represents the complete image edge information after the image edges in the two directions are fused.
5. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step 5, create a zero matrix fused_edges_init with the same shape and data type as gray_edges_norm to store the final fusion result.
6. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step six, first, the zero matrix fused_edges_init is passed through two nested for loops to traverse each block of the image. Here, block_height and block_width define the height and width of each block respectively. For each block, its end row number block_end_row and column number block_end_col are calculated, and the data of the current block is extracted from the normalized V channel image v_channel_norm, and its mean v_mean is calculated. According to the value of v_mean, the weight weight_h of the H channel edge image h_edges_norm in the block is calculated by the weight_function function. Then, the weight weight_gray of the gray edge image gray_edges_norm is calculated, which is 1 minus weight_h. The calculation formula for obtaining the weight is as follows: Among them, v is the brightness mean of the V channel, and k is the fusion ratio of the two edge images; Extract the data of the current block from the normalized grayscale edge image gray_edges_norm and the H channel edge image h_edges_norm to obtain gray_edges_block and h_edges_block respectively. Use the weights calculated above to perform weighted fusion on the two extracted block edge images. The result is stored in fused_edges_init at the current block position. The calculation formula for weighted fusion is as follows: fusedblock=k×grayblock+(1-k)×hueblock.
7. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step 7, pixel-level correction is performed by comparing the intensity of each pixel in the grayscale edge image and the hue edge image. When both exceed a preset threshold, the intensity of the pixel in the fused image is set to the maximum value.
8. The method for detecting hue and grayscale edges based on an adaptive fusion method according to claim 1, characterized in that: In step eight, the normalization process uses the cv2.normalize function of OpenCV to normalize the corrected edge image to a specified value range and specify the data type of the output image.
9. A system for the hue and grayscale edge detection method based on the adaptive fusion method as claimed in claim 1, characterized in that: The system includes an image conversion module, a tone extraction module, a preprocessing module, a grayscale edge extraction module, a tone edge extraction module, a block fusion module and a pixel correction module. The tone extraction module is connected to the image conversion module, the preprocessing module is connected to the tone extraction module, the grayscale edge extraction module and the tone edge extraction module are connected in parallel to the preprocessing module and connected to the block fusion module, and the pixel correction module is connected to the block fusion module.
Citation Information
Cited By
Underwear gluing image recognition method and system based on high-precision positioning
CN121788478A
An underwear gluing image recognition method and system based on high-precision positioning
CN121788478B
