Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tp_quadtree
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stefan.lazic
tp_quadtree
Commits
0a17cff8
Commit
0a17cff8
authored
4 years ago
by
stefan.lazic
Browse files
Options
Downloads
Patches
Plain Diff
added more console outputs
parent
add6d956
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
quadtree_tool
+0
-0
0 additions, 0 deletions
quadtree_tool
src/quadtree_tool.c
+16
-2
16 additions, 2 deletions
src/quadtree_tool.c
with
16 additions
and
2 deletions
quadtree_tool
+
0
−
0
View file @
0a17cff8
No preview for this file type
This diff is collapsed.
Click to expand it.
src/quadtree_tool.c
+
16
−
2
View file @
0a17cff8
...
...
@@ -57,45 +57,59 @@ int main(int argc, char *argv[]) {
pgm
*
p_pgm1
=
calloc
(
1
,
sizeof
(
pgm
));
// create p_pgm1
alloc_test
(
p_pgm1
);
print_applying
(
"read PGM to matrix1"
);
run_func
(
pgm_read
(
p_pgm1
,
argv
[
1
]));
// pgm read argv[1] > p_pgm1
int
n_max
=
ceil
(
log2
(
p_pgm1
->
mat
.
m
));
// calculate quadtree levels, 2^x = 512, x = log2(512), mat.m = 512 (for our test images) -> x = 9
print_applying
(
"create qtree1"
);
quadtree
p_qtree1
=
quadtree_create
(
n_max
);
// create quadtree
alloc_test
(
p_qtree1
);
print_applying
(
"matrix1 to qtree1"
);
// quadtree to matrix
run_func
(
matrix_to_quadtree
(
p_qtree1
,
&
p_pgm1
->
mat
,
0
,
n_max
,
p_pgm1
->
mat
.
m
/
2
,
p_pgm1
->
mat
.
m
/
2
,
p_pgm1
->
mat
.
n
/
2
));
print_applying
(
"horizontal symmetry qtree1"
);
run_func
(
quadtree_horizontal_symmmetry
(
p_qtree1
));
// symmetry
run_func
(
quadtree_vertical_symmmetry
(
p_qtree1
));
// symmetry
//print_applying("horizontal symmetry");
//run_func(quadtree_vertical_symmmetry(p_qtree1)); // symmetry
//run_func(quadtree_central_symmmetry(p_qtree1)); // symmetry
print_applying
(
"compression qtree1"
);
quadtree_compress
(
p_qtree1
,
atof
(
argv
[
3
]));
// compression
print_applying
(
"write qtree1 to temp.qtree"
);
run_func
(
quadtree_write_file
(
p_qtree1
,
"temp.qtree"
,
n_max
));
// write compressed file to temp.qtree
// ------------------------------------------------------------------------- read compressed file, build qtree, build matrix, output pgm
print_applying
(
"read temp.qtree to qtree2"
);
quadtree
p_qtree2
=
quadtree_read_file
(
"temp.qtree"
,
&
n_max
);
// read quadtree file, n_max will be overwritten
alloc_test
(
p_qtree2
);
print_applying
(
"create matrix2"
);
pgm
*
p_pgm2
=
calloc
(
1
,
sizeof
(
pgm
));
// create p_pgm2
alloc_test
(
p_pgm2
);
p_pgm2
->
max
=
255
;
run_func
(
matrix_create
(
&
p_pgm2
->
mat
,
pow
(
2
,
n_max
),
pow
(
2
,
n_max
)));
// create matrix
print_applying
(
"qtree1 to matrix1"
);
print_applying
(
"qtree2 to matrix2"
);
// fill matrix from quadtree
run_func
(
quadtree_to_matrix
(
p_qtree1
,
&
p_pgm1
->
mat
,
0
,
n_max
,
p_pgm1
->
mat
.
m
/
2
,
p_pgm1
->
mat
.
m
/
2
,
p_pgm1
->
mat
.
n
/
2
,
-
1
));
run_func
(
quadtree_to_matrix
(
p_qtree2
,
&
p_pgm2
->
mat
,
0
,
n_max
,
p_pgm2
->
mat
.
m
/
2
,
p_pgm2
->
mat
.
m
/
2
,
p_pgm2
->
mat
.
n
/
2
,
-
1
));
if
(
argc
>
4
&&
(
int
)
atof
(
argv
[
4
])
==
1
){
// if 4th parameter is given, write pgm2 to output, otherwise pgm1
print_applying
(
"write matrix2 to PGM"
);
run_func
(
pgm_write
(
p_pgm2
,
argv
[
2
]));
// pgm write p_pgm1> argv[2]
}
else
{
print_applying
(
"write matrix1 to PGM"
);
run_func
(
pgm_write
(
p_pgm1
,
argv
[
2
]));
// pgm write p_pgm2 > argv[2]
}
print_applying
(
"cleanup"
);
run_func
(
quadtree_destroy
(
p_qtree1
));
// cleanup
run_func
(
quadtree_destroy
(
p_qtree2
));
run_func
(
pgm_destroy
(
p_pgm1
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment