I am creating a histogram stored in a matrix on OpenCV.
So, if I match a result, I'll +1 something on the index.
My mat is:
Mat countframe matrix = mat :: zero (9, 9, cv_8u);
When I try to sum 1 already in the set index (0), then I do:
int value matrixframe = Ginframematics.et I tried in other ways, nothing else happened before changing the other problems for unsigned char to int .
My results are:
- Or all the matrix is zero.
-
Or I find something like this:
[2.3693558-38, 0, 0, 0, 0, 0, 0, 0, 0; 2.3693558e-38, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0]
And I never store data on (0,0) I am or (0,1) or (1.0) or (1,1) ,: (
What would you suggest? Thanks
You are meeting a very simple mistake,
valueMatrixFrames ++; Do not match the matrix space valueMatrixFrames .
Correct way
Suppose you (1, 1) ,
countFramesMatrix.at (1,1) ++; OUTPUT
[0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 1, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Running the command again will increase the value (1, 1) to 2.
[0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 2, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0; 0, 0, 0, 0, 0, 0, 0, 0, 0] So, your histogram is ready!
Comments
Post a Comment