Author Topic: bayer pattern in crop vs non-crop raw video  (Read 5404 times)

Andy600

  • Contributor
  • Hero Member
  • *****
  • Posts: 1863
  • Have you tried turning it off and on again?
bayer pattern in crop vs non-crop raw video
« on: August 14, 2013, 12:27:44 AM »
I'm trying to get my head around how debayering works and specifically how line skipping in non-crop video might affect the bayer readout of the sensor? Is it different to crop mode 1:1 video?

I'm thinking about this because a cameras bayer pattern affects how certain debayering algorithms perform which is why something like Davinci Resolve debayers BMCC, ARRI and Red cameras well but sometimes struggles with ML video.

If the pattern is different for crop and non-crop how does the debayer know? Is it written into the DNG file?

I also noticed in Raw Therapee that AMaZE seems to perform best with non-crop video and DCB with crop.

Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

CFP

  • Member
  • ***
  • Posts: 185
Re: bayer pattern in crop vs non-crop raw video
« Reply #1 on: August 14, 2013, 06:37:22 PM »
As far as I know, the sensor looks like this:

- Sensor Pattern

And with line skipping it simply reads every third line and every third column, so it looks like this:

- Line Skipping Pattern

So the debayering method is the same. The pattern is always R G R G for the uneven lines and G B G B for the even lines.
(R = red | B = blue | G = green)

But if the debayering algorithm is too bad, the images with line skipping may look bad too because of the big gaps between the pixels.
But I would like to know how the skipping works in 720p mode. There it reads every third column but only every forth line ...
And of course it would be cool if Magic Lantern could set the skipping ...

Andy600

  • Contributor
  • Hero Member
  • *****
  • Posts: 1863
  • Have you tried turning it off and on again?
Re: bayer pattern in crop vs non-crop raw video
« Reply #2 on: August 14, 2013, 07:31:23 PM »
As far as I know, the sensor looks like this:

- Sensor Pattern

And with line skipping it simply reads every third line and every third column, so it looks like this:

- Line Skipping Pattern

So the debayering method is the same. The pattern is always R G R G for the uneven lines and G B G B for the even lines.
(R = red | B = blue | G = green)

But if the debayering algorithm is too bad, the images with line skipping may look bad too because of the big gaps between the pixels.
But I would like to know how the skipping works in 720p mode. There it reads every third column but only every forth line ...
And of course it would be cool if Magic Lantern could set the skipping ...

Thanks CFP. Explained very nicely :)

So would I be correct in thinking this is written into the DNG files and that specific pattern can only be properly debayered with an algorithm that uses the same order or are debayers intelligent? Just ran some DNGs through ExifTool and can see the bayer info etc.

On a slightly different subject....

I was also reading an interesting article over on BMCuser about upscaling BM 2.5k DPX files to deduce moire and aliasing. This is especially useful for the raw on the 50D as non-crop footage needs upscaling to 1080p and I'm trying to find the absolute best method.

http://www.bmcuser.com/showthread.php?2489-Proper-processing-upres-ing-and-the-future-5-years-of-resolution/page3

user Redgamma seems to have found a nice method but he's keeping quiet about the exact procedure: example: http://www.mediafire.com/view/?8cfrzbbuv5k5xxh#.

Someone else took an educated guess at how he did it http://www.bmcuser.com/showthread.php?2489-Proper-processing-upres-ing-and-the-future-5-years-of-resolution&p=75219&viewfull=1#post75219


Colorist working with Davinci Resolve, Baselight, Nuke, After Effects & Premier Pro. Occasional Sunday afternoon DOP. Developer of Cinelog-C Colorspace Management and LUTs - www.cinelogdcp.com

CFP

  • Member
  • ***
  • Posts: 185
Re: bayer pattern in crop vs non-crop raw video
« Reply #3 on: August 14, 2013, 08:53:43 PM »
As a 600D user I am really interested in the best way to upscale your footage too ;D

My footage has a way lower resolutions than yours but so far I got really nice results using a simple AviSynth script.
(Here it is:   [Spoiler]LoadPlugin(ScriptDir()+"..\Avisynth-plugins\nnedi3.dll")
# Get the Plugin here: http://web.missouri.edu/~kes25c/nnedi3.zip
# Edit the path if necessary

LoadVirtualDubPlugin(ScriptDir()+"..\VirtualDub\plugins\msu_sharpen.vdf", "MSUSmartSharpen", 0)
# Get the Plugin here: http://www.compression.ru/video/smart_sharpen/src/smart_sharpen.zip
# Edit the path if necessary

ImageSource("PATH TO YOU TIFF FILES\%d.tif", FIRST_FRAME'S_NAME, LAST_FRAME'S_NAME, FRAME_RATE, false, false, "RGB24")
# That works only if your TIFF files are named like this: 1, 2, 3, 4, [...], 678

nnedi3_rpow2(rfactor = 4)

ConvertToRGB32()

MSUSmartSharpen(3)

ConvertToRGB24()

Spline36Resize(1920, 768)
# If your aspect ratio isn't 2.5:1 you may want to change the second number ;)
# If you want 4K, use 4096 X (4048 / YOUR_ASPECT_RATIO)
[/Spoiler]  )

If I would be better in scripting, I guess I could do what Hendrik suggested with AviSynth.
But I suck at scripting. There are some AviSynth Pros out there. Maybe one of them could do it. I don't know.

If you don't know AviSynth: It is a really powerful editing software. But it has no front end. So instead of using an interface you have to write a script and run that script inside another editing software. The tool that was used to process the old HDR videos based on AviSynth.

If you find the best way to upscale RAW videos, please share it with us :D

deleted.account

  • Member
  • ***
  • Posts: 154
Re: bayer pattern in crop vs non-crop raw video
« Reply #4 on: August 14, 2013, 11:23:29 PM »
I'm trying to get my head around how debayering works and specifically how line skipping in non-crop video might affect the bayer readout of the sensor? Is it different to crop mode 1:1 video?

I'm thinking about this because a cameras bayer pattern affects how certain debayering algorithms perform which is why something like Davinci Resolve debayers BMCC, ARRI and Red cameras well but sometimes struggles with ML video.

If the pattern is different for crop and non-crop how does the debayer know? Is it written into the DNG file?

I also noticed in Raw Therapee that AMaZE seems to perform best with non-crop video and DCB with crop.

Why not use dcraw and output Bayer raw images to see any differences between patterns?

re: Avisynth, yeah playing with it with 1200x496 T2i raw looking at upscaling methods and algo's on 16bit source.