2013-01-11 45 views
2

高斯分佈的圖像我正在嘗試使用opencv創建一個遵循正態分佈的20X20圖像,我知道有一個randn函數允許我做類似的事情,但是如果我打算在我想創建的圖像的數據中嵌入一個字符串,我該如何去做呢?創建一個使用OpenCV C++

+1

您是否試圖在圖像或高斯形濾波器內核中生成高斯噪聲? – Pete

+1

所以你想創建一個如下圖所示的圖片:http://en.wikipedia.org/wiki/File:Image_gaussian_noise_example.png?當你談論嵌入一個字符串時,你的意思是元數據還是隱寫術? – sietschie

+0

我的意思是使用隱寫術,我試圖創建一個鏈接中顯示的圖像。 對不起,我的問題沒有更清楚 – user1926691

回答

2

退房這裏均勻高斯隨機數字:http://www.design.caltech.edu/erik/Misc/Gaussian.html

如果你想利用最後的2個數據位(最低顯著的)你的隱藏文字,要他們在降噪設置爲零圖片。

接下來,創建3張圖片:

Image noise, mask, textimg 

AddNoiseTo(noise) // any kind of noise you want 


SetEveryPixel(mask,unsigned char, 255-3) 
CvAnd(noise,mask,noise) // to remove noise from the last 2 bits 


cvPutText(textimg,yourtext,white); 
CvNot(mask,mask) // invert the mask to remove data from the first 6 bits 
CvAnd(textimg,mask,textimg) // filter the text image so only last 2 bits are kept 
CvOr(noise,textimg,outputimg) // this will merge the two images 

如果你想7個數據位(更容易看到用肉眼文本)從面膜中減去127(二進制7 1)而不是3 (二進制11)。