2.3. DCCR Feature Extractor
The directional contrast core response is designed to model local directional contrast in sonar images. Its purpose is to emphasize the structural relationship between target echoes and surrounding acoustic shadows, which is often informative in side-scan sonar imagery. The design of DCCR is motivated by the local acoustic structure of side-scan sonar targets. A target commonly produces a high-intensity highlight adjacent to a low-intensity acoustic shadow, which forms a directional local contrast pattern. In locally smooth background regions, directional difference responses are close to zero. In contrast, at highlight–shadow boundaries, the directional contrast response becomes large. Therefore, directional contrast kernels suppress slowly varying seabed background while emphasizing target-related structural transitions. Combining horizontal and vertical responses reduces sensitivity to target orientation and provides a compact, domain-informed representation complementary to the raw sonar intensity image. Unlike Canny and conventional gradient features, DCCR is designed to retain the contrast relationship between the highlight and its surrounding shadow rather than only isolated edge magnitude.
Given an input image
I(
x,
y), contrast kernels in the horizontal and vertical directions are defined, and the corresponding responses are computed by two-dimensional convolution.
where
and
are the horizontal and vertical convolution kernels, respectively.
The corresponding directional contrast responses are obtained by convolving the input image
I(
x,
y) with these kernels:
where ∗ denotes the 2D convolution operation; and R
h(x, y) and R
v(x, y) are the horizontal and vertical contrast response maps, respectively.
The final DCCR response is obtained by combining the absolute values of the two directional responses:
where ∣·∣ denotes the absolute value operator, and
is the raw directional contrast response map before normalization.
To facilitate comparability across different image regions and enable consistent fusion with other features, the response map is normalized to the range [0, 1]:
where
denotes the maximum value of
over the entire spatial domain, and
is the normalized DCCR feature map, which serves as one of the five input channels in the subsequent early fusion stage.
Compared with generic edge operators, this feature is intended to retain directional contrast information related to sonar imaging structure rather than merely emphasizing local intensity changes.
2.4. Multi-Stream Feature Extraction Module
In addition to DCCR, four commonly used handcrafted features are considered: gradient magnitude, Canny edges, local binary pattern (LBP), and histogram of oriented gradients (HOG). These features capture different aspects of image structure and are used to study whether complementary low-level information can improve target detection.
- (1)
Gradient Magnitude Calculation
Gradient magnitude reflects local intensity variation and is commonly used to describe edge strength. For the input acoustic intensity image
I(
x,
y), Sobel operators are used to compute the horizontal and vertical gradients:
where ∗ denotes the 2D convolution operation; (x, y) is the pixel spatial coordinate;
and
are the horizontal and vertical Sobel kernel matrices, respectively;
and
are the corresponding horizontal and vertical gradient maps.
The gradient magnitude M(x, y) is obtained by computing the Euclidean norm:
The result is normalized to the range [0, 1].
- (2)
Canny Edge Feature Extraction
The Canny detector is used to generate a thin binary edge map through four steps:
Step 1: Gaussian filtering. Smooth the image using a Gaussian filter with standard deviation σ = 1.0 to reduce noise impact:
where
denotes the 2D Gaussian kernel, and
is the resulting smoothed image.
Step 2: Gradient calculation. Compute gradient magnitude and direction using the Sobel operator:
where M(x, y) is the gradient magnitude, and
is the gradient orientation angle at pixel (x, y). The use of atan2 ensures numerical stability by avoiding division-by-zero when
, while also preserving the correct quadrant of the angle.
Step 3: Non-maximum suppression. Compare the gradient value of each pixel along the gradient direction, retaining local maxima to thin edges:
where
is the thinned edge response map, which retains the magnitude value at local maxima and suppresses non-maximum pixels to zero.
Step 4: Double threshold detection and hysteresis connection. Set high and low thresholds T
high and T
low (default ratio 2:1).
The thresholds Tlow and Thigh are used in the double-threshold hysteresis stage of Canny edge extraction. Thigh determines strong edge candidates, whereas Tlow retains weak edge pixels only when they are connected to strong edges. The dual-threshold ratio is fixed at 2:1 to preserve spatial connectivity of genuine target edges while suppressing isolated speckle responses, as the hysteresis connection mechanism relies on the continuity prior of physical sonar targets.
Weak edge pixels are retained only if connected to strong edges, ultimately generating a binary edge map ECanny(x, y) ∈ {0, 1}.
In sonar imagery, Canny edges may help preserve target contours, but they may also respond strongly to background clutter and speckle noise. Therefore, their utility is scene-dependent.
- (3)
Local Binary Pattern
LBP encodes local texture patterns by comparing neighboring pixel values with the central pixel.
Step 1: Basic LBP operator:
For a central pixel p
c, its LBP value is defined as:
where g
c is the grayscale value of the central pixel, g
i is the grayscale value of the i-th sampling point in the neighborhood, and s(x) is the sign function.
Step 2: Uniform patterns:
LBP values are divided into uniform and non-uniform patterns:
where
is the number of spatial transitions in the binary pattern. When U ≤ 2, the pattern is uniform, with a total of P(P − 1) + 3 = 59 patterns.
Step 3: LBP feature map:
The final generated feature map contains the LBP code value (0–58) for each pixel, normalized to [0, 1].
LBP is often useful for texture description, but in sonar imagery it may over-respond to background granularity.
- (4)
Histogram of Oriented Gradients
HOG describes the distribution of gradient orientations within local regions.
Step 1: Gradient calculation:
Compute horizontal and vertical gradients for the grayscale image
I(
x,
y):
where
and
are the horizontal and vertical gradient maps, respectively, computed specifically for HOG feature extraction.
Step 2: Orientation voting within cells:
Divide each 8 × 8 pixel cell into 9 orientation bins (0–180°, one bin every 20°).
For each pixel within a cell, vote to two adjacent bins based on its gradient direction θ and magnitude G:
where
and G(x, y) are the gradient orientation and magnitude;
is the center angle of the i-th orientation bin; w
1 and w
2 are the bilinear interpolation weights for the two adjacent bin;
denotes the accumulated gradient magnitude in the i-th bin of the current cell.
Step 3: Block normalization:
Group 2 × 2 cells into a block and concatenate their feature vectors:
Apply L2 norm normalization.
Step 4: HOG visualization image:
In the visualization image, line segments are drawn in 9 directions within each cell, with length proportional to the cumulative gradient value for that direction:
where δ(⋅) is the direction matching function, finally normalized to [0, 1].
- (5)
Difference Between DCCR and Gradient, Canny, LBP, and HOG
Gradient magnitude, Canny, LBP, and HOG are widely used handcrafted features for describing image edges, textures, and shapes. However, their design objectives are fundamentally different from that of DCCR. Gradient magnitude measures local intensity variation and mainly reflects edge strength; it is a generic operator without explicit domain knowledge about sonar echo–shadow structures. The Canny detector further improves edge localization by producing thin and well-defined edge maps through smoothing, non-maximum suppression, and hysteresis thresholding, but it still focuses on general contour extraction rather than sonar-specific structural cues. LBP characterizes local texture by encoding the binary relationship between a central pixel and its neighbors, making it effective for describing microscopic texture patterns, yet it does not explicitly capture directional contrast between target echoes and acoustic shadows. HOG describes object shape by statistically aggregating gradient orientation distributions over local regions, thereby emphasizing macroscopic contours and structural information, but its representation remains appearance-driven and is not tailored to the acoustic imaging properties of side-scan sonar.
In contrast, DCCR is specifically designed for side-scan sonar imagery to model the directional contrast relationship between target echoes and shadows. Its purpose is not simply to highlight edge strength or local texture, but to emphasize the structural discrepancy formed by sonar backscatter. This makes DCCR more suitable for capturing the characteristic echo–shadow pattern of underwater targets, especially in low-contrast and noisy scenes where conventional edge or texture descriptors may be insufficient. Therefore, compared with Gradient, Canny, LBP, and HOG, DCCR provides a sonar-oriented prior that encodes domain-specific structural differences rather than generic local intensity, contour, or texture information.
2.6. Feature Fusion Module
Unlike deep learning methods, which automatically learn hierarchical features from data, traditional handcrafted feature methods construct features based on domain knowledge and understanding of the problem being addressed, which can generate stable and effective features.
First, the five feature maps are resized to the same dimensions, and then the feature weight for each position is calculated:
where w
i(x, y) denotes the adaptive fusion weight for the i-th handcrafted feature at pixel coordinate(x, y), satisfying w
i(x, y) ∈ [0, 1] for every spatial location; f
i(x, y) is the saliency measure of the i-th feature map at (x, y), defined as the absolute value of the feature response after local contrast enhancement (i.e., f
i(x, y) = |F
i(x, y)|, where F
i(x, y) is the normalized feature value in the range [0, 1]). Among them, F
DCCR(x, y) is calculated using Formulas (1) to (4). The final fused feature is:
where
denotes the normalized response of the i-th handcrafted feature map prior to fusion;
is the resulting fused feature map.
This fusion strategy dynamically adjusts the contribution of each feature based on local scene characteristics.
The aim of the fusion module is not to force all features to contribute equally, but to examine whether structured low-level priors can enrich the detector input. The experimental results later show that some feature combinations are helpful, whereas others may degrade performance, especially in noisy scenes. This finding is important because it suggests that feature fusion in sonar detection should be selective rather than indiscriminate.