How to convert multiple rgb snapshots into grayscale and save them into a folder?

조회 수: 2 (최근 30일)
I've taken multiple rgb snapshots and saved them into the folder using for-loop. But now I need to know how those snapshots can be converted into grayscale and save them into a folder.
After the above has been done, I need to know how both of these (rgb and gray) can be subtracted so that the difference is spotted.
Please help. thank you very much in advance.

채택된 답변

Image Analyst
Image Analyst 2014년 11월 23일
Try this:
grayImage = rgb2gray(rgbImage);
diffGray = double(grayImage) - double(grayReferenceImage);
diffRGB = double(rgbImage) - double(rgbReferenceImage);
if max(abs(diffGray(:))) > 0
% There is at least one different pixel.
end
  댓글 수: 13
Omar Ahmad
Omar Ahmad 2014년 11월 29일
편집: Omar Ahmad 2014년 11월 29일
So to make the question short and simple. I want the result of diffGray converted into Binary and save it.By this I must be able to view in Black and White. Please help. This could be my last question. You (image analyst and Mohammed Abouali) helped me alot.
Image Analyst
Image Analyst 2014년 11월 29일
OK, you want to binarize the difference signal by thresholding it and turning it into a logical array. So you can do something like
binaryImage = diffRGB > someValue; % Like 2 or 5 or whatever
Pick a value that you want to see if the difference is greater than. Like if the difference between the images is more than 3 gray levels, show it, otherwise consider them the same with essentially no difference at all.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by