fabmodules/src/core/array_edges.c

53 wiersze
914 B
C

//
// array_edges.c
// find edges in array
// array_edges in.array out.array threshold
//
// Neil Gershenfeld
// CBA MIT 7/30/10
//
// (c) Massachusetts Institute of Technology 2010
// Permission granted for experimental and personal use;
// license for commercial sale available from MIT.
//
// todo
// pipe I/O
// variable bit depth
//
#include "fab.h"
int main(int argc, char **argv) {
//
// variables
//
struct fab_vars v;
init_vars(&v);
int threshold;
//
// command line args
//
if (argc != 4) {
printf("command line: array_edges in.array out.array threshold\n");
exit(-1);
}
//
// read array
//
fab_read_array(&v,argv[1]);
//
// threshold
//
sscanf(argv[3],"%d",&threshold);
fab_threshold(&v,threshold);
//
// find edges
//
fab_edges(&v);
//
// write array
//
fab_write_array(&v,argv[2]);
}