-
Notifications
You must be signed in to change notification settings - Fork 0
/
p3.c
41 lines (33 loc) · 812 Bytes
/
p3.c
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
/**
* p3.c
* A program to take a labeled image file and output the corresponding object database file and another labeled image with lines along each object's axis of minimum inertia.
*/
#include <assert.h>
#include <limits.h>
#include <string.h>
#include <stdlib.h>
#include <float.h>
#include <stdio.h>
#include "hw2.h"
int main(int argc, char *argv[])
{
char *ifname, *odname, *ofname;
ObjectDB odb;
Image im;
if (argc < 4) {
fprintf(stderr, "usage: %s <input labeled image> <output database> <output image>", argv[0]);
return 1;
}
ifname=argv[1];
odname=argv[2];
ofname=argv[3];
readImage(&im, ifname);
makeODB(&odb, getColors(&im));
getObjects(&im, &odb);
writeDatabase(&odb, odname);
drawLines(&im, &odb);
writeImage(&im, ofname);
free(odb.objs);
free(im.data);
return 0;
}