51 lines
1.2 KiB
C++
51 lines
1.2 KiB
C++
// magick malenia.jpg -define ppm:format=raw test.ppm
|
|
#include <bits/stdc++.h>
|
|
#include "libImg.h"
|
|
using namespace std;
|
|
|
|
const int WIDTH = 16 * 60;
|
|
const int HEIGHT = 9 * 60;
|
|
|
|
int main () {
|
|
/*
|
|
image matrix = randomImage(WIDTH, HEIGHT);
|
|
|
|
//BWimage(matrix, 0.70);
|
|
Grayimage(matrix);
|
|
|
|
if (!save("output.ppm", matrix, WIDTH, HEIGHT)) {
|
|
return -1;
|
|
}
|
|
|
|
|
|
int height, width;
|
|
image caricato = load("output.ppm", width, height);
|
|
|
|
if(images_equal(matrix, caricato)){
|
|
std::cout << "Cazzo funziona"<<endl;
|
|
}else {
|
|
std::cout << "MMMMMMMMM" <<endl;
|
|
}
|
|
|
|
std::cout << "Matrice: " << HEIGHT << "x" << WIDTH << "\n";
|
|
std::cout << "Caricato: " << height << "x" << width << "\n";
|
|
std::cout << "Pixel [0][0] matrice: "
|
|
<< (int)matrix[0][0].r << " " << (int)matrix[0][0].g << " " << (int)matrix[0][0].b << "\n";
|
|
std::cout << "Pixel [0][0] caricato: "
|
|
<< (int)caricato[0][0].r << " " << (int)caricato[0][0].g << " " << (int)caricato[0][0].b << "\n";
|
|
*/
|
|
int heightC, widthC;
|
|
image carica = load("test.ppm", widthC, heightC);
|
|
//Grayimage(carica);
|
|
//float numerone = BWAimage(carica);
|
|
//invertImage(carica);
|
|
if(!save("testOutput.ppm", carica)){
|
|
return -1;
|
|
}
|
|
|
|
//cout << "Numerone finale: " << numerone <<endl;
|
|
|
|
|
|
return 0;
|
|
}
|