main.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /****************************************************************************
  2. *
  3. * MODULE: i.segment
  4. * AUTHOR(S): Markus Metz
  5. * based on the the GSoC project by Eric Momsen <eric.momsen at gmail com>
  6. * PURPOSE: Object recognition, segments an image group.
  7. * COPYRIGHT: (C) 2012 by Eric Momsen, and the GRASS Development Team
  8. *
  9. * This program is free software under the GNU General
  10. * Public License (>=v2). Read the COPYING file that
  11. * comes with GRASS for details.
  12. *
  13. *
  14. * NOTE: the word "segment" is already used by the
  15. * Segmentation Library for the data files/tiling, so
  16. * iseg (image segmentation) will be used to refer to
  17. * the image segmentation.
  18. *
  19. *****************************************************************************/
  20. #include <stdlib.h>
  21. #include <grass/gis.h>
  22. #include <grass/glocale.h>
  23. #include "iseg.h"
  24. int main(int argc, char *argv[])
  25. {
  26. struct globals globals; /* input and output file descriptors, data structure, buffers */
  27. struct GModule *module;
  28. G_gisinit(argv[0]);
  29. module = G_define_module();
  30. G_add_keyword(_("imagery"));
  31. G_add_keyword(_("segmentation"));
  32. G_add_keyword(_("object recognition"));
  33. module->description =
  34. _("Identifies segments (objects) from imagery data.");
  35. parse_args(argc, argv, &globals);
  36. G_debug(1, "Main: starting open_files()");
  37. if (open_files(&globals) != TRUE)
  38. G_fatal_error(_("Error in reading data"));
  39. G_debug(1, "Main: starting create_isegs()");
  40. if (create_isegs(&globals) != TRUE)
  41. G_fatal_error(_("Error in creating segments"));
  42. G_debug(1, "Main: starting write_output()");
  43. if (write_output(&globals) != TRUE)
  44. G_fatal_error(_("Error in writing data"));
  45. G_debug(1, "Main: starting close_files()");
  46. close_files(&globals);
  47. G_done_msg(_("Number of segments created: %d"), globals.n_regions);
  48. exit(EXIT_SUCCESS);
  49. }