Saving data into Mat

asked 2017-03-03 05:51:33 -0500

zms gravatar image

Hi. this might be a second post after @berak had pinpoint my last issue and it work except for the last one #4. link. Anyway thanks Berak.

The thing is i could not solve how to save the data into a define MAT M. I knew mat++ is causing the havoc but i could not find a solution on how to solve this. The error message on the last paragraph. I'm not really good in programming as i do not understand how can i save the data into the MAT. It had been a week and i could not solve this. Hope no one got mad with this question. image description

   Mat M(1,63, CV_8UC1,  Scalar::all(0));
    inRange(frame_gray, Scalar(0, 195, 0), Scalar(255, 255, 255), frame_gray);
     cv::findNonZero(frame_gray, locations);

     for(int x=639;x> 0;x-=10){
     for (int y=239;y> 0; y-=1){

        if (<uchar>(y,x)==0)
        { bitsize.append("0"); cnt++; /*cout << "0 binary=" << cnt << endl*/;}

        {  bitsize.append("1");cnt++;/*cout << "1 binary=" << cnt << endl*/;width++;}

    cout << "width=" << width << endl;

bitset<240> a(bitsize);
auto b = a >> 1;
auto c = a ^ b;
auto len = c.count();  // popcnt() , if you use integers.
cout << len << endl;
bitsize.clear();<uchar>(0,mati) = len; mati++;

edit retag flag offensive close merge delete



Please provide a Minimal, Complete, and Verifiable example! Please read this & this

Balaji R gravatar imageBalaji R ( 2017-03-03 07:08:58 -0500 )edit