imwrite through step() to snapshot a video saves red images why?

1 回表示 (過去 30 日間)
Lobna
Lobna 2013 年 5 月 12 日
I'm getting snapshots of a video using imwrite to write a frame captured by step() the images that are saved to the folder are red and with low quality
why is that? and how do I avoid it?
Thank you

回答 (2 件)

David Tarkowski
David Tarkowski 2013 年 5 月 13 日
It looks like you are using a YCbCr format of your camera. When you are previewing or writing to disk, the toolbox converts the frame to RGB since display and disk logging require RGB data. When you use step or getsnapshot, the toolbox does not, by default, convert the image to RGB since there arr easons why you might actually want the YCbCr data.
You can set the ReturnedColorSpace property of your videoinput or imaq.VideoDevice object to 'RGB' which will cause the toolbox to convert the frame to RGB before it returns it. You could also use the ycbcr2rgb function to do the conversion.

Image Analyst
Image Analyst 2013 年 5 月 12 日
Is the camera white balanced? Does the image look like that in your GUI before you save it to disk and recall it? What does your call to imwrite() look like?
  6 件のコメント
Lobna
Lobna 2013 年 5 月 13 日
編集済み: Lobna 2013 年 5 月 13 日
I use getsnapshot() as well but when I use it in this particular code it gives me the "Too many output arguments." error message
Image Analyst
Image Analyst 2013 年 5 月 13 日
You forgot to show your code, or answer my question.

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by