Matlab source code for Image compression algorithm
정보
This question is locked. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I need a source code for image compression algorithm that will read the image and then compress it and save it in another folder. There is no need to display the image while executing. It would be more helpful if the source code works on multiple files through a loop. p.s i am working in matlab 2010a
댓글 수: 0
채택된 답변
추가 답변 (2개)
Sufyan Parkar
2019년 9월 26일
편집: DGM
2024년 4월 8일
Well Steven Lord,
I have tried to write a code myself.
Please try to assist me here.
clc;
clear all;
close all;
a = imread("location");
ag = rgb2gray(a);
imshow(a)
z = zeros(size(ag));
[x y] = size(ag);
for i = 1:x
z(i,1) = ag(i,1);
for j = 2:y
z(i,j) = ag(i,j-1) - ag(i,j);
end
end
disp(z)
figure()
imshow(z)
댓글 수: 1
Walter Roberson
2019년 9월 26일
That code does no image compression. It tries to find the difference between adjacent pixels, perhaps in preparation for delta encoding. However, you will find that ag is likely uint8 and when you subtract a larger uint8 from a smaller you get 0 rather than negative. If you were to take care to double(ag) then you could get negative. However you are storing the results in double() and imshow of double with negative values might not give you the results you expect. Does it make sense to display the difference between adjacent pixels as if it were itself an image?
By the way: read about diff()
khadija elazrag
2019년 10월 27일
0 개 추천
Hi i need source code for DNA comprission by using huffman algorithm
댓글 수: 6
Walter Roberson
2019년 10월 27일
Finding a consultant to hire and negotiating payments could take several days. It would probably be faster for you to just write the program yourself.
khadija elazrag
2019년 10월 28일
thanks a lot i have question. how i can enter my inputs like probability and symbole from datasets
and how can i apply this code on DNA from datasets, is it manoualy or there is command to do that, my problem is how i can find and enter datasets for huffman code.
Walter Roberson
2019년 10월 28일
huffmandict() can calculate probabilities.
You can probably created a datastore object and use a small loop to process the entires. See https://www.mathworks.com/help/matlab/ref/matlab.io.datastore.read.html
mousa
2024년 7월 30일
hi i need code to do this,Give an example of image compression using MATLAB code.
Image Analyst
2024년 7월 30일
@mousa just save your image variable as a JPG or PNG image file
imwrite(rgbImage, 'compressed image.jpg'); % Lossy compression
imwrite(rgbImage, 'compressed image.png'); % Lossless compression
This question is locked.
카테고리
도움말 센터 및 File Exchange에서 Large Files and Big Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!