Need help with Reed-Solomon Coding

5 vues (au cours des 30 derniers jours)
Neeraj Chimwal
Neeraj Chimwal le 16 Avr 2021
Commenté : Neeraj Chimwal le 18 Avr 2021
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?

Réponse acceptée

Walter Roberson
Walter Roberson le 16 Avr 2021
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 commentaires
Walter Roberson
Walter Roberson le 17 Avr 2021
Modifié(e) : Walter Roberson le 17 Avr 2021
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 le 18 Avr 2021
My bad. Got confused in variables. Anyway, Thankyou so much for expaining this stuff to me

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Error Detection and Correction dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by