Skip to content

Templates, filtering and image sizes #40

Description

@maehw

While browsing the self-o-mat code and where I may want to place changes, I've developed some diagrams which describe the software architecture (or my understanding of it) as well as the image processing chain. This is what I came up with for a combination of

ImageProcessor::frameImageForPrint(void *inputImageJpeg, size_t jpegBufferSize, FILTER filter, double filterGain) {
and
ImageProcessor::decodeImageForPrint(void *inputImageJpeg, size_t jpegBufferSize, FILTER filter, double filterGain) {

image-processing-chain2

I have some remarks/questions which I'd be happy if someone commented on (most likely you, @ClemensElflein ):

  1. When using templates. Does the applyFilter function call really work as expected?
    applyFilter(decodedImage, filter, filterGain);
    -- Shouldn't variables result or decodedImageROI be used to apply the filter? In my understanding decodedImage won't be used anymore. Can you confirm? (Maybe it just did not pop up because the default filter is not very prominent.)
  2. Why did you call it "compression" here? I think it's "just" applying the alpha channel of the template... or blending template and resized image together... - nothing is really "compressed" here, right?
    LOG_D(TAG, "Compression Took", std::to_string(((double) tend.tv_sec + 1.0e-9 * tend.tv_nsec) -
  3. When no template is applied, the target size is 1773 pixels x 1182 pixels (hard-coded) -- that's a perfect aspect ratio of 1.5 (or 3:2). Assuming 300 dpi printers, this yields 5.91" x 3.94"print size. However, we've documented that the "Hagaki" format ("postcard") has 148 mm x 100 mm or 5.83" x 3.94". Do you see a problem in the .2mm difference? Not too many pixels lost probably.. but do you think this will cause the printer to re-scale unnecessarily?
  4. I've never used templates before, but I'd like to give them a try. In https://github.com/xtech/self-o-mat/wiki/Configuration#templates we started documenting them in the wiki. How are the other hard-coded values related?
    float widthFactor = 1864.0f / image.cols;
    float heightFactor = 1228.0f / image.rows;
    -- Yet another slightly different aspect ratio (approx. 1.518). 1864 pixels x 1228 pixels seems to be "the perfect size" and would match the template file you provided once, but why this size?

I'd be happy if we could make sense out of these numbers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions