If we use the cvSaveImage to save images in .pgm file, we will see the size of the image is very big...That's because it's plain(P2) but not raw(P5) format...
If you want to save image in pgm which is raw format, then you should do following:
1, find the grfmt_pxm.cpp under the opencv software package. In 332 line you will see GrFmtPxMWriter::WriteImage()
3, set IsBinary from false to true.
4,rebuild the library...\
how to rebuild the library..
I dont know too much about this..
But you can reinstall opencv...(how to reinstall it??? if you dont know , please google)
then you will get the .pgm image file in raw format...