Color Image Edge Extraction Method Based on Conceptual Structural Elements and Matrix Norm
By extracting pixel windows in the color image and constructing the background matrix to generate the object relationship matrix, using matrix norms to extract conceptual structural elements, and directly performing point operations on the color image, it solves the problem of being unable to extract low-contrast area edges and edge extraction results in the existing technology. It eliminates the problem of inaccuracy and achieves high-precision and high-definition color image edge extraction.
Patent Information
- Application Number
- CN202210207060.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-04
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2042-03-04
AI Technical Summary
The existing technology cannot effectively extract the actual edges of the low-contrast areas of the image when extracting the edges of color images, and converting the color image into a grayscale image results in low accuracy of edge extraction results and increased edge width.
Using a method based on conceptual structural elements and matrix partial ordering, the pixel window is extracted for each pixel in the color image, the background matrix is constructed and the object relationship matrix is generated. The matrix norm is used to extract conceptual structural elements, and the color image is directly processed. operation to avoid converting color images into grayscale image processing.
The accuracy and clarity of edge extraction in color images are significantly improved, and the actual edges of high-contrast and low-contrast areas of the image can be extracted with high quality, maximizing the use of the color information of the image and avoiding an increase in the width of the edge extraction results.
Smart Images

Figure CN114565633B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of digital image processing technology, and further relates to a color image edge extraction method based on conceptual structural elements and matrix partial order in the field of image edge extraction technology. The present invention applies an object relationship matrix to extract conceptual structural elements and applies a vector partial order relationship of a matrix norm to perform morphological operations on an image, thereby realizing an image edge extraction operation, and can be used to extract various types of edges in a color image. Background Art
[0002] Images are the main source of information for humans to obtain and exchange, and edges are one of the most basic features of images. The edge of an image is where the color of the shape structure of an object changes dramatically under changes in external environmental lighting, and it directly reflects the outline and topological structure of the object. In digital image processing technology, edges are an important way for images to express information and are important research objects in the fields of graphics and image processing, computer vision, etc. Edge extraction is the basis for studying image edge information, and the quality of its extraction results will directly affect the next step. Traditional edge extraction methods require the selection of appropriate thresholds. At the same time, there is a lot of noise in the edge extraction results, which may cause the extracted boundaries to become wider or even connected, which cannot meet the current requirements of digital image processing technology for edge accuracy.
[0003] Zhengzhou University of Light Industry disclosed a method for extracting the edges of color images in its patent document "A method for edge extraction of color images" (patent application number 202110787844.5, application publication number 113469916A). The implementation steps of this method are: 1. Use a threshold-based denoising method to reduce the noise of the image; 2. Use the RGB model and HSI model to perform color analysis on the image structure; 3. Design an algorithm to compare the threshold value, determine the color edge point, and the edge points constitute the color edge. The disadvantage of this method is that when determining whether each pixel is an image edge point, the total gradient of the pixel point needs to be compared with the set threshold, and the threshold is a fixed value for each pixel of the entire image, which causes the edges of the low-contrast areas of the image to be connected in the edge extraction result map, and the actual edges of the low-contrast areas of the image cannot be obtained.
[0004] Dalian University of Technology has disclosed a method for extracting edges of color images in its patented technology "An Improved Canny Adaptive Edge Extraction Method Based on a Newly Constructed Membership Function" (patent application number 201811521855.3, authorization announcement number 109636822B). The implementation steps of this method are: 1. Convert the color image to a grayscale image; 2. Use Gaussian filtering to smooth and denoise the image to be processed; 3. Use the Sobel gradient operator to calculate the gradient component G in the X direction of the image. xAnd find the gradient component G in the Y direction y ;4. Based on the gradient components in two directions, the gradient amplitude is calculated using the second-order norm;5. A new membership function is constructed, and the edge membership is solved according to the function;6. Based on the edge membership graph, non-maximum suppression is performed to further refine the edge;7 Based on the refined edge membership graph, the Otsu method is used to calculate the overall threshold T according to the maximum inter-class variance principle, and the image is divided into high-value areas and low-value areas according to T, and the mean and variance of the eigenvalues in the two areas are calculated respectively, and the high threshold and low threshold are obtained by the mean and variance;8. The refined edge membership graph is binarized using the high threshold and the low threshold, and whether it is an edge point is determined according to the interval where the gray value is located. The disadvantage of this method is that the color image is converted into a gray image for processing, which is a pseudo-color image processing method, and the color information of the image is lost during the conversion process, resulting in the extracted edge being wider than the actual edge, and the accuracy of the extraction result is not high. Summary of the invention
[0005] The purpose of the present invention is to address the deficiencies of the above-mentioned prior art and propose a color image edge extraction method based on conceptual structure elements and matrix partial order, aiming to solve the problem that when extracting the edge of a color image, the actual edge of the low-contrast area of the image cannot be extracted, and the image edge extraction result is wider than the actual edge.
[0006] The idea of realizing the purpose of the present invention is that the present invention uses each pixel point in the color image as the center to extract the corresponding pixel window, constructs a background matrix to describe the pixel window, obtains an object relationship matrix after performing a series of matrix operations on the background matrix, and uses the generated object relationship matrix to extract the conceptual structural elements of the selected pixel. When constructing the background matrix to describe the pixel window, each pixel in the pixel window is compared with the selected pixel in four aspects: the pixel values of the three channels of red, green and blue and the Euclidean color distance. Therefore, the selected pixels are different, the generated object relationship matrix is different, and the extracted conceptual structural elements are also different, so that each pixel point in the color image can be processed adaptively. When the selected pixel is located in the low-contrast area of the image, the present invention can still obtain the actual edge of the image. The present invention uses the Euclidean color distance of the color pixel to obtain the matrix norm of the pixel, uses the matrix norm to obtain the maximum pixel in the conceptual structural element, and obtains the difference pixel by subtracting the maximum pixel from the selected pixel. The difference pixel is assigned to the color image after edge extraction. If the difference pixel is a black pixel, it means that the selected pixel is not an edge point. If the difference pixel is a color pixel, it means that the selected pixel is an edge point. Therefore, the color image after edge extraction composed of all difference pixels is the edge extraction result of the image. It can be seen that the present invention directly performs point operation on each pixel in the color image, and does not need to convert the color image into a grayscale image for processing, and can maximize the use of the color information of the image to obtain the actual edge of the image.
[0007] The specific steps for achieving the purpose of the present invention are as follows:
[0008] Step 1, extract the pixel window centered on the selected pixel:
[0009] (1a) Select an unselected pixel from the color image of the edge to be extracted;
[0010] (1b) expanding pixels from the top, bottom, left, right, upper left, lower left, upper right, and lower right with the selected pixel as the center to obtain an n×n pixel window with the selected pixel as the center, where n represents the window size and is an odd number greater than or equal to 3;
[0011] Step 2, generate the background matrix of all pixels in the pixel window:
[0012] Construct a background matrix K with N rows and 4 columns. The i-th row of the background matrix represents the j-th pixel in the pixel window, where i=j. The 1st to 4th columns of the background matrix respectively describe the four relationship quantities between the pixel represented by the i-th row and the selected pixel in the red channel, green channel, blue channel and Euclidean color distance, where 1≤i≤N, N represents the total number of pixels in the pixel window, and N=n 2 ;
[0013] Step 3: Generate the object relationship matrix according to the following formula:
[0014] W=~(K*(~(K T )))
[0015] Where W represents the generated object relation matrix, T represents the transpose operation, ~ represents the complement operation on the matrix, and * represents the matrix multiplication operation;
[0016] Step 4, determining a set of conceptual structural elements of the selected pixel;
[0017] The pixels corresponding to all columns whose element values of the rows corresponding to the selected pixel in the object relationship matrix are 1 are all determined to be a pixel element in the concept structure element set, thereby obtaining the concept structure element set of the selected pixel;
[0018] Step 5, using the matrix norm of the pixel, determine the maximum pixel element in the conceptual structure element set:
[0019] (5a) Calculate the matrix norm of each pixel element in the conceptual structure element set according to the following formula:
[0020]
[0021] Among them, ||U x,y || represents the matrix norm of the pixel at the (x,y) coordinate position in the color image to be extracted edge, u x,y Represents the Euclidean color distance of the pixel at the (x,y) coordinate position in the color image of the edge to be extracted, u x-1,y Represents the Euclidean color distance of the pixel at the (x-1, y) coordinate position in the color image of the edge to be extracted, u x+1,y The Euclidean color distance of the pixel at the (x+1, y) coordinate position in the color image of the edge to be extracted, u x,y-1 The Euclidean color distance of the pixel at the (x, y-1) coordinate position in the color image of the edge to be extracted, u x,y+1 The Euclidean color distance of the pixel at the (x, y+1) coordinate position in the color image of the edge to be extracted, u x-1,y-1 Represents the Euclidean color distance of the pixel at the (x-1, y-1) coordinate position in the color image of the edge to be extracted, u x+1,y-1 The Euclidean color distance of the pixel at the coordinate position (x+1, y-1) in the color image of the edge to be extracted, u x-1,y+1 Represents the Euclidean color distance of the pixel at the coordinate position (x-1, y+1) in the color image of the edge to be extracted, u x+1,y+1 Represents the Euclidean color distance of the pixel at the coordinate position (x+1, y+1) in the color image of the edge to be extracted. Indicates a round-down operation;
[0022] (5b) determining the pixel corresponding to the maximum value in the matrix norm as the maximum pixel in the conceptual structure element;
[0023] Step 6, assign the generated difference pixels:
[0024] (6a) using a difference pixel formula, generating a difference pixel corresponding to the selected pixel;
[0025] (6b) Assign the difference pixel to the color image after edge extraction, and the position of the assignment corresponds to the position of the selected pixel in the color image of the edge to be extracted.
[0026] Step 7: Using the same method as steps 1 to 6, edge extraction is performed on each pixel point in the color image whose edge is to be extracted, to obtain a color image after edge extraction.
[0027] Compared with the prior art, the present invention has the following advantages:
[0028] First, since the present invention generates an object relationship matrix by performing a series of matrix operations on the background matrix, the generated object relationship matrix can be used to adaptively extract the conceptual structural elements of the selected pixels, thereby overcoming the defect that the fixed threshold used in the prior art cannot adaptively process each pixel in the color image, resulting in the inability to extract the actual edges of the low-contrast areas of the image. The present invention can not only extract the edges of the high-contrast areas of the image with high quality, but also extract the actual edges of the low-contrast areas of the image with high quality, thereby significantly improving the clarity of the color image after edge extraction.
[0029] Secondly, since the present invention uses the matrix norm of pixels to obtain the maximum pixel in the conceptual structural element, subtracts the maximum pixel from the selected pixel to obtain the difference pixel, and directly performs point operations on each pixel in the color image, it overcomes the shortcomings of the prior art of converting the color image into a grayscale image and then processing it, which causes the image to lose color information during the processing process and the edge extraction result is wider than the actual edge. The present invention has the ability to maximize the use of the color information of the image and extract the actual edge of the color image, and can extract highly clear and detailed edges of the color image, significantly improving the accuracy of edge extraction of the color image. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 is a flow chart of the present invention;
[0031] Figure 2 A color image provided by an embodiment of the present invention;
[0032] Figure 3 A color image of the edge to be extracted used in the simulation experiment of the present invention;
[0033] Figure 4 This is a color image after edge extraction in the simulation experiment of the present invention. DETAILED DESCRIPTION
[0034] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0035] Reference Figure 1 , the specific implementation steps of the present invention are further described.
[0036] The embodiment of the present invention selects a color image with a size of 5×5, such as Figure 2 shown. Figure 2 The image on the left is a component image of the red channel of the color image, the image in the middle is a component image of the green channel of the color image, and the image on the right is a component image of the blue channel of the color image.
[0037] Step 1: Select an unselected pixel from the color image and extract a pixel window centered on the selected pixel.
[0038] Combine the following Figure 2 , the complete processing process of a pixel point selected from the color image in the embodiment of the present invention is further described in detail.
[0039] In an embodiment of the present invention, a color pixel located at the position (3, 3) of the color image is selected, and the pixel values of the red, green and blue channels of the color pixel are 237, 174 and 203 respectively.
[0040] Step 1: Select a pixel window of size n×n from the color image, centered at the selected pixel:
[0041] In the embodiment of the present invention, n=3 is taken, and the selected pixel {237,174,203} is taken as the center. Eight pixels above, below, left, right, upper left, lower left, upper right, and lower right around the pixel are selected from the color image. The coordinates of these eight pixels in the color image are (2,3), (4,3), (3,2), (3,4), (2,2), (4,2), (2,4), and (4,4). The pixel values of the pixels above the selected pixel in the red, green, and blue channels are 242, 199, and 227, respectively. The pixel values of the pixels below the selected pixel in the red, green, and blue channels are 255, 169, and 185, respectively. The pixel values of the pixels to the left of the selected pixel are The pixel values in the red, green and blue channels are 96, 218 and 103 respectively, the pixel values in the red, green and blue channels of the pixel to the right of the selected pixel are 254, 188 and 232 respectively, the pixel values in the red, green and blue channels of the pixel to the upper left of the selected pixel are 69, 229 and 51 respectively, the pixel values in the red, green and blue channels of the pixel to the lower left of the selected pixel are 247, 201 and 232 respectively, the pixel values in the red, green and blue channels of the pixel to the upper right of the selected pixel are 241, 39 and 211 respectively, and the pixel values in the red, green and blue channels of the pixel to the lower right of the selected pixel are 54, 90 and 231 respectively. These 8 pixels together with the selected pixel form a pixel window of size 3×3.
[0042] Step 2: Number the pixels in the pixel window: the pixel in the upper left corner of the pixel window is numbered 1, and the numbers of other pixels increase gradually to the right and downward. The number of the selected pixel in the pixel window is The pixel at the bottom right corner of the window is numbered n. 2 .
[0043] In an embodiment of the present invention, the selected pixel is numbered 5, and the upper left, upper, upper right, left, right, lower left, lower, and lower right pixels around the selected pixel are numbered 1, 2, 3, 4, 6, 7, 8, and 9 respectively.
[0044] Step 2, generate a background matrix for all pixels in the pixel window.
[0045] Step 1: Calculate the Euclidean color distance of each pixel in the pixel window.
[0046] When calculating the Euclidean color distance of a pixel, any color pixel whose pixel values of the red, green, and blue channels are r0, g0, and b0 can be used as a reference.
[0047] The embodiment of the present invention takes the black pixel whose pixel values of the red, green and blue channels are all 0 as the reference, and sets r0=0, g0=0, b0=0. The following Euclidean color distance formula is used to calculate the Euclidean color distance of each pixel in the pixel window of the selected pixel:
[0048]
[0049] Among them, d j represents the Euclidean color distance of the jth pixel in the pixel window, r j ,g j ,b j Respectively represent the pixel values of the red, green, and blue channels of the j-th pixel, Indicates a floor operation.
[0050] In an embodiment of the present invention, the Euclidean color distances of pixels 1-9 in the pixel window of the selected pixel are 244, 386, 322, 259, 357, 392, 393, 357, and 253, respectively.
[0051] Step 2: Construct a background matrix that describes the relationship between each pixel in the pixel window and the selected pixel.
[0052] Construct a background matrix K with N rows and 4 columns. The i-th row of the background matrix represents the j-th pixel in the pixel window, where i=j. The 1st to 4th columns of the background matrix respectively describe the four relationship quantities between the pixel represented by the i-th row and the selected pixel in the red channel, green channel, blue channel and Euclidean color distance, where 1≤i≤N, N represents the total number of pixels in the pixel window, and N=n 2 .
[0053] Since the selected pixel is located at the center of the pixel window, the row number of the selected pixel in the pixel matrix is equal to its row number in the pixel window.
[0054] If the first column of the pixel represented by the i-th row of the background matrix is greater than or equal to the first column of the selected pixel, the value of the element at position (i,1) in the background matrix is set to 1, K i1 =1, otherwise, set to 0, K i1 =0.
[0055] If the second column of the pixel represented by the i-th row of the background matrix is greater than or equal to the second column of the selected pixel, the value of the matrix element at position (i,2) in the background matrix is set to 1, K i2 =1, otherwise set to 0, K i2 =0.
[0056] If the third column of the pixel represented by the i-th row of the background matrix is greater than or equal to the third column of the selected pixel, the value of the matrix element at position (i,3) in the background matrix is set to 1, K i3 =1, otherwise set to 0, K i3 =0.
[0057] If the 4th column of the pixel represented by the i-th row of the background matrix is greater than or equal to the 4th column of the selected pixel, the value of the matrix element at position (i,4) in the background matrix is set to 1, K i4 =1, otherwise set to 0, K i4 =0.
[0058] In an embodiment of the present invention, the background matrix of each pixel in the pixel window and the selected pixel is:
[0059]
[0060] Step 3, generate an object relationship matrix describing the relationship between any two pixels in the pixel window:
[0061] Step 1: Transpose the background matrix of the selected pixel to obtain a temporary matrix M1.
[0062] In an embodiment of the present invention, the temporary matrix M1 is:
[0063]
[0064] Step 2: Perform matrix complement operation on the temporary matrix M1 obtained in step 1 to obtain a temporary matrix M2.
[0065] The matrix complement operation refers to first obtaining an all-1 matrix of the same size as the operated matrix, and then performing a subtraction operation on the obtained all-1 matrix and the operated matrix.
[0066] In an embodiment of the present invention, the temporary matrix M2 is obtained by the following formula:
[0067]
[0068] Step 3: Perform matrix multiplication operation on the background matrix describing all pixels in the pixel window and the temporary matrix M2 obtained in step 2 of this step to obtain a temporary matrix M3.
[0069] In an embodiment of the present invention, the temporary matrix M3 is obtained by the following formula:
[0070]
[0071] Step 4: Perform matrix complement operation on the temporary matrix M3 obtained in step 3 of this step to obtain the object relationship matrix W of the background matrix.
[0072] In an embodiment of the present invention, the object relation matrix W of the background matrix is obtained by the following formula:
[0073]
[0074] Step 4, determine the conceptual structural element of the selected pixels:
[0075] The pixels corresponding to all columns of the object relationship matrix whose element values of the rows corresponding to the selected pixels are 1 are determined to be an element in a concept structure element set.
[0076] In the embodiment of the present invention, according to the record of step 2 in step 2, the 5th row in the background matrix represents the selected pixel, so in the object relationship matrix, the 5th row of the object relationship matrix is taken as follows:
[0077] [-2 1 -1 -2 1 1 1 -1 -2]
[0078] In the 5th row, the columns with element values 1 are the 2nd, 5th, 6th, and 7th columns respectively, so the set of pixels corresponding to the 2nd, 5th, 6th, and 7th columns is a conceptual structural element.
[0079] There are 4 pixels in the conceptual structure element. The pixels corresponding to the second column have pixel values of 242, 199, and 227 for the red, green, and blue channels respectively, and their coordinates in the color image are (2, 3); the pixels corresponding to the fifth column have pixel values of 237, 174, and 203 for the red, green, and blue channels respectively, and their coordinates in the color image are (3, 3); the pixels corresponding to the sixth column have pixel values of 254, 188, and 232 for the red, green, and blue channels respectively, and their coordinates in the color image are (3, 4); the pixels corresponding to the seventh column have pixel values of 247, 201, and 232 for the red, green, and blue channels respectively, and their coordinates in the color image are (4, 2).
[0080] Step 5, using the matrix norm of the pixel to determine the maximum pixel element in the set of conceptual structure elements.
[0081] Since color pixels are represented by the red, green, and blue channel pixel values, their sizes cannot be directly compared like grayscale pixels. Therefore, the size relationship of the pixel matrix norm is used to determine the largest pixel element in the set of conceptual structure elements.
[0082] Step 1: Calculate the matrix norm of each pixel element in the conceptual structure element set according to the following formula:
[0083]
[0084] Among them, ||U x,y || represents the matrix norm of the pixel at the (x,y) coordinate position in the input color image, u x,y Represents the Euclidean color distance of the pixel at the (x,y) coordinate position in the input color image, u x-1,y Represents the Euclidean color distance of the pixel at the (x-1, y) coordinate position in the input color image, ux+1,y Represents the Euclidean color distance of the pixel at the (x+1,y) coordinate position in the input color image, u x,y-1 Represents the Euclidean color distance of the pixel at the (x, y-1) coordinate position in the input color image, u x,y+1 Represents the Euclidean color distance of the pixel at the (x, y+1) coordinate position in the input color image, u x-1,y-1 Represents the Euclidean color distance of the pixel at the (x-1, y-1) coordinate position in the input color image, u x+1,y-1 Represents the Euclidean color distance of the pixel at the coordinate position (x+1, y-1) in the input color image, u x-1,y+1 Represents the Euclidean color distance of the pixel at the coordinate position (x-1, y+1) in the input color image, u x+1,y+1 Represents the Euclidean color distance of the pixel at the coordinate position (x+1,y+1) in the input color image. represents a floor operation, and the Euclidean color distance of the pixel is obtained using the same formula as step 1 in step 2.
[0085] In the embodiment of the present invention, there are 4 pixels in the conceptual structure element. The positions of these 4 pixels in the color image are: (2, 3), (3, 3), (3, 4), (4, 2), and the matrix norms of these 4 pixels are: ||U 2,3 ||=924,||U 3,3 ||=1003,||U 3,4 ||=959,||U 4,2 ||=895.
[0086] Step 2: Determine the maximum pixel in the conceptual structure element.
[0087] The pixel corresponding to the maximum value in the matrix norm is determined as the maximum pixel in the conceptual structure element.
[0088] In an embodiment of the present invention, the maximum value of the matrix norm is ||U 3,3 ||=1003, therefore, the pixel at position (3,3) in the color image is the largest pixel in the conceptual structural element, and the pixel values of the red, green, and blue channels of the maximum pixel are 237, 174, and 203 respectively.
[0089] Step 6, construct a result image whose length and width are equal to those of the color image, and set the difference pixel obtained by subtracting the maximum pixel from the selected pixel in the result image. The position of the difference pixel in the result image corresponds to the position of the selected pixel in the color image.
[0090] The difference pixel is obtained by the following formula:
[0091]
[0092] Among them, O r ,O g ,O b Respectively represent the pixel values of the red, green, and blue channels of the difference pixel, P r ′,P g ′,P b ′ represents the pixel values of the three channels of the maximum pixel red, green and blue, respectively, r ,P g ,P b Respectively represent the pixel values of the red, green, and blue channels of the selected pixel.
[0093] In the embodiment of the present invention, the pixel values of the red, green and blue channels of the maximum pixel in the conceptual structure element are 237, 174 and 203 respectively, and the pixel values of the red, green and blue channels of the selected pixel are 237, 174 and 203 respectively, then the difference pixel is obtained by the following formula:
[0094]
[0095] From the above calculation, the pixel values of the red, green and blue channels of the difference pixel are 0, 0, 0 respectively.
[0096] Since the position of the selected pixel in the color image is: (3,3), the position of the difference pixel in the result image is: (3,3).
[0097] Step 7: Using the same method as steps 1 to 6, edge extraction is performed on each pixel point in the color image whose edge is to be extracted, to obtain a color image after edge extraction.
[0098] The effect of the present invention is further described below in conjunction with simulation experiments:
[0099] 1. Simulation experiment conditions:
[0100] The hardware platform of the simulation experiment of the present invention is: the processor is Intel Core i7-9700 CPU, the main frequency is 3.0 GHz, and the memory is 8 GB.
[0101] The software platforms for the simulation experiment of the present invention are: Windows 10 operating system and Mtalab R2018b.
[0102] The simulation parameters of the present invention are as follows: the pixel window is n=3.
[0103] 2. Simulation content and results analysis:
[0104] The simulation experiment of the present invention uses the present invention to perform edge extraction operation on an input color image to obtain a color image after edge extraction of the input image.
[0105] The input image used in the simulation experiment of the present invention is a color image with a size of 666×479 and an image format of jpg. Figure 3 shown. Figure 3 The image on the left is the component map of the red channel of the input image, the image in the middle is the component map of the green channel of the input image, and the image on the right is the component map of the blue channel of the input color image.
[0106] The edge-extracted color image obtained by performing edge extraction on the input image using the method of the present invention is a color image with a size of 666×479 and an image format of jpg, such as Figure 4 shown. Figure 4 The left image is a component image of the red channel of the color image after edge extraction, the middle image is a component image of the green channel of the color image after edge extraction, and the right image is a component image of the blue channel of the color image after edge extraction.
[0107] The simulation results of the present invention show that: Figure 3 and Figure 4 It is found that the present invention can extract the actual edge of a color image, and the color image after edge extraction has the advantages of high definition and no noise interference.
Claims
1. A color image edge extraction method based on conceptual structure elements and matrix norm, characterized in that: The generated object relationship matrix is used to extract the conceptual structural element corresponding to each pixel in the color image, and the maximum pixel in the conceptual structural element is obtained by using the matrix norm. The steps of the method include the following: Step 1, extract the pixel window centered on the selected pixel: (1a) Select an unselected pixel from the color image of the edge to be extracted; (1b) expanding pixels from the top, bottom, left, right, upper left, lower left, upper right, and lower right with the selected pixel as the center to obtain an n×n pixel window with the selected pixel as the center, where n represents the window size and is an odd number greater than or equal to 3; Step 2, generate the background matrix of all pixels in the pixel window: Construct a background matrix K with N rows and 4 columns. The i-th row of the background matrix represents the j-th pixel in the pixel window, where i=j. The 1st to 4th columns of the background matrix respectively describe the four relationship quantities between the pixel represented by the i-th row and the selected pixel in the red channel, green channel, blue channel and Euclidean color distance, where 1≤i≤N, N represents the total number of pixels in the pixel window, and N=n 2 ; Step 3: Generate the object relationship matrix according to the following formula: W=~(K*(~(K T ))) Where W represents the generated object relation matrix, T represents the transpose operation, ~ represents the complement operation on the matrix, and * represents the matrix multiplication operation; Step 4, determining a set of conceptual structural elements of the selected pixel; The pixels corresponding to all columns whose element values of the rows corresponding to the selected pixel in the object relationship matrix are 1 are all determined to be a pixel element in the concept structure element set, thereby obtaining the concept structure element set of the selected pixel; Step 5, using the matrix norm of the pixel, determine the maximum pixel element in the conceptual structure element set: (5a) Calculate the matrix norm of each pixel element in the conceptual structure element set according to the following formula: Among them, ||U x,y || represents the matrix norm of the pixel at the (x,y) coordinate position in the color image to be extracted edge, u x,y Represents the Euclidean color distance of the pixel at the (x,y) coordinate position in the color image of the edge to be extracted, u x-1,y Represents the Euclidean color distance of the pixel at the (x-1, y) coordinate position in the color image of the edge to be extracted, u x+1,y The Euclidean color distance of the pixel at the (x+1, y) coordinate position in the color image of the edge to be extracted, u x,y-1 The Euclidean color distance of the pixel at the (x, y-1) coordinate position in the color image of the edge to be extracted, u x,y+1 The Euclidean color distance of the pixel at the (x, y+1) coordinate position in the color image of the edge to be extracted, u x-1,y-1 Represents the Euclidean color distance of the pixel at the (x-1, y-1) coordinate position in the color image of the edge to be extracted, u x+1,y-1 The Euclidean color distance of the pixel at the coordinate position (x+1, y-1) in the color image of the edge to be extracted, u x-1,y+1 Represents the Euclidean color distance of the pixel at the coordinate position (x-1, y+1) in the color image of the edge to be extracted, u x+1,y+1 Represents the Euclidean color distance of the pixel at the coordinate position (x+1, y+1) in the color image of the edge to be extracted. Indicates a round-down operation; (5b) determining the pixel corresponding to the maximum value in the matrix norm as the maximum pixel in the conceptual structure element; Step 6, assign the generated difference pixels: (6a) using a difference pixel formula, generating a difference pixel corresponding to the selected pixel; (6b) assigning the difference pixel to the color image after edge extraction, and the position of the assignment corresponds to the position of the selected pixel in the color image of the edge to be extracted; Step 7: Using the same method as steps 1 to 6, edge extraction is performed on each pixel point in the color image whose edge is to be extracted, to obtain a color image after edge extraction.
2. The color image edge extraction method based on conceptual structure elements and matrix norm according to claim 1 is characterized in that: The complement operation described in step 3 refers to subtracting the matrix to be operated from a matrix of all 1s having the same size as the matrix to be operated.
3. The color image edge extraction method based on conceptual structure elements and matrix norm according to claim 1, characterized in that: The difference pixel formula in step (6a) is as follows: Among them, O r ,O g ,O b Respectively represent the pixel values of the red, green, and blue channels of the difference pixel, P r ′,P g ′,P b ′ represents the pixel values of the three channels of red, green and blue, respectively, r ,P g ,P b Respectively represent the pixel values of the red, green, and blue channels of the selected pixel.
Citation Information
Cited By
Color image edge extraction method based on reduction concept structure elements and matrix sequence
CN115861349A
Color Image Edge Extraction Method Based on Reduced Concept Structure Elements and Matrix Order
CN115861349B
Color image edge extraction method based on adaptive window and dynamic weight norm
CN122089767A
