Plz anyone can give me matlab code for image compression with run length encoding
It's so simple, I am definitely sure you can do it yourself, which by the way is good to practice your programming skills.
The pseudo code reads something like that, assuming the array to encode is named in_buf (not actual matlab syntax):
cur_val = in_buf[0]
i = 1, k = 1, o = 0
while i < length(in_buf) {
if in_buf[i] == cur_val {
k += 1
}
else {
out_buf[o] = k
out_buf[o+1] = curval
o += 2
cur_val = in_buf[i]
k = 1
i += 1
Sure you can do more fancy stuff using find and cumsum, which is left as exercise :-)
Thank u but what about decoding
Sorry can u check this code
function [im] = rlemain (infile,outfile)
% Example of use:
% out=rlemain('input_image.dcm','output_image.dcm');
I = dicomread(infile);
I = mat2gray(I);
I=im2uint8(I);
figure('Name','Input image');
imshow(I);
level=graythresh(I);
bw=I;
a=bw'; a=a(:); a=a';
a=double(a);
rle(1)=a(1); m=2; rle(m)=1;
for i=1:length(a)-1
if a(i)==a(i+1)
rle(m)=rle(m)+1;
else
m=m+1; rle(m)=1; %dynamic allocation and initialization of next element of rle
end
figure;imshow(bw);title('RLE image');
dicomwrite(bw,'Rle image.dcm');
I am working on the topic of image compression I want to know if arithmetic coding can used directly for image compression if yes how to implement it using matlab
06 July 2017 7,094 4 View
I am working on my master thesis the topic is on the dicom image compression I want to know the best is to use matlab or gdcm to make my work and make my contribution
06 July 2017 313 2 View
I have a project for hybrid image compression I already have the matlab code for the techniques used for compression which is huffman, dwt and dct.The problem I do not know how to put them all...
05 June 2017 9,989 7 View
------------------------------------------------------------------------ please I want to modify that code to make it work on grayscale image not binary image can anyone help...
05 June 2017 4,476 5 View
I need to model an anisotropic material in which the Poisson's ratio ν_12 ≠ ν_21 and so on. Therefore, the elastic compliance matrix wouldn't be a symmetric one. In ANSYS APDL, for TB,ANEL...
09 August 2024 5,048 2 View
Request Python code from this article : Gender equity of authorship in pulmonary medicine over the past decade. THANKS!
08 August 2024 6,242 2 View
Visual Studio Code (VS Code) has become a popular choice among developers for several reasons: 1. **Free and Open Source**: VS Code is free to use and open source, making it accessible to...
07 August 2024 7,013 4 View
Dear QE-users, In the method where full MS positive mode and PRM mode are used, we always get an incorrect auxiliary gas reading (41 instead of 25). This only happens in this method; other...
06 August 2024 4,953 0 View
After immunohistochemistry of previously fixed in PFA and EtOH and then frozen 20 μm sections of zebrafish brain, DAPI staining is very weak (right) compared to the same sections stained without...
05 August 2024 9,637 2 View
I need the python code to forecast what crop production will be in the next decade considering climate and crop production variables as seen in the attached.csv file.
05 August 2024 2,977 3 View
Hello guys! Do you have experience running a Oaxaca-Blinder decomposition on R applying person weights. How do you suggest doing it? I have a variable PERWT which gives more information on how...
04 August 2024 6,033 0 View
Hi everyone I need a file with a dirty and clean potato image
04 August 2024 7,199 4 View
I fabricated Ti3C2Tx using concentrated HF 40%, I plot an XRD as attached image below.. please let to know if I obtained it or not.
02 August 2024 6,789 4 View
I am new to Micromechanics and having similar problem with understanding the implementation of the formula's. I would appreciate if anyone can guide me on how to go about getting a scalar value...
30 July 2024 969 0 View