I would like to write two functions to load and store binary (types P5 and P6) “*.pnm” image files but I am new in image processing, can anyone help me or give me some resources that I can use. Furthermore, The image structure should contain following:
type : an integer value specifying the image type. Values Gray = 0 and RGB = 1
width : an integer value specifying the width of the image.
height : an integer value specifying the width of the image.
data : a byte array of image data (stored in row major order).
For example following C++ code shows the headers of required functions.
struct Image {int type; // an integer value specifying the image type. Values // Gray = 0 and RGB = 1 int width; // an integer value specifying the width of the image.int height; // an integer value specifying the height of the image. char* data; // an 8-bit array of image data (row major). }; Image loadImage(string fileName); void storeImage(string fileName, Image img);