/* Copyright (c) 2001 S.E. Grigorescu */ #include <iostream.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <tip.h> // Example program for the "Contrast" function. // // Usage: // test_contrast <input_image> // int main(int argc, char *argv[]) { // Test for the correct number of arguments in the command line. if (argc != 2) { cout << "Usage: " << argv[0] << " <input_image>" << endl; exit(0); } // Read an image from the file specified by "argv[1]" and display it. Image< float > im1; im1.readImage(argv[1]); im1.setName("test_image"); cout << "Min: " << im1.min() << "\t" << "Max: " << im1.max() << endl; im1.showImage(); // Do a contrast stretching in the range [10, 100]. Image< float > im2; Contrast(im1, 10, 100, im2); im2.setName("test_image_2"); cout << "Min: " << im2.min() << "\t" << "Max: " << im2.max() << endl; im2.showImage(); // Do a contrast stretching from the range [80, 200] to the range [10, 100]. Image< float > im3; Contrast(im1, 10, 100, 80, 200, im3); im3.setName("test_image_3"); cout << "Min: " << im3.min() << "\t" << "Max: " << im3.max() << endl; im3.showImage(); char l; cin >> l; im1.closeWindow(); im2.closeWindow(); im3.closeWindow(); return(1); }