Author Topic: MLV App dark frame subtraction creates extreme noise  (Read 3646 times)

CommanderLake

  • New to the forum
  • *
  • Posts: 21
MLV App dark frame subtraction creates extreme noise
« on: March 11, 2022, 05:58:48 AM »
I've not tried dark frame subtraction before so I just gave it a go with my 6D at 1824x1026 14bit lossless and MVL App 1.13 but when subtracting a dark frame using a short (8-9s) uncompressed video I recorded with the lens cap on I get a sea of bright fully saturated pixels in dark areas with sharp details.

Actually I still get the bright saturated noise without dark frame subtraction just not as bad and even with raw processing completely disabled.
Also with most of the debayer algorithms the bright pixels are black but with AMaZE or AHD its really overpowering!
It only seems to happen at ISO 6400 and above.

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #1 on: March 13, 2022, 08:01:05 PM »
Bright saturated noise,  sounds like hot pixels ?
MLV app has option to fix bad pixels.
BUT, what helped me a lot to get rid of most of those hot pixels is to do a dead/hot pixel remap in camera.
you can google it, canon pixel remapping.
How it's done.

-Remove lens and put on body cap.
-Turn on camera and to get best results, enable liveview and set it to iso 6400 and leave it that way for a minute or more so the sensor becomes noisy.
-Now do a sensor cleaning in Canon menu (almost in the latest tab of canon menu, 'sensor cleaning' and choose 'clean now'.

After this, you should have much less hot pixels.


Darkframe subtraction is mostly helpful to remove vertical line noise in raw video.
But there is even a better way for 6d.
For low light, you should use LV raw type 0x12 (only works for normal raw recording, not working for high resolution crop module modes)

Not sure if you have a build where you can alter 'LV raw type', it should be available on top in the DEBUG tab of ML menu.

Debug tab -> LV raw type option
Default LV raw type = 0x10
For low light, set it to 0x12, highlight LV raw type option, click set button, use cursor keys to set cursor below the 0 from 10 value, and use scroll wheel on top of DSLR to set it to value 2, so you get 12.
Now use set button to exit and you should have LV raw type value of 0x12

Now shoot a scene in low light, in this mode, even iso 25600 looks great.
Every time the camera is turned off, the LV raw type is set to default 0x10 value.

If you don't have the LV raw type option in DEBUG tab,  try the build in this post:
https://www.magiclantern.fm/forum/index.php?topic=25782.msg228784#msg228784



Skinny

  • Member
  • ***
  • Posts: 197
Re: MLV App dark frame subtraction creates extreme noise
« Reply #2 on: March 13, 2022, 08:15:04 PM »
Is this raw type option only exist for 6D? 25600 iso sounds crazy :o :D

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #3 on: March 13, 2022, 08:58:55 PM »
No, different LV raw types exist on all cameras.
It’s a debug options, so disabled in most ML builds.
In some 6d builds, I have the option enabled and available in Debug menu.

Lv raw types are data streams of the live view raw data. There are a lot of raw type data streams, some are more altered then the other.
There are raw types which contain purple pixels (dead/hot pixels), while on other the dead/hot pixels are fixed and not present.
So it seems that canon does some fixing on the raw data stream.

The difference between 0x10 and 0x12 on the 6d:

0x10 -> can be used with high resolution crop rec options and 0x10 has highest dynamic range.
In high iso and low light, vertical line noise becomes visible in image.

0x12 -> only works for normal available resolutions, doesn’t work with the altered crop rec module resolutions.
Dynamic range is slightly lower ( 0.5 stop ). No vertical line noise in high iso low light situations.

The above difference means that canon is doing some dark frame correction in camera on raw type 0x12. Explains the lower dynamic range and missing vertical line noise.

Not sure if the above applies to other camera (lv raw type 0x10 vs 0x12).

Skinny

  • Member
  • ***
  • Posts: 197
Re: MLV App dark frame subtraction creates extreme noise
« Reply #4 on: March 14, 2022, 06:47:27 AM »
Thanks. I did some search on the forum and found other mentions, but it seems that nobody implemented this on other cameras at least yet. And I wonder why, because it could be very nice option to use in low light. Maybe on other cameras it's just different and actually working low noise raw type it is exclusive to 6D..

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #5 on: March 14, 2022, 08:54:07 AM »
It's not difficult to test yourself, all you need is a build for your camera, where the option is enabled.

You can ask in the forum of your camera if someone can make a build where it is enabled.

The option is in the 'raw.c' file, located in the 'src' folder in the source files.

For example in the source on magic lantern page:
https://foss.heptapod.net/magic-lantern/magic-lantern/-/blob/branch/unified/src/raw.c

In this example, it's on code line 37
Code: [Select]
#undef RAW_DEBUG_TYPE   /* this lets you select the raw type (for PREFERRED_RAW_TYPE) from menu */

All someone has to do is change the 'undef' to 'define' and you will have an option in debug menu to alter the raw type value which will be used for raw video recording.

So the line has to be changed to:
Code: [Select]
#define RAW_DEBUG_TYPE   /* this lets you select the raw type (for PREFERRED_RAW_TYPE) from menu */

There are a lot of raw types value to choose from, some might freeze your camera, but in that case, pull out battery and try again  : ;D
There aren't that many clean raw type streams, most contain the purple pixels.
I think for Digic V an Digic VI the values are the same, so I expect default is 0x10 on other cams and first thing to try would be value 0x12.
Then do some comparison in low light high iso (6400 or higher) and see if there is any difference.

Edit: you can't see changes to raw type in canon liveview, but it will do show up in ML preview, the slow low resolution preview option available in raw video menu.

Skinny

  • Member
  • ***
  • Posts: 197
Re: MLV App dark frame subtraction creates extreme noise
« Reply #6 on: March 14, 2022, 10:49:54 AM »
ok, sounds very interesting  :) I'll ask in 5D2 thread since this is the camera I'm using.. thank you for very interesting suggestion. I really like night scenes, but never go beyond iso 800 in raw, maybe 1600 sometimes but it is already too noisy.

masc

  • Contributor
  • Hero Member
  • *****
  • Posts: 2007
Re: MLV App dark frame subtraction creates extreme noise
« Reply #7 on: March 14, 2022, 05:41:55 PM »
@CommanderLake: no idea how to help with this few information. Maybe you should upload your darkframe and a frame of the clip which brings up the problem. So we could analyse and help.
5D3.113 | EOSM.202

IDA_ML

  • Hero Member
  • *****
  • Posts: 1014
Re: MLV App dark frame subtraction creates extreme noise
« Reply #8 on: March 15, 2022, 04:46:10 PM »
It's not difficult to test yourself, all you need is a build for your camera, where the option is enabled.

Has anyone compiled this for the 5d3 (113)?

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #9 on: March 16, 2022, 07:58:23 PM »
@IDA_ML
Noticed that there is not much reaction to make a build with raw type enabled.
So compiled one for 5d3 - 113.
Not sure if it works, it's on your own risk, can't test it on a 5d3.
Also made a 6d build from the same source and tested it on my 6d, works and with raw_type selection in debug tab.
(sourcecode is "crop_rec_4k_mlv_snd_isogain_1x3_presets"

Couldn't figure out how to compile without crop_rec module and sd_uhs module.
So I unpacked the zip file, uploaded the complete folder to google drive and removed the sd_uhs module and crop_rec module manually.
(crop_rec and sd_uhs modules in this build are made for 6d, not sure if they work on 5d3, so removed them)
Since this build is based on the crop_rec_4k source, you can of course use crop_rec modules from other builds with this build, just copy the crop_rec.mo file from another build in the ML/module/ directory

As you know, if it breaks you get to keep both pieces  :P

https://drive.google.com/drive/folders/10a3g3M_b5n8DufDAaZMagcWsAXN8c_14?usp=sharing

For quick test to see If it makes any difference for vertical line noise.
Enable the following modules first time you start the camera with this build:
-mlv_lite
-mlv_play
-mlv_snd
Restart camera

Go to debug tab in ML menu and check LV raw type is 0x10
Now set iso to 25600 and shoot some ML raw video in low light.
After that, set LV raw type to value 0x12 and shoot another raw video in low light.

Curious, see any difference on 5d3 ?

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #10 on: March 16, 2022, 08:00:43 PM »
@Skinny

Tried to compile a same build for 5d2, but didn't succeed, error messages and no build.
Probably because the source is the "crop_rec_4k_mlv_snd" branch, where the 5d2 is not fully supported  ???


ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #11 on: March 17, 2022, 04:02:43 AM »
I've just learn to compile for 700D from bilal's source code here
I have tested it and works.

download: 700D-DEFINE-RAW-DEBUG-TYPE.zip
EOS 700D

ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #12 on: March 17, 2022, 05:17:58 AM »
Has anyone compiled this for the 5d3 (113)?
I use Danne's source code

here I tried to compile it for you Dannephoto-5d3.113-define_raw_debug_type.zip

copy *.mo files from your ML/modules (except 5d3_113.sym) and ML/script from your 5d3.113 build to the same folder in this build

I hope it helps.


EOS 700D

ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #13 on: March 17, 2022, 05:38:47 AM »
It's not difficult to test yourself, all you need is a build for your camera, where the option is enabled.

You can ask in the forum of your camera if someone can make a build where it is enabled.

The option is in the 'raw.c' file, located in the 'src' folder in the source files.

For example in the source on magic lantern page:
https://foss.heptapod.net/magic-lantern/magic-lantern/-/blob/branch/unified/src/raw.c

In this example, it's on code line 37
Code: [Select]
#undef RAW_DEBUG_TYPE   /* this lets you select the raw type (for PREFERRED_RAW_TYPE) from menu */

All someone has to do is change the 'undef' to 'define' and you will have an option in debug menu to alter the raw type value which will be used for raw video recording.

So the line has to be changed to:
Code: [Select]
#define RAW_DEBUG_TYPE   /* this lets you select the raw type (for PREFERRED_RAW_TYPE) from menu */

There are a lot of raw types value to choose from, some might freeze your camera, but in that case, pull out battery and try again  : ;D
There aren't that many clean raw type streams, most contain the purple pixels.
I think for Digic V an Digic VI the values are the same, so I expect default is 0x10 on other cams and first thing to try would be value 0x12.
Then do some comparison in low light high iso (6400 or higher) and see if there is any difference.

Edit: you can't see changes to raw type in canon liveview, but it will do show up in ML preview, the slow low resolution preview option available in raw video menu.

Thanks for the idea..
EOS 700D

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #14 on: March 17, 2022, 09:16:26 AM »
Curious, can you see any difference in vertical line noise between raw type 0x10 and 0x12 on the 700d ?

ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #15 on: March 17, 2022, 10:37:46 AM »
I didn't see any vertical line but horizontal line
I will try again later and see if there is any difference.
EOS 700D

ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #16 on: March 17, 2022, 04:32:17 PM »
Here are some test 0x10 and 0x12 at ISO 12800

0x10 using binning mode 1x3 looks greenish with striped like horizontal line


0x10 crop_rec OFF ISO 12800


change to 0x12


0x12 ISO 12800


I didn't see any different so far.. except using binning 1x3 with iso 12800 got very dark image
EOS 700D

Skinny

  • Member
  • ***
  • Posts: 197
Re: MLV App dark frame subtraction creates extreme noise
« Reply #17 on: March 17, 2022, 05:20:08 PM »
@Skinny

Tried to compile a same build for 5d2, but didn't succeed, error messages and no build.
Probably because the source is the "crop_rec_4k_mlv_snd" branch, where the 5d2 is not fully supported  ???
@Levas thank you anyway :)

@ML700D but.. is this a standart canon preview? what about actual recorded raw footage?
Edit: you can't see changes to raw type in canon liveview, but it will do show up in ML preview, the slow low resolution preview option available in raw video menu.

ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #18 on: March 17, 2022, 06:54:27 PM »
@Levas thank you anyway :)

@ML700D but.. is this a standart canon preview? what about actual recorded raw footage?

no, that is ML live view, the footages are both same when open in mlvapp and mlv_play afaik.

Edit: you can't see changes to raw type in canon liveview, but it will do show up in ML preview, the slow low resolution preview option available in raw video menu.
I will try ss from mlv_play later.. sorry.
EOS 700D

theBilalFakhouri

  • Developer
  • Hero Member
  • *****
  • Posts: 1013
  • UHS-I
Re: MLV App dark frame subtraction creates extreme noise
« Reply #19 on: March 17, 2022, 09:29:03 PM »
Here are some test 0x10 and 0x12 at ISO 12800

0x10 using binning mode 1x3 looks greenish with striped like horizontal line
...

Not related to RAW type, these artifact happen because we are tweaking preview registers in 1x3 modes (also in other presets with correct real-time preview). These artifact only affects LiveView but not the recorded RAW data, in lower bit-depths it becomes even more visible.

BTW, on 700D the maximum analog ISO is 3200. Both 6400 and 12800 ISOs are digital.

ML700D

  • Member
  • ***
  • Posts: 150
Re: MLV App dark frame subtraction creates extreme noise
« Reply #20 on: March 18, 2022, 03:38:28 AM »
I see, thanks bilal

btw have you ever try this 0x12 things?
EOS 700D

cannibalferox

  • New to the forum
  • *
  • Posts: 14
Re: MLV App dark frame subtraction creates extreme noise
« Reply #21 on: May 30, 2022, 02:11:04 PM »
I have found this thread and wanted also to contribute and/or ask what went wrong. For the first I would just share two screenshots and you can decide if you really need the footage, too.

https://drive.google.com/drive/folders/1fFFIf96Lh9A9hcOaG3PYxu7u0dXWTJbM?usp=sharing

Especially on the back of the black pullover its in the after screenshot so much worse. But I can definetly see a change and am not sure if its to the better or the worse :D

Levas

  • Contributor
  • Hero Member
  • *****
  • Posts: 1741
  • 6d - Nightly build user
Re: MLV App dark frame subtraction creates extreme noise
« Reply #22 on: May 31, 2022, 07:23:07 PM »
In this case the after is worse.
The after has the vertical lines which have that Magic lantern high iso raw fingerprint  :P
Dark frame subtraction should solve the vertical line issues.

So if you haven't mistaken before and after...then it looks like your dark frame is not made with the same settings as the shot you extracted it from.

All settings must be equal, resolution settings in ML, iso setting and shutter time setting. Aperture shouldn't make a difference, I always close it as much as I can for dark frame creation.
It looks like your dark frame are recorded in different resolution or other iso setting.

cannibalferox

  • New to the forum
  • *
  • Posts: 14
Re: MLV App dark frame subtraction creates extreme noise
« Reply #23 on: June 02, 2022, 05:54:27 AM »
The MLVapp states if the resolutions are different and doesnt allow you to use wrong darkframe video. Iso is definetly equal because I have looked it up in the info tab and I never change shutterspeed but it should be the same. And yeah I hope that the aperture doesnt make a difference but I can try to make one with the most closed down just for testing. I will try to upload the source files and link them two that you can try it out for yourself and compare what went wrong :)

Skinny

  • Member
  • ***
  • Posts: 197
Re: MLV App dark frame subtraction creates extreme noise
« Reply #24 on: June 02, 2022, 12:13:12 PM »
So the dark frame was recorded in different conditions, after some time? Sensor temperature can make a lot of difference in the noise and patterns.. dark frame should be shot as close as possible to the original conditions. And not only things like themperature, but even battery charge will probably affect some noise patterns. But I don't believe the aperture will make any difference...