[CREATE] Lens correction database

Cyrille Berger cberger at cberger.net
Sat Sep 8 12:53:55 PDT 2007


> In any case, I have exposed the internals of the models already.
Thanks.

> >  - pixels are not stored in a big memory chunk, but in tiles (or
> > possibely even more sophisticated structures), while copying from
> > thoses structures to a big memory chunk is possible, it's defeating
> > one of the point of having those structures
>
> Sure, one of the things I want to avoid is imposing some specific
> image-in-memory layout to client applications.
>
> For now I mean processing image pixel by pixel, e.g. for example the
> method:
>
> void Apply (uint8 *rgb);
>
> is meant to be called for every pixel. I see why this is quite an
> expensive approach, maybe there are better ideas on a more optimal
> image processing? Of course, this could be even a generic:
>
> void Apply (float &r, float &g, float &b);
>
> and your application would just convert the pixel back and forth
> between float and native pixel format. However, I decided it would be
> better to have just one pointer to three consecutive values of their
> native types for performance reasons.

A possible solution is (that's what lcms does):
void Apply (uint8 *rgb, int length);

Or even better:
void Apply (const uint8 *rgbSrc, uint8 *rgbDst , int length);

And you can allow rgbSrc == rgbDst. This usefull for people who need to have 
an undo operation, that allow to spare a memcpy of the original data.

But I don't see how pixel by pixel processing could work except for vignetting 
correction ? Distortion correction needs more than one pixel. As for TCA or 
CCI I don't know :/ But I thought you would need it.

> In any case, how would Krita apply, say, TCA correction or CCI
> correction on a CMYK image? Will it convert CMYK to RGB, then apply the
> channel shift/colour correction, then back to CMYK or how? Point is, all
> existing lens models deals with red, green and blue, I haven't seen
> lens models for other color spaces. So if there will be a back and
> forth conversion, maybe a generic method like above will help.
Applying a "lens defect" correction to a CMYK image is well a stupid idea 
(unless for some reason the user wants to create a distortion effect of its 
CMYK image). But beside the Krita philosphy of having as many as possible of 
our filters/tools to work natively, I am more concerned by YCbCr images. And 
grayscale (well except TCA and CCI correction).

So yes for us, to respect our philosophy and to not disable the filter when 
editing a CMYK image, for TCA or CCI correction, we would need to convert to 
RGB.

-- 
Cyrille Berger


More information about the CREATE mailing list