Pages: [1] 2 3 ... 6 Next   Go Down
  Print  
Author Topic: Custom processing for JPEG (Tone curve, CA ...)  (Read 9326 times)
0 Members and 1 Guest are viewing this topic.
toinech
Jr. Member
**

Karma: +6/-0
Offline Offline

Posts: 65


« on: 03 / April / 2008, 05:42:46 »

According to the code it looks like it is possible to pre-process the RAW value stored in memory before it gets saved to JPEG.
For now an existing RAW file is reloaded and developed with internal settings during RAW develop. Is the code as I understood?
I am planning to add the following features:

- Custom tonal curves (for example to reduce blown out in JPEG like on the Fuji S100)
- Chromatic Aberration reduction using PTLens data base
- Filter simulation (Polarizer, Warm tone...)
- Film simulation (Velvia, Chrome....)

Does it make any sense?

Toine
Logged
Barney Fife
Hero Member
*****

Karma: +70/-219
Offline Offline

Posts: 1159



« Reply #1 on: 03 / April / 2008, 06:48:33 »

Deleted
« Last Edit: 22 / April / 2008, 20:55:19 by Barney Fife » Logged

[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +121/-27
Offline Offline

Posts: 1624


Coders Humiliate DSLR Kiddies


« Reply #2 on: 03 / April / 2008, 07:23:47 »

makes sense, and also it will make alot of work Big Grin
what do you mean by "developed by internal settings"? development is done according to the camera's settings, e.g. whitebalance, sharpening, quality. adding additional settings there will be a huge task, i doubt it is possible, but then again there are a lot of features that wouldnt be in chdk if the devs would have "hit the wall of doubts".
« Last Edit: 03 / April / 2008, 07:26:07 by PhyrePhoX » Logged

GrAnd
Developers
Hero Member
****

Karma: +74/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #3 on: 03 / April / 2008, 08:53:33 »

adding additional settings there will be a huge task, i doubt it is possible
Anything is possible. Big Grin We have RAW data and we can modify it before saving to JPG. Right now only badpixels correction uses this possibility. But it can be more intellectual processing. Anyway, it should work very quick to prevent camera from shutdown by watchdog timeout.
Logged

CHDK Developer.
mkmenuts
Jr. Member
**

Karma: +4/-0
Offline Offline

Posts: 60

SD700 (1.01b)


« Reply #4 on: 03 / April / 2008, 12:03:17 »

Quote
it should work very quick to prevent camera from shutdown

...If only we knew how to program the DIGIC DSP...

It is capable of quite a lot, and is used in the high end cameras as well. I would guess applying a curve or a filter is peanuts for it.

If we knew what function sends the configuration to the DIGIC, we could try it with all the different options already available and  then add more.
Logged
PhyrePhoX
Global Moderator
Hero Member
*****

Karma: +121/-27
Offline Offline

Posts: 1624


Coders Humiliate DSLR Kiddies


« Reply #5 on: 03 / April / 2008, 12:10:36 »

we should send  a rogue agent to canon, so he can steal a software emulator & debugger. Big Grin
Logged

Barney Fife
Hero Member
*****

Karma: +70/-219
Offline Offline

Posts: 1159



« Reply #6 on: 03 / April / 2008, 14:30:52 »

Deleted
« Last Edit: 22 / April / 2008, 20:55:40 by Barney Fife » Logged

[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye
PS
Jr. Member
**

Karma: +4/-5
Offline Offline

Posts: 97

A610 1.00f


« Reply #7 on: 03 / April / 2008, 19:43:06 »

- Something needs to be done with the lack of saturation in the shadows;
Logged
toinech
Jr. Member
**

Karma: +6/-0
Offline Offline

Posts: 65


« Reply #8 on: 04 / April / 2008, 02:09:03 »

At first I was going to only do the same mapping for all pixels - i.e. for any pixel a specific input value will be converting to a specific value from the below table:

  outValue[inValue] 
              with inValue in the [0..1023] range
              and outValue in the [0..1023] range

Then I thought of color filters with the following table:

  outValue[colorPixel, inValue]
              with inValue in the [0..1023] range
              and outValue in the [0..1023] range
              and colorPixel in the [0..3] range or [0..2] range depending on whether it is CYMG or RGB

The problem is that I don't know how the color pixels are arranged in the file and whether it is a RGB or CYMG matrix.

Anybody knows (at least for the A610)?

Worst case I will stick with the initial - but that will be a shame.

Looks like the algo is stupid enough to eat not too much of CPU and cause time out - But who knows...

Thanks in advance for your help,

Toine
« Last Edit: 04 / April / 2008, 03:09:28 by toinech » Logged
Barney Fife
Hero Member
*****

Karma: +70/-219
Offline Offline

Posts: 1159



« Reply #9 on: 04 / April / 2008, 06:37:18 »

Deleted
« Last Edit: 22 / April / 2008, 20:56:00 by Barney Fife » Logged

[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye
toinech
Jr. Member
**

Karma: +6/-0
Offline Offline

Posts: 65


« Reply #10 on: 04 / April / 2008, 07:19:23 »

Uhhmm... unless I'm totally misunderstanding how the RAW data is being held in the camera's memory.... it should be in the format of RGBG (bayer matrix) for all of these cameras.

Aren't they all luminance values taken direct from the sensor? They just happen to have a color filter over each one. No such thing as a "colorPixel" in RAW.


Still need to find out what color filter is for which pixel. I am planning to apply a different response curve against each of those 'color filtered' pixel (e.g. the one with green filter will have the 'Green' response curve applied to).

Anyway, if the information can be read by dcraw, I'll probably have go look at the dcraw source and work from there.

Can you confirm that the CHDK RAW file is readable by dcraw?

Thanks
Logged
GrAnd
Developers
Hero Member
****

Karma: +74/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #11 on: 04 / April / 2008, 07:51:54 »

Uhhmm... unless I'm totally misunderstanding how the RAW data is being held in the camera's memory.... it should be in the format of RGBG (bayer matrix) for all of these cameras.

Aren't they all luminance values taken direct from the sensor? They just happen to have a color filter over each one. No such thing as a "colorPixel" in RAW.

Still need to find out what color filter is for which pixel. I am planning to apply a different response curve against each of those 'color filtered' pixel (e.g. the one with green filter will have the 'Green' response curve applied to).

RGGB Bayer matrix.
* Even lines - RGRGRG...
* Odd lines - GBGBGB...


Can you confirm that the CHDK RAW file is readable by dcraw?

Yes.
Logged

CHDK Developer.
Barney Fife
Hero Member
*****

Karma: +70/-219
Offline Offline

Posts: 1159



« Reply #12 on: 04 / April / 2008, 08:10:45 »

Deleted
« Last Edit: 22 / April / 2008, 20:56:19 by Barney Fife » Logged

[acseven/admin commented out: please refrain from more direct offensive language to any user. FW complaints to me] I felt it imperative to withdraw my TOTAL participation. Nobody has my permission, nor the right, to reinstate MY posts. Make-do with my quoted text in others' replies only. Bye
toinech
Jr. Member
**

Karma: +6/-0
Offline Offline

Posts: 65


« Reply #13 on: 06 / April / 2008, 04:09:13 »

Anyway, it should work very quick to prevent camera from shutdown by watchdog timeout.

Well I finished the coding and run a couple of test - It did not timeout but it did slow down the camera quite a bit!. It seems to work however (Tried on a  1=>1 level and 1=>1/2 level conversion).

As I am not a wiz for coding C, I attached the code snip here in case anybody has an idea of how to optimize it.

Code
GeSHi (c):
unsigned short curve[4][1024];
// The 3 different color level conversion can be done here...
// (we'll do twice the Green one).
// Assume to have the following matrix
// (0)(1)
// (2)(3)
 
Cut out the outdated code to make room in the post...
 
Thank you all for your input.
 
Hope that I won't have to declare this as a dead feature.
Created by GeSHI 1.0.7.20
« Last Edit: 12 / July / 2008, 22:51:38 by toinech » Logged
GrAnd
Developers
Hero Member
****

Karma: +74/-2
Offline Offline

Posts: 917


[A610, S3IS]


« Reply #14 on: 06 / April / 2008, 09:13:53 »

> unsigned short curve[4][1024];
> ...
> pixVal[k]=curve[2*(i&2)+(k&2)][pixVal[k]]; // Assumme Bayer

The expression 2*(i&2)+(k&2) can has 0, 2, 4, 6 as the result, but declaration is "curve[4]".
Is it supposed to be 2*(i&1)+(k&1)?
Logged

CHDK Developer.
Pages: [1] 2 3 ... 6 Next   Go Up
  Print  
 
Jump to: