init2
This commit is contained in:
parent
f21cd3abcc
commit
b3fcaf0075
Binary file not shown.
|
@ -0,0 +1,35 @@
|
||||||
|
../images/1.ppm 0.0240894
|
||||||
|
../images/2.ppm 0.0798028
|
||||||
|
../images/3.ppm 0.136535
|
||||||
|
../images/4.ppm 0.248314
|
||||||
|
../images/5.ppm 0.363927
|
||||||
|
../images/6.ppm 0.814739
|
||||||
|
../images/7.ppm 3.20648
|
||||||
|
../images/1.ppm 0.0255179
|
||||||
|
../images/2.ppm 0.082453
|
||||||
|
../images/3.ppm 0.187293
|
||||||
|
../images/4.ppm 0.504723
|
||||||
|
../images/5.ppm 0.421034
|
||||||
|
../images/6.ppm 0.905171
|
||||||
|
../images/7.ppm 4.12279
|
||||||
|
../images/1.ppm 0.0105311
|
||||||
|
../images/2.ppm 0.0422888
|
||||||
|
../images/3.ppm 0.0912897
|
||||||
|
../images/4.ppm 0.204927
|
||||||
|
../images/5.ppm 0.497162
|
||||||
|
../images/6.ppm 0.452158
|
||||||
|
../images/7.ppm 1.66216
|
||||||
|
../images/1.ppm 0.0135349
|
||||||
|
../images/2.ppm 0.0437362
|
||||||
|
../images/3.ppm 0.0821199
|
||||||
|
../images/4.ppm 0.54249
|
||||||
|
../images/5.ppm 0.39126
|
||||||
|
../images/6.ppm 0.555806
|
||||||
|
../images/7.ppm 2.16977
|
||||||
|
../images/1.ppm 0.0217065
|
||||||
|
../images/2.ppm 0.0748607
|
||||||
|
../images/3.ppm 0.174253
|
||||||
|
../images/4.ppm 0.201994
|
||||||
|
../images/5.ppm 0.352959
|
||||||
|
../images/6.ppm 0.497504
|
||||||
|
../images/7.ppm 1.79435
|
|
@ -0,0 +1,26 @@
|
||||||
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
|
pixels = [81000, 308898, 588800, 1164800, 1500000, 3406500, 9262500]
|
||||||
|
read_time = [0.0372315, 0.1104362, 0.162849, 0.3120326, 0.4681494, 0.9840036, 1.665642]
|
||||||
|
smoothened_time = [0.03347448, 0.1221104, 0.2514082, 0.4795412, 0.6044902, 1.1334092, 2.453936]
|
||||||
|
details_time = [0.01907596, 0.0646283, 0.13429812, 0.3404896, 0.4052684, 0.6450756, 2.591112]
|
||||||
|
sharpened_time = [0.02013736, 0.07459558, 0.13045596, 0.2987406, 0.4569202, 0.699245, 3.019178]
|
||||||
|
write_time = [0.010278664, 0.03954574, 0.05814792, 0.1842653, 0.2484992, 0.304828, 1.119439]
|
||||||
|
|
||||||
|
|
||||||
|
plt.figure(figsize=(12, 8))
|
||||||
|
plt.plot(pixels, read_time, marker='o', label='Read Time')
|
||||||
|
plt.plot(pixels, smoothened_time, marker='o', label='Smoothened Time')
|
||||||
|
plt.plot(pixels, details_time, marker='o', label='Details Time')
|
||||||
|
plt.plot(pixels, sharpened_time, marker='o', label='Sharpened Time')
|
||||||
|
plt.plot(pixels, write_time, marker='o', label='Write Time')
|
||||||
|
|
||||||
|
plt.xlabel('Pixels')
|
||||||
|
plt.ylabel('Time (seconds)')
|
||||||
|
plt.title('Pixels vs Time')
|
||||||
|
plt.legend()
|
||||||
|
plt.grid(True)
|
||||||
|
plt.xscale('log')
|
||||||
|
plt.yscale('log')
|
||||||
|
|
||||||
|
plt.show()
|
|
@ -1,6 +1,8 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "libppm.h"
|
#include "libppm.h"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <chrono>
|
||||||
|
#include <fstream>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
@ -15,79 +17,123 @@ struct image_t* S1_smoothen(struct image_t *input_image)
|
||||||
smoother->height = height;
|
smoother->height = height;
|
||||||
smoother->width = width;
|
smoother->width = width;
|
||||||
smoother->image_pixels = new uint8_t**[height];
|
smoother->image_pixels = new uint8_t**[height];
|
||||||
for(int i = 0; i < height; i++)
|
for(int i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
smoother->image_pixels[i] = new uint8_t*[width];
|
smoother->image_pixels[i] = new uint8_t*[width];
|
||||||
for(int j = 0; j < width; j++)
|
for(int j = 0; j < width; j++)
|
||||||
smoother->image_pixels[i][j] = new uint8_t[3];
|
smoother->image_pixels[i][j] = new uint8_t[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 1; i < height-1; i++)
|
for(int i = 1; i < height-1; i++)
|
||||||
|
{
|
||||||
|
for(int j = 1; j < width-1; j++)
|
||||||
{
|
{
|
||||||
for(int j = 1; j < width-1; j++)
|
for(int k = 0; k < 3; k++)
|
||||||
{
|
{
|
||||||
for(int k = 0; k < 3; k++)
|
//image->image_pixels[i][j][k] = val;
|
||||||
{
|
// edge cases
|
||||||
//image->image_pixels[i][j][k] = val;
|
if(i == 0 && j == 0) { // i-1 and j - 1 doesnt exist
|
||||||
//cout << unsigned( input_image->image_pixels[i][j][k]) << endl;
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9 + input_image->image_pixels[i+1][j][k] / 9 + input_image->image_pixels[i+1][j+1][k] / 9);
|
||||||
//break;
|
|
||||||
// edge cases
|
|
||||||
if(i == 0 && j == 0) { // i-1 and j - 1 doesnt exist
|
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9 + input_image->image_pixels[i+1][j][k] / 9 + input_image->image_pixels[i+1][j+1][k] / 9);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if(i == height - 1 && j == 0) { // i+1 and j-1 does not exist
|
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j][k] / 9 + input_image->image_pixels[i-1][j+1][k] / 9+ input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9);
|
|
||||||
}
|
|
||||||
|
|
||||||
else if(i == 0 && j == width - 1) { // i-1 and j+1 does not exist
|
}
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i][j-1][k] / 9 + input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i+1][j-1][k] / 9 + input_image->image_pixels[i+1][j][k] / 9);
|
else if(i == height - 1 && j == 0) { // i+1 and j-1 does not exist
|
||||||
}
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j][k] / 9 + input_image->image_pixels[i-1][j+1][k] / 9+ input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9);
|
||||||
else if(i == height - 1 && j == width - 1) { // i+1 and j+1 does not exist
|
}
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9 + input_image->image_pixels[i-1][j][k] / 9 + input_image->image_pixels[i][j-1][k] / 9 + input_image->image_pixels[i][j][k] / 9);
|
|
||||||
}
|
else if(i == 0 && j == width - 1) { // i-1 and j+1 does not exist
|
||||||
else if (i == 0) { // i - 1 does not exist
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i][j-1][k] / 9 + input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i+1][j-1][k] / 9 + input_image->image_pixels[i+1][j][k] / 9);
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i][j-1][k] / 9 + input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9+ input_image->image_pixels[i+1][j-1][k] / 9+ input_image->image_pixels[i+1][j][k] / 9+ input_image->image_pixels[i+1][j+1][k] / 9);
|
}
|
||||||
}
|
else if(i == height - 1 && j == width - 1) { // i+1 and j+1 does not exist
|
||||||
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9 + input_image->image_pixels[i-1][j][k] / 9 + input_image->image_pixels[i][j-1][k] / 9 + input_image->image_pixels[i][j][k] / 9);
|
||||||
else if(j == 0) { // j -1 does not exist
|
}
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j][k] / 9+ input_image->image_pixels[i-1][j+1][k] / 9+ input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9+ input_image->image_pixels[i+1][j][k] / 9+ input_image->image_pixels[i+1][j+1][k]/ 9);
|
else if (i == 0) { // i - 1 does not exist
|
||||||
}
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i][j-1][k] / 9 + input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9+ input_image->image_pixels[i+1][j-1][k] / 9+ input_image->image_pixels[i+1][j][k] / 9+ input_image->image_pixels[i+1][j+1][k] / 9);
|
||||||
|
|
||||||
else if(i == height - 1) { // i+1 does not exist
|
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9+ input_image->image_pixels[i-1][j][k] / 9+ input_image->image_pixels[i-1][j+1][k] / 9+ input_image->image_pixels[i][j-1][k] / 9+ input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k]/ 9);
|
|
||||||
}
|
|
||||||
else if(j == width - 1) { // j + 1 does not exist
|
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9+ input_image->image_pixels[i-1][j][k] / 9+ input_image->image_pixels[i][j-1][k] / 9+ input_image->image_pixels[i][j][k]/ 9 + input_image->image_pixels[i+1][j-1][k] / 9+ input_image->image_pixels[i+1][j][k] / 9);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9 + input_image->image_pixels[i-1][j][k] / 9 + input_image->image_pixels[i-1][j+1][k]/9 + input_image->image_pixels[i][j-1][k]/9 + input_image->image_pixels[i][j][k] / 9 + input_image->image_pixels[i][j+1][k] / 9 + input_image->image_pixels[i+1][j-1][k] / 9 + input_image->image_pixels[i+1][j][k] / 9 + input_image->image_pixels[i+1][j+1][k] / 9);
|
|
||||||
cout << unsigned(smoother->image_pixels[i][j][k]) << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if(j == 0) { // j -1 does not exist
|
||||||
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j][k] / 9+ input_image->image_pixels[i-1][j+1][k] / 9+ input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k] / 9+ input_image->image_pixels[i+1][j][k] / 9+ input_image->image_pixels[i+1][j+1][k]/ 9);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(i == height - 1) { // i+1 does not exist
|
||||||
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9+ input_image->image_pixels[i-1][j][k] / 9+ input_image->image_pixels[i-1][j+1][k] / 9+ input_image->image_pixels[i][j-1][k] / 9+ input_image->image_pixels[i][j][k] / 9+ input_image->image_pixels[i][j+1][k]/ 9);
|
||||||
|
}
|
||||||
|
else if(j == width - 1) { // j + 1 does not exist
|
||||||
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9+ input_image->image_pixels[i-1][j][k] / 9+ input_image->image_pixels[i][j-1][k] / 9+ input_image->image_pixels[i][j][k]/ 9 + input_image->image_pixels[i+1][j-1][k] / 9+ input_image->image_pixels[i+1][j][k] / 9);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
smoother->image_pixels[i][j][k] = ( input_image->image_pixels[i-1][j-1][k] / 9 + input_image->image_pixels[i-1][j][k] / 9 + input_image->image_pixels[i-1][j+1][k]/9 + input_image->image_pixels[i][j-1][k]/9 + input_image->image_pixels[i][j][k] / 9 + input_image->image_pixels[i][j+1][k] / 9 + input_image->image_pixels[i+1][j-1][k] / 9 + input_image->image_pixels[i+1][j][k] / 9 + input_image->image_pixels[i+1][j+1][k] / 9);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for(int i = 0; i < height; ++i) {
|
|
||||||
break;
|
|
||||||
for(int j = 0; j < width; ++j) {
|
|
||||||
cout << unsigned(smoother->image_pixels[i][j][0]) << "" ;
|
|
||||||
}
|
|
||||||
cout << endl;
|
|
||||||
}
|
|
||||||
return smoother;
|
return smoother;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct image_t* S2_find_details(struct image_t *input_image, struct image_t *smoothened_image)
|
struct image_t* S2_find_details(struct image_t *input_image, struct image_t *smoothened_image)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
int width = input_image->width;
|
||||||
|
int height = input_image->height;
|
||||||
|
|
||||||
|
struct image_t* details = new struct image_t;
|
||||||
|
details->height = height;
|
||||||
|
details->width = width;
|
||||||
|
details->image_pixels = new uint8_t**[height];
|
||||||
|
|
||||||
|
for(int i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
details->image_pixels[i] = new uint8_t*[width];
|
||||||
|
for(int j = 0; j < width; j++)
|
||||||
|
details->image_pixels[i][j] = new uint8_t[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 1; i < height-1; i++)
|
||||||
|
{
|
||||||
|
for(int j = 1; j < width-1; j++)
|
||||||
|
{
|
||||||
|
for(int k = 0; k < 3; k++)
|
||||||
|
{
|
||||||
|
details->image_pixels[i][j][k] = max(0, input_image->image_pixels[i][j][k] - smoothened_image->image_pixels[i][j][k]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return details;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct image_t* S3_sharpen(struct image_t *input_image, struct image_t *details_image)
|
struct image_t* S3_sharpen(struct image_t *input_image, struct image_t *details_image)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return input_image; //TODO remove this line when adding your code
|
int width = input_image->width;
|
||||||
|
int height = input_image->height;
|
||||||
|
|
||||||
|
int a = 1;
|
||||||
|
|
||||||
|
struct image_t* sharp = new struct image_t;
|
||||||
|
sharp->height = height;
|
||||||
|
sharp->width = width;
|
||||||
|
sharp->image_pixels = new uint8_t**[height];
|
||||||
|
|
||||||
|
for(int i = 0; i < height; i++)
|
||||||
|
{
|
||||||
|
sharp->image_pixels[i] = new uint8_t*[width];
|
||||||
|
for(int j = 0; j < width; j++)
|
||||||
|
sharp->image_pixels[i][j] = new uint8_t[3];
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = 1; i < height-1; i++)
|
||||||
|
{
|
||||||
|
for(int j = 1; j < width-1; j++)
|
||||||
|
{
|
||||||
|
for(int k = 0; k < 3; k++)
|
||||||
|
{
|
||||||
|
sharp->image_pixels[i][j][k] = min(255, input_image->image_pixels[i][j][k] + details_image->image_pixels[i][j][k]) * a;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sharp; //TODO remove this line when adding your code
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -98,15 +144,67 @@ int main(int argc, char **argv)
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto startread = chrono::high_resolution_clock::now();
|
||||||
struct image_t *input_image = read_ppm_file(argv[1]);
|
struct image_t *input_image = read_ppm_file(argv[1]);
|
||||||
|
auto endread = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
auto startsmooth = chrono::high_resolution_clock::now();
|
||||||
struct image_t *smoothened_image = S1_smoothen(input_image);
|
struct image_t *smoothened_image = S1_smoothen(input_image);
|
||||||
|
auto endsmooth = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
auto startdetail = chrono::high_resolution_clock::now();
|
||||||
struct image_t *details_image = S2_find_details(input_image, smoothened_image);
|
struct image_t *details_image = S2_find_details(input_image, smoothened_image);
|
||||||
|
auto enddetail = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
auto startsharp = chrono::high_resolution_clock::now();
|
||||||
struct image_t *sharpened_image = S3_sharpen(input_image, details_image);
|
struct image_t *sharpened_image = S3_sharpen(input_image, details_image);
|
||||||
|
auto endsharp = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
write_ppm_file(argv[2], smoothened_image);
|
auto startwrite = chrono::high_resolution_clock::now();
|
||||||
|
write_ppm_file(argv[2], sharpened_image);
|
||||||
|
auto endwrite = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
chrono::duration<double> readduration = endread - startread;
|
||||||
|
chrono::duration<double> smoothduration = endsmooth - startsmooth;
|
||||||
|
chrono::duration<double> detailduration = enddetail - startdetail;
|
||||||
|
chrono::duration<double> sharpduration = endsharp - startsharp;
|
||||||
|
chrono::duration<double> writeduration = endwrite - startwrite;
|
||||||
|
|
||||||
|
|
||||||
|
ofstream logFile("read_times.txt", std::ios_base::app);
|
||||||
|
if (logFile.is_open()) {
|
||||||
|
logFile << argv[1] << " ";
|
||||||
|
logFile << readduration.count() << endl;
|
||||||
|
logFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
logFile.open("smooth_times.txt", std::ios_base::app);
|
||||||
|
if (logFile.is_open()) {
|
||||||
|
logFile << argv[1] << " ";
|
||||||
|
logFile << smoothduration.count() << endl;
|
||||||
|
logFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
logFile.open("detail_times.txt", std::ios_base::app);
|
||||||
|
if (logFile.is_open()) {
|
||||||
|
logFile << argv[1] << " ";
|
||||||
|
logFile << detailduration.count() << endl;
|
||||||
|
logFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
logFile.open("sharp_times.txt", std::ios_base::app);
|
||||||
|
if (logFile.is_open()) {
|
||||||
|
logFile << argv[1] << " ";
|
||||||
|
logFile << sharpduration.count() << endl;
|
||||||
|
logFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
logFile.open("write_times.txt", std::ios_base::app);
|
||||||
|
if (logFile.is_open()) {
|
||||||
|
logFile << argv[1] << " ";
|
||||||
|
logFile << writeduration.count() << endl;
|
||||||
|
logFile.close();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
../images/1.ppm 0.0436004
|
||||||
|
../images/2.ppm 0.200632
|
||||||
|
../images/3.ppm 0.142189
|
||||||
|
../images/4.ppm 0.328569
|
||||||
|
../images/5.ppm 0.584479
|
||||||
|
../images/6.ppm 1.57548
|
||||||
|
../images/7.ppm 1.44286
|
||||||
|
../images/1.ppm 0.0362725
|
||||||
|
../images/2.ppm 0.121128
|
||||||
|
../images/3.ppm 0.199664
|
||||||
|
../images/4.ppm 0.402522
|
||||||
|
../images/5.ppm 0.51656
|
||||||
|
../images/6.ppm 0.831204
|
||||||
|
../images/7.ppm 1.68258
|
||||||
|
../images/1.ppm 0.0502397
|
||||||
|
../images/2.ppm 0.0540259
|
||||||
|
../images/3.ppm 0.104212
|
||||||
|
../images/4.ppm 0.217633
|
||||||
|
../images/5.ppm 0.566316
|
||||||
|
../images/6.ppm 1.06233
|
||||||
|
../images/7.ppm 1.76924
|
||||||
|
../images/1.ppm 0.0191352
|
||||||
|
../images/2.ppm 0.0632993
|
||||||
|
../images/3.ppm 0.0990502
|
||||||
|
../images/4.ppm 0.304179
|
||||||
|
../images/5.ppm 0.306761
|
||||||
|
../images/6.ppm 0.740531
|
||||||
|
../images/7.ppm 1.62881
|
||||||
|
../images/1.ppm 0.0369097
|
||||||
|
../images/2.ppm 0.113096
|
||||||
|
../images/3.ppm 0.26913
|
||||||
|
../images/4.ppm 0.30726
|
||||||
|
../images/5.ppm 0.366631
|
||||||
|
../images/6.ppm 0.711473
|
||||||
|
../images/7.ppm 1.80572
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# List of input and output file pairs
|
||||||
|
input_files=("1" "2" "3" "4" "5" "6" "7")
|
||||||
|
output_files=("output1" "output2" "output3" "output4" "output5" "output6" "output7")
|
||||||
|
|
||||||
|
# Loop through each file pair and run the make command
|
||||||
|
for i in "${!input_files[@]}"
|
||||||
|
do
|
||||||
|
input_file="${input_files[$i]}"
|
||||||
|
output_file="${output_files[$i]}"
|
||||||
|
|
||||||
|
echo "Running make for input: $input_file and output: $output_file"
|
||||||
|
make run-sharpen INPUT="$input_file" OUTPUT="$output_file"
|
||||||
|
|
||||||
|
# Check if make was successful
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Make failed for input: $input_file and output: $output_file"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Make completed successfully for all file pairs."
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
../images/1.ppm 0.0285746
|
||||||
|
../images/2.ppm 0.118526
|
||||||
|
../images/3.ppm 0.133181
|
||||||
|
../images/4.ppm 0.333111
|
||||||
|
../images/5.ppm 0.687696
|
||||||
|
../images/6.ppm 0.919815
|
||||||
|
../images/7.ppm 5.18353
|
||||||
|
../images/1.ppm 0.0278552
|
||||||
|
../images/2.ppm 0.080822
|
||||||
|
../images/3.ppm 0.201076
|
||||||
|
../images/4.ppm 0.509533
|
||||||
|
../images/5.ppm 0.535679
|
||||||
|
../images/6.ppm 0.747966
|
||||||
|
../images/7.ppm 4.45165
|
||||||
|
../images/1.ppm 0.0100292
|
||||||
|
../images/2.ppm 0.0381673
|
||||||
|
../images/3.ppm 0.0739177
|
||||||
|
../images/4.ppm 0.223357
|
||||||
|
../images/5.ppm 0.433985
|
||||||
|
../images/6.ppm 0.450129
|
||||||
|
../images/7.ppm 1.67468
|
||||||
|
../images/1.ppm 0.0115579
|
||||||
|
../images/2.ppm 0.040362
|
||||||
|
../images/3.ppm 0.0973441
|
||||||
|
../images/4.ppm 0.257049
|
||||||
|
../images/5.ppm 0.231088
|
||||||
|
../images/6.ppm 0.573983
|
||||||
|
../images/7.ppm 2.23737
|
||||||
|
../images/1.ppm 0.0226699
|
||||||
|
../images/2.ppm 0.0941006
|
||||||
|
../images/3.ppm 0.146761
|
||||||
|
../images/4.ppm 0.170653
|
||||||
|
../images/5.ppm 0.396153
|
||||||
|
../images/6.ppm 0.804332
|
||||||
|
../images/7.ppm 2.54863
|
|
@ -0,0 +1,35 @@
|
||||||
|
../images/1.ppm 0.0422791
|
||||||
|
../images/2.ppm 0.118747
|
||||||
|
../images/3.ppm 0.26533
|
||||||
|
../images/4.ppm 0.377423
|
||||||
|
../images/5.ppm 0.673011
|
||||||
|
../images/6.ppm 1.36309
|
||||||
|
../images/7.ppm 2.34904
|
||||||
|
../images/1.ppm 0.0396053
|
||||||
|
../images/2.ppm 0.14362
|
||||||
|
../images/3.ppm 0.398949
|
||||||
|
../images/4.ppm 0.59141
|
||||||
|
../images/5.ppm 0.730647
|
||||||
|
../images/6.ppm 0.869892
|
||||||
|
../images/7.ppm 2.32653
|
||||||
|
../images/1.ppm 0.0165813
|
||||||
|
../images/2.ppm 0.102202
|
||||||
|
../images/3.ppm 0.143081
|
||||||
|
../images/4.ppm 0.43276
|
||||||
|
../images/5.ppm 0.646602
|
||||||
|
../images/6.ppm 1.36732
|
||||||
|
../images/7.ppm 2.33917
|
||||||
|
../images/1.ppm 0.0341145
|
||||||
|
../images/2.ppm 0.079444
|
||||||
|
../images/3.ppm 0.163173
|
||||||
|
../images/4.ppm 0.501014
|
||||||
|
../images/5.ppm 0.52402
|
||||||
|
../images/6.ppm 1.03143
|
||||||
|
../images/7.ppm 2.75437
|
||||||
|
../images/1.ppm 0.0347922
|
||||||
|
../images/2.ppm 0.166539
|
||||||
|
../images/3.ppm 0.287508
|
||||||
|
../images/4.ppm 0.495099
|
||||||
|
../images/5.ppm 0.448171
|
||||||
|
../images/6.ppm 1.03631
|
||||||
|
../images/7.ppm 2.50061
|
|
@ -0,0 +1,26 @@
|
||||||
|
import os
|
||||||
|
from collections import defaultdict
|
||||||
|
|
||||||
|
|
||||||
|
file_names = ["read_times.txt", "sharp_times.txt", "smooth_times.txt", "detail_times.txt", "write_times.txt"]
|
||||||
|
|
||||||
|
|
||||||
|
def calculate_average_times(file_path):
|
||||||
|
times = defaultdict(list)
|
||||||
|
with open(file_path, 'r') as file:
|
||||||
|
for line in file:
|
||||||
|
parts = line.strip().split()
|
||||||
|
if len(parts) == 2:
|
||||||
|
image, time = parts
|
||||||
|
times[image].append(float(time))
|
||||||
|
|
||||||
|
average_times = {image: sum(time_list) / len(time_list) for image, time_list in times.items()}
|
||||||
|
return average_times
|
||||||
|
|
||||||
|
|
||||||
|
for file_name in file_names:
|
||||||
|
average_times = calculate_average_times(file_name)
|
||||||
|
print(f"Averages for {file_name}:")
|
||||||
|
for image, avg_time in sorted(average_times.items()):
|
||||||
|
print(f"{image}: {avg_time}")
|
||||||
|
print()
|
|
@ -0,0 +1,35 @@
|
||||||
|
../images/1.ppm 0.0129698
|
||||||
|
../images/2.ppm 0.0731423
|
||||||
|
../images/3.ppm 0.0586685
|
||||||
|
../images/4.ppm 0.391597
|
||||||
|
../images/5.ppm 0.441327
|
||||||
|
../images/6.ppm 0.362438
|
||||||
|
../images/7.ppm 1.01397
|
||||||
|
../images/1.ppm 0.0104656
|
||||||
|
../images/2.ppm 0.0389386
|
||||||
|
../images/3.ppm 0.102665
|
||||||
|
../images/4.ppm 0.229473
|
||||||
|
../images/5.ppm 0.370227
|
||||||
|
../images/6.ppm 0.359944
|
||||||
|
../images/7.ppm 1.65748
|
||||||
|
../images/1.ppm 0.00587877
|
||||||
|
../images/2.ppm 0.0390165
|
||||||
|
../images/3.ppm 0.0345854
|
||||||
|
../images/4.ppm 0.0927168
|
||||||
|
../images/5.ppm 0.184159
|
||||||
|
../images/6.ppm 0.231483
|
||||||
|
../images/7.ppm 1.05401
|
||||||
|
../images/1.ppm 0.00660735
|
||||||
|
../images/2.ppm 0.0207068
|
||||||
|
../images/3.ppm 0.0402921
|
||||||
|
../images/4.ppm 0.0976897
|
||||||
|
../images/5.ppm 0.119102
|
||||||
|
../images/6.ppm 0.249217
|
||||||
|
../images/7.ppm 0.822115
|
||||||
|
../images/1.ppm 0.0164718
|
||||||
|
../images/2.ppm 0.0259248
|
||||||
|
../images/3.ppm 0.0545286
|
||||||
|
../images/4.ppm 0.10985
|
||||||
|
../images/5.ppm 0.127681
|
||||||
|
../images/6.ppm 0.322058
|
||||||
|
../images/7.ppm 1.0496
|
Loading…
Reference in New Issue