00001 #include <iostream.h>
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 #include <string.h>
00005 #include "tip.h"
00006
00007
00008
00009
00010
00011
00012
00013 int main(int argc, char *argv[])
00014 {
00015
00016 if (argc != 2) {
00017 cout << "Usage: " << argv[0] << " <input_image>" << endl;
00018 exit(0);
00019 }
00020
00021 char l;
00022
00023
00024 IntImage im1;
00025 im1.readImage(argv[1]);
00026 im1.setName("IntImage");
00027 cout << "Min: " << im1.min() << "\t" << "Max: " << im1.max() << endl;
00028 im1.showImage();
00029 cin >> l;
00030
00031
00032 int nr_comp = ConnectedComponents(im1, FOUR_CONN);
00033 cout << "Image: \"" << argv[1] << "\" has " << nr_comp << " connected components" << endl;
00034 im1.showImage();
00035 cin >> l;
00036
00037
00038 ByteImage im2;
00039 IntImage output_image;
00040 im2.readImage(argv[1]);
00041 im2.setName("ByteImage");
00042
00043
00044 nr_comp = ConnectedComponents(im2, EIGHT_CONN, output_image);
00045 cout << "Image: \"" << argv[1] << "\" has " << nr_comp << " connected components" << endl;
00046 output_image.showImage();
00047
00048 cin >> l;
00049 im1.closeWindow();
00050 output_image.closeWindow();
00051 return(1);
00052 }