Need help with Reed-Solomon Coding

4 ビュー (過去 30 日間)
Neeraj Chimwal
Neeraj Chimwal 2021 年 4 月 16 日
コメント済み: Neeraj Chimwal 2021 年 4 月 18 日
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 Center および File ExchangeError Detection and Correction についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by