-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_mtat.c
More file actions
55 lines (54 loc) · 979 Bytes
/
test_mtat.c
File metadata and controls
55 lines (54 loc) · 979 Bytes
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
#include "mtat.h"
#include <stdlib.h>
int main(int argc, const char *argv[])
{
FILE *fp;
// fp = fopen("img1_6x6_color.bmp","rb");
// fp = fopen("img2_384x510_gray.bmp","rb");
fp = fopen("car.bmp","rb");
char* error = NULL;
BMPImage* image;
// BMPImage* image1;
BMPImage* image2;
image = read_bmp(fp, &error);
if(image == NULL)
{
fprintf(stderr, error);
free(error);
return EXIT_FAILURE;
}
if(fp != NULL)
{
fclose(fp);
}
/* image1 = binarize(image, 1, 2, &error);
if(image1 == NULL)
{
fprintf(stderr, error);
free(error);
return EXIT_FAILURE;
}*/
image2 = median(image, 1, 2, &error);
if(image2 == NULL)
{
fprintf(stderr, error);
free(error);
return EXIT_FAILURE;
}
FILE *fp2;
fp2 = fopen("6x6gray.bmp","wb");
if(!write_bmp(fp2, image2, &error))
{
fprintf(stderr, error);
free(error);
return EXIT_FAILURE;
}
if(fp2 != NULL)
{
fclose(fp2);
}
free_bmp(image);
// free_bmp(image1);
free_bmp(image2);
return EXIT_SUCCESS;
}