Pages: 1 2 [3] 4 5 ... 7   Go Down

Author Topic: Is this Aliasing?  (Read 49856 times)

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #40 on: January 17, 2010, 08:37:32 pm »

Quote from: Jonathan Wienke
This is exactly why interpolation of a linear image (at least with spline-based algorithms) is a bad idea. Interpolating after a a perceptually even gamma has been applied (approximately 2) gives much better results.

I get your point, sometimes working in the "perceptual space" is better. My concern is that in a gamma space, 2+2 does not equal 4, and depending on the operation that could cause visible distortion (like a harmonic generator).

Some time ago I was inspired by Bart's down-sampling page  to try down-sampling in linear, and I recall seeing better results. Do you have some examples?

Cliff
Logged
Cliff

nma

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 312
Is this Aliasing?
« Reply #41 on: January 17, 2010, 09:38:50 pm »

Quote from: ejmartin
If one used a simple linear filter to do the interpolation of color channels, resolution would be limited by the sampling frequency, and so would be particularly poor for R and B channels on a Bayer RGGB array.  However, image data is correlated between the color channels, and if those correlations are used one can achieve much higher resolution with much less artifacting.  No good demosaic just does a linear interpolation; and the better ones make some use of the correlations between R,G, and B data to achieve resolution near Nyquist for the full array rather than the individual color subsampled arrays.

Cliff, thanks for the vote of confidence.
Emil,

Thanks for your thoughtful response about the spatial correlations between channels. While I do not dispute anything you wrote, it does raise more questions in my mind. For example, if the red and blue channels were over sampled, relying on the partial correlations would add distortion.
As the sampling of the red and blue channel improves without limit, the need for relying on the correlation diminishes. Certainly using the correlation was much more important when we had 6 mPix cameras than now at 24 mPix. The degree of correlation must be dependent on the scene. How is that taken into account? What is the criteria for including the correlation?  

Thanks for your comments
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #42 on: January 17, 2010, 10:29:17 pm »

Quote from: crames
I get your point, sometimes working in the "perceptual space" is better. My concern is that in a gamma space, 2+2 does not equal 4, and depending on the operation that could cause visible distortion (like a harmonic generator).

Some time ago I was inspired by Bart's down-sampling page  to try down-sampling in linear, and I recall seeing better results. Do you have some examples?

Interpolation in gamma 2:


Interpolation in linear, with nearest-neighbor for reference:


The ringing effects in the dark area are much more noticeable in the linear image, and most unforgivably, the rendering of the white dot on black background is not the perceptual inverse of the black dot on white. The gamma 2 interpolation is better on both counts.
« Last Edit: January 17, 2010, 10:33:33 pm by Jonathan Wienke »
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #43 on: January 17, 2010, 11:09:36 pm »

Quote from: Jonathan Wienke
The ringing effects in the dark area are much more noticeable in the linear image, and most unforgivably, the rendering of the white dot on black background is not the perceptual inverse of the black dot on white. The gamma 2 interpolation is better on both counts.

Those are some funky colors! I'm seeing different results than you - for the gamma version there is a dark gray band between the green and magenta patches, and the little black square looks noticeably larger.

It could be a display problem - either yours, mine, or both. Maybe it's because channels are clipped.

I would think that linear would better emulate the additive mixing of light in the eye.

Cliff
Logged
Cliff

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #44 on: January 17, 2010, 11:13:05 pm »

Try looking at them in Photoshop side by side with a calibrated/profiled monitor. Comparisons on an uncalibrated monitor aren't going to be very useful. I see a light band on the edge of the green that fades into a narrower dark band on the edge of the magenta in the linear, as opposed to a wider dark band between green and magenta in the gamma-2 image. For real-world images, the gamma-2 is generally better because of the perceptual uniformity of sharpening/ringing artifacts, and black on white more closely matches a negative image of white on black.

Think of it this way: when transitioning from black (0) to white (1) in a series such as 0,0,0,1,1,1, the middle interpolated value is going to be (0.5). (0.5) should correspond perceptually to "halfway between white and black". In a linear image, (0.5) is only 1 stop below clipped white, and thus is on the brighter end of the luminance scale perceptually. As a result, light colors will bleed into dark colors, as shown by the second image I posted, causing bright objects on a dark background to become somewhat larger than a dark object on a light background having the same pixel dimensions.
« Last Edit: January 17, 2010, 11:27:56 pm by Jonathan Wienke »
Logged

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Is this Aliasing?
« Reply #45 on: January 17, 2010, 11:27:51 pm »

Quote from: crames
I would think that linear would better emulate the additive mixing of light in the eye.

Cliff

Why not a perceptually uniform space such as Lab?  I thought that would be the space where one would want to interpolate, since color differences of adjacent pixels in the source image are, well, perceptually uniform.
Logged
emil

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Is this Aliasing?
« Reply #46 on: January 17, 2010, 11:28:28 pm »

duplicate post.
« Last Edit: January 17, 2010, 11:31:02 pm by ejmartin »
Logged
emil

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #47 on: January 17, 2010, 11:29:40 pm »

Quote from: Jonathan Wienke
Try looking at them in Photoshop side by side with a calibrated/profiled monitor. Comparisons on an uncalibrated monitor aren't going to be very useful.

That's what I did. And I confirmed that L* goes from 88 in the green, dips to 49 in the seam, then goes up to 60 in the magenta.
Logged
Cliff

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #48 on: January 17, 2010, 11:47:11 pm »

Quote from: crames
That's what I did. And I confirmed that L* goes from 88 in the green, dips to 49 in the seam, then goes up to 60 in the magenta.

I don't dispute the existence of the dark band between the green and magenta. Try counting how many pixels it takes to get to L*50 from the edge the clipped part of the black square vs the white square in the linear image vs the gamma-2 image. IMO accurately rendering the perceptual transition between white and black is more important than perfectly handling oddball hard-edged color transitions like the green/magenta example that only rarely occur in real-world images.

Converting to LAB before resampling would solve both issues simultaneously, though.
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #49 on: January 17, 2010, 11:53:10 pm »

Quote from: ejmartin
Why not a perceptually uniform space such as Lab?  I thought that would be the space where one would want to interpolate, since color differences of adjacent pixels in the source image are, well, perceptually uniform.

It depends on what you want to do. If you want to reconstruct the pattern of light that fell on the focal plane, I think you want to stay linear.

If you want to make a perceptual enhancement of some kind, use a perceptual space. I just think that the perceptual tweaks should occur later in the pipeline.

Colors don't mix in Lab like they do in say XYZ tristimulus space.
« Last Edit: January 18, 2010, 01:12:38 am by crames »
Logged
Cliff

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #50 on: January 18, 2010, 01:21:14 am »

Quote from: crames
OK, I think I know what's happening. My guess is that you are viewing your monitor in a dark room. I've been looking at my monitor in a more "average surround" environment, with a CRT with a low black point. That's enough to explain the differences in what we are seeing, since contrast perception is affected by the surround.

When interpolating in a linear space, ringing artifacts are accentuated in dark areas and somewhat de-emphasized in bright areas, perceptually speaking. Interpolating with a non-linear gamma evens out the visibility of the artifacts so that the artifacts are perceptually similar in highlights and shadows. As a result, a lesser degree of mathematical gymnastics is needed to reduce ringing artifacts to the point where they are no longer visible.
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #51 on: January 18, 2010, 01:32:36 am »

Quote from: Jonathan Wienke
I don't dispute the existence of the dark band between the green and magenta. Try counting how many pixels it takes to get to L*50 from the edge the clipped part of the black square vs the white square in the linear image vs the gamma-2 image. IMO accurately rendering the perceptual transition between white and black is more important than perfectly handling oddball hard-edged color transitions like the green/magenta example that only rarely occur in real-world images.

OK, I think I know what's happening. My guess is that you are viewing  your monitor in a dark room. I've been looking at my monitor in a more  "average surround" environment, with a CRT with a low black point.  That's enough to explain the differences in what we are seeing, since  contrast perception is affected by the surround.

I would try it with more usual colors like those on a Color Checker.

Quote
Converting to LAB before resampling would solve both issues simultaneously, though.

You should try it, but I have my doubts.
Logged
Cliff

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #52 on: January 18, 2010, 01:45:46 am »

Quote from: crames
OK, I think I know what's happening. My guess is that you are viewing  your monitor in a dark room. I've been looking at my monitor in a more  "average surround" environment, with a CRT with a low black point.  That's enough to explain the differences in what we are seeing, since  contrast perception is affected by the surround.

The ringing artifacts in the black area of the linear image (between the white dot and magenta square) have peak RGB values between 25 and 35. The same area in the gamma-2 image peaks between 10 and 14. That's a pretty significant difference, IMO, not just monitor viewing conditions.
Logged

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #53 on: January 18, 2010, 02:01:04 am »

Quote from: BartvanderWolf
In the sample I provided earlier (post 5), there is no room in the FT beyond 64 x Sqrt(2) distance from DC. Here are the image, its top right corner zoomed in, and the FFT (the yellow rectangle in the next image is 64x64 pixels):

Of course there is more room in the FT, but we also know what happens with the image when we push detail to the extreme (the image turns gray at given frequencies).

You have room to go right out to the edge of the frequency space. Here's an example of what you get when you approach the diagonal corners. First, what was created in the frequency domain:


Next, what you get after inverse FT to spatial domain:

If you look closely, it's all checkerboard with just the 3 white lines.

Amazingly, the above reconstructs to the following (1.5 interpolated, then zoomed 2x, center crop):


So you can reconstruct up to sqrt(2) higher resolution, super-fine detail along the diagonals. Wasn't this what Fuji exploited in their Super CCD sensor?
Logged
Cliff

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #54 on: January 18, 2010, 02:28:49 am »

Quote from: Jonathan Wienke
The ringing artifacts in the black area of the linear image (between the white dot and magenta square) have peak RGB values between 25 and 35. The same area in the gamma-2 image peaks between 10 and 14. That's a pretty significant difference, IMO, not just monitor viewing conditions.

The apparent difference in gamma between average surround viewing and dark surround viewing is about a factor of 1.5. If you're in a dark surround, you have to increase the gamma to 1.5 for the image to appear the same as in an average surround.

Try it in PS Levels or Exposure - set gamma to 1/1.5 = .67 (PS uses reciprocal gamma) to simulate what I see in an average surround.

If I do the opposite and set (reciprocal) gamma to 1.5 in my average surround, I can see exactly what you are describing.

I think your test target is too sensitive to viewing contrast. Plus it responds strangely to changes in Levels, I guess because channels are maxed out. You might end up optimizing your routines so the results look good only under limited conditions.
« Last Edit: January 18, 2010, 03:05:42 am by crames »
Logged
Cliff

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #55 on: January 18, 2010, 03:04:08 am »

Quote from: Dick Roadnight
It would be nice if I could upload the raw file to the forum... I will e-mail it to anyone who sends me their e-mail address. The raw file is .3FR, Hasselblad Phocus format.

I suppose I could up load it somewhere and post a link to it.

Dick,
I sent you my email address in a message through the LL message system. If you want, I can put the raw file where others will be able to download it.

Thanks,
Cliff
Logged
Cliff

Dick Roadnight

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 1730
Is this Aliasing?
« Reply #56 on: January 18, 2010, 07:24:31 am »

Quote from: crames
Dick,
I sent you my email address in a message through the LL message system. If you want, I can put the raw file where others will be able to download it.

Thanks,
Cliff
Hi...

I have had four requests for the raw file...

The file is 80Mpx, and my e-mail service says that the limit it 25Mpx.

When I crop the file in Phocus, it does not reduce the file size, or hide the identity of the young lady.

Reducing the size by cropping would be the best way if it was possible, as it would save me having to get permission from the subject, and compression might reduce the moire effect
Logged
Hasselblad H4, Sinar P3 monorail view camera, Schneider Apo-digitar lenses

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
Is this Aliasing?
« Reply #57 on: January 18, 2010, 07:30:51 am »

You can't send a crop of the RAW file; all Phocus is doing is setting some metadata tags indicating the preferred cropping parameters when converting. Try converting the file to losslessly compressed DNG; that should at least bring down the file size considerably. If there are permission/usage issues with the subject, you'll simply have to get the appropriate permissions, use a different RAW that shows the same problem, or send a TIFF crop of the problem area instead of the RAW.
Logged

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
Is this Aliasing?
« Reply #58 on: January 18, 2010, 08:43:38 am »

Quote from: Dick Roadnight
Hi...

I have had four requests for the raw file...

The file is 80Mpx, and my e-mail service says that the limit it 25Mpx.

When I crop the file in Phocus, it does not reduce the file size, or hide the identity of the young lady.

Reducing the size by cropping would be the best way if it was possible, as it would save me having to get permission from the subject, and compression might reduce the moire effect


Try uploading it to a file hosting service, eg yousendit.com
Logged
emil

crames

  • Full Member
  • ***
  • Offline Offline
  • Posts: 210
    • http://sites.google.com/site/clifframes/
Is this Aliasing?
« Reply #59 on: January 18, 2010, 08:50:19 am »

There is a quick and dirty way to try reconstruction in Photoshop - no Matlab required. You just need a plugin that does forward and inverse FFTs. I have the freeware KamLex FFT Plugin  (for Windows), that works well.

Here is the the proceedure:

1. Do the forward FFT.
2. Increase the canvas size on all sides. The ratio of the new size/original size is your interpolation factor.
3. Do the inverse FFT.

That's it! The color of the increased canvas area will affect edge effects and rippling. There are standard methods to minimize edge effects by mirroring, etc.

There are limitations to the plugin, but actually I think this might work as well or better than the Yaroslavsky Matlab code.

That's it!
Cliff
« Last Edit: January 18, 2010, 08:52:08 am by crames »
Logged
Cliff
Pages: 1 2 [3] 4 5 ... 7   Go Up