Created
April 7, 2020 06:00
-
-
Save Wolwer1nE/f4d1ce933912b6bb82e9954e4eabb45b to your computer and use it in GitHub Desktop.
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
function [output] = addText(input, text) | |
red_data = input(:,:,1); | |
text = strcat(num2str(length(text), '%03.f'), text); | |
binary_data = dec2bin(text)'; | |
data_to_encode = str2num(binary_data(:)); | |
for i = 1:length(data_to_encode) | |
red_data(i) = bitset(red_data(i), 1, data_to_encode(i)); | |
end | |
output = input; | |
output(:,:,1) = red_data; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment