Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to make Mat as new whenever the function called again?

Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;

Scalar value(0, 0, 0); copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value); for (int i = 0; i < rowPaddedImage.rows; i++) //For img { for (int j = h; j < rowPaddedImage.cols - h; j++) //For img { for (int l = 0; l < f_size; l++) { colPaddedImage.at<vec3d>(i + h, j - h)[0] += rowPaddedImage.at<vec3d>(i, j - h + l)[0] * filter[l];
colPaddedImage.at<vec3d>(i + h, j - h)[1] += rowPaddedImage.at<vec3d>(i, j - h + l)[1] * filter[l];
colPaddedImage.at<vec3d>(i + h, j - h)[2] += rowPaddedImage.at<vec3d>(i, j - h + l)[2] * filter[l]; } } } //The row "rowPaddedImage" is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.

How to make Mat as new whenever the function called again?

Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;

Scalar value(0, 0, 0);
copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
for (int i = 0; i < rowPaddedImage.rows; i++) //For img
    {
        for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
        {
            for (int l = 0; l < f_size; l++) 
                {
                    colPaddedImage.at<vec3d>(i colPaddedImage.at<Vec3d>(i + h, j - h)[0] += rowPaddedImage.at<vec3d>(i, rowPaddedImage.at<Vec3d>(i, j - h + l)[0] * filter[l]; 
colPaddedImage.at<vec3d>(i
colPaddedImage.at<Vec3d>(i + h, j - h)[1] += rowPaddedImage.at<vec3d>(i, rowPaddedImage.at<Vec3d>(i, j - h + l)[1] * filter[l];
colPaddedImage.at<vec3d>(i
colPaddedImage.at<Vec3d>(i + h, j - h)[2] += rowPaddedImage.at<vec3d>(i, rowPaddedImage.at<Vec3d>(i, j - h + l)[2] * filter[l]; } } } //The row "rowPaddedImage" is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.

size.

How to make Mat as new whenever the function called again?

Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;

 Scalar value(0, 0, 0);
 copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
 for (int i = 0; i < rowPaddedImage.rows; i++) //For img
     {
         for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
         {
             for (int l = 0; l < f_size; l++) 
                 {
                     colPaddedImage.at<Vec3d>(i + h, j - h)[0] += rowPaddedImage.at<Vec3d>(i, j - h + l)[0] * filter[l];                 
                     colPaddedImage.at<Vec3d>(i + h, j - h)[1] += rowPaddedImage.at<Vec3d>(i, j - h + l)[1] * filter[l];                 
                     colPaddedImage.at<Vec3d>(i + h, j - h)[2] += rowPaddedImage.at<Vec3d>(i, j - h + l)[2] * filter[l];
                 }
         }
     }
 //The row "rowPaddedImage"  is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.

How to make Mat as new whenever the function called again?

Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;

    Scalar value(0, 0, 0);
    copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
    for (int i = 0; i < rowPaddedImage.rows; i++) //For img
        {
            for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
            {
                for (int l = 0; l < f_size; l++) 
                    {
                        colPaddedImage.at<Vec3d>(i + h, j - h)[0] += rowPaddedImage.at<Vec3d>(i, j - h + l)[0] * filter[l];                 
                        colPaddedImage.at<Vec3d>(i + h, j - h)[1] += rowPaddedImage.at<Vec3d>(i, j - h + l)[1] * filter[l];                 
                        colPaddedImage.at<Vec3d>(i + h, j - h)[2] += rowPaddedImage.at<Vec3d>(i, j - h + l)[2] * filter[l];
                    }
            }
        }
    //The row "rowPaddedImage"  is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.

How to make Mat as new whenever the function called again?

Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;

 Scalar value(0, 0, 0);
 copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
 for (int i = 0; i < rowPaddedImage.rows; i++) //For img
     {
         for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
         {
             for (int l = 0; l < f_size; l++) 
                 {
                     colPaddedImage.at<Vec3d>(i + h, j - h)[0] += rowPaddedImage.at<Vec3d>(i, j - h + l)[0] * filter[l];                 
                     colPaddedImage.at<Vec3d>(i + h, j - h)[1] += rowPaddedImage.at<Vec3d>(i, j - h + l)[1] * filter[l];                 
                     colPaddedImage.at<Vec3d>(i + h, j - h)[2] += rowPaddedImage.at<Vec3d>(i, j - h + l)[2] * filter[l];
                 }
         }
     }
 //The row "rowPaddedImage"  is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.

How to make Mat as new whenever the function called again?

Mat rowPaddedImage; //Row filter int filter_size = 7; int h = filter_size / 2; int top, bottom, left, right; top = bottom = left = right = h;

Scalar value(0, 0, 0);
copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
for (int i = 0; i < rowPaddedImage.rows; i++) //For img
    {
        for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
        {
            for (int l = 0; l < f_size; l++) 
                {
                    colPaddedImage.at<Vec3d>(i + h, j - h)[0] += rowPaddedImage.at<Vec3d>(i, j - h + l)[0] * filter[l];                 
                    colPaddedImage.at<Vec3d>(i + h, j - h)[1] += rowPaddedImage.at<Vec3d>(i, j - h + l)[1] * filter[l];                 
                    colPaddedImage.at<Vec3d>(i + h, j - h)[2] += rowPaddedImage.at<Vec3d>(i, j - h + l)[2] * filter[l];
                }
        }
    }
//The row "rowPaddedImage"  is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.
click to hide/show revision 7
None

updated 2019-04-22 05:02:14 -0600

berak gravatar image

How to make Mat as new whenever the function called again?

.

Mat rowPaddedImage;
 //Row filter
 int filter_size = 7;
 int h = filter_size / 2;
 int top, bottom, left, right;
 top = bottom = left = right = h;

h;

Scalar value(0, 0, 0);
copyMakeBorder(double_src, rowPaddedImage, 0, 0, left, right, BORDER_CONSTANT, value);
for (int i = 0; i < rowPaddedImage.rows; i++) //For img
    {
        for (int j = h; j < rowPaddedImage.cols - h; j++) //For img
        {
            for (int l = 0; l < f_size; l++) 
                {
                    colPaddedImage.at<Vec3d>(i + h, j - h)[0] += rowPaddedImage.at<Vec3d>(i, j - h + l)[0] * filter[l];                 
                    colPaddedImage.at<Vec3d>(i + h, j - h)[1] += rowPaddedImage.at<Vec3d>(i, j - h + l)[1] * filter[l];                 
                    colPaddedImage.at<Vec3d>(i + h, j - h)[2] += rowPaddedImage.at<Vec3d>(i, j - h + l)[2] * filter[l];
                }
        }
    }
//The row "rowPaddedImage"  is getting bigger and bigger after the row filter function is being called. If I called twice the padded row borders is 6 it is twice, if I call thrice it become three time the padded size.