I have two arrays:
A (rows:60, cols:62,dim:2,channel:32) and F(rows:9, cols:9,dim:2,channel:32).
I want to compute Convolution with A and F, but it failed because the channel of A is more than 3. So the official API filter2d() not support this input Array!!! Now, I implement this function with for-loop :
- Split A into vector vecA,and the vecA.size=A.channel = 32 , the same as F and vecF.
for-loop for computing Convolution
cv::Mat acc;
for( int i=0 ; i < vecA.size() ; i++) {
cv::Mat dst;
filter2d( vecA[i], dst , vecA[i].depth(), vecF[i], Point(-1, -1), 0, BORDER_CONSTANT);
cv::add(acc, dst ,acc);
}
It is very ugly and not Efficient , so anyone have some ideas help me???