Hello, for my assignment, I have to implement 2D Gaussian convolution using 1D Gaussian masks. I have two pgm files. I know the theory but I do not know where to start and how to deal with pixels. can anybody help me?

If you want to achieve this without using special libraries.The way I think it should be done is by, converting the pgm files into normal text files. You should be aware of the format of pgm files. The new text file will be all the pixels of the image. Then read these numbers into matrix and apply the gaussian filter matrix. The resulting file will be converted back to pgm file.

I am saying this from experience, I have written programs for image processing but unfortunately they are in Matlab.

I want to use opencv for this. so do i need to convert file?

No, if you have a program which can read a pgm file and you can obtain each pixel of your pgm image its all good. The only thing you have to do is to get the formula for the 2d convolution and make an algorithm for it.

I would suggest after obtaining the pixel values from your pgm image, just apply 1D Gaussian formula on those values and view the result. If your 1D Gaussian filter works then convolution should be straight forward.

I don't understand how to obtain each pixel of your pgm image and how to treat it. i had not done image programming before.