Author Topic: Dealing with Focus Pixels in raw video  (Read 313065 times)

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7294
Re: Dealing with Focus Pixels in raw video
« Reply #400 on: October 07, 2017, 10:59:20 PM »
Quote
if it doesn't have an impact on the quality of the image or processing speed maybe that would be a way to get crop_rec working in MLVFS without having to swap out the map files?
+1

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #401 on: October 08, 2017, 12:29:47 AM »
Committed bouncyball's 100D crop_rec map file to the ML Focus Pixels repository.

Now for the instructions how to use this in MLVFS.

Grab that map file any way you want--here's a direct link to it. Right click, save link. Make sure it is named 80000346_1808x726.fpm.

Now copy it to your MLVFS contents. On the Mac MLVFS is located in your home Library/Services. Right click (control click on Mac) and choose Show Package Contents. Copy the map file in there. Sometimes the raw buffer is 727, sometimes 726 so make a copy of that map file and rename it 80000346_1808x727.fpm. Yes, I know there's already a file in there by that name, save it somewhere safe because you might want to go back to it if this experiment doesn't work.

Ok now--100D owners, shoot some crop_rec and some mv720 footage and check for focus pixels. Please report back.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #402 on: October 08, 2017, 12:01:33 PM »
Oops--I missed that when I tried to re-create your map. It does clean up nicely in MLVFS using your 2-pass map and doesn't need any chroma smoothing in MLVFS.
Nice to hear. I was sure that you gone the way I did by yourself and just missed some details :).

I'm having problems with some of my scripts that I use to convert fpm to pbm and back but once I get your map converted to an image file I'll save that too.
Give a try to my 'fpmutil' it converts fpm->pbm->fpm in no second. Run './fpmutil -h' to get detailed help with examples. Note: you have to compile it because existing mac binary not updated and does not include the latest 100D crop_rec changes updated.

Also I'm sure you noticed header in the FPM. Header format is:
Code: [Select]
Sig  CamID    W    H   Crop program vers
----------------------------------------
#FPM 80000346 1808 726 1 -- fpmutil v0.5
and it's needed to convert fpm->pbm

If you want to convert your FPM to PBM you just need to insert this header as the 1st line of FPM and fill with appropriate values after '#FPM' signature with white spaces in between.

I could implement this header to MLVFS and make file name format like this: CamID_Width_x_Height_croprec.fpm. Had no time to do this yet.

Edit: unfortunately detection of crop_rec by RAWC header is not implemented anywhere yet.

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #403 on: October 08, 2017, 09:55:08 PM »
Wow, you took this topic to a higher level. I'm just now trying it out and it is lightning fast compared to my scripts. Have you considered submitting it to the contrib section of the official ML source?
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7294
Re: Dealing with Focus Pixels in raw video
« Reply #404 on: October 08, 2017, 09:58:16 PM »

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #405 on: October 09, 2017, 09:05:04 AM »
@dfort
Glad you liked it :)
Now try the link Danne posted above. On the fly map generation is implemented to the mlv_dump itself. No more fpm files in in the mlv_dump directory needed.

Have you considered submitting it to the contrib section of the official ML source?
Nope, I have not yet.

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #406 on: October 09, 2017, 03:07:46 PM »
The 2-pass crop_rec map file is working so well with the 100D that I decided to do the same with the EOSM/650D/700D crop_rec map. The changes made the code much simpler.

Need to do some more testing but it should solve the hassle of having to swap out map files in MLVFS when switching between mv720 and crop_rec footage.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

DeafEyeJedi

  • Hero Member
  • *****
  • Posts: 3411
  • 5D3 | M1 | 7D | 70D | SL1 | M2 | 50D
Re: Dealing with Focus Pixels in raw video
« Reply #407 on: October 09, 2017, 06:50:27 PM »
Damn @bouncyball's at it again. Keep on rolling and please never stop bouncing around!  ;D

To be able to get clean footage from cameras affected by Focus Pixels without the need of Chroma Smoothing is just godsend!
5D3.113 | 5D3.123 | EOSM.203 | 7D.203 | 70D.112 | 100D.101 | EOSM2.* | 50D.109

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #408 on: October 10, 2017, 10:20:57 AM »
Keep on rolling and please never stop bouncing around!  ;D
Well... I'm trying ;)

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #409 on: October 11, 2017, 12:56:09 PM »
I was testing 2pass method on cameras other than 100D and discovered that 1st pass is not needed for 700D (only mv1080, no mv720). EOSM definitely needs it. What about 650D? I don't have the sample MLV. I guess it does not support crop_rec at all.

Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7294

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #411 on: October 11, 2017, 01:16:33 PM »
Good. Do you have some samples?

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #412 on: October 11, 2017, 05:35:15 PM »
...1st pass is not needed for 700D (only mv1080, no mv720). EOSM definitely needs it...

Interesting. Usually what works on on the EOSM works on the 700D and vice versa. We're close to getting the 650D working in crop_rec and my bet is that it behaves the same as the 700D. These are all of the "pattern A" cameras so once the tests are in we can make specific cases for the cameras that need the 2-pass treatment and those that don't need it--though with zoom mode I'm hitting areas that don't need it and it doesn't seem to hurt. Then there's the zoom mode on the 100D that doesn't show any focus pixels at all. Go figure.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #413 on: October 11, 2017, 05:45:15 PM »
On second thought--it makes sense that the EOSM needs an mv720 pixel map pass because that camera is "normally" in mv720 mode except when recording H.264.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #414 on: October 11, 2017, 05:55:14 PM »
I need more 700D (crop_rec/no crop_rec) samples. Can someone upload them?

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #415 on: October 11, 2017, 05:57:43 PM »
The funny thing is I never possessed/borrowed the camera affected by focus pixels :)

saulbass

  • Freshman
  • **
  • Posts: 86
Re: Dealing with Focus Pixels in raw video
« Reply #416 on: October 12, 2017, 07:14:01 PM »
Hi Bouncyball - I have a 300mb mlv from a 650D running dforts latest crop rec experiment crop_rec_4k.2017Oct11.650D104.zip - it's 2512x1072. 14bit lossless compressed.
How should I pass it over to you - Hightail?


Danne

  • Developer
  • Hero Member
  • *****
  • Posts: 7294
Re: Dealing with Focus Pixels in raw video
« Reply #417 on: October 12, 2017, 07:33:31 PM »
Hi saulbass. Noticed you used Switch? You can shrink this file by creating a sample file package(zip). You do it from either (ms) mlv_dump_on_steroids or (m) mlv_dump menus:




saulbass

  • Freshman
  • **
  • Posts: 86
Re: Dealing with Focus Pixels in raw video
« Reply #418 on: October 12, 2017, 08:41:35 PM »
Danne - thanks for the pointer - really useful to know - cheers!

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #419 on: October 12, 2017, 09:16:04 PM »
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

bouncyball

  • Contributor
  • Hero Member
  • *****
  • Posts: 849
Re: Dealing with Focus Pixels in raw video
« Reply #420 on: October 25, 2017, 10:55:20 AM »
Hi Bouncyball - I have a 300mb mlv from a 650D running dforts latest crop rec experiment crop_rec_4k.2017Oct11.650D104.zip - it's 2512x1072. 14bit lossless compressed.
How should I pass it over to you - Hightail?
Sorry about very late response. It does not matter, just upload it somewhere and give the link.

Thx
bb

theBilalFakhouri

  • Developer
  • Hero Member
  • *****
  • Posts: 887
Re: Dealing with Focus Pixels in raw video
« Reply #421 on: December 23, 2017, 05:27:05 PM »
Hello
I noticed today a small problem with 12/11-8bit lossless pixel dots (14bit lossless works fine)
The focus pixels only appears in Contrast edge image and in the whole image except flat dark or flat white parts
Used camera: Canon 700D with croprec4kmlvsnd.2017Oct23.700D115 build
ISO: 100
All was Shooted at 12bit lossless on mv1080 mode 1736x976
Examples with no focus map applied :
White out of focus:
White 00000" border="0
Dark image:
Dark" border="0
Contrast Edge image:
Contrast Edge" border="0
And this with focus map applied: 80000326_1808x1190.fpm focus map (only the middle cleard)
Cleard Contrast Edge" border="0
Orginal MLV, DNG samples and Images here:
https://drive.google.com/open?id=1-TaNgr0ZTjQ_Ea4Q6tPjAZVTIW_7qSG0
If this problem discoverd before, Can you give me the Map for this pattern? I tried all the maps didn't work.
New custom build for 100D/SL1 is up:
https://www.magiclantern.fm/forum/index.php?topic=26511.msg239125#msg239125
Porting still work in progress!

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #422 on: December 23, 2017, 07:14:03 PM »
Wow, fantastic testing!

I've been going though your sample files and have tried a few different methods. The best results I've gotten so far is using mlv_dump_on_steroids (via Switch) and adding a 2x2 chroma smooth. It looks like you are using MLVFS and it should work the same there but I didn't test it because I broke it on my system, need to look into that.

I made a tiff from the dng file using dcraw. This is tends to show focus pixels more than Resolve, Adobe Camera Raw and other raw converters. dcraw is also showing some artifacts that can be smoothed out with the other apps but I wanted to show a worse case scenario.



Click on the image to see it full sized, zoom in, download, pixel peep, whatever.

Note that the test pattern that you are using is really challenging the pixel removal. Hard contrasty edges will often show the focus pixels even when running through the map file and that's why I added some chroma smoothing.

Ok--so we know that this worked with your 14-bit file but the problem is with the 12-bit file, right? Where's the 12-bit MLV? From your examples it looks like you found focus pixels that are outside of the area where we know there are focus pixels. Not surprising because there are settings that can show strange patterns all over the image even on cameras that don't normally show focus pixels.

mlv_dump -v
Code: [Select]
    raw_info:
      api_version      0x00000001
      height           1188
      width            1808
      pitch            3164
      frame_size       0x0039674C
  --> bits_per_pixel   14
      black_level      2047
      white_level      5586
      active_area.y1   28
      active_area.x1   72
      active_area.y2   1185
      active_area.x2   1808
      exposure_bias    0, 0
      cfa_pattern      0x02010100
      calibration_ill  1
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: Dealing with Focus Pixels in raw video
« Reply #423 on: December 23, 2017, 07:25:24 PM »
Ok--so we know that this worked with your 14-bit file but the problem is with the 12-bit file, right? Where's the 12-bit MLV?

Right here (explanation):
Code: [Select]
  --> bits_per_pixel   14
      black_level      2047
      white_level      5586

Note the 8...12-bit lossless mode uses a different LV raw type. There might be other raw types that allow image darkening via digital gain (to "reduce" the bit depth - actually the range of useful levels - while keeping the "old" focus pixels) - no idea how to find them other than brute-forcing (or whether they exist).

dfort

  • Developer
  • Hero Member
  • *****
  • Posts: 3751
Re: Dealing with Focus Pixels in raw video
« Reply #424 on: December 23, 2017, 07:43:50 PM »
Learn something new every day. I've been doing lots of testing with 10-bit and mlv_dump shows bits_per_pixel as 10.

@theBilalFakhouri - I can clearly see focus pixels in areas where they haven't appeared before so I'll do some more digging into this. I can make a fpm file that covers the entire frame, like it does on the 100D, but it will take me some time before I can get to it.
5D3.* 7D.206 700D.115 EOSM.203 EOSM2.103 M50.102