float kernel[kernel_size][kernel_size] = {
0.000036, 0.000363, 0.001446, 0.002291, 0.001446, 0.000363, 0.000036,
0.000363, 0.003676, 0.014662, 0.023226, 0.014662, 0.003676, 0.000363,
0.001446, 0.014662, 0.058488, 0.092651, 0.058488, 0.014662, 0.001446,
0.002291, 0.023226, 0.092651, 0.146768, 0.092651, 0.023226, 0.002291,
0.001446, 0.014662, 0.058488, 0.092651, 0.058488, 0.014662, 0.001446,
0.000363, 0.003676, 0.014662, 0.023226, 0.014662, 0.003676, 0.000363,
0.000036, 0.000363, 0.001446, 0.002291, 0.001446, 0.000363, 0.000036
};
float kernel[kernel_size][kernel_size] = {
{0.000036, 0.000363, 0.001446, 0.002291, 0.001446, 0.000363, 0.000036},
{0.000363, 0.003676, 0.014662, 0.023226, 0.014662, 0.003676, 0.000363},
{0.001446, 0.014662, 0.058488, 0.092651, 0.058488, 0.014662, 0.001446},
{0.002291, 0.023226, 0.092651, 0.146768, 0.092651, 0.023226, 0.002291},
{0.001446, 0.014662, 0.058488, 0.092651, 0.058488, 0.014662, 0.001446},
{ 0.000363, 0.003676, 0.014662, 0.023226, 0.014662, 0.003676, 0.000363},
{0.000036, 0.000363, 0.001446, 0.002291, 0.001446, 0.000363, 0.000036}
};
正如你所看到的,第二個數組對每一行都有額外的{}。這兩個數組有區別嗎?
如果我用另一個替換它們中的一個,這兩個等價的或者程序的行爲是否不同?
不知道'kernel_size'是不可能的。 – AnT
取決於。如果'kernel_size == 7',它是一樣的。否則它不是。 –
是的kernel_size == 7,對不起,我忘了添加 –