Project

General

Profile

Feature #9951

support x-trans sensor raw files

Added by Dan Torop about 4 years ago. Updated almost 4 years ago.

Status:
Fixed
Priority:
Low
Assignee:
-
Category:
Darkroom
Start date:
05/09/2014
Due date:
% Done:

100%

Affected Version:
git development version
System:
all
bitness:
64-bit
hardware architecture:
amd64/x86

Description

The https://github.com/dtorop/darktable/tree/xtrans2 branch supports raw files from Fuji X-Series cameras. This should fulfill the criteria from http://www.darktable.org/2012/12/released-1-1-1/comment-page-1/#comment-8553. Changes are:

- use libraw 0.16.0 to read raw files
- downsampling for fast display
- interpolation: bilinear, VNG, and modified AHD (aka Markesteijn), all adapted from dcraw; these operate on floats and use OpenMP
- highlights, hotpixels, invert, rawdenoise, temperature handle x-trans
- disable cacorrect for x-trans
- white balance presets and basecurve for X100S
- camera matrices for x-series cameras (from dcraw)

None of this should alter performance for users of Bayer sensors.

Potential future changes would be:

- load with use RawSpeed once it supports these sensors
- deal with the "Dynamic Range" feature of the camera
- white balance presets and basecurves for other X-Series cameras
- cacorrect module
- OpenCL or SSE optimizations

The current code is being tested by other users and (so far) seems to work and be fast enough. If this would be an appealing change, I'm happy to make a pull request. I'm also happy to change this code as necessary to make it appropriate for inclusion.

History

#1 Updated by Pascal de Bruijn about 4 years ago

We just imported rawspeed's development branch into git master. rawspeed's development branch seems to support RAF files.

I've added support for the Classic X100 myself (which is still plain bayer), which seems to work fine.

I hope you'd want to "port" your work to RawSpeed, which should be easy enough...

RawSpeed needs explicit camera definitions. I've written an experimental script to partially automate this (which can be run on DNGs converted from RAFs with a recent version of Adobe DNG Converter):

https://github.com/darktable-org/darktable/blob/master/tools/dngmeta.sh

The script however does not yet account for non 2x2 patterns, but I guess you should be able to reasonably easily adapt this.

If you have any questions come find me on IRC :)

#2 Updated by Dan Torop about 4 years ago

Thank you for the notice about rawspeed! I'll look forward to trying out the RAF support in the next few days, and post notice of any updates -- or ask questions...

#3 Updated by Dan Torop about 4 years ago

The xtrans2 branch can now use RawSpeed to load x-trans sensor (and other fuji "x-series") cameras.

There's now code in dngmeta.sh for 6x6 sensors which would also work for 2x2, but for now I left in the former 2x2 code as well. There's something odd about how the newer 14-bit 6x6 sensors have their CFA offset horizontally in DNG files (though not in the original raw). Not sure why, but there's some ad hoc code to work around this.

In general the x-trans branch is coming along, though certainly could use more testing, especially after these changes.

#4 Updated by Dan Torop about 4 years ago

Current known issues for X-Trans code:

- images demosaiced with Markesteijn algorithm have a lower-quality 6 pixel border
- RawSpeed crops for X-series cameras currently determined by observation, perhaps instead match raw file metadata

Wishlist/future items would include:

- deal with the "Dynamic Range" feature of the camera (though note darktable doesn't yet support similar features of other cameras)
- white balance presets and basecurves for other X-Series cameras besides X100S
- cacorrect module
- OpenCL or SSE optimizations

#5 Updated by Dan Torop about 4 years ago

There are now two branches for X-Trans in https://github.com/dtorop/darktable: "xtrans2" which uses RawSpeed solely, which is the preferred branch, and "libraw-0.16" which includes an update to the newest (x-trans capable) LibRaw. To make the "xtrans2" branch work without the newest LibRaw, there's a small patch to its 0.14.7 LibRaw version.

The noisy outer border on Markesteijn demosaic should now be fixed (at the cost of using a bit more memory/processing) via implementing Lars Kotthoff's idea of extending the image by mirroring at the edges. There's probably a way to do this without the extra memory allocation...

Some more work on RawSpeed cameras.xml and misc. fixups as well. I've recently worked via altering/consolidating my extant commits, in order to provide a sensible/compact set of patches, rather than a moment-by-moment development history.

The most visible remaining issue is handling the "dynamic range" setting, but it seems sensible to get basic X-Trans reading going before adding features.

Barring other issues I'll make a pull request for the xtrans2 branch, and hope it can be reviewed.

#6 Updated by Dan Torop about 4 years ago

There is a pull request for this work: https://github.com/darktable-org/darktable/pull/588. This code should be in a workable/usable state.

There is also a branch https://github.com/dtorop/darktable/tree/xtrans2-dev which contains changes beyond what is in the pull request. This branch will also have a more continuous commit history (e.g. will merge upstream/mster rather than rebasing onto it). (The "libraw-0.16" branch has the changes necessary for a LibRaw update, but I won't add new code to it unless a LibRaw change becomes necessary.)

Current xtrans2-dev changes not in PR 588:

- disable linear demosaic in the UI
- VNG4 for Bayer sensors (based on dcraw's "-f" option and the X-Trans VNG code)

Additional work could include:

- profiled denoise for X-Series cameras
- merge very similar X-Trans and Bayer code
- look into "match greens" and "edge threshold" for X-Trans demosaic
- look into LMMSE demosaic as per http://chromasoft.blogspot.com/2012/11/demosaicing-fuji-x-pro1-part-4.html

#7 Updated by Roman Lebedev about 4 years ago

  • Status changed from New to Fixed
  • % Done changed from 0 to 100
  • Target version set to Candidate for next major release

#8 Updated by Marc Cousin almost 4 years ago

Hi,

Is there anything a Fuji-X user can do to help, here ? :)

I have an XE-2, maybe I can capture noise profiles (if pointed in the right direction) for the X-Trans II sensor ?

Anyway, thanks a lot for what is already done... it works great here.

#9 Updated by Dan Torop almost 4 years ago

Noise profiles or basecurve for the XE-2 (and other X-Series cameras) would be great! Also white balance presets could be helpful.

Right now in the darktable master branch there is a basecurve and white balance presets for the X100S. There's also a noise profile for the X100S in https://github.com/darktable-org/darktable/pull/626/files. Francisco Cribari sent over an X100S basecurve which appears to be better than what I made, and hence may well be in an upcoming pull request.

#10 Updated by Marc Cousin almost 4 years ago

Should I be using:
http://www.darktable.org/2012/12/profiling-sensor-and-photon-noise/ for noise,
http://www.darktable.org/2013/10/about-basecurves/ for basecurve ?

For white balance, is there also a doc?

By the way, the X100s and XE2 sensors are supposed to be the same, is there a point in me doing this ? Maybe just to double-check that they really are the same ?

#11 Updated by Roman Lebedev almost 4 years ago

Marc Cousin wrote:

Should I be using:
http://www.darktable.org/2012/12/profiling-sensor-and-photon-noise/ for noise,

Yes

http://www.darktable.org/2013/10/about-basecurves/ for basecurve ?

Things have changed a bit, but mostly yes. Join IRC if you need help.

For white balance, is there also a doc?

Section "White balance presets" of
http://www.darktable.org/2012/10/whats-involved-with-adding-support-for-new-cameras/

By the way, the X100s and XE2 sensors are supposed to be the same, is there a point in me doing this ? Maybe just to double-check that they really are the same ?

Same sensors does not really mean anything, because in the camera FW, manufacturers might do completely different things for different cameras.
So it should be done for each camera.

#12 Updated by Marc Cousin almost 4 years ago

I have a noise profile for the XE2. I tried it with very noisy pictures, it works great. Where should I upload it ?

#13 Updated by Marc Cousin almost 4 years ago

I also have the basecurve. What should I provide ? The shell script ?

#14 Updated by Roman Lebedev almost 4 years ago

Best way - try to make noise in IRC at evening (EU time).
Simplest way - send everything (except source images) to dt-devel ML

#15 Updated by Marc Cousin almost 4 years ago

I cannot manage to get a nice basecurve. It seems too "linear". The fuji-like is much closer to the JPEGs, that is really strange. I put all the data here: https://drive.google.com/file/d/0B_liIOwDeWUmNno3RHI5Tk10TDQ/edit?usp=sharing

The 2 first pictures (XE025649 and XE025650) exhibit the problem very clearly (sea pictures). The sea and the coast are better using the default fuji-like basecurve than the one I managed to produce.

BTW, I'll try to hang on IRC all day, nick marco44, if that can help.

#16 Updated by Marc Cousin almost 4 years ago

I have profiled noise for XE2. Who should I contact on IRC to make those available ?

#17 Updated by Simon Spannagel almost 4 years ago

  • bitness set to 64-bit
  • System set to all
  • Affected Version set to git development version

Hi,

best contact hanatos if around.

Also available in: Atom PDF