Image compression channel not working
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Matt Alvarez
le 3 Juil 2022
Modifié(e) : Walter Roberson
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
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);
Réponse acceptée
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
0 commentaires
Plus de réponses (0)
Voir également
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!