Post ASTvaXmsNGrumaFWc4 by JoakZieg@mstdn.social
 (DIR) More posts by JoakZieg@mstdn.social
 (DIR) Post #ASSJYJdq0Rt8umZYGm by mjg59@nondeterministic.computer
       2023-02-08T02:31:19Z
       
       0 likes, 0 repeats
       
       Given very noisy low-light video of a static scene (made worse by it being relatively low bitrate MPEG), is there any reasonable way to construct a less noisy still image?
       
 (DIR) Post #ASSJh5lmwzU2UyTaBk by est@social.emily.news
       2023-02-08T02:31:52Z
       
       0 likes, 0 repeats
       
       @mjg59 define “reasonable”
       
 (DIR) Post #ASSK4eFiuUw26bi6Xw by datenwolf@chaos.social
       2023-02-08T02:37:01Z
       
       0 likes, 0 repeats
       
       @mjg59 My initial approach would be to throw a temporal median filter at it.
       
 (DIR) Post #ASSKHjOz4nDzqBHS4m by MichaelPhillips@dice.camp
       2023-02-08T02:39:37Z
       
       0 likes, 0 repeats
       
       @mjg59 do you mean existing tool or technique? Because I'm pretty sure the answer is yes, but I don't know if tools exist for it
       
 (DIR) Post #ASSKdMLpSYV2ij7Mps by nickzoic@aus.social
       2023-02-08T02:43:09Z
       
       0 likes, 0 repeats
       
       @mjg59 does exporting all the key frames as images [1] and then averaging them in numpy [2] count as reasonable?[1] https://jdhao.github.io/2021/12/25/ffmpeg-extract-key-frame-video/[2] https://stackoverflow.com/questions/17291455/how-to-get-an-average-picture-from-100-pictures-using-pil
       
 (DIR) Post #ASSKmKyLxFgH3DPz4i by juul@mastodon.xyz
       2023-02-08T02:43:37Z
       
       0 likes, 0 repeats
       
       @mjg59 Yes look at image stacking software for "lucky imaging" in astronomy. It's not solving _exactly_ the same problem but it's probably close enough. You will probably have to extract the images into e.g. TIFF files using something like ffmpeg first
       
 (DIR) Post #ASSL1NbETAYhXgmC4O by MichaelPhillips@dice.camp
       2023-02-08T02:44:26Z
       
       0 likes, 0 repeats
       
       @mjg59 depending on how static the recording is, you might have to start by realigning every frame. And then through your stack of frames, go pixel by pixel finding what the most likely most common value for each pixel is. There's probably somewhat less brute force approaches by clever people than me
       
 (DIR) Post #ASSL1PKe1oTiup1yUa by MichaelPhillips@dice.camp
       2023-02-08T02:45:44Z
       
       0 likes, 0 repeats
       
       @mjg59 but essentially, your constructing the equivalent of the static parts of web video from the late '90s out of every pixel of every frame of your video or at least of every pixel of the best frames of your video
       
 (DIR) Post #ASSNxKrwyju7mKMKp6 by sifutweety@mastodon.online
       2023-02-08T03:19:07Z
       
       0 likes, 0 repeats
       
       @mjg59 it's a _static_ scene?  what happens if you average all the frames?
       
 (DIR) Post #ASSOiXQW6k8GKr2Fvs by rlb@hachyderm.io
       2023-02-08T03:29:02Z
       
       0 likes, 0 repeats
       
       @mjg59 the video can be denoised with VBM3D (multiple implementations are available in GitHub). If you're looking for just a single image, you can dump frames with ffmpeg and then use a Hugin/ImageMagick flow to do median blending.Hugin: align_image_stack -m -a aligned_ ${several_frames}ImageMagick: convert aligned_* -evaluate-sequence median output.jpg
       
 (DIR) Post #ASSWHaKK15b990nREO by mjg59@nondeterministic.computer
       2023-02-08T04:54:12Z
       
       0 likes, 0 repeats
       
       @rlb Thanks! That did a great job of de-noising, sadly it looks like the object I'm trying to spot is below the noise floor
       
 (DIR) Post #ASSgXnE8ovBPKSGyR6 by funkylab@mastodon.social
       2023-02-08T06:48:54Z
       
       0 likes, 0 repeats
       
       @mjg59 @rlb ah! There's an object you want to detect. Knowledge of properties of that object can change your approach. (Just like knowledge of the properties of the structure of the satellites' emissions allow the cheapest-built GPS receivers to lift multiple, colliding, GPS signals from significantly below the noise floor)
       
 (DIR) Post #ASSiueqaLIxxuLHjwu by mjg59@nondeterministic.computer
       2023-02-08T07:15:46Z
       
       0 likes, 0 repeats
       
       @funkylab @rlb It's a snow depth gauge, with a stationary camera pointing at it. During daylight I can see it clearly. At night it's invisible unless it's a clear night with good moon. It would be nice to know how deep the snow is, even at night!
       
 (DIR) Post #ASSm54s4jy73NVdt0C by funkylab@mastodon.social
       2023-02-08T07:51:06Z
       
       0 likes, 0 repeats
       
       @mjg59 @rlb nice problem! My first instinct would be to downscale your luminance channel by a factor of 8, thereby reducing each 8x8 compression pixel block to its average.Then, take N consecutive frames, and keep the *lowest* value for each position. Try also with the *average* value, and some weighted mixture of these two.My theoretical ramblings motivating that are:
       
 (DIR) Post #ASTEWCbOtzExtIZ6bA by tienelle@mendeddrum.org
       2023-02-08T13:09:33Z
       
       0 likes, 0 repeats
       
       @mjg59 If you get the opportunity to modify the hardware, some retroreflective paint or tape on the gauge and an IR LED near the camera might help a lot.It seems as though knowledge (from your daylight pictures) of exactly what the target looks like should be really helpful but I can't work out how.
       
 (DIR) Post #ASTvaXmsNGrumaFWc4 by JoakZieg@mstdn.social
       2023-02-08T21:12:15Z
       
       0 likes, 0 repeats
       
       @mjg59 Yes. If the frames are static enough, a temporal median filter  over enough frames should do it. If not, things like Neat Video will do motion tracking and averaging for you. Also, as others mention, look into techniques used by astrophotographers.
       
 (DIR) Post #ASgQFpg2E5ZUn0410y by johninparis@zx81.social
       2023-02-14T21:52:03Z
       
       0 likes, 0 repeats
       
       @mjg59 @funkylab @rlb I’m late to this party, but would it help to light the gauge with an infrared LED? You wouldn’t be bothered by the light, but your camera might pick it up.
       
 (DIR) Post #ASgWNfvCymhsZkHfE0 by mjg59@nondeterministic.computer
       2023-02-14T23:01:03Z
       
       0 likes, 0 repeats
       
       @johninparis @funkylab @rlb unfortunately everywhere I could fit such an LED is currently covered in snow
       
 (DIR) Post #ASiEzvhxKDU9gI634C by johninparis@zx81.social
       2023-02-15T18:55:34Z
       
       0 likes, 0 repeats
       
       @mjg59 @funkylab @rlb D’oh! Well, it was worth a shot (in the dark).