Need help with Reed-Solomon Coding

5 次查看(过去 30 天)
Hi
I am trying to encode my image with Reed-Solomon code. The code is as below
n = 255;
img = imread('pout.tif');
binary = img > 102;
resized = imresize(binary,[291 247]);
[row k] = size(resized);
gfmsg = gf(resized);
enc = rsenc(gfmsg,n,k);
error = enc + gf(randerr(row,n));
When I run the code, I get an error :
Error using rsenc (line 74)
Symbols in MSG must all have 3 or more bits.
Can you pls help me with this?

采纳的回答

Walter Roberson
Walter Roberson 2021-4-16
n = 255;
img = imread('pout.tif');
binary = img > 102;
resized = imresize(binary,[291 247]);
[row k] = size(resized);
gfmsg = gf(resized,8);
enc = rsenc(gfmsg,n,k);
error = enc + gf(randerr(row,n),8);
  9 个评论
Walter Roberson
Walter Roberson 2021-4-17
编辑:Walter Roberson 2021-4-17
You cannot use m = 1 because rsenc will not accept anything less than m = 3.
So you would need to use either k = 1 n = 3 or k = 1 n = 5 or k = 1 n = 7, or k = 3 n = 5 or k = 3 n = 7 .
The case k = 1 n = 3, you would be using one logical value from the image, and turning it into something that is logically 3 bits (000 or 001), and when it is encoded it would be followed by two three-bit words. That would give a total of 9 bits per row, and the number of rows would be 291*247 = 71877 for a total of 646893 bits to transmit.
If you pad out to 37 rows of 247 columns, each item a full 8 bit's worth of values, and you use n = 255, then the encoded size would be 37 * 255 with 8 meaningful bits per entry, for a total of 75480 bits to transmit.
Neeraj Chimwal
Neeraj Chimwal 2021-4-18
My bad. Got confused in variables. Anyway, Thankyou so much for expaining this stuff to me

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Error Detection and Correction 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by