Image compression channel not working

1 回表示 (過去 30 日間)
Matt Alvarez
Matt Alvarez 2022 年 7 月 3 日
編集済み: Walter Roberson 2022 年 7 月 3 日
Hi im working on a image compression code for matlab below is the code
clear all;
% Tx Rx Setup
enc = comm.RSEncoder;
mod = comm.DPSKModulator('BitInput',false);
chan = comm.AWGNChannel(...
'NoiseMethod','Signal to noise ratio (SNR)','SNR',10);
demod = comm.DPSKDemodulator('BitOutput',false);
hDdecec = comm.RSDecoder;
errorRate = comm.ErrorRate('ComputationDelay',3);
%compression
X = dctcompr ("Picturetest.jpg",19200,"OutputPicturetest.jpg")
%Reading and converting to digital data of image (working)
im=imread('OutputPicturetest.jpg');
imshow(im)
pause(1)
IMAGEBIN=im2bw(im,0.4);
imshow(IMAGEBIN);
%channel(not working, incomplete from project specs)
encodedData = step(enc, IMAGEBIN(:,[1]));
modSignal = step(mod, encodedData);
receivedSignal = step(chan, modSignal);
demodSignal = step(demod, receivedSignal);
receivedSymbols = step(hDdecec, demodSignal);
errorStats = step(errorRate, data, receivedSymbols);
%merge decoded column matrices into one
%mask the merged matrix to original image to simulate conversion(working)
maskedImage=uint8(IMAGEBIN).*im;
%show image and save(working)
imshow(maskedImage);
imsave;
The image "Picturetest.jpg" is a 1080p photo from the internet
for compression, i am using a function made by Luigi rosa from file exchange
Currently my code is having problems on the channel part. When i run the code, this error message pops up:
Error using IntegerRSEncoder/step
The input data type must
not be Boolean.
Error in comm.RSEncoder/stepImpl (line 341)
y = step(obj.cIntRSEnc, x);
i would like to ask if there is any way to resolve this issue?
  2 件のコメント
KALYAN ACHARJYA
KALYAN ACHARJYA 2022 年 7 月 3 日
Have you observed the error -
"The input data type must not be Boolean"
In the code-
IMAGEBIN=im2bw(im,0.4);
Matt Alvarez
Matt Alvarez 2022 年 7 月 3 日
is it possible to convert the image into a format that can be used in the channel part?

サインインしてコメントする。

採用された回答

Walter Roberson
Walter Roberson 2022 年 7 月 3 日
編集済み: Walter Roberson 2022 年 7 月 3 日
IMAGEBIN=im2bw(im,0.4);
im2bw returns logical data
encodedData = step(enc, IMAGEBIN(:,[1]));
That kind of encoder does not accept logical by default. When you construct the encoder set BitInput to true

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by