lundi 27 octobre 2014

How to create a Mat on OpenCV for making an histogram


Vote count:

0




I'm making kind of an histogram stored in a Matrix on OpenCV.


So, if I match one result, I will at +1 on some index.


My mat is:


Mat countFramesMatrix = Mat::zeros(9,9,CV_8U);


when I try to access to sum +1 to the already set index (from 0), I do:



int valueMatrixFrames = countFramesMatrix.at<int>(sliceMatch.j, sliceMatch.i);
valueMatrixFrames++;
countFramesMatrix.at<unsigned char>(sliceMatch.j, sliceMatch.i) = (unsigned char)valueMatrixFrames;


I tried in other ways, as changing unsigned char for int an other problems I had before, but nothing happens.


My results are:



  1. Or all the matrix is zeros.


  2. Or I get something like:


    [2.3693558e-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'm never storing data at (0,0) or (0,1) or (1,0) or (1,1), :(


What would you suggest? thank you.



asked 2 mins ago







How to create a Mat on OpenCV for making an histogram

Aucun commentaire:

Enregistrer un commentaire