Answer the question
In order to leave comments, you need to log in
What type should be specified in mat.at to read all channels in CV_16SC2?
This type for me (CV_16SC2) is quite specific and new, I do not understand what size one pixel of a two-channel matrix has.
Here I want to use exactly mat.at, and not follow the pointer, a place that does not require high speed.
The following code gives this output:
coord_mat = Mat::ones(img.size[0], img.size[1], CV_16SC2);
for (int y = 0; y < img.size[0]; ++y) {
for (int x = 0; x < img.size[1]; ++x) {
cout << coord_mat.at<Vec2s>(Point(x,y)) << " " << y << " " << x << endl;
}
}
[1, 0] 0 0
[1, 0] 0 1
[1, 0] 0 2
[1, 0] 0 3
[1, 0] 0 4
[1, 0] 0 5
[1, 0] 0 6
[1, 0] 0 7
[1, 0] 0 8
[1, 0] 0 9
[1, 0] 0 10
[1, 0] 0 11
[1, 0] 0 12
[1, 0] 0 13
[1, 0] 0 14
[1, 0] 0 15
[1, 0] 0 16
[1, 0] 0 17
[1, 0] 0 18
[1, 0] 0 19
[1, 0] 0 20
[1, 0] 0 21
[1, 0] 0 22
[1, 0] 0 23
[1, 0] 0 24
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question