Fmdpa Posted September 22, 2010 Share Posted September 22, 2010 I was looking at the various image functions in the PHP manual, and I came across the imageconvolution() function. It looks very powerful, but I'm having trouble understanding it. How does the 3x3 matrix work, and what do the div and offset arguments do? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 22, 2010 Share Posted September 22, 2010 These links were in the comments:http://loriweb.pair.com/8udf-basics.htmlhttp://loriweb.pair.com/8udf-sharpen.htmlhttp://loriweb.pair.com/8udf-edges.htmlhttp://loriweb.pair.com/8udf-emboss.htmlThe divisor is used for normalizing the results of the convolution equations, one of the comments on the manual has a class to help computer it. The color offset is used in the transformation. The end result is that the values in the matrix are RGB transformations, and the function applies the transformation to each pixel in the image, so the new color of each pixel is based on the current pixel, the calculation matrix of RGB offsets, the divisor, and the color offset. Experiment with different values to see how things change. Link to comment Share on other sites More sharing options...
Fmdpa Posted September 22, 2010 Author Share Posted September 22, 2010 I've experimented with different values, but I can't detect a consistent change in results, except with the offset arg. Link to comment Share on other sites More sharing options...
Fmdpa Posted September 23, 2010 Author Share Posted September 23, 2010 Thanks for those links. They were helpful. If I use this matrix... $gaussian = array(array(1,1,1), array(1,1,1), array(1,1,1)); ...is that the strongest blur I can achieve? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 23, 2010 Share Posted September 23, 2010 I think 1 is the highest value, and that's what the normalization divisor is for, but I've got to say I have no clue as to how it picks the filter. If you look at this function:http://www.php.net/manual/en/function.imagefilter.phpClearly, you're picking a specific filter. It's not immediately apparent to me how the matrix picks a filter, from the other comments posted on the manual page it looks like the substitute functions people post are using the matrix values for raw RGB multipliers. Link to comment Share on other sites More sharing options...
Fmdpa Posted September 23, 2010 Author Share Posted September 23, 2010 The thing I don't like about the imagefilter() function is that it isn't as flexible. I don't think that the Gaussian Blur can even be adjusted. Of course it can be applied multiple times, which is basically the same as a more powerful setting, but its a rough compromise. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.