Borrar filtros
Borrar filtros

Image compression channel not working

1 visualización (últimos 30 días)
Matt Alvarez
Matt Alvarez el 3 de Jul. de 2022
Editada: Walter Roberson el 3 de Jul. de 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 comentarios
KALYAN ACHARJYA
KALYAN ACHARJYA el 3 de Jul. de 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 el 3 de Jul. de 2022
is it possible to convert the image into a format that can be used in the channel part?

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 3 de Jul. de 2022
Editada: Walter Roberson el 3 de Jul. de 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

Más respuestas (0)

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by