Ask Your Question

Revision history [back]

Create a Mat by stating each value for every pixel

Hi guys! Is it possible to create a Mat by check the value of another Mat? For example

for(int i=0;i<640;i++)
{
  for (int j=0;j<480;j++)
  {
      if(MatSrc.at<unsigned char>(i,j)==255)
      MatDst. at<unsigned char>(i,j)==128;
  }
}

For some reason I get several errors.

Create a Translate Mat by stating each value for every pixelx and y offset

Hi guys! Is it possible Hi! I want to create be able to translate a mat by a x and y offset and form a new Mat by check of the same size.Also I want the value of another Mat? For example

for(int i=0;i<640;i++)
{
  pixels that belong to offset to become 0. How can I do it? I tried it for (int j=0;j<480;j++)
  {
      if(MatSrc.at<unsigned char>(i,j)==255)
      MatDst. at<unsigned char>(i,j)==128;
  }
}

For some reason every element of matrix but I get several errors.failed.