Encoding Gray scal image

조회 수: 3 (최근 30일)
Neeraj Chimwal
Neeraj Chimwal 2021년 4월 29일
댓글: Jan 2021년 4월 30일
Hi.
I am trying to encode my gray scale image using encode(img,291,247,'hamming/decimal') but I get this error :
Error using encode (line 78)
For 'hamming' code with decimal data, MSG must be a vector.
If I convert it to a vector using img = img(:), I get this error
Error using *
MTIMES (*) is not fully supported for integer classes. At least one argument must be scalar.
Error in encode (line 117)
code = rem(msg * gen, 2);
Error in dummy (line 5)
encoded = encode(img,127,120,'hamming/decimal');
Can you please help me with this?

채택된 답변

Jan
Jan 2021년 4월 29일
What is the type of the variable img? The documentation of encode() mentions, that the 1st input must by a double. So try:
encode(double(img(:)), 291, 247, 'hamming/decimal')
  댓글 수: 4
Neeraj Chimwal
Neeraj Chimwal 2021년 4월 30일
Yes, the error message is not helpful for beginners
Jan
Jan 2021년 4월 30일
I do agree with you. It would be useful if you write an enhancement request to TMW to fix this message. You can include a link to this question, to explain the details.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Hamming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by