Prev: Canon 1250U2
Next: driver
From: Lorenzo J. Lucchini on
Well, my Imatest trial is up, and I'm not going to buy it (though it is
a very nice program that I'd recommend!), but I'd still like to play
with ESF, PSF, MTF and all that.
Specifically, I'm still very interested in findout out what the "best
sharpening" for my scanner is by analysing the edge spread function.

There is another interesting "slanted edge tester" at
http://www.i3a.org/downloads_iso_tools.html (if I'm not mistaken,
Imatest is actually based on its code), but it doesn't give nearly as
much information as Imatest does... even though perhaps the MTF alone
could be turned into the correct deconvolution for my scanner in the
hands of "some of the people here"! ;-)


But. In the last few days I've been busy writing my own "slanted edge"
program. It now sort of works, meaning that it doesn't (often) crash,
and that it gives results that are similar to what Imatest or SFRWin give.
Similar, not really identical... that's why I would be glad if Bart,
Kennedy, or anybody who's into this kind of things could help me a little.


The program can be found at
http://ljl.150m.com/slantededge-alpha1.tar.gz

and I've created a SourceForge project at
http://sourceforge.net/projects/slantededge/

with sourcecode in the CVS.


I'll explain briefly what the program does and in what order it does it,
as the source is not very well commented, er, at the moment.

1) Read in an RGB image
2) We work with vertical edges, so rotate the image if needed
3) Besides the "red", "blue" and "green" channels, create a "gray"
channel that is the average of the other three
4) Normalize the image, so that 0.5% of the pixels clip down, and 0.5%
clip up
5) For each line in the image, find the point with the max adjacent
pixel difference (should be the edge)
6) By doing a least squares regression on those points, find a straight
line that ought to best represent the edge
7) Associate a distance from that line to each pixel in the image. The
function PixelValue(Distance) approximates the edge spread function.
8) Use "some kind" of local regression to create a uniformly-spaced
version of the ESF, from the data described above.
9) Derive the line spread function from the edge spread function:
LSF(i)=ESF(i+1)-ESF(i)
10) Apply a Hanning window to the LSF
11) Take the discrete Fourier transform or the resulting data


Note that, at the moment, the input image must be an RGB, 8-bit ASCII
("plain") PPM file. These can be created using "*topnm" and
"pnmtoplainpnm" from the NetPBM suite, or by using the GIMP.
Type --help for some uncomprehensive help.


I have a lot of doubts and questions to ask, but first I'd like to get
an overall look at the program by someone competent, to find out what I
have done *badly* wrong (something awful is bound to be there).

Please keep in mind that I knew nothing about regressions, spread
functions or Fourier transforms two weeks ago -- and I suppose I don't
know that much more now.
I just read some Internet source and implemented what I thought they meant.


by LjL
ljlbox(a)tiscali.it
From: Lorenzo J. Lucchini on
Lorenzo J. Lucchini wrote:
> [snip]

Since http://ljl.150m.com appears to be down, the file can also be found at
http://ljl.741.com/slantededge-alpha1.tar.gz

SourceForge's "web" CVS will also take some hours to update, even though
the files are really there.

by LjL
ljlbox(a)tiscali.it
From: Bart van der Wolf on

"Lorenzo J. Lucchini" <ljlbox(a)tiscali.it> wrote in message
news:P8_Ze.49524$nT3.24502(a)tornado.fastwebnet.it...
> Lorenzo J. Lucchini wrote:
> > [snip]
>
> Since http://ljl.150m.com appears to be down,

I was wondering about that, so it wasn't my setup afterall ;-)

> the file can also be found at
> http://ljl.741.com/slantededge-alpha1.tar.gz

Although the source maybe helpful, I'm running on a Windows XP
platform. I don't mind looking into the project, but I have too little
time to compile it myself (I know compilation itself doesn't take
long, but I'd have to install a compiler first). A pre-compiled Win32
version might help.

> SourceForge's "web" CVS will also take some hours to update, even
> though the files are really there.

Didn't find them yesterday, they are available now.

Bart

From: Lorenzo J. Lucchini on
Bart van der Wolf wrote:
>
> "Lorenzo J. Lucchini" <ljlbox(a)tiscali.it> wrote in message
> news:P8_Ze.49524$nT3.24502(a)tornado.fastwebnet.it...
>
>> Lorenzo J. Lucchini wrote:
>> > [snip]
>>
>> Since http://ljl.150m.com appears to be down,
>
> I was wondering about that, so it wasn't my setup afterall ;-)

You know, it's free hosting... I'm starting to worry, though, it's been
down for quite a while now.

>> the file can also be found at
>> http://ljl.741.com/slantededge-alpha1.tar.gz

Hope this one stays up! Anyway, I guess I'll make a release on
SourceForge after I've fixed the really bad bugs.

> Although the source maybe helpful, I'm running on a Windows XP platform.
> I don't mind looking into the project, but I have too little time to
> compile it myself (I know compilation itself doesn't take long, but I'd
> have to install a compiler first). A pre-compiled Win32 version might help.

I know. The main problem is that I'm using the FFTW library for taking
Fourier transforms, and while there seems to be a Windows version
available (several, actually), well... the site is down. The web doesn't
like me apparently.

I'll see what I can do, perhaps I can just write a slow, simple DFT
myself (I have no idea how difficult it is, I'll have to read a bit) as
a compile alternative to FFTW.


Anyway, do you have a SourceForge account? With one, I can just add you
to the project, and then you'll be able to access SF's shell servers.
This way you could easily run - and even easily compile - the program
remotely, without installing anything special on your computer.


Now some of the most important questions I have:

- What is Imatest's "10%" and "90%"? Initially, I took these as the
minimum and maximum pixel values that can constitute the "edge". But it
appears clear that the showed ESF also contains lower and higher values;
besides, it always seem to go from -6 pixels to +8 pixels from the edge
center. Is there a reason for this?
So, now I suppose "10%" and "90%" are simply used to compute (guess
what) the 10%-90% rise.
Which in turns call for: should I normalize the image before doing
anything else? I currently normalize so that 0.5% of pixels clip to
black and 0.5% clip to white.

- Is it ok to take a (single) Fourier transform of the Hanning-windowed
LSF? Without windowing, I get weird results, but with windowing, I'm
afraid I'm affecting the data. My MTF's always look "smoother" than
Imatest's and SFTWin's ones, and too high in the lower frequencies.

- How many samples should my ESF/LSF have? I understand that it only
depends on how high you want your frequencies to be -- i.e., if I want
to show the MTF up to 4xNyquist, I should have 4x more samples than
there are real pixels. Is this correct?

- How do I reduce frequencies spacing in the DFT? If I just transform
the LSF (or a Hanning'ed LSF), I get ridiculously low frequencies
resolution. What I'm doing now to overcome this is... add a lot of
zeroes at the end of the original LSF. But, somehow, I think this is
kinda stupid.

- The method I'm currently using for getting a smooth,
uniformely-spacing sampled ESF from the point I have is naive and very
slow. The sources I've read suggest using "LOESS curve fitting" for
this. I've had some trouble finding good references about this, and it
seems very complicated anyway. The question is: is something simpler
good enough?


by LjL
ljlbox(a)tiscali.it
From: Bart van der Wolf on

"Lorenzo J. Lucchini" <ljlbox(a)tiscali.it> wrote in message
news:5KYZe.49331$nT3.33343(a)tornado.fastwebnet.it...
> Well, my Imatest trial is up, and I'm not going to buy it (though it
> is a very nice program that I'd recommend!), but I'd still like to
> play with ESF, PSF, MTF and all that.

Yes, once you really grasp what you are actually looking at, it will
help with improving the results. e.g. by allowing to optimize capture
sharpening.

> Specifically, I'm still very interested in findout out what the
> "best sharpening" for my scanner is by analysing the edge spread
> function.

Exactly. There are several possibilities to use the ESF to check for
that (e.g. edge halo), and the PSF can be used as input in several
deconvolution programs. The MTF allows to compare systems in an
unambiguous way (assuming test conditions are under control).

> There is another interesting "slanted edge tester" at
> http://www.i3a.org/downloads_iso_tools.html (if I'm not mistaken,
> Imatest is actually based on its code),

Not really based on it, but it helped as an inspiration and discussion
tool with, amongst others, the programmers of the original ISO demo
sourcecode. Imatest uses the basic idea of the slanted edge target, as
it is described in the relevant ISO standards 16067-1&2 for scanners,
and 12233 for digital still cameras.


> but it doesn't give nearly as much information as Imatest does...
> even though perhaps the MTF alone could be turned into the correct
> deconvolution for my scanner in the hands of "some of the people
> here"! ;-)

The MTF is more suited for judging the effect of such a sharpening on
the various spatial frequencies, and the associated risk of aliasing
artifacts when down-sampling afterwards. The PSF is needed for
deconvolution (or for the creation of a high-pass convolution kernel).

> But. In the last few days I've been busy writing my own "slanted
> edge" program. It now sort of works, meaning that it doesn't (often)
> crash, and that it gives results that are similar to what Imatest or
> SFRWin give.
> Similar, not really identical... that's why I would be glad if Bart,

Reporting for duty ;-)

> Kennedy, or anybody who's into this kind of things could help me a
> little.

I'll add some program related comments in a separate message.

Bart

 |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8 9 10 11
Prev: Canon 1250U2
Next: driver