Edge-based Steganography algorithm

I have recently read some paper about steganography algorithms and found out that I am interested in these kind of problems. So here is the python implementation of this paper which is open access and you don't need to spend money to buy it (actually it doesn't worth it!!!).

Actually the intuition behind this algorithm is very simple. Knowing the length of the secret message, the algorithm tries to find edge pixels using canny edge detector and hide data in LSB and second LSB of those selected pixels. Canny algorithm has three input parameters: Sigma (width) of the gaussian kernel, high threshold and low threshold. By changing the value of these parameters, we can control the number of pixels selected as edge. So assume that we know the length of our secret message, then we are going to find an appropriate thereshold value that extract the same number of edge pixels (with 1% tolerance). then we are going to hide two bit in each pixel. Simple as that!!!

I have executed the code and the result is as below:


	Starting to hide data...
        Input image size :  512 x 512
        Selected High threshold for canny algorithm is :  33.969347017532186
        Selected Low threshold for canny algorithm is :  13.587738807012876
        Selected Width(Sigma) of gaussian kernel for canny algorithm is :  0.6
        First 20 bytes of secret message is:  42~]BT<);]:9KYYaW~Li
        recovery process had error? False
        PSNR value of stego-image is :  55.08435616265639
        Mean of original image :  124.061351776
        Mean of stego-image :  124.059715271
        Hiding and restoring process done in  5.899349042037713 second(s)
	 

Subjective result and histogram of original and stego image:


You can download the python code from here. Notice that to run this code, you must have numpy, scipy, matplotlib and scikit-image installed. I prefer anaconda package which has all this modules installed.

Conclusion

Compared to simple LSB algorithm, edge-based steganography has higher psnr, lower capacity, almost same robustness and the algorithm is a little slower. Because it uses only edge pixels, capacity of this algorithm is lower than simple lsb that take advantage of all pixels in image. The algorithm is slower than LSB algorithm because of binary search used to find the appropriate threshold value for Canny edge detector. Since this is a spatial domain algorithm, it is not robust to image compression, resizing or noise.