Pages: 1 2 [3] 4   Go Down

Author Topic: New Lens Correction Software  (Read 33462 times)

Guillermo Luijk

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 2005
    • http://www.guillermoluijk.com
New Lens Correction Software
« Reply #40 on: December 26, 2009, 06:14:46 pm »


Hi Bart, I was reading at your resizing tests, and from my experience non-RGB mode image files are always rescaled using nearest neighbour, no matter the algorithm selected, so I think it is not worth even considering or mentioning PS resizing capabilities in non-RGB mode.

Regards

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
New Lens Correction Software
« Reply #41 on: December 26, 2009, 06:49:40 pm »

Quote from: Guillermo Luijk
Hi Bart, I was reading at your resizing tests, and from my experience non-RGB mode image files are always rescaled using nearest neighbour, no matter the algorithm selected, so I think it is not worth even considering or mentioning PS resizing capabilities in non-RGB mode.

Hi Guillermo,

Thanks for the observation. At the time (in 2004) I was not aware of the aberrant behavior of Photoshop, since then I know better. I thought it important enough to mention, because I usually allow others to verify/duplicate my findings when practical. For those who would like to verify my findings, it is important to mention the caveats (in this case shortcomings of Photoshop), to avoid confusion. That's why I pointed it out instead of avoiding it.

It is also important to understand that Photoshop doesn't offer anything better than bicubic resampling for downsampling (which is a common procedure for web publishing), while it's been known for some time now that e.g. a Sinc based downsampling filter provides better results. Downsampling offers a different Digital Signal Processing (DSP) challenge than upsampling does.

That's why I wanted to see how Jonathan's adaptive method does, expecting more than necessary aliasing artifacts, but unfortunately I was unable to verify it.

Cheers,
Bart
« Last Edit: December 26, 2009, 06:52:49 pm by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #42 on: December 26, 2009, 07:12:31 pm »

I updated the installer and tweaked the upsizing algorithm a bit. Perhaps the new version will fix the file error, please try it and let me know.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
New Lens Correction Software
« Reply #43 on: December 27, 2009, 06:29:42 am »

Quote from: Jonathan Wienke
I've fixed the missing database file error, and a few small bugs in the interpolation code. I also added a check box so the barrel/pincushion adjustments are optional.

The download link is the same, simply download the updated ZIP file, extract, and then run the new installer.

Hi Jonathan,

Thanks for the update. I can get this 0_0_1_9 release to work, but I have to ignore an error message when I start it:
[attachment=18915:JW_PixelClarity.png]
Setup installed it in the "c:\Users\Bart\AppData\Local\Apps\2.0\..." directory (Vista Ultimate 64-bit).


I'll do some testing with images and let you know my findings.

Cheers,
Bart
« Last Edit: December 27, 2009, 06:43:35 am by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #44 on: December 27, 2009, 02:39:05 pm »

Quote from: BartvanderWolf
Hi Jonathan,

Thanks for the update. I can get this 0_0_1_9 release to work, but I have to ignore an error message when I start it:

For some reason, you're missing the ADODB database DLLs needed to open the PSF database file. It's not really being used right now, but will be needed for deconvolution.
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #45 on: December 28, 2009, 03:31:13 am »

I updated the installer again; I made a few more bug fixes and changed the comparison interpolation to nearest neighbor. This makes it easier to tell whether the spline interpolation is clipping/ringing/haloing or if the artifacts are in the original image.

http://www.visual-vacations.com/media/PixelClarity.zip
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #46 on: December 28, 2009, 09:56:55 pm »

Yet another update which tunes the blending between the upsized and downsized areas, and should also fix the database file open error issue. Bart, if you could re-download and see if you still get the startup error, I'd appreciate it.
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
New Lens Correction Software
« Reply #47 on: December 29, 2009, 09:24:59 pm »

Quote from: Jonathan Wienke
Yet another update which tunes the blending between the upsized and downsized areas, and should also fix the database file open error issue. Bart, if you could re-download and see if you still get the startup error, I'd appreciate it.

Jonathan,

Thanks for looking into apparently my specific issue (I haven't heard anybody else mention it). Unfortunately the same error box appears (with version 0_0_1_12). The application does start and it does its resampling. The downsampling generates aliasing errors, but for images with less critical content it does produce crisp results. The upsampling looks a bit gritty (not smooth) around edges, it seems (if I recall correctly) that the earlier versions were smoother in the upsampling.

Cheers,
Bart
« Last Edit: December 29, 2009, 09:26:04 pm by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #48 on: December 30, 2009, 09:07:53 am »

Quote from: BartvanderWolf
The downsampling generates aliasing errors, but for images with less critical content it does produce crisp results. The upsampling looks a bit gritty (not smooth) around edges, it seems (if I recall correctly) that the earlier versions were smoother in the upsampling.

Can you post a sample of the "grittiness" you're referring to? I'm not quite sure what you're referring to.

The aliasing is there, especially between 50% and 100%, but it's a trade-off between aliasing and sharpness, so I biased the parameters more toward sharpness than aliasing suppression. Perhaps I should add a sharpness or aliasing prevention control.

To resolve your startup problem, you may need to download and reinstall the MS Jet database engine. Try this link:
http://www.microsoft.com/downloads/details...;displaylang=en
« Last Edit: December 30, 2009, 09:24:08 am by Jonathan Wienke »
Logged

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
New Lens Correction Software
« Reply #49 on: December 31, 2009, 09:16:04 am »

Quote from: Jonathan Wienke
Can you post a sample of the "grittiness" you're referring to? I'm not quite sure what you're referring to.

Hi Jonathan,

The grittiness is caused by pixelization/blocking artifacts. Here's an example based on my 'torture' testtarget:
[attachment=19049:PC_02.png]
Aliasing/moiré is visible with downsampled images, it is just a matter of luck whether the image detail can mask it:
[attachment=19050:PC_01.png]

Quote
The aliasing is there, especially between 50% and 100%, but it's a trade-off between aliasing and sharpness, so I biased the parameters more toward sharpness than aliasing suppression. Perhaps I should add a sharpness or aliasing prevention control.

In general I think it's better to do the downsizing properly (i.e. after removing high spatial frequency content with a filter), and add an option for sharpening the result.

Quote
To resolve your startup problem, you may need to download and reinstall the MS Jet database engine. Try this link:
http://www.microsoft.com/downloads/details...;displaylang=en

I looked at that, but it seems to address a Windows XP problem, I'm not going to try that on my Vista Ultimate 64-bit version unless there's no other way. The missing DLL seems to be a part of Visual Studio 6 and Office 2003. I'm not sure how that will play out with newer computer systems (e.g. Win 7 and Office 2007/2010), perhaps there is an alternative DLL that can be invoked? Just thinking aloud, to future proof your application. Thanks for your suggestions anyway.

Cheers, and a happy new year,
Bart
Logged
== If you do what you did, you'll get what you got. ==

ejmartin

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 575
New Lens Correction Software
« Reply #50 on: December 31, 2009, 12:48:11 pm »

Bart, what are we looking at in these two sets of side-by-side images?
Logged
emil

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #51 on: December 31, 2009, 06:56:50 pm »

Quote from: ejmartin
Bart, what are we looking at in these two sets of side-by-side images?

The image on the left is resampled with my resampling algorithms, and the one on the right is using a simple nearest-neighbor algorithm. I use the nearest-neighbor simply for comparison, it makes it easier to see if the "real" upsizing algorithm is having issues with ringing or clipping, or if those things are present in the original image and therefore not the fault of the resizing. For downsizing, the nearest-neighbor version offers a comparison to see how well the downsizing algorithm is filtering out aliasing artifacts.

The image on the left is the one to compare to other resampling algorithms, NOT the one on the right. "Grittiness" and aliasing are to be expected on the right side, my only concern is if you find that sort of thing on the left side.
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #52 on: December 31, 2009, 07:04:59 pm »

Quote from: BartvanderWolf
I looked at that, but it seems to address a Windows XP problem, I'm not going to try that on my Vista Ultimate 64-bit version unless there's no other way. The missing DLL seems to be a part of Visual Studio 6 and Office 2003. I'm not sure how that will play out with newer computer systems (e.g. Win 7 and Office 2007/2010), perhaps there is an alternative DLL that can be invoked? Just thinking aloud, to future proof your application. Thanks for your suggestions anyway.

The DLL coexists peacefully with Office 2007 on 32-bit Vista, so I doubt you'd have issues. It's an older MS database engine (Jet/ADODB), but the newer one that is supposed to replace it is slower, has fewer capabilities, AND is harder to code, so there's been considerable resistance to switching--even more than the resistance to giving up XP in favor of Vista. It's still supported in Office 2007 and VB.Net, so I doubt it is going to go away any time soon.

BTW, I've been using your ring images for torture testing and fine-tuning the balance between aliasing and sharpness.
« Last Edit: December 31, 2009, 07:07:08 pm by Jonathan Wienke »
Logged

jjlphoto

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 467
New Lens Correction Software
« Reply #53 on: December 31, 2009, 08:14:33 pm »

I read some articles about converting the file to a custom RGB space with a gamma of 1 when you are doing serious interpolation. Keeps color artifacts in check. If you are using a PS 32 bit file, it will already be in a gamma 1 space, but for others, you have to do it manually.
Logged
Thanks, John Luke

Member-ASMP

Bart_van_der_Wolf

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 8913
New Lens Correction Software
« Reply #54 on: December 31, 2009, 08:56:35 pm »

Quote from: Jonathan Wienke
The image on the left is resampled with my resampling algorithms, and the one on the right is using a simple nearest-neighbor algorithm.

Ah, thanks for clarifying that! Must have somehow missed that info, I thought it was the other way around.

In that case you'll notice that the edge pixels need special treatment by adding enough virtual pixels to accommodate the filter's support size. Personally I prefer mirrored virtual pixels.

Cheers,
Bart
« Last Edit: December 31, 2009, 09:42:57 pm by BartvanderWolf »
Logged
== If you do what you did, you'll get what you got. ==

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #55 on: December 31, 2009, 08:58:47 pm »

Quote from: jjlphoto
I read some articles about converting the file to a custom RGB space with a gamma of 1 when you are doing serious interpolation. Keeps color artifacts in check.

That is incorrect. Using a linear gamma causes perceptually non-linear luminance transitions--a single white pixel on a black background will be upsized differently than a black pixel on a white background. For resizing interpolation, you need to work with the image data in a gamma of ~2 to get the resized white pixel and the resized black pixel to be the same size.
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #56 on: January 01, 2010, 11:14:03 am »

Quote from: BartvanderWolf
Ah, thanks for clarifying that! Must have somehow missed that info, I thought it was the other way around.

Yeah, that makes a difference...

Quote
In that case you'll notice that the edge pixels need special treatment by adding enough virtual pixels to accommodate the filter's support size.

I'm doing something a little different that eliminates the need to do a standalone filtration process before downsampling; the downsampling and low-pass filtration are combined into a single step.

The edge oddness you see with some images is from extrapolating a few extra pixels past the edges of the image. When using spline interpolation, the original pixels are essentially points in the center of 1-pixel-wide "boxes" (before rescaling). You have to extrapolate at least a half-pixel (pre-rescaling) around the edges of the image, or you end up doing a small cropping of the image when you resize--you lose 1 pixel horizontally and 1 pixel vertically. To solve this, I'm allowing the algorithm to extrapolate that half-pixel around the edges, plus an additional pixel.
« Last Edit: January 01, 2010, 11:24:30 am by Jonathan Wienke »
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #57 on: January 01, 2010, 07:50:27 pm »

Quote from: Jonathan Wienke
The image on the left is resampled with my resampling algorithms, and the one on the right is using a simple nearest-neighbor algorithm. I use the nearest-neighbor simply for comparison, it makes it easier to see if the "real" upsizing algorithm is having issues with ringing or clipping, or if those things are present in the original image and therefore not the fault of the resizing. For downsizing, the nearest-neighbor version offers a comparison to see how well the downsizing algorithm is filtering out aliasing artifacts.

Here's some samples of what I'm referring to:

Upsizing:
[attachment=19102:Upsize.png]

Looking at the left-side image, one might wonder whether the halos around the rocks in the water on the right side are present in the original image, or if they're caused by upsizing artifacts. By comparing to the nearest-neighbor image on the right (nearest-neighbor resizing cannot cause ringing/haloing problems), you can see that the halos are present in the original image and therefore are not upsizing artifacts.

Downsizing:
[attachment=19103:Downsize.png]

Here, we can compare the intensity of the aliasing patterns to see how well the "real" downsizing algorithm on the left filters out aliasing vs the nearest-neighbor image on the right. As you can see, some aliasing is present, but most of it is filtered out.
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #58 on: January 03, 2010, 12:12:59 am »

Another update. New features include:

  • Improved aliasing suppression when downsampling, without compromising sharpness.
  • Improved blending between upsampled and downsampled areas (such as when correcting barrel distortion).
  • Eliminated unnecessary upsampling and downsampling function calls when distortion correction is not needed.
  • Added a timer to time how long the "real" interpolation takes.

[attachment=19132:AliasDn.png]
Logged

Jonathan Wienke

  • Sr. Member
  • ****
  • Offline Offline
  • Posts: 5829
    • http://visual-vacations.com/
New Lens Correction Software
« Reply #59 on: January 07, 2010, 07:06:40 pm »

Another update, 0.0.1.14--mostly internal redesign to allow for use of floating-point storage from start to finish through all stages of processing (to avoid rounding errors), while still allowing large images to be processed without out-of-memory exceptions. The progress indication system has been tweaked a bit as well.
Logged
Pages: 1 2 [3] 4   Go Up