
Software Photoshop, Lightroom, Paintshop Pro, Painter, etc., and all their various plugins. Of course, you can also discuss all other programs, as well. 
 Thread Tools 
#11
 
 
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 
#12
 
 
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. 
#13
 
 
Chris: Yours is the BEST howto / 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~ 
#14
 
 
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 workarounds 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:
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 builtin 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; 10242002 at 07:14 AM. 
#15
 
 
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. 
#16
 
 
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 
#17
 
 
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 
#18
 
 
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" 
#19
 
 
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). 
#20
 
 
Quote:
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? 

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)  
Thread Tools  
 
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
PHOTO ART: Minichallenge #49 – Park Bench  DannyRaphael  Photo Art MiniChallenges  100  12252010 07:49 PM 
Impressionist plugin: Troubleshooting  Cheryl H  PhotoArt Resources  34  06152009 10:13 PM 
Sharpening  T Paul  Scratch Pad  34  08162004 10:02 AM 
Photoshop Filters: Books and websites  DannyRaphael  PhotoBased Art  1  03202003 04:17 PM 
Impressive Free Filters  thomasgeorge  Software  1  01022002 10:40 AM 