how to convert a series of RGB images into grayscale and save them?
이전 댓글 표시
I have taken snapshots using my webcam and have saved those snaps in rgb type. Now I need to convert those rgb images into gray. Please help.
I have used the following code to save: and it is better if the solution is also given using for loop.
for i=1:10
a=getsnapshot (cam);
imwrite (a,sprintf('%d.jpg',i);
end
Thank you.
댓글 수: 2
Image Analyst
2014년 11월 26일
Isn't this question totally contained in the question you already asked and I already answered: http://www.mathworks.com/matlabcentral/answers/163909#comment_251947? You asked the same thing plus how to subtract some image from the gray and RGB image, and I gave code for that there.
Omar Ahmad
2014년 11월 26일
채택된 답변
추가 답변 (1개)
Reeve
2014년 11월 24일
2 개 추천
Hi Omar,
You just need to add:
a = rgb2gray(a);
after your getsnapshot line.
카테고리
도움말 센터 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!