Home  >  Article  >  Web Front-end  >  Detailed explanation of H5+canvas convolution kernel image processing steps

Detailed explanation of H5+canvas convolution kernel image processing steps

php中世界最好的语言
php中世界最好的语言Original
2018-05-07 17:37:591871browse

This time I will bring you H5 canvas convolution kernelImage processingdetailed steps, what are the notes of H5 canvas convolution kernel image processing, the following is a practical case, one Get up and take a look.

What is convolution?

I skipped some explanations that used professional terminology and I was confused after reading it.

Since my Chinese score is very poor, I tried to explain literally what convolution is. ...

Convolution, understood as a kind of compression; product, product, accumulation;

Convolution requires a convolution kernel, usually a 3x3 or 5x5 square matrix,

For example:

// A 3x3 convolution kernel
0 0 0
0 1 0
0 0 0

How do we use it? What about the data processed by the convolution kernel?

The following is an example:

//The following is a bunch of data arranged in a square matrix
//This is our data source
1 3 5 1 3 5 1 3 5
4 5 6 1 3 5 1 3 5
4 5 6 1 3 5 1 3 5
4 5 6 1 3 5 1 3 5

We will use the convolution kernel to "scan and process" each data,

For example, to process the second row and second column5

1 3 5 0 0 0
4 5 6 * 0 1 0
4 5 6 0 0 0

We extract the numbers around 5, and then put the two Numbers with the same position in the square matrix are multiplied and then added,

results in 5, which is of course, because what this convolution kernel does is to output the original data

The above is the detailed content of Detailed explanation of H5+canvas convolution kernel image processing steps. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn