Executable file is in the ./build/build folder, and there're two additional folders ./inputs and ./outputs for image testing. To run the program, the current working directory should be in the top folder, and run ./build/build/main.exe.
This program can read P2, P3, P5, and P6 formats of PPM images, and can mix different types for image arithmetic.The output is always P6 for the best performance. However, these images must be the same size.
Convert P2 to P6 format.
MyImageClass p2("./inputs/P2.ppm");
p2.save("./outputs/P2_P6.ppm");
it add the two pixels values.
Mandrill + NYU
img = image1 + image2;
My subtraction rule is that when the values is 0, it becomes black.
Mandrill - NYU
img = image1 - image2;
NYU * 3.1
img = image2 * 3.1f;
It average the pixel value for requirement.
Mandrill += NYU
image4 += image5;
Empire State Building -= NYU
image3 -= image2;
Return 8-bit color value at a specific index, RGB and grayscale images have the same 3 values for each pixel. For example, white color is [255,255,255], Image[1] returns the g value for the first pixel which is 255, if you want the b value at the 15th pixel then use Image[15*3+3]
//first pixel value is 164
cout << "first pixel value is " << image1[0] << endl;
Gamma 2
img = image1.gammaCorrection(2.f);
Mandrill(0.85) + NYU(0.15)
img = image1.alphaCompositing(image2, 0.85f);
Only Sobel operator with X+Y Kernels
img = image1.edgeDetection();
Blurring
img = image1.blurring();
Blurring then Sobel operator
img = image1.blurring();
img = img.edgeDetection();
img.save("./outputs/blurring_to_edgeDetection.ppm");