cv::Mat element matrix multiplication
I need to take concrete element from three channel matrix:
a.row(0).col(0)
and use this element for multiplication:
multiply(a.row(0).col(0), b, c);
Something like this:
Mat a(5, 5, CV_32FC3);
Mat b(5, 5, CV_32FC3);
Mat c;
multiply(a.row(0).col(0), b, c);
But it is not working. Do you have some tip how to do it?
P.S. : it is really easy for one channel image using
a.at<float>(0,0)
Edit
Ok, let me give an example.
Mat a:
[ 91, 2, 79, 179, 52, 205, 236, 8, 181, 239, 26, 248, 207, 218, 45;
183, 158, 101, 102, 18, 118, 68, 210, 139, 198, 207, 211, 181, 162, 197;
191, 196, 40, 7, 243, 230, 45, 6, 48, 173, 242, 125, 175, 90, 63;
90, 22, 112, 221, 167, 224, 113, 208, 123, 214, 35, 229, 6, 143, 138;
98, 81, 118, 187, 167, 140, 218, 178, 23, 43, 133, 154, 150, 76, 101]
Mat b:
[ 8, 38, 238, 84, 47, 7, 117, 246, 163, 237, 69, 129, 60, 101, 41;
190, 50, 90, 72, 168, 109, 121, 220, 114, 248, 99, 202, 199, 212, 79;
128, 198, 90, 168, 76, 145, 181, 118, 8, 63, 114, 217, 164, 158, 217;
237, 147, 44, 207, 54, 182, 65, 197, 191, 239, 72, 166, 236, 240, 3;
151, 91, 246, 116, 238, 94, 63, 252, 232, 25, 17, 8, 166, 116, 81]
I want to take element [0; 0] from the a which is (91, 2, 79) and use it for per-element multiplication to achieve Mat c:
[ 728, 76, 18802, 7644, 94, 553, 10647, 492, 12877, 21567, 138, 10191, 5460, 202, 3239;
17290, 100, 7110, 6552, 336, 8611, 11011, 440, 9006, 22568, 198, 15958, 18109, 424, 6241;
11648, 396, 7110, 15288, 152, 11455, 16471, 236, 632, 5733, 228, 17143, 14924, 316, 17143;
21567, 294, 3476, 18837, 108, 14378, 5915, 394, 15089, 21749, 144, 13114, 21476, 480, 237;
13741, 182, 19434, 10556, 476, 7426, 5733, 504, 18328, 2275, 34, 632, 15106, 232, 6399]
it's unclear, what you're trying to achieve in the end. could you concentrate more on that, and less on your faulted attempts ?
also, multiply does a per-element multiplication, not a matrix one (that's cv::gemm).
I have added an example.