Created
April 8, 2020 07:54
-
-
Save Wolwer1nE/c52e4823a8c253e51f1338daec0f8936 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(image, text) | |
red_data = image(:,:,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 = image; | |
output(:,:,1) = red_data; | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment