I am working on an assignment where we have to use the NEC algorithm for inserting and extracting a watermark from an image file. Using the techniques described in this article. I am at the point where I want to apply the similarity function in Matlab:
$$\begin{align*} X &= (x_1,x_2,\dotsc,x_n)\quad\text{original watermark}\\ X^* &= (x^*_1,x^*_2,\dotsc,x^*_n)\quad\text{extracted watermark}\\\\ sim(X, X^*) &= \frac{X^* * X}{\sqrt{X^* * X^*}}\\ \end{align*}$$
After that, the purpose is to compare the result to a threshold value to take a decision.
EDIT Question: what is the best way to implement the sim() function? The values of the watermark vectors are doubles.