- fopen
- fclose
- fscanf
- uigetfile
- figure
- subplot
- imshow
- title
how can i solve the reshape error appearing in my code?
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Tim McBrayer
2016-7-13
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 个评论
Tim McBrayer
2016-7-20
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.
更多回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!