G'MIC exercises

exercise

(Alan Gibson) #272

Here’s another way of thinking about the situation. For simplicity, I’ll assume only one dimension.

Suppose we have a curve y=f(x). We don’t know what the curve is, we know only that for two values x0 and x1, the y values are y0 and y1. For a resampling (enlargement or reduction, or some other process) we need to guess the values of y for some other values of x.

Well, if we know only two points, we might guess the function is linear. That guess is as good as any other. But if we know four points, we might guess the function is piecewise linear between each pair, but a better guess would be a curve that passes through the known points but doesn’t suddenly change direction at any point. A spline curve would qualify, and is probably more accurate than a piecewise linear function.

However, sadly, we don’t really know the y-values at exact values of x because each camera sensor element capturea light over an area, not a point. So we really know the average value of y summed over a certain range of x-values. We don’t know that the curve passes through any particular points, only that the curve has a certain average at various ranges of x. And the task is to find the average of the curve at certain other (smaller) ranges.

This opens more possibilities. A wide range of curves can be considered. Which we choose depends on many factors. For example, a Nikon D800 has an anti-aliasing filter, which creates a blur. So the ranges of x-values overlap. We know the average values of y at various overlapping ranges of x. And I suppose that “average” is bell-shaped, so light hitting the centre of the sensor pixel has a greater weight than light hitting near the edge. An accurate resampling method (eg to simulate a photo taken with a camera that had greater resolution) should take these factors into account.

The result is that the curve for a resampled image might have characteristics including:

  • sharpness vs blurry (steep vs shallow curve)
  • aliasing (“jaggies”, “staircase”; over-sharp)
  • halos (“overshoot”, increases perceived sharpness; may be useful or obtrusive)

These characteristics are trade-offs.

How do we choose? In my work, I choose visually.


#273

Take the following sample image.

gmic sp tiger > 240

1. Which are the largest or smallest i and I patches?
2. Is there a way to mask them based on their size? E.g.,
   < 10 pixels in area?
   < 3 pixels in width (for elongated or ring shapes)?


(dumb) #274

To complement the CubeHelix filter I’ve been using satellite image enhancement colour schemes; they’re useful for bringing out contrast in images. I found a load of text files from with some which the NOAA use and I’ve used an online awk clone to sort out all the prepare the data for fill.

Filter, table for the last scheme that I’m including and sample image:

I’ll be adding more soon before I make a PR on GH. Should I have used map instead? Also, yes, I know that this’ll be used for fakery but genuine products always come from the respective websites. Also it’s really easy to tell that this is fake because I’ve never seen any cloud tops that get yellow colours before when using this scheme.