1 | initial version |
@trucna why not split the original multi-channel matrices into individual matrices within a vector<Mat>
, then multiply the individual correspondent channels and finally re-merge the final outcome into a multi-channel matrix again. Example, pseudo code:
Mat a;
Mat b;
Mat c;
vector<Mat> a_channels;
vector<Mat> b_channels;
vector<Mat> c_channels;
split(a, a_channels);
split(b, b_channels);
for(i = 0; i < a_channels.size() || b_channels.size(); i++)
{
c_channels.push_back(a_channels[i] * b_channels[i]);
}
merge(c_channels, c);
and then you have your result.
2 | No.2 Revision |
@trucna why not split the original multi-channel matrices into individual matrices within a vector<Mat>
, then multiply the individual correspondent channels by using the mul() and finally re-merge the final outcome into a multi-channel matrix again. Example, pseudo code:
Mat a;
Mat b;
Mat c;
vector<Mat> a_channels;
vector<Mat> b_channels;
vector<Mat> c_channels;
split(a, a_channels);
split(b, b_channels);
for(i = 0; i < a_channels.size() || b_channels.size(); i++)
{
c_channels.push_back(a_channels[i] * b_channels[i]);
c_channels.push_back(a_channels[i].mul(b_channels[i]));
}
merge(c_channels, c);
and then you have your result.
3 | No.3 Revision |
@trucna why not split the original multi-channel matrices into individual matrices within a vector<Mat>
, then multiply the individual correspondent channels by using the mul() and finally re-merge the final outcome into a multi-channel matrix again. Example, pseudo code:
Mat a;
Mat b;
Mat c;
vector<Mat> a_channels;
vector<Mat> b_channels;
vector<Mat> c_channels;
split(a, a_channels);
split(b, b_channels);
for(i = 0; i < a_channels.size() || b_channels.size(); i++)
{
c_channels.push_back(a_channels[i].mul(b_channels[i]));
}
merge(c_channels, c);
and then you have your result.