-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3fd6ca9
commit 7758033
Showing
5 changed files
with
29 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# HideInfo | ||
|
||
Info Hiding Library | ||
一些原理简洁的信息隐藏方法 | ||
一些小而美的信息隐藏方法 | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = '0.1.6' | ||
__version__ = '0.1.7' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import numpy as np | ||
|
||
|
||
def get_error_rate(wm_extract, wm_bits): | ||
len_wm_bits = len(wm_bits) | ||
error_num = np.sum(np.abs(wm_extract - wm_bits)) | ||
error_rate = error_num / len_wm_bits | ||
print(f'bit error rate = {error_rate:.2%} ({error_num} / {len_wm_bits})') | ||
return error_rate | ||
|
||
|
||
def get_snr(ori_signal, wm_signal): | ||
snr = 10 * np.log10( | ||
np.sum(np.square(ori_signal.astype(np.float32))) | ||
/ np.sum(np.square(ori_signal.astype(np.float32) | ||
- wm_signal.astype(np.float32)))) | ||
print(f'SNR = {snr:.2f} dB') | ||
return snr |