## 3 Proposed Method  
Most watermarking techniques share a similar framework, with variations arising in the specific methods used for embedding and extracting the watermark [24]. In this work, we introduce a new blind and robust watermarking approach that extends the capabilities of the Discrete Wavelet Transform (DWT) by scrutinizing both the gradient direction and magnitude across decomposed sub-bands. Figure 1 illustrates the schematic representation of the proposed approach. Our proposed method consists of two main sections, namely (a) Information Embedding in which the information of the patient will be hidden in the cover image and (b) Information Extraction in which the hidden information will be extracted. Our approach considers extracting three main components, which will be used later on for the embedding, from the cover image. The three components the _LL_ sub-band for the Haar wavelet, the gradient magnitude, and the gradient direction are extracted as follows: _LL_**sub-band:** We apply the Haar wavelet transform to the image, resulting in the frequency domain representation with the _LL_ sub-band:  
\[LL(i,j)=\frac{1}{2}(I(i,j)+I(i,j+1)+I(i+1,j)+I(i+1,j+1)) \tag{1}\]  
This sub-band captures the low-frequency content, representing a smoothed version of the original image. The forthcoming procedures are performed at block-levels of size \(n\times n\). **Gradient direction (D):** This provides crucial information about the orientation of edges and structures in the image. The gradient direction at each pixel is calculated using the following function:  
\[D(i,j)=\text{atan2}(\
abla_{y}I(i,j),\
abla_{x}I(i,j)) \tag{2}\]  
To further improve robustness and to alleviate the noise effect, a binning is performed in the gradient direction according to the following formula:  
\[f(x)=\left\lceil\frac{x}{c}\right\rceil\quad\text{for }0<x\leq 2\pi \tag{3}\]  
where \(c\) is a constant that determines the size of each interval and \(\left\lceil.\right\rceil\), the ceiling function, returns the smallest integer that is greater than or equal to the input value. In our work, \(c\) was set to \(\pi/2\) to provide greater flexibility and enhance robustness against noise effects. **Gradient magnitude (M):** This represents the rate of change of pixel intensity across the image. It measures the overall intensity variation at each pixel, providing information about the edges. The gradient magnitude at each pixel is calculated using the gradient operators \(\
abla_{x}\) and \(\
abla_{y}\) in the horizontal and vertical directions, respectively:  
\[M(i,j)=\sqrt{(\
abla_{x}I(i,j))^{2}+(\
abla_{y}I(i,j))^{2}} \tag{4}\]  
where \(\
abla_{x}I(i,j)\) and \(\
abla_{y}I(i,j)\) represent the horizontal and vertical gradients of the image \(I\) at the pixel \(I(i,j)\), respectively. Figure 1: Proposed scheme with two main phases: (**a**) Information Embedding, (**b**) Information Extraction, GM: block (3 \(\times\) 3) of gradient magnitude, GD: block (3 \(\times\) 3) of gradient direction, BD: binning decomposition. After having binned the gradient direction \(D(i,j)\) and extracted the gradient magnitude \(M(i,j)\), we construct the watermark's final histogram \(H\) accumulating binarized magnitudes according to the binned directions as follows:  
\[H[k]=\sum_{d\in D}\sum_{(ij,j)\in S_{kd}}B_{a}(M(i,j)) \tag{5}\]  
where \(D\) is the set of all possible binarized directions, \(S_{kd}\) is the set of all pixel indices \((i,j)\) having gradient directions \(d\) and that fall into the \(k\)-th bin of the histogram, and \(B_{a}(x)\) is a binarization function defined as follows:  
\[B_{a}[x]= \begin{cases}1&\text{if }x\geq\alpha\\ 0&\text{if }x<\alpha\end{cases}  \tag{6}\]  
For simplicity, \(\alpha\) can be set to the middle of the magnitude value range for each \(S_{kd}\), calculated as:  
\[\alpha=\frac{\min(M(S_{kd}))+\max(M(S_{kd}))}{2} \tag{7}\]  
It should be mentioned that each block must produce a 1 byte code (8 bits) called the _crypto code_.