Author Topic: PinkDotRemover tool 650D  (Read 402855 times)

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: PinkDotRemover tool 650D
« Reply #275 on: October 03, 2013, 02:20:05 PM »
What puzzles me right now is that all these new smoothing methods seem worse when used with cr2hdr (at least on the resolution charts and some tricky video frames). So I'll commit after I'll find out what's going on.

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: PinkDotRemover tool 650D
« Reply #276 on: October 03, 2013, 03:22:00 PM »
Commited:

- initial version: https://bitbucket.org/hudson/magic-lantern/commits/4c1b0c2e65eb
- v2: https://bitbucket.org/hudson/magic-lantern/commits/2d0671859c1e
- ahd-like: https://bitbucket.org/hudson/magic-lantern/commits/b24b9f189203
- with noise threshold: https://bitbucket.org/hudson/magic-lantern/commits/530908efe192

It's disabled by default; define CHROMA_SMOOTH to enable it.

The algorithm is inspired from dcraw median_filter.

Some details:
Code: [Select]
            /**
             * for each red pixel, compute the median value of red minus interpolated green at the same location
             * the median value is then considered the "true" difference between red and green
             * same for blue vs green
             *
             *
             * each red pixel has 4 green neighbours, so we may interpolate as follows:
             * - mean or median(t,b,l,r)
             * - choose between mean(t,b) and mean(l,r) (idea from AHD)
             *
             * same for blue; note that a RG/GB cell has 6 green pixels that we need to analyze
             * 2 only for red, 2 only for blue, and 2 shared
             *    g
             *   gRg
             *    gBg
             *     g
             *
             * choosing the interpolation direction seems to give cleaner results
             * the direction is choosen over the entire filtered area (so we do two passes, one for each direction,
             * and at the end choose the one for which total interpolation error is smaller)
             *
             * error = sum(abs(t-b)) or sum(abs(l-r))
             *
             * interpolation in EV space (rather than linear) seems to have less color artifacts in high-contrast areas
             *
             * we can use this filter for 3x3 RG/GB cells or 5x5
             */

maxotics

  • Hero Member
  • *****
  • Posts: 532
Re: PinkDotRemover tool 650D
« Reply #277 on: October 03, 2013, 03:32:42 PM »
Hi Alex.  I'm thrilled you're working on incorporating other debayering algos and filters into RAW conversion.  For the non focus-pixel cameras, your work is going to pay instant dividends.  1% has been asking about noise processing, and what you're doing will improve on that.  When I said above that you're losing 30% color information I didn't mean to also imply that that was a bad thing.  Even with less color information your work should bring footage closer to H.264 in out-of-the-box usability, with plenty of extra dynamic range.  A great option to have, which I've wanted too.

I just want to point out again, because I shoot every day and I'm not sure you or anyone will see this who doesn't.  There are too many focus pixels then can be dealt with effectively with a general algo in certain shots.  You alluded to this with not having a complete bad pixel list.  One of the problems is that the main red focus pixels are easy to remove (with PDR for example), but there are blue pixels and other red pixels, a pixel or two away from the main ones.  And there are dark pixels.  So you might interpolate around a main red pixel fine, but the blue pixel fired and another red went black or something, and then you generate another hot pixel.  You can expand your interpolation around more pixels, but the more you do, the more you degrade the whole image.

Again, not a big issue with the other cameras.

I guess what I'm saying is you want to have realistic expectations about what you can accomplish, at least with the focus pixel footage. 

Continuing on your current effort...

One of the problems I have is there is no easy workflow where I can send a bad pixel list to dcRAW, for example, and get a DNG back.  If we had something like raw2dng with the bad pixels interpolated around, like PDR (using a bad pixel list), it would be easier to see what's falling apart with what you're doing and what's a focus pixel problem.   I think this would be helpful to us all (I'm working on this alone, but am not up to speed with C yet).

raw2dng_removebadpixels.exe  (A version that either interpolates /deadens pixels identified in a pad pixel list.  Similar to PDR)
dng2dng_alexfilters (does your filtering around the stuff)

With those two workflows we can compare footage with focus dots removed, AND exactly how much your stuff cleans up afterwards.  Right now, hard to know where the problems come from.

Thanks!






maxotics

  • Hero Member
  • *****
  • Posts: 532
Re: PinkDotRemover tool 650D
« Reply #278 on: October 03, 2013, 03:36:03 PM »
The algorithm is inspired from dcraw median_filter.

On that subject, you may find this interesting...

http://ninedegreesbelow.com/photography/floating-point-dcraw.html

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: PinkDotRemover tool 650D
« Reply #279 on: October 03, 2013, 03:41:23 PM »
Integrating a badpixel list is pretty simple. Instead of sweeping the entire image in chroma_smooth, use an array of x,y coords from the file.

These pixels seem to follow a regular pattern, so just include all of them, even if they are not always noticeable.

Rewind

  • Senior
  • ****
  • Posts: 356
Re: PinkDotRemover tool 650D
« Reply #280 on: October 03, 2013, 03:49:12 PM »
maxotics, if there is any combination of resolution / aspect ratio, in which PDR doesn't work for your EOS-M, send me an example along with a short series of underexposed flat frames to stack, so i can build the new map and tune up the PDR for you.

Upd. Just a 50-80 frames of flat field would be fine. No need a reference frames at all. Just like you did last time recently.

maxotics

  • Hero Member
  • *****
  • Posts: 532
Re: PinkDotRemover tool 650D
« Reply #281 on: October 03, 2013, 04:07:16 PM »
Rewind, thanks!  Let me take a little time to put together a good reference set for us all.  I know Gary would love a new map too!!!

Alex, here are a couple of shots that show what you're up against.  Rewind might be right, a little tuning and the problem can be eliminated.  But you can see how there are a lot of pixels used for focus type work, both red and blue.  It's difficult for me to calculate the bad pixel list because the software I built to identify them still needs work.  It isn't as easy as it looks because the pixels are not uniform in brightness.  These images are AFTER a lot of Photivo adjustments.

I would just download these

http://maxotics.com/images/1600x542_20130929.jpg

http://maxotics.com/images/1600x542_20130929.bmp

Here is 1280x720,



What might work well is a combination of basic hot pixels PDRd away using Rewinds new version and then your stuff for clean-up.  (Wish the dev of RAWanizer was around or it was open source).

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #282 on: October 03, 2013, 07:23:23 PM »
Small update: noticed that "ahdlike" affected noise structure in Gary's shot (which is extremely underexposed), so I've added a threshold below which it no longer tries to choose the interpolation direction (it averages both).

raw2dng_cs3x3_ahdlike_noise.exe
raw2dng_cs5x5_ahdlike_noise.exe (for really noisy shots)

For regular shots, the noise threshold should not make any difference (if it does, post some test shots that show the difference). For noisy shots, the noise should be whiter (less correlated, easier to clean).
I have noticed that a lot of my raw files show up in ACR as underexposed, yet when I make the movie, I am exposed ok. I am trying to push this camera to it's limit for shooting documentaries with low light, available light. Also having the camera being so small does not draw attention to when I shoot, looking like I am tourist.

Obviously i run into a limit of raising ISO and having more digital noise then what I like. I am still seeking that limit of acceptance. I can use a light if you want for now on these tests. But, why are the underexposed when the LCD shows a decent exposure when shooting?

Gary

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: PinkDotRemover tool 650D
« Reply #283 on: October 03, 2013, 07:27:09 PM »
Expose to the right (try ETTR) and forget the myth that raising ISO increases noise (it actually decreases noise, until around ISO 1600; after that you get no more improvement in noise, you only lose highlight detail).

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #284 on: October 03, 2013, 10:03:18 PM »
Pixel peepers: which one do you like best and why?

original dng png
3x3 (first version) dng png
3x3_v2 dng png
3x3_median4 dng png
3x3_ahdlike dng png
i don't see the green fringing on the last pic in the list

gary
just noticed the other replies on this. I am trying to catch up reading the replies I have not seen

1%

  • Developer
  • Hero Member
  • *****
  • Posts: 5936
  • 600D/6D/50D/EOSM/7D
Re: PinkDotRemover tool 650D
« Reply #285 on: October 04, 2013, 01:19:00 AM »
I'm using this build on some non-dotted but noisy footage, seems to be helping a bit.

Sometimes it helps, sometimes not.

Old Style
http://www.filedropper.com/m28-2303-000239
3x3 exe
http://megafileupload.com/en/file/457243/M28-2303-000239-dng.html

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #286 on: October 04, 2013, 02:24:56 AM »
I just tried shooting some raw 1290 non crop mode and i then dropped the raw file in to the  raw2dng_cs3x3_ahdlike_noise.
is this correct? no PDR? I then put the dng sequence into AE CC with ACR adjustment and then used the Neat Video filter. Looks pretty good except i see one vertical row of pink dots along the left edge of the frame.

gary
never mind. i must have had a bad corrupted file. newer tests look good on crop and non crop so far.

Rewind

  • Senior
  • ****
  • Posts: 356
Re: PinkDotRemover tool 650D
« Reply #287 on: October 04, 2013, 09:41:24 AM »
ii just tried shooting some raw 1290 non crop mode and i then dropped the raw file in to the  raw2dng_cs3x3_ahdlike_noise.
is this correct? no PDR?

Did you missed the whole latest discussion?
http://www.magiclantern.fm/forum/index.php?topic=6658.msg80241#msg80241

Yes, you can use this method of chroma aliasing, but you losing detail, and if you concerned in quality, you'd better read the latest posts )

broch

  • New to the forum
  • *
  • Posts: 14
Re: PinkDotRemover tool 650D
« Reply #288 on: October 04, 2013, 06:01:35 PM »

raw2dng_cs3x3_ahdlike_noise.exe
raw2dng_cs5x5_ahdlike_noise.exe (for really noisy shots)

I don't know if this matters but both links are pointing to the same file: raw2dng_cs3x3_ahdlike_noise.exe

maxotics

  • Hero Member
  • *****
  • Posts: 532
Re: PinkDotRemover tool 650D
« Reply #289 on: October 04, 2013, 06:52:49 PM »
Rewind, I've been shooting only in 1280x720 these past few days and your latest version of PDR is working great.  I'm going to give up on non-crop mode RAW on the EOS-M for now. 

My guess is that a combination of your PDR and Alex's latest raw2dng options will cover all the shooting situations.  I don't mind if I lose some quality on shots where there is a lot of dots in blown out areas.  As long as I know I HAVE a solution at hand.

At some point we need to write an updated man page with links to the latest software and a shooter's guide for anyone with all these questions.

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #290 on: October 04, 2013, 08:29:54 PM »
Rewind, I've been shooting only in 1280x720 these past few days and your latest version of PDR is working great.  I'm going to give up on non-crop mode RAW on the EOS-M for now. 

My guess is that a combination of your PDR and Alex's latest raw2dng options will cover all the shooting situations.  I don't mind if I lose some quality on shots where there is a lot of dots in blown out areas.  As long as I know I HAVE a solution at hand.

At some point we need to write an updated man page with links to the latest software and a shooter's guide for anyone with all these questions.
i also saw that with crop mode 1290x720 i was not getting the aliasing on lines like i was getting with non crop. I tried a few different ways just using alex's   raw2dng_cs3x3_ahdlike.exe and i did not get any pink dots. and that was no pdr applied. i just use adobe PS CC with ACR to  ge the tif seq made and then Neat Video filter in PPro CC.

Gary

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #291 on: October 04, 2013, 08:34:27 PM »
Did you missed the whole latest discussion?
http://www.magiclantern.fm/forum/index.php?topic=6658.msg80241#msg80241

Yes, you can use this method of chroma aliasing, but you losing detail, and if you concerned in quality, you'd better read the latest posts )
no,  i have read everything. i am only going by what i see as a result on a large 42" hd display using HDMI. It looks preety good from what I see what I shot. I will try some more, re read what was said before and see if there is anything I am missing.I am also using ETTR as Alex suggested so my exposure now do look better in ACR.

gary

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #292 on: October 04, 2013, 08:41:52 PM »
Rewind, I've been shooting only in 1280x720 these past few days and your latest version of PDR is working great.  I'm going to give up on non-crop mode RAW on the EOS-M for now. 

My guess is that a combination of your PDR and Alex's latest raw2dng options will cover all the shooting situations.  I don't mind if I lose some quality on shots where there is a lot of dots in blown out areas.  As long as I know I HAVE a solution at hand.

At some point we need to write an updated man page with links to the latest software and a shooter's guide for anyone with all these questions.
where is this latest version of PDR you mention?

Gary

Rewind

  • Senior
  • ****
  • Posts: 356
Re: PinkDotRemover tool 650D
« Reply #293 on: October 04, 2013, 08:52:13 PM »
where is this latest version of PDR you mention?

try this one http://moredo.ru/raw/PDR Rewind for EOS-M crop.zip

One note: Although this build is dedicated to crop mode specially, You should NOT use the 'crop mode' option with this build. Just select EOS-M and hit 'convert'

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #294 on: October 04, 2013, 09:00:12 PM »
try this one http://moredo.ru/raw/PDR Rewind for EOS-M crop.zip

One note: Although this build is dedicated to crop mode specially, You should NOT use the 'crop mode' option with this build. Just select EOS-M and hit 'convert'
thank you. are you saying do not shoot raw with crop mode on? Then why is your pdr called crop?

Rewind

  • Senior
  • ****
  • Posts: 356
Re: PinkDotRemover tool 650D
« Reply #295 on: October 04, 2013, 09:02:46 PM »
thank you. are you saying do not shoot raw with crop mode on? Then why is your pdr called crop?

))) I'm talking about these settings
 

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #296 on: October 04, 2013, 09:07:52 PM »
))) I'm talking about these settings
 
ok. i never knew crop mode was there . i always used eosm

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #297 on: October 04, 2013, 09:16:58 PM »
try this one http://moredo.ru/raw/PDR Rewind for EOS-M crop.zip

One note: Although this build is dedicated to crop mode specially, You should NOT use the 'crop mode' option with this build. Just select EOS-M and hit 'convert'
this version worked good for me on a clip at 1280x720 crop mode on. I used the original raw2dng to convert the files after pdr. i ran pdr using the raw file, not all the dng files.

gary
I am seeing some pink dots in the raw files I shot at 1536x520 "non crop mode" using this version of PDR.
https://www.transferbigfiles.com/5706a02e-9af5-4ec7-b334-688d3e5cbe10/V9AvG-Ha2ICC4HP2G3bqyg2

gary2013

  • Hero Member
  • *****
  • Posts: 660
Re: PinkDotRemover tool 650D
« Reply #298 on: October 05, 2013, 09:31:28 PM »
I tried some more raw video testing today and PDR is not working. I am using different resolutions and ratios.It seems to me PDR is only working for 1280 x7 20. There are many variables people can use for resolutions and aspect and I think PDR cannot handle or figure out the differences. Leads me back to thinking of how we might need some app that can scan one image of each new sequence of DNGs and determine where the pink dots are and then do its magic to remove them. 

Gary

a1ex

  • Administrator
  • Hero Member
  • *****
  • Posts: 12564
Re: PinkDotRemover tool 650D
« Reply #299 on: October 05, 2013, 09:43:54 PM »
@Rewind: MLV has metadata about crop offset (the exact position of each frame within the full raw buffer), exactly for this purpose. To get the full (not cropped) raw buffer, take a silent picture.