Image compression channel not working

1 vue (au cours des 30 derniers jours)
Matt Alvarez
Matt Alvarez le 3 Juil 2022
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 commentaires
KALYAN ACHARJYA
KALYAN ACHARJYA le 3 Juil 2022
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 le 3 Juil 2022
is it possible to convert the image into a format that can be used in the channel part?

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 3 Juil 2022
Modifié(e) : Walter Roberson le 3 Juil 2022
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

Plus de réponses (0)

Catégories

En savoir plus sur Image Data Workflows 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