- fopen
- fclose
- fscanf
- uigetfile
- figure
- subplot
- imshow
- title
how can i solve the reshape error appearing in my code?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
PRIYANKA SHIRODKAR
am 13 Jul. 2016
Kommentiert: Tim McBrayer
am 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 Kommentare
Akzeptierte Antwort
Tim McBrayer
am 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 Kommentare
Tim McBrayer
am 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!