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?
댓글 수: 0
채택된 답변
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
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.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Error Detection and Correction에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!