# Contrast-Invariant Edge Detection: A Methodological Advance in Medical Image Analysis
## 3 Proposed Methods
For each pixel in an image, its new value is determined by the weighted average of the pixels in its neighborhood. The weights are determined by the Gaussian function. The farther a pixel is from the central pixel, the smaller its weight. In this way, Gaussian noise in the image can be effectively reduced while keeping the edges and details of the image relatively clear. For a two-dimensional image, the Gaussian function can be expressed as Equation (3), where \((x,y)\) is the coordinate relative to the center pixel and \(\sigma\) is the standard deviation, which controls the width of the distribution of the Gaussian function. It is common to use a convolution kernel \(K\) of finite size, whose elements \(K(i,j)\) are computed by the Gaussian function \(G(x,y)\) and normalized so that all the elements sum to 1. The input grayscale image is \(I(x,y)\), and the filtered image \(J(x,y)\) is obtained by Equation (4). After Gaussian filtering processing, we perform the opening operation and the closing operation on the image successively. The opening operation involves performing an erosion operation on the image first and then a dilation operation. The formula for the opening operation is shown in Equation (5), where \(J\) is set to be the Gaussian filtered image and \(E\) is the structural element. The erosion operation \(J\ominus E\) shrinks the bright objects in the image and removes some small bright noise points or thin connecting parts. Then, the dilation operation \(J\oplus E\) restores the size of the objects to a certain extent, but it does not restore the small objects or noise points that have been eroded away, thus achieving the effect of removing small bright noise points and smoothing the contours of the objects. The closing operation first performs a dilation operation on the image and then an erosion operation. The formula for the closing operation is shown in Equation (6). The dilation operation \(J\oplus E\) reduces the holes in the dark objects in the image and connect the broken parts. Then, the erosion operation \(J\ominus E\) restores the approximate original size of the objects, but it does not restore the small holes filled by the dilation or the broken connected parts, thus achieving the purpose of connecting the broken parts at the edges of the objects and filling the small holes. By the method of Gaussian filtering followed by morphological processing, we obtain the processed image. Gaussian filtering is performed first to remove noise, and then morphological opening and closing operations are processed to further optimize the structure and edge information of the image on the basis of reducing noise interference, improving the quality of the image, and facilitating the subsequent image analysis and processing. \[G(x,y)=\frac{1}{2\pi\sigma^{2}}e^{-\frac{x^{2}+y^{2}}{2\sigma^{2}}}\] (3)\[J(x,y)=\sum_{i=-1}^{1}\sum_{j=-1}^{1}I(x+i,y+j)K(i,j) \tag{4}\]  
\[J\circ E=(J\odot E)\oplus E \tag{5}\]  
\[J\bullet E=(J\oplus E)\odot E \tag{6}\]  
* Step 1: This step is bit-plane decomposition. There is a grayscale image of 8-bit depth with each pixel taking values ranging from 0 to 255, and each bit plane is a binary image composed of only 0 and 1. If \(x,y\) denote the coordinates of the processed image \(I_{p}\) and \(B_{i}\) denotes the binary value on the \(i\)th bit plane of that pixel value, then the pixel value at the \(x,y\) position can be represented as Equation (7). The main contour information contained in the 3 MSB planes is relatively stable and does not change significantly due to lighting variations and imaging angles. As the 3 MSB planes encompass the principal structure and contour details of the image and exhibit lower sensitivity to noise, the CIED method employs these 3 MSB planes for detecting the edge of the medical image. Consequently, a bit-plane decomposition of the grayscale image is carried out. Each pixel value is divided into different bit planes, and then we extract the 3 MSB planes using the following Equation (8).