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');
06 July 2017 256 2 View
06 July 2017 7,034 4 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,927 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,387 5 View
I have tried to download the 64-bit version of MGLtools however, as many times as I have downloaded and uninstall the programs, an error arises that the app needs to be updated. Thank you.
03 March 2021 5,997 2 View
I have selected brain tumor images ...but now found that already lots of research done n this topic.
03 March 2021 5,774 3 View
Hi everyone, I am conducting research for my Master's thesis. I am using PROCESS by Johnson-Neyman to analyze my Moderator model. I test the relationship between Public Service Motivation and...
03 March 2021 2,350 2 View
i am try to classify the x-ray images. During classification , can i block unwanted images (except x-ray image).
03 March 2021 7,100 1 View
Need to image mesoporous silica nanoparticles using the TEM. Also, need high resolution TEM images to see the mesoporous structure. Kindly suggest what kind of grids to use. Thanks, Shatadru
02 March 2021 1,787 2 View
I just wanted to check if I need to run a linear regression separately if I am using PROCESS MACRO to run mediation analysis. Thank you.
02 March 2021 4,359 3 View
Hello all, In SPSS I am going to code 2 open-ended questions. I have already read all the answers and I made a list of the most important categories to which I can code the answers. This question...
02 March 2021 1,757 4 View
Dear Colleagues, After running Western blot on PVDF membrane and detection using ECL, I would like to stain my PVDF with colloidal gold to be able to allign the ECL image with total proteins on...
02 March 2021 7,829 3 View
So, I have been trying to run a pACYC PCR which will be used later on for a Gibson Assembly. However the PCR is not working. I have already tried gradient PCR and changing extension time; however...
02 March 2021 1,146 2 View
I would like to research on MR images (0.5T and 3T). Can you please suggest some websites that I can download dataset including both 0.5T and 3T MR images? Thank you.
02 March 2021 7,735 3 View