Jump to content

Understanding the imageconvolution function


Fmdpa

Recommended Posts

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

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...