RetouchPRO

Go Back   RetouchPRO > Tools > Software
Register Blogs FAQ Site Nav Search Today's Posts Mark Forums Read


Software Photoshop, Lightroom, Paintshop Pro, Painter, etc., and all their various plugins. Of course, you can also discuss all other programs, as well.

Free Plug-In Filters: Custom Filter & Adaptive Equalization

Reply
 
Thread Tools
  #1  
Old 10-06-2002, 04:37 AM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Free Plug-In Filters: Custom Filter & Adaptive Equalization

While looking for info on 'Fovea Pro' (which may be too deep for me) I stumbled over these three plugs - which may be of interest (the third less so for most users):

Custom Filter: Just as unintuitive as the Adobe one, but with more options (KPT Convolver seems to be the king of convolutions).

Adaptive Equalization: implements a technique for increasing the local contrast of images by reducing overall dynamic range. It is particularly useful for making small surface marks visible, or revealing detail in shadow areas, while preserving color information.

http://www.reindeergraphics.com/free.shtml

Regards,

Stephen Marsh.
Reply With Quote top
  #2  
Old 10-06-2002, 07:32 PM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
I have had some small time to play with these two filters since posting...

The Custom Convolution Filter is like Photoshop's filter/other/custom with floating point precision (as if convolution needs to be made harder with more precision than simple integer math) and a few other options including high bit edit ability. The supplied matrix txt files are loaded into the plug to give you a start on using this very unintuitive 'filter maker'.

The Adaptive Equalization filter is similar in result in some ways to my 'EnhanceDetail' action:

http://www.retouchpro.com/forums/att...=&postid=20574

You REALLY do NOT want to use this on skintones (unless going for the reptile look) - but for shadow detail, natural rough detail in rocks, old metal and other 'rough' objects this can add some much needed detail and local contrast, using a duped filtered layer blended at 2-5% (yes, really low) opacity in different blend modes may help (luminosity, multiply, hard light, overlay, experiment!). Shadow detail may use some higher opacity, such as 10% or perhaps higher for the right image/blends, but highlight detail only seems to need a very minor opacity blend (you can use blend if sliders or masks to reduce the effect more so in the highlights than the shadows etc).

In addition to contrast masking, 'coming out of the shadows' and other shadow lifting tricks, this filter can help bring out shadow detail - but it can also bring out posterized shadows, JPEG artifacts, noise and other junk. Due the local contrast boost, some dark halo USM type effect is also a side benefit of this filter.

Before using this filter, it might be wise to use methods similar to ones described in a small article of mine (Photoshop 5 action included to help demonstrate the methods in the article):

http://members.ozemail.com.au/~binar...ctremoval.html

With further exploration this filter may prove useful for retouching and perhaps extraction, when combined with other methods...

Take care with this filter, poor application may ruin things just as quick as helping.

Stephen Marsh.
Reply With Quote top
  #3  
Old 10-06-2002, 08:25 PM
DJ Dubovsky's Avatar
DJ Dubovsky DJ Dubovsky is offline
Senior Member
 
Join Date: Aug 2001
Location: Upper Penninsula of Michigan
Posts: 1,659
Stephen,
I downloaded them all and extracted them. I haven't moved the filters to the PS plugin file yet. In one of them there are several folders with text files of numbers in them. Where did you put them? In the plugins folder as well? I skimmed over the PDF file but saw nothing to explain where to put them. Just curious.
DJ
Reply With Quote top
  #4  
Old 10-06-2002, 08:57 PM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Hi DJ, these are the Custom Convolution filter settings, which are manually loaded from within the third party Custom filter in question (to save you typing in all those numbers).

I personally store the plug in a folder called Custom Convolution and the folders in question live there (but they could be anywhere on your drive/s).

It is then a simple matter to navigate to the plug folder to find the files to load. I do the same for Actions, Adobe custom filter kernels, brushes etc...all live in a Goodies folder within the apps folder for easy access.

I am just about to try to find a demo version of KPT Convolver as I am getting sick of doing maths just to get a result I finally find that I don't like. <g>

Stephen Marsh.
Reply With Quote top
  #5  
Old 10-06-2002, 09:13 PM
DJ Dubovsky's Avatar
DJ Dubovsky DJ Dubovsky is offline
Senior Member
 
Join Date: Aug 2001
Location: Upper Penninsula of Michigan
Posts: 1,659
Oh thank God. I was thinking I would have to type in all those numbers myself. Thanks
DJ
Reply With Quote top
  #6  
Old 10-17-2002, 09:53 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Custom (Both Adobe's and Reindeer's versions)

Do you want me to give you a tutorial on the kinds of things that you can do with a convolution kernel and what they're good for?

The reason we provide that kind of plug-in is because it is the basis for image processing. You can do bluring, sharpening, edge-detection, pattern matching and a host of other things with kernels, so it seemed natural to provide (albeit unintuitive) this kind of tool.

-Chris Russ
Reply With Quote top
  #7  
Old 10-18-2002, 12:30 AM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Chris - firstly, welcome and thank you for posting - it is nice to have the plugs creators willing to lend a hand, when it is not really a problem with the plug itself.

Thanks for the kind offer of a tutorial - yes that would be VERY welcome.

I understand that convolving is a complex topic and is based in maths and pixel brightness levels, but the simpler the better would be my vote...I have read many tutorials from software makers and math geeks - but for an average GUI based user, this is all very foreign...add in floating point precision - and things just get harder for the newbies like me! <g>

Stephen Marsh.
Reply With Quote top
  #8  
Old 10-18-2002, 10:12 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Convolution
Let's start with the basics. What you're really doing is creating a new image a pixel at a time, using the rules in the kernel.

Consider the center of the kernel (5x5 in Photoshop, 7x7 with my Custom plug-in) to be the original pixel, and the squares around it to be its neighbors. If we used a kernel like this:

0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0 (set the scale to 1 offset to 0)

Add extra zeros around the outside to get to a 7x7:
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (set the scale to 1 offset to 0, or turn on “Autoscale”)

This is called the identity function. If you use this kernel you will get out exactly what was put it. The weight on the center pixel is 1.0, and the weights on the neighbors are all 0.0, so the image is left alone.

Add an Echo

If we change it to look like this:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 1
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (set the scale to 2 offset to 0, or turn on “Autoscale”)

You add an “echo” that is 3 pixels to the right, and the image seems to shift 1 1/2 pixels to the right (halfway between the center and the echo).

Embossing

Let’s change the value to the right to be a –1 instead.

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 –1
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (set the scale to 1 offset to 128, or turn on “Autoscale”)

This shows you the difference between the central value (the original image) and the value 3 pixels to the right. We’ve just invented embossing.

The –1 doesn’t have to be the value 3 pixels to the right. In fact, it could be ANY of the neighbors. Try it.

The technical name for this is a Directional Derivative – we’re taking the 1-D derivative or the rate of change from a pixel to its neighbor which gives us the slope of the signal. Not really meaningful unless you can think of the brightness of the image as a surface (treat the values as altitudes).

The derivative tends to be large (either positive or negative) when the image is changing rapidly. This can happen in two places: edges and noise.

Averaging (or blurring)

We can get rid of noise by adding neighbors together. Try the following kernel:

0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 1 1 1 1 1 0
0 1 1 1 1 1 0
0 1 1 1 1 1 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0 (set the scale to 21 offset to 0, or turn on “Autoscale”)

This is an approximation of a round neighborhood where all 21 values are added together. The original pixel is therefore 1/21 of the result. This is a significant blur.

Let’s try to blur in only one direction:
0 0 0 0 0 0 1
0 0 0 0 0 1 0
0 0 0 0 1 0 0
0 0 0 1 0 0 0
0 0 1 0 0 0 0
0 1 0 0 0 0 0
1 0 0 0 0 0 0 (scale 7 offset 0, or turn on “Autoscale”)

(With Photoshop, use the center 5x5 and set the scale to 5 offset to 0)

This will be a blur in one direction (45 degrees). You could try thickening the line to see what that does.

Q: What about scale and offset?

Here’s a good rule of thumb:
If the sum of the values is zero (e.g. the embossing case, directional derivatives), then the offset should be 128. The scale works if it is the sum of the positive values in the kernel. You aren’t restricted to that, but it is a good place to start. Or, you can turn on “Autoscale” and our Custom filter will do the work (it will find the largest and smallest value and make sure they fit in the 0..255 range).

Sharpening

We’ve seen that you can (sort of) find an edge with a derivative. How does “Trace Edges” work? They use two different kernels and add the results of the images together. (This is a simplified version of a Sobel Edge Detector, named after the guy, but it is similar to Trace Edges.)

We’ll take some directional derivatives (do each of these in different layers):
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 0 -1 0 0
0 0 1 0 -1 0 0
0 0 1 0 -1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 3 offset = 0, autoscale OFF)

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 -1 0 1 0 0
0 0 -1 0 1 0 0
0 0 -1 0 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 3 offset = 0, autoscale OFF)

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 -1 -1 -1 0 0
0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 3 offset = 0, autoscale OFF)

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0
0 0 -1 -1 -1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 3 offset = 0, autoscale OFF)

Now use the transfer mode “Lighter” between all of the layers. This gives you the biggest “step up” from each of the 4 directions (there is a way to do 8 directions) as a new image. This is a map of where the edges are. Also note, we’re using a little bit of blur in the other direction when doing the derivative. This helps reduce the effect of noise when “Tracing Edges”.

That’s enough for today, but next time we’ll talk about Gaussian Blurs, Laplacian (2nd-derivative edge enhancement), high-pass and low-pass filters, and the “Mexican Hat” filter.

-Chris Russ
Reply With Quote top
  #9  
Old 10-23-2002, 10:09 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Angry Interest in this topic?

Questions, problems, things I should know, things I SHOULDN'T know?

If you're not interested, then I'll stop.
Reply With Quote top
  #10  
Old 10-23-2002, 10:35 AM
Doug Nelson's Avatar
Doug Nelson Doug Nelson is offline
Janitor
 
Join Date: Aug 2001
Posts: 6,854
Blog Entries: 21
Please don't stop, it's fascinating. Way over my head, but fascinating.
Reply With Quote top
  #11  
Old 10-23-2002, 08:48 PM
Tim_S's Avatar
Tim_S Tim_S is offline
Member
 
Join Date: Dec 2001
Location: California
Posts: 67
Chris, please keep going. This is great stuff.

I worked with convolution for linear data streams for signal processing, but 2D images are a great deal more complex. There are a lot of transforms I have wanted to try, and I know there are many more that are more specific to other kinds of images than the microscopy I used to work with... I will happily read whatever you are willing to type on the subject.

--tks
Reply With Quote top
  #12  
Old 10-24-2002, 01:58 AM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Chris, please post on!

I have printed out your 'basic' post for extended study and practice. This is deep stuff for a GUI user to get into - so I have not had time to really push things.

I will hold back on my current questions, as they may well be covered in your next tutorial...if not I will post away.

Here is a link to a great little tutorial which forces you to think and to correctly answer a question before proceeding to the next step - which I think is a novel way to present such a deep topic:

http://www.eas.asu.edu/~karam/2dconvolution/

Regards,

Stephen Marsh.
Reply With Quote top
  #13  
Old 10-24-2002, 02:56 AM
DannyRaphael's Avatar
DannyRaphael DannyRaphael is offline
Moderator
 
Join Date: Mar 2002
Location: Near Seattle, Washington, USA
Posts: 6,300
Thumbs down

Chris:

Yours is the BEST how-to / decriptive writeup on custom filters I've seen anywhere. Most are just a paragraph or two with no depth whatsoever.

This is EXCEPTIONAL stuff.

Many thanks to you for sharing your expertise.

~~~~~~~
And another BIG thumbs up to Stephen for another enlightening thread with valuable content.

~Danny~
Reply With Quote top
  #14  
Old 10-24-2002, 07:01 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Convolution, Round 2

So, let us recap a little bit. The center of the 5x5 or 7x7 (or whatever size the kernel is) refers to the weight on each pixel in the original image. The positions around that center pixel refer to weights on the neighbors of that pixel. All of this applies when creating a new image from the original.

Gaussian Filters

Back in the dark old days where computers were slow we had to do a lot of work-arounds to get the operations done in our respective lifetimes. We also worked with 3x3 Kernels because they were easier and a lot faster.

So, you would think that the first blur that we developed was the following kernel:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 1 1 0 0
0 0 1 1 1 0 0
0 0 1 1 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 9, offset = 0)

But you’d be wrong. This kernel has two problems:
  1. The sum is 9. Division was a sloooow operation, unless you were dividing by a power of 2. As we saw before, you’d have to use a scale of 9 in order to make this kernel work, so this wasn’t a good choice.
  2. The kernel is square. More blurring goes on in the diagonals than horizontally and vertically and this is a visible artifact.

So, instead we used the following kernel which is nearly a Gaussian:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 1 2 1 0 0
0 0 2 4 2 0 0
0 0 1 2 1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 16, offset = 0)

It turns out that dividing by 16 on a computer is really easy and fast, and even more useful, multiplying by a power of 2 is really easy and fast, so this was the first useful blur kernel.

Another useful tidbit is that if you reapply several little Gaussians, you get a big Gaussian. Try it.

One big problem with kernels is that as they get bigger, they get a lot slower. A 5x5 has 25 multiplications. A 7x7 has 49 multiplications and takes about twice as long. Yet, the difference in the blur between radius=2 and radius=3 really isn’t that much. And if I want a radius=20, this could really take a lot of time.

So how does Chris Cox (the optimization guru at Adobe) do it? How does he make the Gaussian blur function so fast? He cheats.

First he convolves the image with a horizontal Gaussian Blur (example below is a radius=1.0) and then with a vertical Gaussian Blur. He doesn’t have to do any work where there are 0’s, so it is really fast. In fact, that 7x7 = 49 multiplies is reduced to 7 + 7 = 14 multiplies. At the larger radius, these advantages become really obvious.

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0.011 0.135 0.607 1.000 0.607 0.135 0.011
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 2.506, offset = 0 or use autoscale)
Horizontal Blur, radius = 1

0 0 0 0.011 0 0 0
0 0 0 0.135 0 0 0
0 0 0 0.607 0 0 0
0 0 0 1.000 0 0 0
0 0 0 0.607 0 0 0
0 0 0 0.135 0 0 0
0 0 0 0.011 0 0 0 (scale = 2.506, offset = 0 or use autoscale)
Vertical Blur, radius = 1

So if you did both of them to your image, and the order doesn’t matter, you’d get almost exactly the same effect as the built-in Gaussian function.

Edge Enhancing II – The Laplacian

Earlier we saw that a directional derivative was really the same thing as embossing, and if we took the directional derivative in several directions and kept the biggest value, we’d find the edges. There is a different way that came first. This is called the Laplacian, after the guy. If you’ve got a math background, this is really the second derivative.

Let’s start with the simplest version of the Laplacian:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 -1 0 0 0
0 0 -1 4 -1 0 0
0 0 0 -1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 1, offset = 128)

(You could also use scale = 4 if you’re following the Scale & Offset Rule from the last post.)

This will trace every edge and highlight every bit of noise in your entire image. In fact, the Laplacian is the best noise amplifier of all of the edge detectors.

There is an additive version of that kernel (notice the different center value and that Offset = 0):

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 -1 0 0 0
0 0 -1 5 -1 0 0
0 0 0 -1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 1, offset = 0)

What I did was add the original image back to the edge image. You could use the FADE tool here to get as much emphasis as you want… if you like noise, that is.
However, if you had some kind of QuickMask (Selection) that isolated the processing to where the edges are… Nevermind. We’ll talk about that some other time.

This kernel setting works because the sum of the positive values is one more than the sum of the negative values. Because the difference is just one, I can use scale = 1, offset = 0. This causes a uniform area on the image to be unchanged.

Back with the –1’s and the 4, the positive sum was the same as the negative sum so a uniform area on the image would give a zero and it was possible to get negatives, so we used an offset=128 to put the unchanging values in the middle of the histogram.

One other Laplacian kernel is used fairly often because it emphasizes diagonals, too:

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 -1 -1 -1 0 0
0 0 -1 8 -1 0 0
0 0 -1 -1 -1 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0 (scale = 8 or 1, offset = 128)

If you replace the 8 in the middle with a 9, set scale = 1, offset = 0.

I’m running out of time. Next time we’ll do a High Pass filter which is basically subtracting the blurred image from the original, show how that is related to the UnSharp Mask (and where the USM came from) and we’ll go from there.

-Chris Russ

Last edited by jcr6; 10-24-2002 at 07:14 AM.
Reply With Quote top
  #15  
Old 10-25-2002, 08:17 PM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Wow - thanks again Chris, you are really helping with your posts on convolution and I appreciate you sharing your time and knowledge on this topic.

I don't want to sidetrack your posts, but I have a link to some custom convolution kernels for sub pixel motion simulation for anyone following this thread to experiment with:

http://www.retouchpro.com/forums/sho...4352#post34352

P.S. PC users should add a .acf file name extension to the downloaded kernel files if it is missing (Photoshop, Adobe Custom Filter preset file extension).

Stephen Marsh.
Reply With Quote top
  #16  
Old 10-26-2002, 06:25 PM
DJ Dubovsky's Avatar
DJ Dubovsky DJ Dubovsky is offline
Senior Member
 
Join Date: Aug 2001
Location: Upper Penninsula of Michigan
Posts: 1,659
Chris,
I'm amazed and thankful that you took the time to type all that out for us and try to explain the mechanics behind it all. It does seem overwhelming but I definately bookmarked this page for future numbers to plug in and save as settings. I think if I really sit down and plug through it and look at the results of your numbers I will begin to feel more comfortable with this filter.
DJ
Reply With Quote top
  #17  
Old 10-28-2002, 05:47 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Let's go back and try some of these. If you have trouble figuring out what I wrote, we can go over those things again.

The point is that convolution is a fundamental part of image processing and that it is a powerful tool.

Not necessarily an EASY tool.

(It's not like I can look at a kernel and intuitively tell you what it does. I have to stare at it for awhile and then guess.)

-Chris
Reply With Quote top
  #18  
Old 10-28-2002, 07:28 PM
Flora's Avatar
Flora Flora is offline
Senior Member
 
Join Date: Mar 2002
Location: Milan, Italy
Posts: 2,325
Blog Entries: 3
Hi Chris!

I have been asking around about Custom Filter, (Photoshop), a while ago.

Stephen has been a big help pointing out several links where I could find a lot of information on the topic....Unfortunately all that proved to be "Way over my head" too....

It will probably remain that way for me but, after reading your posts, I'll definitely start experimenting with it again.... It fascinated me before and now that I have a better glimpse on the starting point....well......

So, let me join everybody else in thanking you for "sharing your time and knowledge on this topic"
Reply With Quote top
  #19  
Old 10-30-2002, 05:26 AM
stewreno's Avatar
stewreno stewreno is offline
Junior Member
 
Join Date: Oct 2002
Location: Honolulu
Posts: 1
Hi Chris! Could you explain Scale and Offset in more detail? I'm not sure I get what I am trying to accomplish with those numbers.

Is the Offset added to the center value? Or the final product? Or is something else completely?

To get something even close to the original, the sum of the values in your kernel should be 1, Correct? It seems that an Offset value of 128 would throw this way off, wherever it's used.

I can't figure exactly where the Scale fits in either, although I know it divides some part of the convulsion.

Paint Shop Pro uses the terms Division Factor and Bias. I'm assuming they are the same thing as Scale and Offset.

That's all the questions I have right now. Thanks in advance (and thanks for the awesome tutorials, I hope to see more).
Reply With Quote top
  #20  
Old 10-30-2002, 05:50 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Quote:
Is the Offset added to the center value? Or the final product? Or is something else completely?

To get something even close to the original, the sum of the values in your kernel should be 1, Correct? It seems that an Offset value of 128 would throw this way off, wherever it's used.

I can't figure exactly where the Scale fits in either, although I know it divides some part of the convulsion.

Paint Shop Pro uses the terms Division Factor and Bias. I'm assuming they are the same thing as Scale and Offset.
Let's say I had a kernel that was like this:
0 0 0
1 1 1
0 0 0

(remember to put this in the center and add the extra zeros all around -- I'm a lazy typist today)

I would want to divide the result by 3 because the sum of the kernel is 3. Since the sum isn't zero, we can leave the offset at 0.
(Scale is what we divide the product of the pixels and the kernel by. Offset is added afterwards.)

You could invert the image with:
0 0 0
0 -1 0
0 0 0 (scale = 1, offset = 0)

The case where offset matters is when the sum of the kernel is zero:
0 -1 0
-1 4 -1
0 -1 0

In a uniform area on the image, where all of the neighbors are the same, this will give you a zero result. It the edges are getting darker, you could get a negative result and if the edges are getting brighter you could get a positive result. So we add 128 (gray) to push these values to the middle of the histogram.

What do you use for scale in this case? I like to use 4 which is the sum of the positive values. You could use 1 and really see the effects more strongly.

The one that really causes confusion is this one:

0 -1 0
-1 8 -1
0 -1 0 (scale = 4, offset = 0)

Now, the positive sum is 8, the negative sum is 4 and the overall sum is 4. Because the sum isn't zero the offset should be 0. The scale should be the sum of the kernel, or in this case 4.

Does this make sense?
Reply With Quote top
  #21  
Old 11-01-2002, 12:48 PM
pstewart's Avatar
pstewart pstewart is offline
Registered User
 
Join Date: Jul 2002
Location: Chicago suburb
Posts: 790
It was more than nice of Chris to share all this expertise with us. Now that we know the secrets, isn't he afraid we'll become competitors? Hmmm...let's see...I think I'll call my company muledeer graphics.

Jus' teasin'...

Phyllis
Reply With Quote top
  #22  
Old 11-01-2002, 01:14 PM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Quote:
Muledeer Graphics
Sure, why not. Then we'll change our name to Nuclear Graphics and go fission all over ya!

I am trying to lead you down the golden path. I will attempt to explain high-pass filters without going the Fourier mathematics route. Then, I guess, we could go to fractal textures... Hmmm.

Before then, I think we'll go into edge detectors. I wanted to show one called a "Frei and Chen" which is very good at finding faint lines, but rejecting noise. If this were used to create a selection mask on the image, I imagine we could do a rather impressive job. (First, let me try a few things on my computer before unleashing it on you.)

The other constraint is that I want a way for people to be able to try it themselves, and perhaps play around. We can't do an ordinary Sobel in an action because it really calls for taking the square root of the sum of the squares of two orthogonal derivatives. Yes, I have a plug-in that does it. Or, a Canny that will make the lines skinny afterwards.

(Some people in machine vision have a huge obsession with edges and regions of the image, and we might be able steal some of their ideas to make better automatic segmentation actions in another discussion.)

Finally, I'd like to introduce you all to a gentleman named David Marr who was a physiologist trying to figure out how the human visual system worked -- by tracing the neurons. Basically he was mapping out the wetware.

Image processing/image analysis is a collection of "Hacks that worked." (Call them heuristics if you like.)

Now that I've hinted at where we're going, this is your last chance to ask questions about where we've been.

-Chris
Reply With Quote top
  #23  
Old 11-05-2002, 05:38 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Stephen M asked a question about kernels that did nudging. There were two groups of them, one that did 1/3 of a pixel and another that did 1/2 a pixel.

The 1/3 pixel kernel looked like this:

0 0 0 0 0
0 0 0 0 0
0 0 8 4 0
0 0 0 0 0
0 0 0 0 0 (scale = 12, offset = 0)

Except they did a little bit of sharpening at the same time, which I think detracts from the result and causes a tiny bit of a halo:

0 0 0 0 0
0 0 0 0 0
0 -1 8 4 -1
0 0 0 0 0
0 0 0 0 0 (scale = 10, offset = 0)

Basically, the second one uses a small amount of a Laplacian (2nd-derivative) sharpening to compensate for the implicit blur in the kernel.

You could rotate the kernel to get blurs in the other 3 directions:

0 0 0 0 0 - 0 0 0 0 0 - 0 0 0 0 0
0 0 4 0 0 - 0 0 0 0 0 - 0 0 0 0 0
0 0 8 0 0 - 0 4 8 0 0 - 0 0 8 0 0
0 0 0 0 0 - 0 0 0 0 0 - 0 0 4 0 0
0 0 0 0 0 - 0 0 0 0 0 - 0 0 0 0 0 (scale = 12, offset = 0)

Do you understand why this works? Questions? Problems?
Reply With Quote top
  #24  
Old 11-06-2002, 02:08 AM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Chris - again you astound me...Thank you for deconvolving the third party convolution! <g>

While I am at it - if we are convolving...and there is a thing known as deconvolution which can be used for making a blurry image appear more infocus...just what/where does deconvolution fit into the scheme of things?

OK, let me see if I am following things correctly from your previous excellent tutorials.

These 'sub pixel motion' custom convolution kernels are a variant of what you described as a more basic 'echo' in an earlier post of yours. Correct?

Instead of a basic 00101 echo as you onced described, the current pixel being processed by this third party kernel will base the echo as a 8:4 in averaged brightness weighting. Correct?

The -1 sharpen value seems obvious now that you point it out. I had noticed it visually, but I did not know how it fit into the construction of the kernel. I agree that this is perhaps not best as a default, thanks to your excellent tip I may now make a version without sharpening as well as keeping the versions as is.

Have I been keeping up with things? Am I totally off base? Do I deserve a A or an F for my test results?

Stephen Marsh.
Reply With Quote top
  #25  
Old 11-08-2002, 06:35 AM
lasm lasm is offline
Junior Member
 
Join Date: Oct 2002
Posts: 3
Smile Convolution presets in Gimp

Quote:
Originally posted by jcr6

The other constraint is that I want a way for people to be able to try it themselves, and perhaps play around. We can't do an ordinary Sobel in an action because it really calls for taking the square root of the sum of the squares of two orthogonal derivatives. Yes, I have a plug-in that does it. Or, a Canny that will make the lines skinny afterwards.


-Chris [/B]
It would be difficult if at all possible to do this in PS actions, but with the scriptable Gimp, it is easy to play with convolutions which are very powerful indeed. In case anyone is interested take a look at the script here http://gug.sunsite.dk/scripts.php
or more specifically the version 0.5 here http://gug.sunsite.dk/scripts/1005753014.scm

The scripting language used in Gimp is called Scheme, a subset of LISP language..

I have an example showing the powerful convolutions at work, here at http://www.geocities.com/lasm.rm/video.html

All the artistic, line-art, black-and-white photos you see are convolved from a custom Gimp script. I have never seen a comercial product which can do this kind of transformation
Reply With Quote top
  #26  
Old 11-08-2002, 06:55 AM
jcr6's Avatar
jcr6 jcr6 is offline
Member
 
Join Date: Oct 2002
Location: Asheville, NC
Posts: 72
Quote:
artistic, line-art, black-and-white photos you see are convolved from a custom Gimp script
Not dissimilar from adding "Trace Edges" back to the original image. I suspect that we could do a fairly good approximation of your Gimp Script within Photoshop.

Actually, that would be a good challenge. Can we come up with ways to approximate various effects with actions, custom convolution, etc. Naturally, everything we come up with will be in the public domain, with commentary on how we did it and why.

Steve, what do you think?

-Chris
Reply With Quote top
  #27  
Old 12-14-2002, 08:36 PM
lasm lasm is offline
Junior Member
 
Join Date: Oct 2002
Posts: 3
Cool Edge Detection Gallery

Here's a showcase of Gimp's edge detection algorithms

http://www.pbase.com/lasm/edge_detect_in_gimp

Enjoy !
Reply With Quote top
  #28  
Old 12-29-2002, 07:26 PM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Action Tester Required

Hi Folks, I have been playing with custom convolution off and on and have put some of these kernels into a Photoshop 5.x or higher action set, things are a bit raw at this point - but close to being final (I hope).

This has been a great learning experience, which I have to thank Chris Russ for helping me along the way - as the consise and easy to follow explanations in this thread have helped me decipher some of the common but hard to follow examples that can be found on the web when looking for info on 'image processing via convolution'.

Before this action set grows any larger, I thought it might be wise to ask for some help in:

a) Checking the convolution kernels contained in the action, including kernel construction (coefficients, bias, scale & offset) and that it matches the action name and works as intended etc.

b) Testing the actions in multiple versions of Photoshop on Mac and PC.

This action set will be a free offering and credit will go those who helped test and evaluate the actions, or additions to the actions or whatever. I will also put together a PDF manual to accompany the action set, once all the little details are ironed out.

So, if you think that you have an 'intermediate' understanding of convolution (then you're one up on me <g>) and picking apart actions - please send me a 'PM'. I am testing on PC v5.x and v7, so a Mac based v6 user would be ideal - although I would really like to hear from anyone who has been following this convolution thread and would like to help verify the results gained so far.

Sincerely,

Stephen Marsh.

Last edited by Stephen M; 01-06-2003 at 07:58 PM.
Reply With Quote top
  #29  
Old 01-11-2003, 09:21 PM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Custom Convolution Action Set Preview

As I have not had any response to these new posts, I presume that this post will either scare people away or spark their imagination...

Attached is a GIF image preview of the custom convolution actions in the set.

Stephen Marsh.
Attached Images
File Type: gif convolution_actionsetpreview.gif (26.6 KB, 76 views)

Last edited by Stephen M; 01-11-2003 at 11:52 PM.
Reply With Quote top
  #30  
Old 01-12-2003, 11:44 PM
john_opitz john_opitz is offline
Senior Member
 
Join Date: Sep 2001
Location: Dallas/Ft.Worth,Texas
Posts: 230
Hello Steven,
I can give you a hand(if you want). It's the least I can do for you. I use them for noise reduction(in the a,b channels of L*A*B) in actions and for sharpening purposes,actions also. I can test on a pc for v.5,5.5,6. On the mac I can't do this because I don't have acess to it at times(at work shooting).
I just got done a skin smoothing action which I wanted to do for a while(based on Dan Margulis'). But taken it a little further than the last one I posted.

John Opitz
Reply With Quote top
  #31  
Old 01-13-2003, 07:28 PM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Thanks John - I have mailed you at the earthlink address, contact me offlist for more info if required.

I will post the action set link here for the rest of the list when the trials are over and all seems to work as intended.

Stephen Marsh.


Last edited by Stephen M; 01-16-2003 at 06:40 PM.
Reply With Quote top
  #32  
Old 03-03-2003, 03:49 AM
Stephen M Stephen M is offline
Senior Member
 
Join Date: Apr 2002
Location: Sydney, Australia
Posts: 439
Firstly - I would like to thank John Opitz for his help in testing my action set and custom kernels.

The Photoshop 5.x or higher action and PDF manual ZIP archive are now available for download:

http://members.ozemail.com.au/~binar...volcorner.html

Enjoy,

Stephen Marsh.
Reply With Quote top
Reply

  RetouchPRO > Tools > Software


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
PHOTO ART: Mini-challenge #49 – Park Bench DannyRaphael Photo Art Mini-Challenges 100 12-25-2010 07:49 PM
Impressionist plugin: Troubleshooting Cheryl H Photo-Art Resources 34 06-15-2009 10:13 PM
Sharpening T Paul Scratch Pad 34 08-16-2004 10:02 AM
Photoshop Filters: Books and websites DannyRaphael Photo-Based Art 1 03-20-2003 04:17 PM
Impressive Free Filters thomasgeorge Software 1 01-02-2002 10:40 AM


All times are GMT -6. The time now is 06:31 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
Copyright © 2015 Doug Nelson. All Rights Reserved