can anyone help in extracing(destego) the original image from the stegoimage for the stego function code is given below

1 view (last 30 days)
function stegoImage = stego(grayCoverImage,hiddenString,integerValue)
[grayCoverImage, storedColorMap] = imread(grayCoverImage); [rows, columns, numberOfColorChannels] = size(grayCoverImage); if numberOfColorChannels > 1 grayCoverImage = grayCoverImage(:, :, 2); elseif ~isempty(storedColorMap) grayCoverImage = ind2rgb(grayCoverImage, storedColorMap); grayCoverImage = uint8(255 * mat2gray(rgb2gray(grayCoverImage))); end [rows, columns, numberOfColorChannels] = size(grayCoverImage);
hFig = figure; subplot(1, 2, 1); imshow(grayCoverImage, []); axis on; caption = sprintf('original Image.'); title(caption); set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]); %integerValue = round(str2double(cell2mat(1))); if isnan(integerValue) integerValue = defaultValue; end bitToSet = integerValue; if bitToSet < 1 bitToSet = 1; elseif bitToSet > 8 bitToSet = 8; end %hiddenString = sprintf('%4.4d%s', length(hiddenString), hiddenString) asciiValues = hiddenString - 0; stringLength = length(asciiValues); numPixelsInImage = numel(grayCoverImage); bitsPerLetter = 7; numPixelsNeededForString = stringLength * bitsPerLetter; if numPixelsNeededForString > numPixelsInImage asciiValues = asciiValues(1:floor(numPixelsInImage/bitsPerLetter)); stringLength = length(asciiValues); numPixelsNeededForString = stringLength * bitsPerLetter; else message = sprintf('Your message is %d characters long.\nThis will require %d * %d = %d pixels,\nYour image has %d pixels so it will fit.',... stringLength, stringLength, bitsPerLetter, numPixelsNeededForString, numPixelsInImage); fprintf('%s\n', message); end binaryAsciiString = dec2bin(asciiValues)' whos binaryAsciiString binaryAsciiString = binaryAsciiString(:)' stegoImage = grayCoverImage; stegoImage(1:numPixelsNeededForString) = bitset(stegoImage(1:numPixelsNeededForString), bitToSet, 0); oneIndexes = find(binaryAsciiString == '1'); stegoImage(oneIndexes) = bitset(stegoImage(oneIndexes), bitToSet, 1); subplot(1, 2, 2); imshow(stegoImage, []); axis on; caption = sprintf('stego Image.'); title(caption); end

Answers (0)

Categories

Find more on Images in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!