Error using BCH encoding scheme

4 views (last 30 days)
amit sikder
amit sikder on 29 Nov 2015
I am trying to encode an image file using BCH encoding scheme using communication toolbox. I am using comn.BCHEncoder function. Problem is the code is showing an error in step function. this is the code -
clc, clear all;
[X,map]= imread('xxxx.jpg'); % read an image 30x30
msg = im2bw(X,map,0.3);
imshow(X,map), figure, %if we don't use figure we can't see the two images
m = 4; n = 2^m-1; % Codeword length = 15
dim=size(msg+0);
%n=double(dim(2)+1);
k=double(dim(2));
msg_d=double(msg);
m=5;
msgN=gf(msg,m);
N=2^n-1;
% decBCH=comm.BCHDecoder;
encBCH = comm.BCHEncoder(n,k);
decBCH=comm.BCHDecoder(n,k);
size_1=dim(1);
BCHEnc=zeros(dim(2)+2,dim(1));
tic
for i=1:size_1
BCHEnc(:,i)=step(encBCH,msg_d(i,:)');
end
toc
MATLAB is showing following error -
step(encBCH,msg_d(1,:)')
Error using BCHEncoder/step
The input and output dimensions must be consistent with the message or codeword length, including the effects of possible puncturing.
if I want to use message matrix [180x30] for example, should I take row by row? What should i use as a value of n and k in comm.BCHEncoder(n,k) then?

Answers (0)

Categories

Find more on Image Processing Toolbox 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!