-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.c
55 lines (40 loc) · 1.41 KB
/
main.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/**
* Program inti untuk melakukan rekonstruksi terhadap
* semua data set 6 jari x 6 kali pengambilan
*/
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <time.h>
#include "config.h"
#include "bmp.h"
#include "corr.h"
int main() {
clock_t time_start = clock();
BMPHEADER bmpheader;
unsigned char
*pixel_image = malloc(BMP_INPUT_SIZE * sizeof(unsigned char)),
*pixel_image_reversed = malloc(BMP_INPUT_SIZE * sizeof(unsigned char)),
*pixel_image_generate = malloc(BMP_OUTPUT_SIZE * sizeof(unsigned char));
char bmp_input[250], bmp_output[250];
unsigned char i, j;
for (i = 0; i <= 5; i++) {
for (j = 0; j <= 5; j++) {
sprintf(bmp_input, "%sHA/HAL%d00%d.bmp", BMP_INPUT_DIR, i, j);
sprintf(bmp_output, "%sHA/HAL%d00%d.bmp", BMP_OUTPUT_DIR, i, j);
memset(pixel_image_generate, DEFAULT_OVERLAP_VALUE, BMP_OUTPUT_SIZE);
load_bmp(bmp_input, &bmpheader, pixel_image);
block_reverse(pixel_image, pixel_image_reversed);
reconstruct(pixel_image_reversed, pixel_image_generate);
save_bmp(bmp_output, &bmpheader, pixel_image_generate);
}
}
// free(pixel_image);
// free(pixel_image_reversed);
// free(pixel_image_generate);
/**
* execution time
*/
printf("%.10f\n", (double) (clock() - time_start) / CLOCKS_PER_SEC);
return 0;
}