sir i have a code which i want to use in image steganography but whenever i am trying to take that code and use in my gui its showing me error

i want to use this code in my gui but i want to retrieve the image from the previous button and whenever im using the previous button its showing me error
the code which i want to use
c = imread('images.jpg');
message = 'hellokarthick'
message = strtrim(message);
m = length(message) * 8;
AsciiCode = uint8(message);
binaryString = transpose(dec2bin(AsciiCode,8));
binaryString = binaryString(:);
N = length(binaryString);
b = zeros(N,1); %b is a vector of bits
for k = 1:N
if(binaryString(k) == '1')
b(k) = 1;
else
b(k) = 0;
end
end
s = c;
height = size(c,1);
width = size(c,2);
k = 1;
for i = 1 : height
for j = 1 : width
LSB = mod(double(c(i,j)), 2);
if (k>m || LSB == b(k))
s(i,j) = c(i,j);
else
if(LSB == 1)
s(i,j) = c(i,j) - 1;
else
s(i,j) = c(i,j) + 1;
end
k = k + 1;
end
end
end
imwrite(s, 'hiddenmsgimage.bmp');
the code which i am using
c = imread('get(handles.filename, 'String');');
message = 'handles.edit2, 'String''
message = strtrim(message);
m = length(message) * 8;
AsciiCode = uint8(message);
binaryString = transpose(dec2bin(AsciiCode,8));
binaryString = binaryString(:);
N = length(binaryString);
b = zeros(N,1); %b is a vector of bits
for k = 1:N
if(binaryString(k) == '1')
b(k) = 1;
else
b(k) = 0;
end
end
s = c;
height = size(c,1);
width = size(c,2);
k = 1;
for i = 1 : height
for j = 1 : width
LSB = mod(double(c(i,j)), 2);
if (k>m || LSB == b(k))
s(i,j) = c(i,j);
else
if(LSB == 1)
s(i,j) = c(i,j) - 1;
else
s(i,j) = c(i,j) + 1;
end
k = k + 1;
end
end
end
imwrite(s, 'hiddenmsgimage.bmp');

Answers (2)

Replace
c = imread('get(handles.filename, 'String');');
with
filename = get(handles.filename, 'String');
c = imread(filename);

1 Comment

Better yet, just use dir() to load the image names into a listbox so the user can easily click on a name to select it. Why force your user to have to know the filename and type it in? Don't be cruel to your users.

Sign in to comment.

plz, where is the decoding part ? can you continue it plz to be more useful for us :)

Asked:

on 22 Jun 2015

Answered:

eng
on 3 Jul 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!