Like Tree2Likes
  • 1 Post By Salem
  • 1 Post By Salem

error: expression must have pointer-to-object type

This is a discussion on error: expression must have pointer-to-object type within the C Programming forums, part of the General Programming Boards category; I am passing two 2D arrays, along with other variables, from the main() function to a function defined as: Code: ...

  1. #1
    Registered User BarakaMaiseli's Avatar
    Join Date
    Sep 2013
    Posts
    4

    Lightbulb error: expression must have pointer-to-object type

    I am passing two 2D arrays, along with other variables, from the main() function to a function defined as:
    Code:
    float conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage,float kernel[][5], int image[][15])
    {
    ..........
    ..........
    float imageConvolved;
    float sum;
    int kernelSize=5;
    imageConvolved[i-kernelSize/2][j-kernelSize/2] = sum;
    return(imageConvolved);
    }
    The main function is defined as:

    Code:
    int main()
    {
    float gauss[5][5]={
                              {.........},
                              {.........},
                               ..........
                              {.........}
                             };
    int img[15][15]={
                           {.......},
                           {.......},
                            .........
                           {.......}
                          };
    int rowsK = 5,colsK = 5,rowsI = 15,colsI = 15;
    float result;
    result = conv2D(rowsK, colsK, rowsI, colsI, gauss, img);
    return 0;
    }
    When I compile this code using CCStudio V3.3 I get an error " error: expression must have pointer-to-object type" and a warning "warning: variable "result" was set but never used". The error points to the function conv2D in the line:
    imageConvolved[i-kernelSize/2][j-kernelSize/2] = sum.

    I have been struggling through the knowledge I am having in C programming and also through various posts online but none of the post has solved my problem. I tried using the GCC v4.7.3 compiler in UBUNTU but I am getting an error in the same line, the error says:
    "error: subscripted value is neither array nor pointer nor vector"
    Please, if someone has a link or explanations to the sources of these errors in my code kindly share it.

    The complete code is:
    Code:
    #include<stdio.h>
    #include<math.h>
    
    float conv2D(int, int, int, int,float kernel[][5], int image[][15]);//Function Prototype definition
    
    float conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage,float kernel[][5], int image[][15])
    {
    int kernelSize;//This variable represents the size of the Gaussian kernel
    int i; //variable which controls the rows of an image
    int j; //variable which controls the columns of an image
    int ii; //variable which controls the rows of the kernel
    int jj;//variable which controls the columns of the kernel
    float sum;//variable that holds the result of convolution for a particular pixel of an image
    float imageConvolved;//Result of an image convolved by a Gaussian kernel
    int imagePixel;
    float kernelPixel;
    kernelSize = colsKernel;/*Since we consider a square kernel, then rowsKernel=colsKernel, which implies that the size of the kernel (kernelSize) equals either of these two variables (that is, kernelSize=colsKernel=rowsKernel)*/
    for (i =  kernelSize/ 2; i < rowsImage - kernelSize / 2; i++) // perform iteration through the rows of an image
    {
      for (j = kernelSize / 2; j < colsImage - kernelSize / 2; j++) // perform iteration through the columns of an image
      {
        sum = 0; /*Initializing the accumulator. This variable will finally contain the convolution result for a particular pixel*/
        for (ii = - kernelSize / 2; ii <= kernelSize / 2; ii++) // perform iteration through the rows of a kernel
        {
          for (jj = - kernelSize / 2; jj <= kernelSize / 2; jj++) //perform iteration through the columns of a kernel
          {
            imagePixel = image[i + ii][j +jj];
            kernelPixel = kernel[ii + kernelSize / 2][jj + kernelSize / 2];
    
            sum += imagePixel * kernelPixel;
          }
        }
        imageConvolved[i-kernelSize/2][j-kernelSize/2] = sum; 
      }
    }
    return(imageConvolved);// convolved image
    }
    
    int main()
    {
    float gauss[][5]={
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1}
               };
    int img[][15]={
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
              };
    int rowsK = 5,colsK = 5,rowsI = 15,colsI = 15;
    float result;
    result = conv2D(rowsK, colsK, rowsI, colsI, gauss, img);
    return 0;
    }
    Last edited by BarakaMaiseli; 09-29-2013 at 10:38 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,852
    > float conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage,float kernel[][5], int image[][15])
    You're returning a scalar value.

    > float imageConvolved;//Result of an image convolved by a Gaussian kernel
    You're declaring a scalar value.

    > imageConvolved[i-kernelSize/2][j-kernelSize/2] = sum;
    Now you're trying to make it into an array of some sort (this won't work).

    > return(imageConvolved);// convolved image
    And finally, you're returning a scalar.

    Now, if you really want to return an array, the best (easiest) thing to do is this.
    void conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage,float kernel[][5], int image[][15], imageConvolved[][5])
    Then pass a result array from main, in the same way you pass existing array parameters.
    BarakaMaiseli likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User BarakaMaiseli's Avatar
    Join Date
    Sep 2013
    Posts
    4
    Thank you for your response.
    I have tried to follow the comments, but I am still getting similar errors. Below is the code after I did follow the comments:
    Code:
    #include<stdio.h>
    #include<math.h>
    
    float conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage, float kernel[][5], int image[][15], float imageConvolved[][11]);//Function Prototype definition
    
    float conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage, float kernel[][5], int image[][15], float imageConvolved[][11])
    {
    int kernelSize;//This variable represents the size of the Gaussian kernel
    int i; //variable which controls the rows of an image
    int j; //variable which controls the columns of an image
    int ii; //variable which controls the rows of the kernel
    int jj;//variable which controls the columns of the kernel
    float sum;//variable that holds the result of convolution for a particular pixel of an image
    int imagePixel;
    float kernelPixel;
    kernelSize = colsKernel;/*Since we consider a square kernel, then rowsKernel=colsKernel, which implies that the size of the                 kernel (kernelSize) equals either of these two variables (that is, kernelSize=colsKernel=rowsKernel)*/
    for (i =  kernelSize/ 2; i < rowsImage - kernelSize / 2; i++) // perform iteration through the rows of an image
    {
      for (j = kernelSize / 2; j < colsImage - kernelSize / 2; j++) // perform iteration through the columns of an image
      {
        sum = 0; /*Initializing the accumulator. This variable will finally contain the convolution result for a particular pixel*/
        for (ii = - kernelSize / 2; ii <= kernelSize / 2; ii++) // perform iteration through the rows of a kernel
        {
          for (jj = - kernelSize / 2; jj <= kernelSize / 2; jj++) //perform iteration through the columns of a kernel
          {
            imagePixel = image[i + ii][j +jj];
            kernelPixel = kernel[ii + kernelSize / 2][jj + kernelSize / 2];
    
            sum += imagePixel * kernelPixel;
          }
        }
        imageConvolved[i-kernelSize/2][j-kernelSize/2] = sum; 
      }
    }
    return(imageConvolved);// convolved image
    }
    
    int main()
    {
    float gauss[][5]={
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1}
               };
    int img[][15]={
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
              };
    int rowsK = 5,colsK = 5,rowsI = 15,colsI = 15;
    float result[11][11];
    float Iconv;
    Iconv = conv2D(rowsK, colsK, rowsI, colsI, gauss, img, result);
    return 0;
    }
    The error the CCS compiler reports is:
    "convolution.c", line 39: error: return value type does not match the function type
    "convolution.c", line 70: warning: variable "Iconv" was set but never used


    The lines listed points to the function conv2D in the line return(imageConvolved);// convolved image
    and the main() function in the line float Iconv;, respectively.

    If I declare the variable Iconv in the main() function as an array, that is float Iconv[11][11];, the warning (that variable "Iconv" was set but never used) disappear, but I am getting another two errors as a result:

    "convolution.c", line 39: error: return value type does not match the function type
    "convolution.c", line 71: error: expression must be a modifiable lvalue

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    6,671
    An array is not magically converted to a single value, or vice versa. That explains the errors. imageConvolved is specifed as a 2D array (in the function arguments). The function returns a single float value. Hence the complaint about return value type not matching function type (and the error you get when you change IConv to be an array - the compiler believes you are trying to store a single float value as an array).

    The warning is simply means you assign the return value from the function to a variable, but then never subsequently use that variable.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Sunshine, and read this, this, and this before posting again.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,852
    So if you make the function return void, remove the return statement and the return result assignments in main, does it work?

    The whole image result will be in your 11x11 result array.
    BarakaMaiseli likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User BarakaMaiseli's Avatar
    Join Date
    Sep 2013
    Posts
    4
    Thanks for the comments. Very useful...! It is now working (in the GCC compiler under UBUNTU environment), and below is a complete code:
    Code:
    //#include"standard_library.h"
    //#include"SuperResolution.h"
    
    #include<stdio.h>
    #include<math.h>
    
    void conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage, float kernel[][5], int image[][15], float res[][11]);//Function Prototype definition
    
    void conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage, float kernel[][5], int image[][15], float res[][11])
    {
    int kernelSize;//This variable represents the size of the Gaussian kernel
    int i; //variable which controls the rows of an image
    int j; //variable which controls the columns of an image
    int ii; //variable which controls the rows of the kernel
    int jj;//variable which controls the columns of the kernel
    float sum;//variable that holds the result of convolution for a particular pixel of an image
    //float imageConvolved;//Result of an image convolved by a Gaussian kernel
    int imagePixel;
    float kernelPixel;
    //float imageConvolved[11][11];
    kernelSize = colsKernel;/*Since we consider a square kernel, then rowsKernel=colsKernel, which implies that the size of the                 kernel (kernelSize) equals either of these two variables (that is, kernelSize=colsKernel=rowsKernel)*/
    for (i =  kernelSize/ 2; i < rowsImage - kernelSize / 2; i++) // perform iteration through the rows of an image
    {
      for (j = kernelSize / 2; j < colsImage - kernelSize / 2; j++) // perform iteration through the columns of an image
      {
        sum = 0; /*Initializing the accumulator. This variable will finally contain the convolution result for a particular pixel*/
        for (ii = - kernelSize / 2; ii <= kernelSize / 2; ii++) // perform iteration through the rows of a kernel
        {
          for (jj = - kernelSize / 2; jj <= kernelSize / 2; jj++) //perform iteration through the columns of a kernel
          {
            imagePixel = image[i + ii][j +jj];
            kernelPixel = kernel[ii + kernelSize / 2][jj + kernelSize / 2];
    
            sum += imagePixel * kernelPixel;
          }
        }
        res[i-kernelSize/2][j-kernelSize/2] = sum; 
      }
    }
    //res=imageConvolved;
    //return(imageConvolved);// convolved image
    }
    
    int main()
    {
    float gauss[][5]={
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1},
                {1, 1, 1, 1, 1}
               };
    int img[][15]={
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
              };
    int rowsK = 5,colsK = 5,rowsI = 15,colsI = 15;
    float res[11][11];
    //float Iconv[11][11];
    int i,j,m,n;
    for(i=0;i<11;i++)
    for(j=0;j<11;j++)
    res[i][j]=0.0;
    conv2D(rowsK, colsK, rowsI, colsI, gauss, img,res);
    for(m=0;m<11;m++)
    for(n=0;n<11;n++)
    {
    printf("%4.0f",res[m][n]);
    if(n==10)
    printf("\n");
    }
    return 0;
    }
    The result when compiled and run is:
    Name:  convolution.png
Views: 1237
Size:  17.6 KB
    This code explains the convolution of an image with a kernel. The indicated matrices, however, can be replaced by real matrices (The convolution kernel and image).

    In the CCStudio V3.3, however, I am still getting some errors when I compile, and I am still struggling on getting a way forward. Here are the errors in the CCStudio:
    ------------------------ super_resolution.pjt - Debug ------------------------
    [convolution.c] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -g -pdsw225 -fr"C:/Documents and Settings/Administrator/Desktop/testPrograms/super_resolution/Debug" -d"_DEBUG" -mv6400 -@"Debug.lkf" "convolution.c"

    Warning: The project has no cmd file while the Text Linker is selected
    [Linking...] "C:\CCStudio_v3.3\C6000\cgtools\bin\cl6x" -@"Debug.lkf"
    <Linking>
    >> warning: entry point symbol _c_int00 undefined

    undefined first referenced
    symbol in file
    --------- ----------------
    __mpyf C:\\Documents and Settings\\Administrator\\Desktop\\testPrograms\\su per_resolution\\Debug\\convolution.obj
    __addf C:\\Documents and Settings\\Administrator\\Desktop\\testPrograms\\su per_resolution\\Debug\\convolution.obj
    __strasgi C:\\Documents and Settings\\Administrator\\Desktop\\testPrograms\\su per_resolution\\Debug\\convolution.obj
    __fltif C:\\Documents and Settings\\Administrator\\Desktop\\testPrograms\\su per_resolution\\Debug\\convolution.obj
    >> error: symbol referencing errors - './Debug/super_resolution.out' not built

    >> Compilation failure

    Build Complete,
    2 Errors, 2 Warnings, 0 Remarks.

    I am thinking that I the problem may be caused by the settings of my compiler, or something is wrong with the linking of the files during the compilation process.

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,852
    > In the CCStudio V3.3, however, I am still getting some errors when I compile, and I am still struggling on getting a way forward. Here are the errors in the CCStudio:
    Those are link errors, not compile errors.

    Since your code uses just standard C, the easy thing would be to just create a new console project and copy/paste your code into it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User BarakaMaiseli's Avatar
    Join Date
    Sep 2013
    Posts
    4
    Great...!! Now it works, and it can also be used for anyone who would like to convolve 2D matrices. A slight modification can be done if one needs to convolve an image with a Gaussian Kernel, since the given matrices a constant (used for testing purposes). My next movie is to perform the convolution using real data.
    Here are the source codes:

    main.c
    Code:
    #include"standard_library.h"
    #include"SuperResolution.h"
    
    int main()
    {
    int rowsK = 5,colsK = 5,rowsI = 15,colsI = 15;
    float res[11][11];
    int i,j,m,n;
    for(i=0;i<11;i++)
    for(j=0;j<11;j++)
    res[i][j]=0.0;
    conv2D(rowsK, colsK, rowsI, colsI, gauss, img,res);
    for(m=0;m<11;m++)
    for(n=0;n<11;n++)
    {
    printf("%4.0f",res[m][n]);
    if(n==10)
    printf("\n");
    }
    return 0;
    }
    conv.c
    Code:
    void conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage, float kernel[][5], int image[][15], float res[][11])
    {
    int kernelSize;//This variable represents the size of the Gaussian kernel
    int i; //variable which controls the rows of an image
    int j; //variable which controls the columns of an image
    int ii; //variable which controls the rows of the kernel
    int jj;//variable which controls the columns of the kernel
    float sum;//variable that holds the result of convolution for a particular pixel of an image
    //float imageConvolved;//Result of an image convolved by a Gaussian kernel
    int imagePixel;
    float kernelPixel;
    //float imageConvolved[11][11];
    kernelSize = colsKernel;/*Since we consider a square kernel, then rowsKernel=colsKernel, which implies that the size of the                 kernel (kernelSize) equals either of these two variables (that is, kernelSize=colsKernel=rowsKernel)*/
    for (i =  kernelSize/ 2; i < rowsImage - kernelSize / 2; i++) // perform iteration through the rows of an image
    {
      for (j = kernelSize / 2; j < colsImage - kernelSize / 2; j++) // perform iteration through the columns of an image
      {
        sum = 0; /*Initializing the accumulator. This variable will finally contain the convolution result for a particular pixel*/
        for (ii = - kernelSize / 2; ii <= kernelSize / 2; ii++) // perform iteration through the rows of a kernel
        {
          for (jj = - kernelSize / 2; jj <= kernelSize / 2; jj++) //perform iteration through the columns of a kernel
          {
            imagePixel = image[i + ii][j +jj];
            kernelPixel = kernel[ii + kernelSize / 2][jj + kernelSize / 2];
    
            sum += imagePixel * kernelPixel;
          }
        }
        res[i-kernelSize/2][j-kernelSize/2] = sum; 
      }
    }
    }
    SuperResolution.h
    Code:
    #ifndef _SUPERRESOLUTION_H
    #define _SUPERRESOLUTION_H
    
    void conv2D(int rowsKernel, int colsKernel, int rowsImage, int colsImage, float kernel[][5], int image[][15], float res[][11]);//Function Prototype definition
    
    float gauss[][5]={
                {1, 2, 4, 2, 1},
                {2, 1, 1, 1, 2},
                {4, 8, 8, 8, 4},
                {2, 1, 1, 1, 2},
                {1, 2, 4, 2, 1}
               };
    int img[][15]={
               {1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1},
               {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
              };
    #endif
    standard_library.h
    Code:
    #ifndef _STANDARD_LIBRARY_H
    #define _STANDARD_LIBRARY_H
    
    //Include standard header files
    #include<math.h>
    #include<stdio.h>
    #endif
    RESULT
    Name:  RESULT.png
Views: 1206
Size:  22.1 KB

    Note that the result of convolution is not the same size as the original convoluting matrix because of cropping at the boundaries. This is one way of implementing convolution, although there are other ways which keep the two matrices (convoluting matrix and result) the same in dimension.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Expression-must-have-pointer-to-object-type
    By bos1234 in forum C Programming
    Replies: 1
    Last Post: 05-29-2012, 08:59 PM
  2. error: expression must have pointer-to-object type
    By MRZ1101 in forum C Programming
    Replies: 3
    Last Post: 02-29-2012, 10:05 AM
  3. Expression must have a pointer type
    By ArunS in forum C Programming
    Replies: 2
    Last Post: 06-23-2011, 04:27 AM
  4. Data type mismatch in criteria expression ERROR
    By Aga^^ in forum C# Programming
    Replies: 2
    Last Post: 02-11-2009, 01:21 AM
  5. Issues with expression must be a point to an object error:
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 02-22-2002, 04:14 PM

Tags for this Thread


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21