00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include <time.h>
00035 #include <iostream>
00036 #include "Image.h"
00037 #include "Filters.h"
00038 #include "cimg_dependent.h"
00039
00040
00041 using namespace lsseg;
00042 using namespace std;
00043
00044
00045
00046 int main(int varnum, char** vararg)
00047 {
00048 if (varnum < 2) {
00049 cerr << endl;
00050 cerr << "This program takes as input an image, and computes and display its structure tensor. " << endl;
00051 cerr << "First, the original image will be displayed. Then, a color image will be shown, where " << endl;
00052 cerr << "the RGB values represent the three different components of the structure tensor. Then, " << endl;
00053 cerr << "each channel will be shown separately." << endl;
00054 cerr << endl;
00055 cerr << "Usage: structureTensorComputation <image filename> " << endl;
00056 cerr << endl;
00057 return -1;
00058 }
00059
00060 const char* filename = vararg[1];
00061
00062 Image<double> img;
00063 load_image(filename, img);
00064 display_image(img);
00065 Image<double> G;
00066 cout << "Entering compute_structure_tensor_2D" << endl;
00067 clock_t start = clock();
00068 compute_structure_tensor_2D(img, G);
00069 clock_t end = clock();
00070 cout << "Exited from compute_structure_tensor_2D" << endl;
00071 cout << "Computation took: " << (end - start) / double(1000) << " ms." << endl;
00072 display_image(G);
00073 Image<double> G_ch;
00074 for (int ch = 0; ch < G.numChannels(); ++ch) {
00075 G.makeChannelImage(G_ch, ch);
00076 display_image(G_ch);
00077 }
00078 };
00079