简体   繁体   English

如何根据亮度水平检测要保留或丢弃的帧?

[英]How to detect frames to keep or discard based on luminosity levels?

I have a series of images from a slow motion capture of pulsing electrical discharges. 我从脉冲放电的慢动作捕捉中得到了一系列图像。 Many of the frames are nearly black. 许多框架几乎都是黑色的。 I would like to selectively keep the frames that are more interesting; 我想有选择地保留更有趣的框架; eg have more luminosity. 例如具有更高的亮度。

I've considered using ImageMagick or GraphicsMagick (or any other; not married to any tool - I'm up for more efficient suggestions). 我已经考虑过使用ImageMagick或GraphicsMagick(或任何其他;尚未与任何工具结合-我在寻求更有效的建议)。

How would I go about selecting such images and then discarding the other images without appreciable luminosity levels? 如何选择此类图像,然后丢弃没有明显亮度水平的其他图像? I'm assuming that I have to establish a baseline first of "black" and then perhaps visually find the least luminous frame image and then use that as the lower limit to use for getting meaningful images / frames... 我假设我必须先建立“黑色”的基线,然后也许在视觉上找到发光度最低的帧图像,然后将其用作获取有意义的图像/帧的下限...

Example of DISCARD ("empty" frame): DISCARD的示例(“空”框架):

空白

Example of KEEP (frame with "data"): KEEP示例(带有“数据”的框架):

数据

I would suggest ImageMagick to Erode the image (clean-up noise), reduce data to a monochrome binary image, and print the statistical mean of the image. 我建议ImageMagick侵蚀图像(清除噪声),将数据减少为单色二进制图像,并打印图像的统计平均值。

convert 5HzsV.jpg -format "%[mean]" -monochrome -morphology Erode Diamond  info:
# => 0
convert lLZFX.jpg -format "%[mean]" -monochrome -morphology Erode Diamond  info:
# => 149.992

So a bash script might be as easy as... 因此,bash脚本可能就像...

for image in $(ls *.jpg)
do
   L=$(convert "$image" -format "%[mean]" -monochrome -morphology Erode Diamond  info:)
   if [[ $L -gt 0 ]]; then
       echo "Image $image is not empty! @ $L"
   fi
done

Of course that can be adjusted to meet your needs. 当然可以调整以满足您的需求。

The way images are encoded, you'll likely find that the 'interesting' images are bigger, because the uniformly dark background compresses better than a random spark. 图像的编码方式,您可能会发现“有趣的”图像更大,因为均匀的深色背景比随机火花具有更好的压缩效果。 For instance, your empty Jpeg is 21K while the interesting one is 39K. 例如,您的空Jpeg是21K,而有趣的是39K。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM