| |
 |
|
|
Science Forum Index » Optics Forum » Accurate edge detection?...
Page 1 of 1
|
| Author |
Message |
| ... |
Posted: Wed Jul 16, 2008 5:17 am |
|
|
|
Guest
|
In the image processing community, there are discussions of edge
detection techniques. For a simple case, imagine an opaque knife edge
with a uniform back light behind it. Further imagine there is a lens
that images the knife edge onto a pixel detector of a camera.
In general, the transition from dark to light at the detector is some
smoothly varying function, not a sharp jump. Diffraction, of course,
limits the ultimate sharpness of the edge image -- diffraction at the
edge itself, and diffraction at the aperture of the lens. Aberrations
of the lens will also contribute to this edge smoothing.
The digital image as presented *by* the camera may take only a pixel
or two to transition from dark to light, or it might take many more.
Regardless, digitization and pixel size and other factors such as MTF
of the electronics themselves serve to mask the true edge function
A very common starting point in the discussions and papers about edge
detection techniques is the assumption that the point at which the
slope of the edge is maximum represents the "true" edge position.
From then on, the various edge detection algorithms usually present
different methods of more accurately calculating this maximum slope,
especially in the face of optical and electronic noise, etc.
Nevertheless, it seems to me that the assumption that the maximum
slope represents the true edge is at least unmotivated (no matter how
"common sense" it feels) if not wrong. I have in mind the pictures of
edge diffraction as produced by using Cornu's spiral. The location of
the true edge, relative to the average intensity of the light area
(smoothing out the diffraction oscillations), looks to be at a
position of increasing slope as you go from dark to light, but NOT
maximum. Furthermore, the edge is less than the 50% point of peak
light intensity. (Another assumption sometimes made in image
processing is that the 50% point of the dark to light transistion
represents the edge.)
Does anyone have references they can point to (or their own pesuasive
arguments) that describe where the true edge location should be
relative to the edge image function? We have done a couple of bench
tests to suggest under the experimental conditions that the best edge
location is about 41% to 46% of the range of the dark to light
transition. We haven't yet completed our analysis regarding how this
compares to the peak slope.
This problem has to have been tackled successfully before, but so far
I've not found any good sources that address the optical issue, only
software techniques.
Thanks!
Spencer |
|
|
| Back to top |
|
| whit3rd... |
Posted: Wed Jul 16, 2008 6:14 am |
|
|
|
Guest
|
On Jul 16, 8:17 am, slus... at (no spam) lw4u.com wrote:
Quote: ...imagine there is a lens
that images the knife edge onto a pixel detector of a camera.
In general, the transition from dark to light at the detector is some
smoothly varying function, not a sharp jump.
...
A very common starting point in the discussions and papers about edge
detection techniques is the assumption that the point at which the
slope of the edge is maximum represents the "true" edge position.
...(Another assumption sometimes made in image
processing is that the 50% point of the dark to light transistion
represents the edge.)
From a practical standpoint, the maximum-slope approach
is the same as detecting the peak of the spatial derivative
(i.e. it's a mathematically simple definition, always
gives an answer).
What you seem to be wanting is an absolute position of a
knife edge given blurring (instrument function) and diffraction
(wavelength-of-light dependent parts of the instrument function)
variables. Would it be satisfactory if the
edge test always correctly reported the separation of
a left-facing knife edge and a right-facing one?
If that wouldn't answer your concern, what would?
In real-world situations, stray light can confuse things, or
detector nonlinearity can report illumination in some
non-linear scale. It's not clear what should be the definition
of an edge, but empiricism rules this field, and the
simple criteria you mention can both do the work. |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 7:48 am |
|
|
|
Guest
|
On Jul 16, 12:14 pm, whit3rd <whit... at (no spam) gmail.com> wrote:
Quote: On Jul 16, 8:17 am, slus... at (no spam) lw4u.com wrote:
...imagine there is a lens
that images the knife edge onto a pixel detector of a camera.
In general, the transition from dark to light at the detector is some
smoothly varying function, not a sharp jump.
...
A very common starting point in the discussions and papers about edge
detection techniques is the assumption that the point at which the
slope of the edge is maximum represents the "true" edge position.
...(Another assumption sometimes made in image
processing is that the 50% point of the dark to light transistion
represents the edge.)
From a practical standpoint, the maximum-slope approach
is the same as detecting the peak of the spatial derivative
(i.e. it's a mathematically simple definition, always
gives an answer).
Righto. Set the second derivative to zero and solve.
Quote: What you seem to be wanting is an absolute position of a
knife edge given blurring (instrument function) and diffraction
(wavelength-of-light dependent parts of the instrument function)
variables.
Correct.
Would it be satisfactory if thee
Quote: edge test always correctly reported the separation of
a left-facing knife edge and a right-facing one?
Possibly. This is exactly the experiment that we performed. Using a
chrome-on-glass bar target that is measured as 12.503mm long
+/-0.003mm, we grabbed images with a telecentric lens and red LED
collimated back light. We then used a micrometer stage to move the
target 12.503mm (again, with an error of +/-0.003mm) -- so that the
trailing edge at the new postion corresponds to the leading edge of
the original position. The direction of motion was perpendicular to
the lens optical axis to within 0.25 degrees. We then used various
edge detection methods, including the 2nd derivative of the edge with
a fit to a parabola, as well as the simple 50% local thresholding,
among others. What we found consistently through different positions
in the field of view and different new set-ups is that the trailing
edge appeared to fail to move far enough to coincide with the old
leading edge. The error range was ~0.2 to 0.45 pixels, or about
0.015mm to 0.034mm in real world units -- always considerably larger
than target and motion error, and alway in the same direction of
error.
Another way to interpret this result is that an object consistently
looks larger than it actually is. (If the bar target appears to be
12.523mm, and you move it 12.503mm, the trailing edge will fail to
"catch" the initial position of the leading edge.)
We've tried this with different lens f-numbers from F/45 to F/8 and
did not see an obvious trend that followed the aperture, but on this
front we've only made a small number of tests -- 4 at each f-number.
The errors average ~0.3pixels, with the standard deviation ~0.05.
So, to answer your question, yes, we could live with a consistent
difference, but we are shooting for better precision than what we are
seeing. It may not be possible to get there without many measurements
and averaging, and we can live with that. But, we would like to
*understand* what's going on. I confess to being a bit embarrassed
because I've been in the machine business for more than two decades.
The old "max. slope" or "50% threshold" has usually been good enough,
even with sub-pixel interpolation.
Quote:
If that wouldn't answer your concern, what would?
In real-world situations, stray light can confuse things, or
detector nonlinearity can report illumination in some
non-linear scale.
We've considered detector non-linearity, and have run the experiment
with two different cameras from different manufacturers (Sony and
AVT). This doesn't guarantee non-linear response isn't the culprit,
but it reduces the odds. We may be getting back to doing a first
principles experiment to confirm linear grey level response.
Thanks very much for your thoughts.
Spencer |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 7:57 am |
|
|
|
Guest
|
Hi Helmut,
Thanks for your comments. See above for a description of some
experments.
On Jul 16, 12:26 pm, hwabnig at (no spam) .- --- -. dotat wrote:
Quote: On Wed, 16 Jul 2008 08:17:25 -0700 (PDT), slus... at (no spam) lw4u.com wrote:
slope of the edge is maximum represents the "true" edge position.
The slope may be curved and have "wrong" maximums.
Indeed the slope is curved similar to an integral sign.
Quote: maximum. Furthermore, the edge is less than the 50% point of peak
light intensity. (Another assumption sometimes made in image
processing is that the 50% point of the dark to light transistion
represents the edge.)
Yup.
Methinks better than slope. Determine brightness of
average and peak values in the image, grainy spots
may sit somewhere and disturb the maximum/minimum calculation.
Exclude them by eliminating outliers.
I made the experience that it is better to have a soft image,
and not maximum photographic sharpness.
Sometimes defocussing was better than optimum focus
in resulting repeatability.
I agree. We are actually reducing our edge sharpness by typically
running at high f-numbers, F/32 to F/45. Our goal is greater depth of
field, but the diffraction caused edge softening is also a benefit.
Quote: The main problem is the adjustment and illumination
of the viewing microscope optics.
Especially a tilted illumination beam will cause "focus walk".
After a light bulb change everything is way off.
Use long living light sources!
Well collimated, pretty uniform source -- LED with a milk white
diffuser in front of it, small aperture in front of this, aperture at
the back focus of the collimating lens.
Quote:
The best results we got were by determining
the "center of gravity" of various brightness level image parts.
A straight edge will form sort of a "stripe" image and by
adjusting stepwise through all brighness levels and continuously
calculating the center of the image you get good numbers
to evaluate. It is no problem to do 500 000 divisions and
multiplications in 0,1 second with a co-processor.
I'm not following this. Can you expand your explanation a bit? It
could be very interesting.
Thanks!
Spencer |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 10:27 am |
|
|
|
Guest
|
On Jul 16, 3:00 pm, hwabnig at (no spam) .- --- -. dotat wrote:
Thanks for the references. I was familiar with most of these, but
I'll be taking a closer look at the last one. Nevertheless, these seem
to be along the lines of what I already described. That is, image
processing methods/commentaries that address how to do X,Y or Z to an
edge image, but not addressing the preceding issue on the purely
optical side of what feature or features of the image correspond to
the location of the real edge.
Spencer |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 11:00 am |
|
|
|
Guest
|
On Jul 16, 4:43 pm, hwabnig at (no spam) .- --- -. dotat wrote:
Quote: On Wed, 16 Jul 2008 13:27:37 -0700 (PDT), slus... at (no spam) lw4u.com wrote:
Thanks for the references. I was familiar with most of these, but
I'll be taking a closer look at the last one. Nevertheless, these seem
to be along the lines of what I already described. That is, image
processing methods/commentaries that address how to do X,Y or Z to an
edge image, but not addressing the preceding issue on the purely
optical side of what feature or features of the image correspond to
the location of the real edge.
Spencer
Aha, ok, understood.
But there is no such thing as the "real edge".
Hope you will learn that soon enough.
w.
Alas, I'm afraid my density may be my undoing. I can't tell you how
many times a ton of bricks has had to fall on me in order to learn the
lesson. :-)
Spencer |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 11:26 am |
|
|
|
Guest
|
On Wed, 16 Jul 2008 08:17:25 -0700 (PDT), sluster at (no spam) lw4u.com wrote:
Quote: slope of the edge is maximum represents the "true" edge position.
The slope may be curved and have "wrong" maximums.
Quote: maximum. Furthermore, the edge is less than the 50% point of peak
light intensity. (Another assumption sometimes made in image
processing is that the 50% point of the dark to light transistion
represents the edge.)
Yup.
Methinks better than slope. Determine brightness of
average and peak values in the image, grainy spots
may sit somewhere and disturb the maximum/minimum calculation.
Exclude them by eliminating outliers.
I made the experience that it is better to have a soft image,
and not maximum photographic sharpness.
Sometimes defocussing was better than optimum focus
in resulting repeatability.
The main problem is the adjustment and illumination
of the viewing microscope optics.
Especially a tilted illumination beam will cause "focus walk".
After a light bulb change everything is way off.
Use long living light sources!
The best results we got were by determining
the "center of gravity" of various brightness level image parts.
A straight edge will form sort of a "stripe" image and by
adjusting stepwise through all brighness levels and continuously
calculating the center of the image you get good numbers
to evaluate. It is no problem to do 500 000 divisions and
multiplications in 0,1 second with a co-processor.
w. |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 1:42 pm |
|
|
|
Guest
|
On Wed, 16 Jul 2008 10:57:13 -0700 (PDT), sluster at (no spam) lw4u.com wrote:
Quote: The slope may be curved and have "wrong" maximums.
Indeed the slope is curved similar to an integral sign.
No, it is not. Never.
(fixed pitch font)
You get this:
x
x
x
x
x
....xx...............................
Or that:
x x x
x
x
x
x
....x....................
And everything in between, and dual slopes,
goin up and down and up again.
Quote:
The best results we got were by determining
the "center of gravity" of various brightness level image parts.
A straight edge will form sort of a "stripe" image and by
adjusting stepwise through all brighness levels and continuously
calculating the center of the image you get good numbers
to evaluate. It is no problem to do 500 000 divisions and
multiplications in 0,1 second with a co-processor.
I'm not following this. Can you expand your explanation a bit? It
could be very interesting.
les us say this is an image of an edge, pixelwise:
x
xxxx
xxx xx
xxx
xxx
xxx
x
Assign each pixel a "weight", then find their common center of
gravity.
In the case of edge detection, we only care for the x values.
We find then the x location on the horizontal axis of the center
vertical line.
This is the best method to define a target's position
in XY coordinates. Of course there is a lot of
image processing involved in preparing the final pixel data.
One could filter and display the outer boundaries of a blob
usind differential operators and then calculate the center
of the boundary line, and so on.
Pattern recognition may be used if there are standard targets,
in case we search for lines, we do a Hough transform,
and so on.
Interestingly humans can do it in null time,
try with a felt pen on your LCD :-)
w. |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 2:00 pm |
|
|
|
Guest
|
|
| Back to top |
|
| AES... |
Posted: Wed Jul 16, 2008 2:15 pm |
|
|
|
Guest
|
Interesting discussion.
Use a collimated, spatially coherent light source, and fit several of
the Cornu-spiral fringes in the near field?
[Of course this will demand accurate perpendicularity of beam and edge.] |
|
|
| Back to top |
|
| ... |
Posted: Wed Jul 16, 2008 3:43 pm |
|
|
|
Guest
|
On Wed, 16 Jul 2008 13:27:37 -0700 (PDT), sluster at (no spam) lw4u.com wrote:
Quote:
Thanks for the references. I was familiar with most of these, but
I'll be taking a closer look at the last one. Nevertheless, these seem
to be along the lines of what I already described. That is, image
processing methods/commentaries that address how to do X,Y or Z to an
edge image, but not addressing the preceding issue on the purely
optical side of what feature or features of the image correspond to
the location of the real edge.
Spencer
Aha, ok, understood.
But there is no such thing as the "real edge".
Hope you will learn that soon enough.
w. |
|
|
| Back to top |
|
| ... |
Posted: Thu Jul 17, 2008 9:41 am |
|
|
|
Guest
|
Spencer
Not sure if your detector is array or large area silicon detector but
you may try clocking the orientation of the detector around the
optical axis if possible to check for nonuniformity of the
responsivity spatially. I know some large area silicon detectors can
have as large as 5-10% difference on the surface.
I was going to mention make sure you were telecentric, but you live
telecentricity and know this.
Color issues like lateral color can affect knife edge measurement
position, but you have a narrow band ~25nm with the LED spectrum.
And backlight signal level as well can affect width measurements.
If you can get a calibrated scale with a known distance then you can
"tune" your measuremts to read what the known scale distance is -
between knife edge measurements.
We used to have to control all of these variables on an optical CMM
for high precision measurements.
A few years back the standard software capability was 1/5 pixel edge
detection and 1/20th pixel was state of the art, I recall an article
by View Engineering on this software/math method of edge finding.
Michael
www.oscintl.com |
|
|
| Back to top |
|
| ... |
Posted: Fri Jul 18, 2008 7:34 am |
|
|
|
Guest
|
On Jul 17, 3:41 pm, mp... at (no spam) oscintl.com wrote:
Quote: Spencer
Not sure if your detector is array or large area silicon detector but
you may try clocking the orientation of the detector around the
optical axis if possible to check for nonuniformity of the
responsivity spatially. I know some large area silicon detectors can
have as large as 5-10% difference on the surface.
I was going to mention make sure you were telecentric, but you live
telecentricity and know this.
Color issues like lateral color can affect knife edge measurement
position, but you have a narrow band ~25nm with the LED spectrum.
And backlight signal level as well can affect width measurements.
If you can get a calibrated scale with a known distance then you can
"tune" your measuremts to read what the known scale distance is -
between knife edge measurements.
We used to have to control all of these variables on an optical CMM
for high precision measurements.
A few years back the standard software capability was 1/5 pixel edge
detection and 1/20th pixel was state of the art, I recall an article
by View Engineering on this software/math method of edge finding.
Michaelwww.oscintl.com
Hi Michael,
Thanks for the comments. We've used two different array cameras (Sony
and AVT) for some experiments, at several different places in the
fields of view with qualitatitvely the same results. The new trailing
edge never "catches up" to the old leading edge, with a range of
results from about 0.2 pixels to 0.45 pixels. Or, objects in the
camera appear larger than they really are -- at least for 50% local
threshold.
Regarding changing clocking, we don't have that level of control. But,
it certainly could be that different pixels have different responses,
or that overall the response to light level is not quite linear. As I
mentioned to another respondent, we might have to make some first
principle tests of this. The different cameras experiment, however,
is one piece of evidence that argues against linearity being the
problem.
I've mentioned the diffraction-at-edge response as shown in many
references (Cornu's spiral stuff) that suggests that a 50% threshold
or alternatively the point of maximum slope is *not* representative of
the true edge. This edge response, convolved with the point spread
function of the lens, might qualitatively explain our results. The
actual mathematical model could get quite ugly given our LED's finite
bandwidth, source size behind the collimator, etc. If someone else
has already addressed the basic optical problem, I'll suffer no loss
of pride for finding an answer elsewhere. :-)
BTW: Your LumenHammer looks quite interesting! We do a lot of
recommendations to our lens and optical splitter customers about light
sources, enclosures, etc. Do you have any more information including
pricing? I'm assuming you're starting with the Lumiled units, but
putting them together in some clever way. Is this the case? Do you
already have patents or applications? Okay, okay, I'm not trying to
get into your business shorts, just intellectually curious.
Spencer
==================http://www.LWU.com |
|
|
| Back to top |
|
| ... |
Posted: Sat Jul 19, 2008 5:54 pm |
|
|
|
Guest
|
Spencer:
One more thing to check is the optical density of your chrome on glass
edge and also the "dark" area of the chrome for pinholes, I guess both
of these could also affect your 50% edge location with leaking light
through the dark side of the knife edge, or even scatter in the
substrate or surfaces getting to the dark side (but that would be a
lot of scatter).
Quote:
BTW: Your LumenHammer looks quite interesting!
Thanks I will send you some info off line.
Michael
www.oscintl.com |
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT - 5 Hours
The time now is Sat Nov 22, 2008 5:05 pm
|
|