# Spatial Domain-Based Nonlinear Residual Feature Extraction for Identification of Image Operations
## 2 Proposed Approach for Identification of Image Operations
### Spatial Domain-Based Nonlinear Residual (SDNR) Feature  
The SDNR is constructed from locally supported linear filters in the spatial domain. By applying minimum and maximum operators, the diversity and nonlinearity are thus introduced. In this way, the construction brings nonsymmetry to the distribution of SDNR samples. In Equation (1), the calculation of residual value is expressed, where \(I\) and \(f\) are the host image and filter, respectively. The corresponding residual of the pixel is calculated by multiplying and summing the corresponding pixel and its adjacent pixels by the filter coefficients. Considering the fact that for edge pixels of the image, the pixel value might not be adequately changed in accordance with the filter coefficients, mirror symmetric filling operations are conducted on the images before applying the filtering operations. Figure 1: Framework of the proposed approach. That means the images are filled adjacently by border pixel values. After this operation, the size of the residual map does not change. \[R_{i,j}=I\otimes f=\sum_{a=-M}^{M}\sum_{b=-N}^{N}f(a,b)\cdot I(i-a,j-b) \tag{1}\]  
where \(R\) denotes the residual map, which is calculated from the host image \(I\) and the filter \(f;\otimes\) denotes the convolution process; and \(A\) and \(B\) indicate the size of the host image. \(M=\lfloor A/2\rfloor\) and \(N=\lfloor B/2\rfloor\). Figure 2 graphically shows the structure of the proposed SDNR, where the symbol '\(\bullet\)' indicates the central pixel \(X_{i,j}\), and the other two symbols denote the neighboring pixels and at the same time indicate the two employed filters. The SDNR can thus be formed with Equation (2). \[\left\{ \begin{array}{l}SDNR_{i,j}^{(\min)}=\min\{X_{i,j-1}+X_{i,j+1}-2X_{i,j},X_{i-1,j+1}+X_{i+1,j-1}-2X_{i,j}\}\\ SDNR_{i,j}^{(\max)}=\max\{X_{i-1,j}+X_{i+1,j}-2X_{i,j},X_{i-1,j-1}+X_{i+1,j+1}- 2X_{i,j}\}\end{array} \right. \tag{2}\]  
To curb the residual's dynamic range and make the residual more sensitive to the processing changes at the spatial discontinuities in the image, especially at the edges and textures, the quantization and truncation process are employed in the residual map \(\mathbf{SDNR}^{((\min),(\max))}\) using Equation (3). \[\left\{ \begin{array}{l}SNDR\_TQ_{i,j}^{(\min)}=\text{trunc}_{\text{T}}\left( \left\lceil\frac{SNDR_{i,j}^{(\min)}}{q}+\frac{1}{2}\right\rceil\right)\\ SNDR\_TQ_{i,j}^{(\max)}=\text{trunc}_{\text{T}}\left(\left\lceil\frac{SNDR_{i, j}^{(\max)}}{q}+\frac{1}{2}\right\rceil\right)\end{array} \right. \tag{3}\]  
where the calculated \(\mathbf{SNDR\_TQ^{((\min),(\max))}}\) means the corresponding truncated and quantized residual map; \(q\) denotes the quantization step (in our method, we set \(q\) to be the residual order, which means the absolute value of the central position coefficient of the filter); \(\lfloor\rfloor\) indicates the round down operation; and \(\text{trunc}_{\text{T}}()\) denotes the truncation function, which is defined in Equation (4). \[\text{trunc}_{\text{T}}(a)=\left\{ \begin{array}{l}a,\text{ if }(|a|<T)\\ T,\text{ if }(|a|\geq T)\end{array} \right. \tag{4}\]  
Figure 2: Definition of the proposed spatial domain-based nonlinear residual (SDNR). where \(a\) is the input to this truncation function. \(a=\left\lfloor\frac{SNDR^{(\text{min})}_{i,j}}{q}+\frac{1}{2}\right\rfloor\) for residual map \(\mathbf{SDNR^{(\text{min})}}\) and \(a=\left\lfloor\frac{SNDR^{(\text{max})}_{i,j}}{q}+\frac{1}{2}\right\rfloor\) for residual map \(\mathbf{SDNR^{(\text{max})}}\). Meanwhile, \(T\) denotes the truncation coefficient; in this paper, we set \(T=2\), which is the same value used in [22]. Next, the horizontal co-occurrence \(\mathbf{CO_{d}^{((\text{min}),(\text{max}))}}\) is constructed from the four consecutive residual samples generated from Equation (3) by using Equation (5), and it is therefore a four-dimensional array. \[\left\{