Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Access 32S Mat element by pointer

Usually I do

unsigned char *input = (unsigned char*)(oOut.data);
for (int i = 0; i < oOut.rows; i++)
{
  for (int j = 0; j < oOut.cols; j++)
  {    
    input[oOut.step[0]*i + oOut.step[1]*j] = 255;
  }
}

This is with a typical 8UC1 mat. Now, I want to store values that can range from -1500 to 1500. So I'm using a CV_32S mat. But I can figure out how to store values inside. I always end up with corruption with incoherent values.

Can someone help me?

Thanks Seb

Access 32S Mat element by pointer

Usually I do

unsigned char *input = (unsigned char*)(oOut.data);
for (int i = 0; i < oOut.rows; i++)
{
  for (int j = 0; j < oOut.cols; j++)
  {    
    input[oOut.step[0]*i + oOut.step[1]*j] = 255;
  }
}

This is with a typical 8UC1 mat. Now, I want to store values that can range from -1500 to 1500. So I'm using a CV_32S mat. But I can can't figure out how to store values inside. I always end up with corruption with incoherent values.

Can someone help me?

Thanks Seb

Access 32S 32F Mat element by pointer

Usually I do

unsigned char *input = (unsigned char*)(oOut.data);
for (int i = 0; i < oOut.rows; i++)
{
  for (int j = 0; j < oOut.cols; j++)
  {    
    input[oOut.step[0]*i + oOut.step[1]*j] = 255;
  }
}

This is with a typical 8UC1 mat. Now, I want to store values that can range from -1500 to 1500. So I'm using a CV_32S CV_32F mat. But I can't figure out how to store values inside. I always end up with corruption with incoherent values.

Can someone help me?

Edit, I mean 32F, not 32S, my mistake

Thanks Seb