Inserting Color Map value in an image
이전 댓글 표시
I have a number of compressed image files in a folder named "Video". I wanted to reconstruct them into an avi video but it said that color map value cannot be non empty. Whats the problem and what is the remedy?
답변 (4개)
Marta Salas
2014년 4월 4일
편집: Marta Salas
2014년 4월 4일
You can copy the code you are using to be able to help you. You can also try this function:
function make_video(video_dir,extension,aviname,fps)
resnames=dir(fullfile(video_dir,['*.' extension]));
aviobj=VideoWriter(aviname);
aviobj.FrameRate=fps;
open(aviobj);
for i=1:length(resnames)
img=imread(fullfile(video_dirs,resnames(i).name));
F=im2frame(img);
if sum(F.cdata(:))==0
error('black');
end
writeVideo(aviobj,F);
end
close(aviobj);
end
Example: make_video('/home/user/myImages/','jpg','myvideo.avi',5)
댓글 수: 2
Rishav
2014년 4월 4일
Marta Salas
2014년 4월 4일
Copy and paste on a .m file
video_dir ='/home/user/myImages/';
extension = 'jpg';
aviname = 'myvideo.avi';
fps =5;
resnames=dir(fullfile(video_dir,['*.' extension]));
aviobj=VideoWriter(aviname);
aviobj.FrameRate=fps;
open(aviobj);
for i=1:length(resnames)
img=imread(fullfile(video_dirs,resnames(i).name));
F=im2frame(img);
if sum(F.cdata(:))==0
error('black');
end
writeVideo(aviobj,F);
end
close(aviobj);
Rishav
2014년 4월 4일
0 개 추천
댓글 수: 1
Image Analyst
2014년 6월 10일
Rishav, why is it taking you so long to resolve this? What's the problem now?
Rishav
2014년 4월 5일
0 개 추천
댓글 수: 1
Image Analyst
2014년 4월 5일
That's because it's not right. See my answer for how to do it. You will notice differences where the colormap is concerned.
Image Analyst
2014년 4월 5일
0 개 추천
See my attached example. It first reads a video and writes out all the frames to disk. In the second part it reconstructs the video by reading in all those images from disk and building a movie from them. It's very well commented so even new people like yourself are able to follow it.
카테고리
도움말 센터 및 File Exchange에서 Video Formats and Interfaces에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!