| #include <stdio.h>
|
| #include <stdlib.h>
|
| #include <string.h>
|
| #include <math.h>
|
|
|
|
|
| typedef struct pixels
|
| {
|
|
|
| unsigned char red;
|
| unsigned char green;
|
| unsigned char blue;
|
|
|
| } pixels;
|
|
|
|
|
| typedef struct qtNode
|
| {
|
|
|
| pixels p;
|
| long long index;
|
| int area;
|
|
|
| struct qtNode *topLeft;
|
| struct qtNode *topRight;
|
| struct qtNode *bottomLeft;
|
| struct qtNode *bottomRight;
|
|
|
| } qtNode;
|
|
|
|
|
| typedef struct qtInfo
|
| {
|
|
|
| unsigned char blue, green, red;
|
| int area;
|
| int topLeft;
|
| int topRight;
|
| int bottomLeft;
|
| int bottomRight;
|
|
|
| } qtInfo;
|
|
|
|
|
|
|
|
|
| pixels **read(int *height, int *width, char *file);
|
| void outputFile(pixels **mat, char *file, int size);
|
| int getMean(pixels **matrix, qtNode **node, int x, int y, int size);
|
|
|
|
|
|
|
| void traversal(qtNode * node, qtNode ** vector[], unsigned int * index);
|
| void copyToArr(qtNode ** vp, qtInfo ** v, int index);
|
| void readTree(qtInfo * vec, qtNode ** node, int i);
|
| void destroyTree(qtNode** t);
|
|
|
|
|
| int min(int a,int b); |