File: main.c

package info (click to toggle)
grass 8.4.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 277,040 kB
  • sloc: ansic: 460,798; python: 227,732; cpp: 42,026; sh: 11,262; makefile: 7,007; xml: 3,637; sql: 968; lex: 520; javascript: 484; yacc: 450; asm: 387; perl: 157; sed: 25; objc: 6; ruby: 4
file content (73 lines) | stat: -rw-r--r-- 2,457 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/****************************************************************************
 *
 * MODULE:       i.segment
 * AUTHOR(S):    Markus Metz
 *               based on the the GSoC project by
 *               Eric Momsen <eric.momsen at gmail com>
 * PURPOSE:      Object recognition, segments an image group.
 * COPYRIGHT:    (C) 2012 by Eric Momsen, and the GRASS Development Team
 *
 *               This program is free software under the GNU General
 *               Public License (>=v2). Read the COPYING file that
 *               comes with GRASS for details.
 *
 *
 *               NOTE: the word "segment" is already used by the
 *               Segmentation Library for the data files/tiling, so
 *               iseg (image segmentation) will be used to refer to
 *               the image segmentation.
 *
 *****************************************************************************/

#include <stdlib.h>
#include <stdio.h>
#include <grass/gis.h>
#include <grass/glocale.h>
#include "iseg.h"

int main(int argc, char *argv[])
{
    struct globals globals; /* input and output file descriptors, data
                               structure, buffers */
    struct GModule *module;

    G_gisinit(argv[0]);

    module = G_define_module();
    G_add_keyword(_("imagery"));
    G_add_keyword(_("segmentation"));
    G_add_keyword(_("classification"));
    G_add_keyword(_("object recognition"));
    module->description = _("Identifies segments (objects) from imagery data.");

    parse_args(argc, argv, &globals);

    G_debug(1, "Main: starting open_files()");
    if (open_files(&globals) != TRUE)
        G_fatal_error(_("Error in reading data"));

    G_debug(1, "Main: starting create_isegs()");
    if (create_isegs(&globals) != TRUE)
        G_fatal_error(_("Error in creating segments"));

    G_debug(1, "Main: starting write_output()");
    if (write_ids(&globals) != TRUE)
        G_fatal_error(_("Error in writing IDs"));

    if (globals.method == ORM_RG && globals.gof) {
        if (write_gof_rg(&globals) != TRUE)
            G_fatal_error(_("Error in writing goodness of fit"));
    }

    if (globals.method == ORM_MS && globals.bsuf) {
        if (write_bands_ms(&globals) != TRUE)
            G_fatal_error(_("Error in writing new band values"));
    }

    G_debug(1, "Main: starting close_files()");
    close_files(&globals);

    G_done_msg(_("Number of segments created: %d"), globals.max_rid);

    exit(EXIT_SUCCESS);
}