ppm"); Image *img3 = new Image(3264, 2448); *img3 = readPPM("Images/ImageStacker_set1/IMG_3.ppm"); Image *img4 = new Image(3264, 2448); *img4 = readPPM("Images/ImageStacker_set1/IMG_4.ppm"); Image *img5 = new Image(3264, 2448); *img5 = readPPM("Images/ImageStacker_set1/IMG_5.ppm"); Image *img6 = new Image(3264, 2448); *img6 = readPPM("Images/ImageStacker_set1/IMG_6.ppm"); Image *img7 = new Image(3264, 2448); *img7 = readPPM("Images/ImageStacker_set1/IMG_7.
ppm"); Image *img8 = new Image(3264, 2448); *img8 = readPPM("Images/ImageStacker_set1/IMG_8.ppm"); Image *img12 = new Image(3264, 2448); *img12 = readPPM("Images/ImageStacker_set1/IMG_9.ppm"); Image *img9 = new Image(3264, 2448); *img9 = readPPM("Images/ImageStacker_set1/IMG_10.ppm"); Image *img10 = new Image(3264, 2448); *img10 = readPPM("Images/ImageStacker_set1/IMG_12.ppm"); Image *img11 = new Image(3264, 2448); *img11 = readPPM("Images/ImageStacker_set1/IMG_11.
ppm"); Image *img13 = new Image(3264, 2448); *img13 = readPPM("Images/ImageStacker_set1/IMG_13.ppm"); //You can access the individual pixel data //This accesses and writes out the r, g, b pixel values for the first pixel //Values are multiplied by 255 as they are 'clamped' between 0 and 1 cout<< "image 1 colour frequency (in respect to red, green, blue)"<< std::endl; cout << (img1->pixels0.r)*255 << std::endl; cout << (img1->pixels0.g)*255 << std::endl; cout << (img1->pixels0.b)*255 << std::endl; cout<< "image 2 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img2->pixels0.
r)*255 << std::endl; cout << (img2->pixels0.g)*255 << std::endl; cout << (img2->pixels0.b)*255 << std::endl; cout<< "image 3 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img3->pixels0.r)*255 << std::endl; cout << (img3->pixels0.g)*255 << std::endl; cout << (img3->pixels0.
b)*255 << std::endl; cout<< "image 4 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img4->pixels0.r)*255 << std::endl; cout << (img4->pixels0.g)*255 << std::endl; cout << (img4->pixels0.b)*255 << std::endl; cout<< "image 5 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img5->pixels0.r)*255 << std::endl; cout << (img5->pixels0.g)*255 << std::endl; cout << (img5->pixels0.
b)*255 << std::endl; cout<< "image 6 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img6->pixels0.r)*255 << std::endl; cout << (img6->pixels0.g)*255 << std::endl; cout << (img6->pixels0.b)*255 << std::endl; cout<< "image 7 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img7->pixels0.
r)*255 << std::endl; cout << (img7->pixels0.g)*255 << std::endl; cout << (img3->pixels0.b)*255 << std::endl; cout<< "image 8 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img8->pixels0.r)*255 << std::endl; cout << (img8->pixels0.g)*255 << std::endl; cout << (img8->pixels0.
b)*255 << std::endl; cout<< "image 9 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img9->pixels0.r)*255 << std::endl; cout << (img9->pixels0.g)*255 << std::endl; cout << (img9->pixels0.b)*255 << std::endl; cout<< "image 10 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img10->pixels0.
r)*255 << std::endl; cout << (img10->pixels0.g)*255 << std::endl; cout << (img10->pixels0.b)*255 << std::endl; cout<< "image 11 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img11->pixels0.r)*255 << std::endl; cout << (img11->pixels0.g)*255 << std::endl; cout << (img11->pixels0.b)*255 << std::endl; cout<< "image 12 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img12->pixels0.
r)*255 << std::endl; cout << (img12->pixels0.g)*255 << std::endl; cout << (img12->pixels0.b)*255 << std::endl; cout<< "image 13 colour frequency (in respect to red, green, blue"<< std::endl; cout << (img13->pixels0.r)*255 << std::endl; cout << (img13->pixels0.
g)*255 << std::endl; cout << (img13->pixels0.b)*255 << std::endl; vector
push_back(*img3); set1.push_back(*img4); set1.push_back(*img5); set1.push_back(*img6); set1.push_back(*img7); set1.
push_back(*img8); set1.push_back(*img9); set1.push_back(*img10); set1.push_back(*img11); set1.
push_back(*img12); set1.push_back(*img13); long begin,end; ifstream myfile ("main.cpp"); begin = myfile.tellg(); myfile.
seekg (0, ios::end); end = myfile.tellg(); myfile.close(); cout << "File size is: " << (end-begin) << " bytes."; Image mean = Image(3264,2448); mean = CalculateMean(set1); writePPM(mean, "Set of images have been mean blended"); Image med = Image(3264,2448); med = CalculateMedian(set1); writePPM(med, "images median blended"); Image sigmaImage = Image(3264,2448); sigmaImage = CalculateSigmaMean(set1); writePPM(sigmaImage, "set of images that have been sigma clipped");}Image CalculateMean(vector
size(); files++) { rgb += set1files.pixelspixel; } mean->pixelspixel.r = rgb.r/13; mean->pixelspixel.g = rgb.
g/13; mean->pixelspixel.b = rgb.b/13; rgb = Image::Rgb(); } return *mean; }Image CalculateMedian(vector
size(); files++) { rgb += set1files.pixelspixel; } med->pixelspixel.r = rgb.r /(13/2); med->pixelspixel.g = rgb.
g /(13/2); med->pixelspixel.b = rgb.b /(13/2); rgb = Image::Rgb(); } return *medImage;}Image CalculateSigmaMean(vector
pixelspixel; } sig->pixelspixel.r = rgb.r /(13*2); sig->pixelspixel.g = rgb.g /(13*2); sig->pixelspixel.b = rgb.b /(13*2); rgb = Image::Rgb(); } return *sigmaImage;}//Read ppm files into the codeImage readPPM(const char *filename){ cout << "Reading image ..." << std::endl; ifstream ifs; ifs.open(filename, std::ios::binary); Image src; try { if (ifs.fail()) { throw("Can't open the input file - is it named correctly/is it in the right directory?"); } string header; int w, h, b; ifs >> header; if (strcmp(header.c_str(), "P6") != 0) throw("Can't read the input file - is it in binary format (Has P6 in the header)?"); ifs >> w >> h >> b; src.w = w; src.h = h; //std::cout << w << " " << h << std::endl; src.pixels = new Image::Rgbw * h; // this is throw an exception if bad_alloc ifs.ignore(255, ''); // skip empty lines in necessary until we get to the binary data unsigned char pix3; // read each pixel one by one and convert bytes to floats for (int i = 0; i < w * h; ++i) { ifs.read(reinterpret_cast