我有一个拜耳图像,.bmp
我想用 FFMpeg 进行 debayer,我认为 FFMpeg 可能默认知道对其进行 debayer,所以我尝试使用这样一个非常简单的查询
ffmpeg -i input.bmp output.png
但output.png
看起来是灰色的,所以 ffmpeg 不会自动应用 debayer。我试图弄清楚 ffmpeg 是否有可能,但谷歌上几乎没有关于它的信息。
图片示例(这里上传太大了):https : //drive.google.com/file/d/1V8HwOuIo9PBX3ix0eKFQFGimskU_H0mN/view?usp=sharing
怎么做?
UPD
这就是我试图做的
ffmpeg -y -i D:\Buffer\Bayer\Time0000000_img.bmp -pix_fmt gray D:\Buffer\Bayer\bmp\test11.y -hide_banner
ffmpeg -y -pixel_format bayer_rggb8 -video_size 4104x3006 -i D:\Buffer\Bayer\bmp\test11.y D:\Buffer\Bayer\bmp\result1.png -hide_banner
我得到了一个错误
Input #0, image2, from 'D:\Buffer\Bayer\bmp\test11.y':
Duration: 00:00:00.04, start: 0.000000, bitrate: 1013196 kb/s
Stream #0:0: Video: rawvideo ([186]RG[8] / 0x84752BA), bayer_rggb8, 4104x3006, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> png (native))
Press [q] to stop, [?] for help
[rawvideo @ 0000027da39d3f80] Invalid buffer size, packet size 5065984 < expected frame_size 12336624
Error while decoding stream #0:0: Invalid argument
Output #0, image2, to 'D:\Buffer\Bayer\bmp\result1.png':
Metadata:
encoder : Lavf58.29.100
Stream #0:0: Video: png, rgb24, 4104x3006, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc58.54.100 png
frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
Conversion failed!
如果我把分辨率改成1920x1080
这样
ffmpeg -y -pixel_format bayer_rggb8 -video_size 1920x1080 -i D:\Buffer\Bayer\bmp\test11.y D:\Buffer\Bayer\bmp\result1.png -hide_banner
我没有收到错误,但输出是错误的
看起来 FFmpeg 没有 Debayer 过滤器。
唯一记录在案的选项是选择拜耳作为输入像素格式。
我找到了一个执行 FFmpeg 两次的解决方案:
从 BMP 转换为原始拜耳:
ffmpeg -y -i Time0000005_img.bmp -pix_fmt gray tmp.y
从原始拜耳转换为 RGB (Debayer):
ffmpeg -y -pixel_format bayer_rggb8 -video_size 4104x3006 -i tmp.y rgb.png
单线解决方案(使用管道):
ffmpeg -y -i Time0000005_img.bmp -vf format=gray -f rawvideo pipe: | ffmpeg -y -f rawvideo -pixel_format bayer_rggb8 -video_size 4104x3006 -i pipe: rgb.png
您也可以尝试伽马校正:
ffmpeg -y -i Time0000005_img.bmp -vf format=gray -f rawvideo pipe: | ffmpeg -y -f rawvideo -pixel_format bayer_rggb8 -video_size 4104x3006 -i pipe: -vf eq=gamma=2.2 rgb.png
注意:
我手动设置video_size
为4104x3006
. 使用FFprobe可以自动
设置,但它使解决方案更加复杂。video_size
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句