- fopen
- fclose
- fscanf
- uigetfile
- figure
- subplot
- imshow
- title
how can i solve the reshape error appearing in my code?
3 views (last 30 days)
Show older comments
PRIYANKA SHIRODKAR
on 13 Jul 2016
Commented: Tim McBrayer
on 20 Jul 2016
The code posted below is for embedding and extracting of a .emb and .ext file generated in an hdl code. I am getting a reshape error while running the extraction code... Please solve
clc;
clear all;
close all;
M = 140;
N = 140;
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
[FileName,PathName] = uigetfile('*.list','Select Original Image');
fileID = fopen([PathName,FileName],'r');
A = fscanf(fileID, '%x');
fclose(fileID);
original_img = reshape(A,N,M);
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
[FileName,PathName] = uigetfile('*.emb','Select Embedded Image');
fileID = fopen([PathName,FileName],'r');
A = fscanf(fileID, '%x');
fclose(fileID);
Extract_img = reshape(A,N,M);
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
subplot(1,2,1);
imshow(original_img',[]);
title('Original Image');
subplot(1,2,2);
imshow(Extract_img',[]);
title('Embedded Image');
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
M = 45;
N = 45;
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %
[FileName,PathName] = uigetfile('*.ext','Select Extracted watermark Image');
fileID = fopen([PathName,FileName],'r');
A = fscanf(fileID, '%x');
fclose(fileID);
Extract_img = reshape(A,M,N);
figure;
subplot(1,2,1);
imshow(Extract_img',[]);
title('Extracted Watermark Image');
0 Comments
Accepted Answer
Tim McBrayer
on 13 Jul 2016
I'm not sure what you are trying to do with HDL Coder here, but there is basically no code in your example that is supported by HDL Coder. Specifically, the following function calls are not supported for HDL code generation:
2 Comments
Tim McBrayer
on 20 Jul 2016
You will need to figure out what is your driver code for your implementation. This is your testbench for HDL code generation, and can contain any code. This is where you read and write files, display plots, and so forth.
The actual implementation of your steganography engine can be converted to HDL if it is modeled appropriately. You will want to accept your image a pixel at a time and perform the embedding and/or extraction on the pixel stream.
More Answers (0)
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!