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');

采纳的回答

Tim McBrayer
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:
  • fopen
  • fclose
  • fscanf
  • uigetfile
  • figure
  • subplot
  • imshow
  • title
  2 个评论
PRIYANKA SHIRODKAR
PRIYANKA SHIRODKAR 2016-7-14
This is my final year project of steganography. I wished to implement the project using an HDL code as well as the MATLAB code. The HDL code gives the simulation results for embedding and extraction of text from an image. But the MATLAB code written above performs only embedding and not extraction. During the extraction code it displays the reshape error
Tim McBrayer
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!

Translated by