diff options
Diffstat (limited to 'SD-VBS/benchmarks/tracking')
84 files changed, 1560 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/tracking/Makefile b/SD-VBS/benchmarks/tracking/Makefile new file mode 100644 index 0000000..60cc0ec --- /dev/null +++ b/SD-VBS/benchmarks/tracking/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | include ../../common/makefiles/Makefile.include | ||
2 | include $(MAKEFILE_COMMON_DIR)/Makefile.recurse | ||
3 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/Makefile b/SD-VBS/benchmarks/tracking/data/Makefile new file mode 100644 index 0000000..ba33d35 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | include ../../../common/makefiles/Makefile.include | ||
2 | include $(MAKEFILE_COMMON_DIR)/Makefile.recurse | ||
3 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/1.bmp b/SD-VBS/benchmarks/tracking/data/cif/1.bmp new file mode 100644 index 0000000..6744178 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/2.bmp b/SD-VBS/benchmarks/tracking/data/cif/2.bmp new file mode 100644 index 0000000..8c2ac57 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/3.bmp b/SD-VBS/benchmarks/tracking/data/cif/3.bmp new file mode 100644 index 0000000..b7195fb --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/4.bmp b/SD-VBS/benchmarks/tracking/data/cif/4.bmp new file mode 100644 index 0000000..9f0525a --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/5.bmp b/SD-VBS/benchmarks/tracking/data/cif/5.bmp new file mode 100644 index 0000000..2f88c26 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/5.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/Makefile b/SD-VBS/benchmarks/tracking/data/cif/Makefile new file mode 100644 index 0000000..1be9797 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | INPUT=cif | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
7 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/expected.m b/SD-VBS/benchmarks/tracking/data/cif/expected.m new file mode 100644 index 0000000..679cea9 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 269.915165 175.828888 195.635312 172.654409 268.516358 289.931921 267.230697 190.086741 | ||
2 | 147.986242 145.928399 148.067509 130.441486 124.919389 64.008098 131.967361 162.460857 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/cif/tracking b/SD-VBS/benchmarks/tracking/data/cif/tracking new file mode 100755 index 0000000..ca31ed0 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/cif/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/1.bmp b/SD-VBS/benchmarks/tracking/data/fullhd/1.bmp new file mode 100644 index 0000000..3db2ad6 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/2.bmp b/SD-VBS/benchmarks/tracking/data/fullhd/2.bmp new file mode 100644 index 0000000..9ff8e9c --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/3.bmp b/SD-VBS/benchmarks/tracking/data/fullhd/3.bmp new file mode 100644 index 0000000..ec53ae6 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/4.bmp b/SD-VBS/benchmarks/tracking/data/fullhd/4.bmp new file mode 100644 index 0000000..c45c5e9 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/Makefile b/SD-VBS/benchmarks/tracking/data/fullhd/Makefile new file mode 100644 index 0000000..2b37182 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | INPUT=fullhd | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
7 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/expected.m b/SD-VBS/benchmarks/tracking/data/fullhd/expected.m new file mode 100644 index 0000000..eb034f0 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 1487.193453 720.553084 1481.188344 382.962678 | ||
2 | 308.382612 306.797105 323.948844 369.542919 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/tracking b/SD-VBS/benchmarks/tracking/data/fullhd/tracking new file mode 100755 index 0000000..d6afa68 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/fullhd/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/1.bmp b/SD-VBS/benchmarks/tracking/data/qcif/1.bmp new file mode 100644 index 0000000..140ace2 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/10.bmp b/SD-VBS/benchmarks/tracking/data/qcif/10.bmp new file mode 100644 index 0000000..61518bc --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/10.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/2.bmp b/SD-VBS/benchmarks/tracking/data/qcif/2.bmp new file mode 100644 index 0000000..8e1f7cc --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/3.bmp b/SD-VBS/benchmarks/tracking/data/qcif/3.bmp new file mode 100644 index 0000000..95fe31f --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/4.bmp b/SD-VBS/benchmarks/tracking/data/qcif/4.bmp new file mode 100644 index 0000000..464608a --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/5.bmp b/SD-VBS/benchmarks/tracking/data/qcif/5.bmp new file mode 100644 index 0000000..71eb1b7 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/5.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/6.bmp b/SD-VBS/benchmarks/tracking/data/qcif/6.bmp new file mode 100644 index 0000000..83e5379 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/6.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/7.bmp b/SD-VBS/benchmarks/tracking/data/qcif/7.bmp new file mode 100644 index 0000000..95b4015 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/7.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/8.bmp b/SD-VBS/benchmarks/tracking/data/qcif/8.bmp new file mode 100644 index 0000000..8847887 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/8.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/9.bmp b/SD-VBS/benchmarks/tracking/data/qcif/9.bmp new file mode 100644 index 0000000..4301f11 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/9.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/Makefile b/SD-VBS/benchmarks/tracking/data/qcif/Makefile new file mode 100644 index 0000000..fb48d25 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | INPUT=qcif | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
7 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/expected.m b/SD-VBS/benchmarks/tracking/data/qcif/expected.m new file mode 100644 index 0000000..65c5984 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 142.858025 145.068198 102.770607 141.110282 90.859800 135.351851 80.185357 113.844268 117.388158 142.126183 80.877169 | ||
2 | 70.993874 35.205162 77.320628 62.895414 38.040784 78.853200 86.164881 63.301686 74.036975 46.176383 92.916465 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/qcif/tracking b/SD-VBS/benchmarks/tracking/data/qcif/tracking new file mode 100755 index 0000000..7288f16 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/qcif/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/1.bmp b/SD-VBS/benchmarks/tracking/data/sim/1.bmp new file mode 100644 index 0000000..825ea49 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/2.bmp b/SD-VBS/benchmarks/tracking/data/sim/2.bmp new file mode 100644 index 0000000..d3451be --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/3.bmp b/SD-VBS/benchmarks/tracking/data/sim/3.bmp new file mode 100644 index 0000000..b060b06 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/4.bmp b/SD-VBS/benchmarks/tracking/data/sim/4.bmp new file mode 100644 index 0000000..137accc --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/Makefile b/SD-VBS/benchmarks/tracking/data/sim/Makefile new file mode 100644 index 0000000..42e2aa9 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | INPUT=sim | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/expected.m b/SD-VBS/benchmarks/tracking/data/sim/expected.m new file mode 100644 index 0000000..6f90559 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 24.422544 21.868191 40.786198 37.742716 30.302637 16.079615 30.062715 35.344185 | ||
2 | 14.131628 32.266282 37.315204 24.606535 32.839030 14.301861 22.509506 15.748797 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/sim/tracking b/SD-VBS/benchmarks/tracking/data/sim/tracking new file mode 100755 index 0000000..a990020 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/1.bmp b/SD-VBS/benchmarks/tracking/data/sim_fast/1.bmp new file mode 100644 index 0000000..272897c --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/2.bmp b/SD-VBS/benchmarks/tracking/data/sim_fast/2.bmp new file mode 100644 index 0000000..414d2cb --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/3.bmp b/SD-VBS/benchmarks/tracking/data/sim_fast/3.bmp new file mode 100644 index 0000000..340e885 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/4.bmp b/SD-VBS/benchmarks/tracking/data/sim_fast/4.bmp new file mode 100644 index 0000000..c347859 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/Makefile b/SD-VBS/benchmarks/tracking/data/sim_fast/Makefile new file mode 100644 index 0000000..12bcfa5 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | INPUT=sim_fast | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/expected.m b/SD-VBS/benchmarks/tracking/data/sim_fast/expected.m new file mode 100644 index 0000000..f944bf8 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 25.330446 17.728868 14.459743 | ||
2 | 16.949109 9.076394 22.247495 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/tracking b/SD-VBS/benchmarks/tracking/data/sim_fast/tracking new file mode 100755 index 0000000..7309b27 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sim_fast/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/1.bmp b/SD-VBS/benchmarks/tracking/data/sqcif/1.bmp new file mode 100644 index 0000000..06a8c3d --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/2.bmp b/SD-VBS/benchmarks/tracking/data/sqcif/2.bmp new file mode 100644 index 0000000..fd5c01f --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/3.bmp b/SD-VBS/benchmarks/tracking/data/sqcif/3.bmp new file mode 100644 index 0000000..14ab860 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/4.bmp b/SD-VBS/benchmarks/tracking/data/sqcif/4.bmp new file mode 100644 index 0000000..7afba08 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/Makefile b/SD-VBS/benchmarks/tracking/data/sqcif/Makefile new file mode 100644 index 0000000..c47a0fd --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/Makefile | |||
@@ -0,0 +1,6 @@ | |||
1 | INPUT=sqcif | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/expected.m b/SD-VBS/benchmarks/tracking/data/sqcif/expected.m new file mode 100644 index 0000000..db8a05c --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 65.833985 96.386766 76.545247 96.006777 62.175348 60.185245 31.941927 68.970416 85.550211 109.931998 72.298306 74.080821 | ||
2 | 25.209999 70.490525 41.265387 59.869753 52.207516 62.050369 30.542002 70.430274 63.040458 45.825585 49.742089 63.956939 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/sqcif/tracking b/SD-VBS/benchmarks/tracking/data/sqcif/tracking new file mode 100755 index 0000000..6ec0f98 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/sqcif/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/test/1.bmp b/SD-VBS/benchmarks/tracking/data/test/1.bmp new file mode 100644 index 0000000..72079a8 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/test/2.bmp b/SD-VBS/benchmarks/tracking/data/test/2.bmp new file mode 100644 index 0000000..d13e26c --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/test/3.bmp b/SD-VBS/benchmarks/tracking/data/test/3.bmp new file mode 100644 index 0000000..10eb499 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/test/4.bmp b/SD-VBS/benchmarks/tracking/data/test/4.bmp new file mode 100644 index 0000000..6536ea7 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/test/Makefile b/SD-VBS/benchmarks/tracking/data/test/Makefile new file mode 100644 index 0000000..963bebc --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | INPUT=test | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
diff --git a/SD-VBS/benchmarks/tracking/data/test/expected.m b/SD-VBS/benchmarks/tracking/data/test/expected.m new file mode 100644 index 0000000..139597f --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | |||
2 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/test/tracking b/SD-VBS/benchmarks/tracking/data/test/tracking new file mode 100755 index 0000000..665fa11 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/test/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/1.bmp b/SD-VBS/benchmarks/tracking/data/vga/1.bmp new file mode 100644 index 0000000..9695b0c --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/1.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/2.bmp b/SD-VBS/benchmarks/tracking/data/vga/2.bmp new file mode 100644 index 0000000..937d03a --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/2.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/3.bmp b/SD-VBS/benchmarks/tracking/data/vga/3.bmp new file mode 100644 index 0000000..faedea3 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/3.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/4.bmp b/SD-VBS/benchmarks/tracking/data/vga/4.bmp new file mode 100644 index 0000000..2be82b8 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/4.bmp | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/Makefile b/SD-VBS/benchmarks/tracking/data/vga/Makefile new file mode 100644 index 0000000..e3fa1c2 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | INPUT=vga | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=tracking | ||
5 | include $(MAKEFILE_COMMON_DIR)/Makefile.common | ||
6 | |||
7 | |||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/expected.m b/SD-VBS/benchmarks/tracking/data/vga/expected.m new file mode 100644 index 0000000..05d987c --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/expected.m | |||
@@ -0,0 +1,2 @@ | |||
1 | 470.825057 292.917830 182.675337 492.818305 276.157171 504.514201 | ||
2 | 216.367613 229.865854 255.912628 150.704991 276.525215 149.690554 | ||
diff --git a/SD-VBS/benchmarks/tracking/data/vga/tracking b/SD-VBS/benchmarks/tracking/data/vga/tracking new file mode 100755 index 0000000..bb2e3b9 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/data/vga/tracking | |||
Binary files differ | |||
diff --git a/SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c b/SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c new file mode 100644 index 0000000..40f03dc --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | |||
7 | /** Compute the sum of pixels over pixel neighborhood. | ||
8 | Neighborhood = winSize*winSize | ||
9 | This will be useful when we compute the displacement | ||
10 | of the neighborhood across frames instead of tracking each pixel. | ||
11 | |||
12 | Input: src Image | ||
13 | # rows, cols, size of window | ||
14 | Output: windowed-sum image, ret. | ||
15 | |||
16 | Example: | ||
17 | |||
18 | winSize = 4, cols = 8, rows = 16 | ||
19 | nave_half = 2, nave = 4 | ||
20 | Say, the first row of the image is: | ||
21 | 3 8 6 2 4 8 9 5 | ||
22 | a1 = 0 0 3 8 6 2 4 8 9 5 0 0 (append nave_half zeros to left and right border) | ||
23 | asum = (sum the first nave # pixels - 0 0 3 8 ) = 11 | ||
24 | ret(0,0) = 11 | ||
25 | For ret(0,1), we need to move the window to the right by one pixel and subtract | ||
26 | from a1sum the leftmost pixel. So, we add value 6 and subtract value at a1(0,0), = 0 here. | ||
27 | ret(0,1) = 17 = a1sum | ||
28 | For ret(0,2), a1sum - a1(0,1) + a1(2+nave) = 17 - 0 + 2 = 19 = a1sum | ||
29 | For ret(0,3), a1sum - a1(0,2) + a1(3+nave) = 19 - 3 + 4 = 20 = a1sum | ||
30 | |||
31 | We proceed this way for all the rows and then perform summantion across all cols. | ||
32 | **/ | ||
33 | F2D* calcAreaSum(F2D* src, int cols, int rows, int winSize) | ||
34 | { | ||
35 | int nave, nave_half, i, j, k; | ||
36 | F2D *ret, *a1; | ||
37 | float a1sum; | ||
38 | |||
39 | nave = winSize; | ||
40 | nave_half = floor((nave+1)/2); | ||
41 | |||
42 | ret = fMallocHandle(rows, cols); | ||
43 | a1 = fSetArray(1, cols+nave,0); | ||
44 | |||
45 | for(i=0; i<rows; i++) | ||
46 | { | ||
47 | for(j=0; j<cols; j++) { | ||
48 | asubsref(a1,j+nave_half) = subsref(src,i,j); | ||
49 | } | ||
50 | a1sum = 0; | ||
51 | for(k=0; k<nave; k++) { | ||
52 | a1sum += asubsref(a1,k); | ||
53 | } | ||
54 | for(j=0; j<cols; j++) | ||
55 | { | ||
56 | subsref(ret,i,j) = a1sum; | ||
57 | a1sum += asubsref(a1,j+nave) - asubsref(a1,j); | ||
58 | } | ||
59 | } | ||
60 | fFreeHandle(a1); | ||
61 | |||
62 | a1 = fSetArray(1, rows+nave,0); | ||
63 | for(i=0; i<cols; i++) | ||
64 | { | ||
65 | for(j=0; j<rows; j++) { | ||
66 | asubsref(a1,j+nave_half) = subsref(ret,j,i); | ||
67 | } | ||
68 | a1sum = 0; | ||
69 | for(k=0; k<nave; k++) { | ||
70 | a1sum += asubsref(a1,k); | ||
71 | } | ||
72 | for(j=0; j<rows; j++) | ||
73 | { | ||
74 | subsref(ret,j,i) = a1sum; | ||
75 | a1sum += asubsref(a1,j+nave) - asubsref(a1,j); | ||
76 | } | ||
77 | } | ||
78 | fFreeHandle(a1); | ||
79 | |||
80 | return ret; | ||
81 | } | ||
diff --git a/SD-VBS/benchmarks/tracking/src/c/calcGoodFeature.c b/SD-VBS/benchmarks/tracking/src/c/calcGoodFeature.c new file mode 100644 index 0000000..0ef1862 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/calcGoodFeature.c | |||
@@ -0,0 +1,78 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | |||
7 | /** Computes lambda matrix, strength at each pixel | ||
8 | |||
9 | det = determinant( [ IverticalEdgeSq IhorzVertEdge; IhorzVertEdge IhorizontalEdgeSq] ) ; | ||
10 | tr = IverticalEdgeSq + IhorizontalEdgeSq; | ||
11 | lamdba = det/tr; | ||
12 | |||
13 | Lambda is the measure of the strength of pixel | ||
14 | neighborhood. By strength we mean the amount of | ||
15 | edge information it has, which translates to | ||
16 | sharp features in the image. | ||
17 | |||
18 | Input: Edge images - vertical and horizontal | ||
19 | Window size (neighborhood size) | ||
20 | Output: Lambda, strength of pixel neighborhood | ||
21 | |||
22 | Given the edge images, we compute strength based | ||
23 | on how strong the edges are within each neighborhood. | ||
24 | |||
25 | **/ | ||
26 | |||
27 | F2D* calcGoodFeature(F2D* verticalEdgeImage, F2D* horizontalEdgeImage, int cols, int rows, int winSize) | ||
28 | { | ||
29 | int i, j, k, ind; | ||
30 | F2D *verticalEdgeSq, *horizontalEdgeSq, *horzVertEdge; | ||
31 | F2D *tr, *det, *lambda; | ||
32 | F2D *cummulative_verticalEdgeSq, *cummulative_horzVertEdge, *cummulative_horizontalEdgeSq; | ||
33 | |||
34 | verticalEdgeSq = fMallocHandle(rows, cols); | ||
35 | horzVertEdge = fMallocHandle(rows, cols); | ||
36 | horizontalEdgeSq = fMallocHandle(rows, cols); | ||
37 | |||
38 | for( i=0; i<rows; i++) | ||
39 | { | ||
40 | for( j=0; j<cols; j++) | ||
41 | { | ||
42 | subsref(verticalEdgeSq,i,j) = subsref(verticalEdgeImage,i,j) * subsref(verticalEdgeImage,i,j); | ||
43 | subsref(horzVertEdge,i,j) = subsref(verticalEdgeImage,i,j) * subsref(horizontalEdgeImage,i,j); | ||
44 | subsref(horizontalEdgeSq,i,j) = subsref(horizontalEdgeImage,i,j) * subsref(horizontalEdgeImage,i,j); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | cummulative_verticalEdgeSq = calcAreaSum(verticalEdgeSq, cols, rows, winSize); | ||
49 | cummulative_horzVertEdge = calcAreaSum(horzVertEdge, cols, rows, winSize); | ||
50 | cummulative_horizontalEdgeSq = calcAreaSum(horizontalEdgeSq, cols, rows, winSize); | ||
51 | |||
52 | tr = fMallocHandle(rows, cols); | ||
53 | det = fMallocHandle(rows, cols); | ||
54 | lambda = fMallocHandle(rows, cols); | ||
55 | |||
56 | for( i=0; i<rows; i++) | ||
57 | { | ||
58 | for( j=0; j<cols; j++) | ||
59 | { | ||
60 | subsref(tr,i,j) = subsref(cummulative_verticalEdgeSq,i,j) + subsref(cummulative_horizontalEdgeSq,i,j); | ||
61 | subsref(det,i,j) = subsref(cummulative_verticalEdgeSq,i,j) * subsref(cummulative_horizontalEdgeSq,i,j) - subsref(cummulative_horzVertEdge,i,j) * subsref(cummulative_horzVertEdge,i,j); | ||
62 | subsref(lambda,i,j) = ( subsref(det,i,j) / (subsref(tr,i,j)+0.00001) ) ; | ||
63 | } | ||
64 | } | ||
65 | |||
66 | fFreeHandle(verticalEdgeSq); | ||
67 | fFreeHandle(horzVertEdge); | ||
68 | fFreeHandle(horizontalEdgeSq); | ||
69 | |||
70 | fFreeHandle(cummulative_verticalEdgeSq); | ||
71 | fFreeHandle(cummulative_horzVertEdge); | ||
72 | fFreeHandle(cummulative_horizontalEdgeSq); | ||
73 | |||
74 | fFreeHandle(tr); | ||
75 | fFreeHandle(det); | ||
76 | |||
77 | return lambda; | ||
78 | } | ||
diff --git a/SD-VBS/benchmarks/tracking/src/c/calcPyrLKTrack.c b/SD-VBS/benchmarks/tracking/src/c/calcPyrLKTrack.c new file mode 100644 index 0000000..3718673 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/calcPyrLKTrack.c | |||
@@ -0,0 +1,179 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | |||
7 | /** calcPyrLKTrack tries to find the displacement (translation in x and y) of features computed in the previous frame. | ||
8 | To compute the displacement, we interpolate the existing feature position around the pixel neighborhood. | ||
9 | For better results, we perform interpolatations across all pyramid levels. | ||
10 | |||
11 | Input: Previous frame blurred images, vertical and horizontal | ||
12 | Current frame edge images, vertical and horizontal | ||
13 | Current frame blurred images, for level 0 and 1 | ||
14 | Number of features from previous frame | ||
15 | Window size | ||
16 | Accuracy | ||
17 | Number of iterations to compute motion vector | ||
18 | Features from the previous frame | ||
19 | currentFrameFeatures, Populate the current frame features' displacements | ||
20 | Output: Number of valid features | ||
21 | |||
22 | **/ | ||
23 | |||
24 | I2D* calcPyrLKTrack(F2D* previousImageBlur_level1, F2D* previousImageBlur_level2, F2D* vertEdge_level1, F2D* vertEdge_level2, F2D* horzEdge_level1, F2D* horzEdge_level2, F2D* currentImageBlur_level1, F2D* currentImageBlur_level2, F2D* previousFrameFeatures, int nFeatures, int winSize, float accuracy, int max_iter, F2D* currentFrameFeatures) | ||
25 | { | ||
26 | int idx, level, pLevel, i, j, k, winSizeSq; | ||
27 | I2D *valid; | ||
28 | F2D *rate, *iPatch, *jPatch, *iDxPatch; | ||
29 | F2D *iDyPatch; | ||
30 | float tr, x, y, dX, dY, c_xx, c_yy, c_xy; | ||
31 | int imgSize_1, imgSize_2; | ||
32 | float mX, mY, dIt, eX, eY, c_det; | ||
33 | I2D *imgDims; | ||
34 | |||
35 | imgDims = iMallocHandle(2, 2); | ||
36 | subsref(imgDims,0,0) = previousImageBlur_level1->height; | ||
37 | subsref(imgDims,0,1) = previousImageBlur_level1->width; | ||
38 | subsref(imgDims,1,0) = previousImageBlur_level2->height; | ||
39 | subsref(imgDims,1,1) = previousImageBlur_level2->width; | ||
40 | |||
41 | pLevel = 2; | ||
42 | rate = fMallocHandle(1, 6); | ||
43 | |||
44 | asubsref(rate,0) = 1; | ||
45 | asubsref(rate,1) = 0.5; | ||
46 | asubsref(rate,2) = 0.25; | ||
47 | asubsref(rate,3) = 0.125; | ||
48 | asubsref(rate,4) = 0.0625; | ||
49 | asubsref(rate,5) = 0.03125; | ||
50 | |||
51 | winSizeSq = 4*winSize*winSize; | ||
52 | valid = iSetArray(1,nFeatures, 1); | ||
53 | |||
54 | /** For each feature passed from previous frame, compute the dx and dy, the displacements **/ | ||
55 | for(i=0; i<nFeatures; i++) | ||
56 | { | ||
57 | dX = 0; | ||
58 | dY = 0; | ||
59 | |||
60 | /** Compute the x and y co-ordinate values at "pLevel" **/ | ||
61 | x = subsref(previousFrameFeatures,0,i) * asubsref(rate,pLevel); | ||
62 | y = subsref(previousFrameFeatures,1,i) * asubsref(rate,pLevel); | ||
63 | c_det = 0; | ||
64 | |||
65 | /** For each pyramid level, try to find correspondence. | ||
66 | We look for the correspondence in a given window size | ||
67 | , (winSize x winSize) neighborhood **/ | ||
68 | for(level = pLevel-1; level>=0; level--) | ||
69 | { | ||
70 | x = x+x; | ||
71 | y = y+y; | ||
72 | dX = dX + dX; | ||
73 | dY = dY + dY; | ||
74 | imgSize_1 = subsref(imgDims,level,0); | ||
75 | imgSize_2 = subsref(imgDims,level,1); | ||
76 | |||
77 | c_xx = 0; | ||
78 | c_xy = 0; | ||
79 | c_yy = 0; | ||
80 | |||
81 | if((x-winSize)<0 || (y-winSize)<0 || (y+winSize+1)>=imgSize_1 || (x+winSize+1)>=imgSize_2) | ||
82 | { | ||
83 | asubsref(valid,i) = 0; | ||
84 | break; | ||
85 | } | ||
86 | |||
87 | /** Perform interpolation. Use co-ord from previous | ||
88 | frame and use the images from current frame **/ | ||
89 | |||
90 | if(level ==0) | ||
91 | { | ||
92 | iPatch = getInterpolatePatch(previousImageBlur_level1, imgSize_2, x, y, winSize); | ||
93 | iDxPatch = getInterpolatePatch(vertEdge_level1, imgSize_2, x, y, winSize); | ||
94 | iDyPatch = getInterpolatePatch(horzEdge_level1, imgSize_2, x, y, winSize); | ||
95 | } | ||
96 | if(level ==1) | ||
97 | { | ||
98 | iPatch = getInterpolatePatch(previousImageBlur_level2, imgSize_2, x, y, winSize); | ||
99 | iDxPatch = getInterpolatePatch(vertEdge_level2, imgSize_2, x, y, winSize); | ||
100 | iDyPatch = getInterpolatePatch(horzEdge_level2, imgSize_2, x, y, winSize); | ||
101 | } | ||
102 | |||
103 | /** Compute feature strength in similar way as calcGoodFeature **/ | ||
104 | for(idx=0; idx<winSizeSq; idx++) | ||
105 | { | ||
106 | c_xx += asubsref(iDxPatch,idx) * asubsref(iDxPatch,idx); | ||
107 | c_xy += asubsref(iDxPatch,idx) * asubsref(iDyPatch,idx); | ||
108 | c_yy += asubsref(iDyPatch,idx) * asubsref(iDyPatch,idx); | ||
109 | } | ||
110 | |||
111 | c_det = (c_xx * c_yy -c_xy * c_xy); | ||
112 | tr = c_xx + c_yy; | ||
113 | |||
114 | if((c_det/(tr+0.00001)) < accuracy) | ||
115 | { | ||
116 | asubsref(valid,i) = 0; | ||
117 | fFreeHandle(iPatch); | ||
118 | fFreeHandle(iDxPatch); | ||
119 | fFreeHandle(iDyPatch); | ||
120 | break; | ||
121 | } | ||
122 | c_det = 1/c_det; | ||
123 | |||
124 | /** We compute dX and dY using previous frame and current | ||
125 | frame images. For this, the strength is computed at each | ||
126 | pixel in the new image. **/ | ||
127 | for(k=0; k<max_iter; k++) | ||
128 | { | ||
129 | if( (x+dX-winSize)<0 || (y+dY-winSize)<0 || (y+dY+winSize+1)>=imgSize_1 || (x+dX+winSize+1)>=imgSize_2) | ||
130 | { | ||
131 | asubsref(valid,i) = 0; | ||
132 | break; | ||
133 | } | ||
134 | |||
135 | if(level == 0) | ||
136 | jPatch = getInterpolatePatch(currentImageBlur_level1, imgSize_2, x+dX, y+dY, winSize); | ||
137 | if(level == 1) | ||
138 | jPatch = getInterpolatePatch(currentImageBlur_level2, imgSize_2, x+dX, y+dY, winSize); | ||
139 | |||
140 | eX = 0; | ||
141 | eY = 0; | ||
142 | for(idx=0; idx<winSizeSq; idx++) | ||
143 | { | ||
144 | dIt = asubsref(iPatch,idx) - asubsref(jPatch,idx); | ||
145 | eX += dIt * asubsref(iDxPatch,idx); | ||
146 | eY += dIt * asubsref(iDyPatch,idx); | ||
147 | } | ||
148 | |||
149 | mX = c_det * (eX * c_yy - eY * c_xy); | ||
150 | mY = c_det * (-eX * c_xy + eY * c_xx); | ||
151 | dX = dX + mX; | ||
152 | dY = dY + mY; | ||
153 | |||
154 | if( (mX*mX+mY*mY) < accuracy) | ||
155 | { | ||
156 | fFreeHandle(jPatch); | ||
157 | break; | ||
158 | } | ||
159 | |||
160 | fFreeHandle(jPatch); | ||
161 | } | ||
162 | |||
163 | fFreeHandle(iPatch); | ||
164 | fFreeHandle(iDxPatch); | ||
165 | fFreeHandle(iDyPatch); | ||
166 | } | ||
167 | |||
168 | subsref(currentFrameFeatures,0,i) = subsref(previousFrameFeatures,0,i) + dX; | ||
169 | subsref(currentFrameFeatures,1,i) = subsref(previousFrameFeatures,1,i) + dY; | ||
170 | |||
171 | } | ||
172 | |||
173 | fFreeHandle(rate); | ||
174 | iFreeHandle(imgDims); | ||
175 | return valid; | ||
176 | } | ||
177 | |||
178 | |||
179 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/c/fillFeatures.c b/SD-VBS/benchmarks/tracking/src/c/fillFeatures.c new file mode 100644 index 0000000..42de169 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/fillFeatures.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /******************************** | ||
2 | |||
3 | Author: Sravanthi Kota Venkata | ||
4 | ********************************/ | ||
5 | |||
6 | #include "tracking.h" | ||
7 | |||
8 | /** Find the position and values of the top N_FEA features | ||
9 | from the lambda matrix **/ | ||
10 | |||
11 | F2D* fillFeatures(F2D* lambda, int N_FEA, int win) | ||
12 | { | ||
13 | int i, j, k, l; | ||
14 | int rows = lambda->height; | ||
15 | int cols = lambda->width; | ||
16 | F2D* features; | ||
17 | |||
18 | features = fSetArray(3, N_FEA, 0); | ||
19 | |||
20 | /** init array **/ | ||
21 | for(i=0; i<N_FEA; i++) | ||
22 | { | ||
23 | subsref(features, 0, i) = -1.0; | ||
24 | subsref(features, 1, i) = -1.0; | ||
25 | subsref(features, 2, i) = 0.0; | ||
26 | } | ||
27 | |||
28 | |||
29 | /** | ||
30 | Find top N_FEA values and store them in | ||
31 | features array along with row and col information | ||
32 | It should be possible to make this algorithm better | ||
33 | if we use a pointer-based data structure, | ||
34 | but have not implemented due to MATLAB compatibility | ||
35 | **/ | ||
36 | |||
37 | for (i=win; i<rows-win; i++) | ||
38 | { | ||
39 | for (j=win; j<cols-win; j++) | ||
40 | { | ||
41 | float currLambdaVal = subsref(lambda,i,j); | ||
42 | if (subsref(features, 2, N_FEA-1) > currLambdaVal) | ||
43 | continue; | ||
44 | |||
45 | for (k=0; k<N_FEA; k++) | ||
46 | { | ||
47 | if (subsref(features, 2, k) < currLambdaVal) | ||
48 | { | ||
49 | /** shift one slot **/ | ||
50 | for (l=N_FEA-1; l>k; l--) | ||
51 | { | ||
52 | subsref(features, 0, l) = subsref(features, 0, l-1); | ||
53 | subsref(features, 1, l) = subsref(features, 1, l-1); | ||
54 | subsref(features, 2, l) = subsref(features, 2, l-1); | ||
55 | } | ||
56 | |||
57 | subsref(features, 0, k) = j * 1.0; | ||
58 | subsref(features, 1, k) = i * 1.0; | ||
59 | subsref(features, 2, k) = currLambdaVal; | ||
60 | break; | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | } | ||
65 | |||
66 | return features; | ||
67 | } | ||
diff --git a/SD-VBS/benchmarks/tracking/src/c/getANMS.c b/SD-VBS/benchmarks/tracking/src/c/getANMS.c new file mode 100644 index 0000000..7ecce8b --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/getANMS.c | |||
@@ -0,0 +1,156 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | |||
7 | /** ANMS - Adaptive Non-Maximal Suppression | ||
8 | This function takes features as input and suppresses those which | ||
9 | are close to each other (within the SUPPRESSION_RADIUS) and have | ||
10 | similar feature strength | ||
11 | **/ | ||
12 | F2D *getANMS (F2D *points, float r) | ||
13 | { | ||
14 | float MAX_LIMIT = 100000; | ||
15 | F2D *suppressR; | ||
16 | float C_ROBUST = 1.0; | ||
17 | F2D *srtdPnts; | ||
18 | int n; | ||
19 | I2D *srtdVIdx, *supId; | ||
20 | float t, t1, r_sq; | ||
21 | F2D *tempF, *srtdV, *interestPnts; | ||
22 | int i, j, validCount, cnt, end, k; | ||
23 | int iter, rows, cols; | ||
24 | F2D *temp; | ||
25 | int supIdPtr = 0; | ||
26 | |||
27 | /** Concatenate x,y,v to form points matrix **/ | ||
28 | r_sq = r * r; | ||
29 | n = points->height; | ||
30 | |||
31 | srtdVIdx = iMallocHandle(points->height, 1); | ||
32 | for (i = 0; i < srtdVIdx->height; i++) { | ||
33 | asubsref(srtdVIdx,i) = i; | ||
34 | } | ||
35 | srtdPnts = fMallocHandle (srtdVIdx->height, points->width); | ||
36 | for (i = 0; i < srtdVIdx->height; i++) { | ||
37 | for(j=0; j<points->width; j++) { | ||
38 | subsref(srtdPnts,i,j) = subsref(points, asubsref(srtdVIdx,i), j); | ||
39 | } | ||
40 | } | ||
41 | temp = fSetArray (1, 3, 0); | ||
42 | suppressR = fSetArray(n, 1, MAX_LIMIT); | ||
43 | validCount = n; | ||
44 | iter = 0; | ||
45 | |||
46 | /** Allocate supId for #validCount and fill the values of | ||
47 | supId with the indices where suppressR>r_sq **/ | ||
48 | k = 0; | ||
49 | supId = iMallocHandle(validCount, 1); | ||
50 | for (i = 0; i < (suppressR->height*suppressR->width); i++) | ||
51 | { | ||
52 | if ( asubsref(suppressR,i) > r_sq) | ||
53 | { | ||
54 | asubsref(supId,k++) = i; | ||
55 | } | ||
56 | } | ||
57 | |||
58 | /** While number of features not-inspected is >0, **/ | ||
59 | while (validCount > 0) | ||
60 | { | ||
61 | F2D *tempp, *temps; | ||
62 | |||
63 | /** Inspect the strongest feature point in srtdPnts | ||
64 | The index of that feature is in supId and the | ||
65 | index values in supId are arranged in descending order **/ | ||
66 | asubsref(temp,0) = subsref(srtdPnts, asubsref(supId,0), 0); | ||
67 | asubsref(temp,1) = subsref(srtdPnts, asubsref(supId,0), 1); | ||
68 | asubsref(temp,2) = subsref(srtdPnts, asubsref(supId,0), 2); | ||
69 | |||
70 | /** Stacking up the interestPnts matrix with top features | ||
71 | post suppression **/ | ||
72 | if(iter == 0) | ||
73 | interestPnts = fDeepCopy(temp); | ||
74 | else | ||
75 | { | ||
76 | tempp = fDeepCopy(interestPnts); | ||
77 | fFreeHandle(interestPnts); | ||
78 | interestPnts = ffVertcat(tempp, temp); | ||
79 | fFreeHandle(tempp); | ||
80 | } | ||
81 | iter++; | ||
82 | |||
83 | tempp = fDeepCopy(srtdPnts); | ||
84 | temps = fDeepCopy(suppressR); | ||
85 | |||
86 | fFreeHandle(srtdPnts); | ||
87 | fFreeHandle(suppressR); | ||
88 | |||
89 | /** Remove the feature that has been added to interestPnts **/ | ||
90 | srtdPnts = fMallocHandle(supId->height-1, 3); | ||
91 | suppressR = fMallocHandle(supId->height-1, 1); | ||
92 | k=0; | ||
93 | |||
94 | for(i=1; i<(supId->height); i++) /** Filling srtdPnts after removing the feature that was added to interestPnts**/ | ||
95 | { | ||
96 | subsref(srtdPnts,(i-1),0) = subsref(tempp, asubsref(supId,i) ,0); | ||
97 | subsref(srtdPnts,(i-1),1) = subsref(tempp, asubsref(supId,i) ,1); | ||
98 | subsref(srtdPnts,(i-1),2) = subsref(tempp, asubsref(supId,i) ,2); | ||
99 | subsref(suppressR,(i-1),0) = subsref(temps, asubsref(supId,i) ,0); | ||
100 | } | ||
101 | |||
102 | fFreeHandle(tempp); | ||
103 | fFreeHandle(temps); | ||
104 | rows = interestPnts->height-1; | ||
105 | cols = interestPnts->width; | ||
106 | |||
107 | /** For each feature, find how robust it is compared to the one in interestPnts **/ | ||
108 | for (i = 0; i < srtdPnts->height; i++) | ||
109 | { | ||
110 | t = 0; | ||
111 | t1 = 0; | ||
112 | |||
113 | if ((C_ROBUST * subsref(interestPnts,rows,2)) >= subsref(srtdPnts, i,2)) | ||
114 | { | ||
115 | t = subsref(srtdPnts, i,0) - subsref(interestPnts,rows,0); | ||
116 | t1 = subsref(srtdPnts, i,1) - subsref(interestPnts,rows,1); | ||
117 | t = t * t + t1 * t1; | ||
118 | t1 = 0; | ||
119 | } | ||
120 | |||
121 | if ((C_ROBUST * subsref(interestPnts,rows,2)) < subsref(srtdPnts, i,2)) | ||
122 | t1 = 1 * MAX_LIMIT; | ||
123 | |||
124 | if ( asubsref(suppressR, i) > (t + t1)) | ||
125 | { | ||
126 | asubsref(suppressR, i) = t + t1; | ||
127 | } | ||
128 | } | ||
129 | |||
130 | /** Inspect the new suppressR to find how many valid features left **/ | ||
131 | validCount=0; | ||
132 | for (i = 0; i < suppressR->height; i++) { | ||
133 | if ( asubsref(suppressR,i) > r_sq) { | ||
134 | validCount++; | ||
135 | } | ||
136 | } | ||
137 | k = 0; | ||
138 | iFreeHandle(supId); | ||
139 | /** Allocate supId for #validCount and fill the values of | ||
140 | supId with the indices where suppressR>r_sq **/ | ||
141 | supId = iMallocHandle(validCount, 1); | ||
142 | for (i = 0; i < suppressR->height*suppressR->width; i++) { | ||
143 | if ( asubsref(suppressR,i) > r_sq) | ||
144 | asubsref(supId,k++) = i; | ||
145 | } | ||
146 | } | ||
147 | |||
148 | iFreeHandle(supId); | ||
149 | iFreeHandle(srtdVIdx); | ||
150 | fFreeHandle(srtdPnts); | ||
151 | fFreeHandle(temp); | ||
152 | fFreeHandle(suppressR); | ||
153 | |||
154 | return interestPnts; | ||
155 | } | ||
156 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c b/SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c new file mode 100644 index 0000000..99e95f9 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c | |||
@@ -0,0 +1,43 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | |||
7 | /** Perform simple interpolation around 2*winSize*2*winSize neighbourhood **/ | ||
8 | F2D* getInterpolatePatch(F2D* src, int cols, float centerX, float centerY, int winSize) | ||
9 | { | ||
10 | F2D *dst; | ||
11 | float a, b, a11, a12, a21, a22; | ||
12 | int i, j, k, srcIdx, dstIdx; | ||
13 | int srcIdxx, dstIdxx; | ||
14 | |||
15 | a = centerX - floor(centerX); | ||
16 | b = centerY - floor(centerY); | ||
17 | |||
18 | a11 = (1-a)*(1-b); | ||
19 | a12 = a*(1-b); | ||
20 | a21 = (1-a)*b; | ||
21 | a22 = a*b; | ||
22 | |||
23 | dst = fSetArray(1,2*winSize*2*winSize, 0); | ||
24 | |||
25 | |||
26 | for(i=-winSize; i<winSize; i++) | ||
27 | { | ||
28 | srcIdxx = floor(centerY) + i; | ||
29 | dstIdxx = i+winSize; | ||
30 | |||
31 | for(j=-winSize; j<(winSize); j++) | ||
32 | { | ||
33 | srcIdx = srcIdxx * cols + floor(centerX) + j; | ||
34 | dstIdx = dstIdxx * 2 * winSize + j + winSize; | ||
35 | asubsref(dst,dstIdx) = asubsref(src,srcIdx)*a11 + asubsref(src,srcIdx+1)*a12 + asubsref(src,srcIdx+cols)*a21 + asubsref(src,srcIdx+1+cols)*a22; | ||
36 | } | ||
37 | } | ||
38 | |||
39 | return dst; | ||
40 | } | ||
41 | |||
42 | |||
43 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/c/script_tracking.c b/SD-VBS/benchmarks/tracking/src/c/script_tracking.c new file mode 100644 index 0000000..bb48ace --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/script_tracking.c | |||
@@ -0,0 +1,263 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #include "tracking.h" | ||
6 | #include <malloc.h> | ||
7 | #include "extra.h" | ||
8 | #define TRACKING_MEM 1<<29 | ||
9 | |||
10 | int main(int argc, char* argv[]) | ||
11 | { | ||
12 | SET_UP | ||
13 | mallopt(M_TOP_PAD, TRACKING_MEM); | ||
14 | mallopt(M_MMAP_MAX, 0); | ||
15 | int i, j, k, N_FEA, WINSZ, LK_ITER, rows, cols; | ||
16 | int endR, endC; | ||
17 | F2D *blurredImage, *previousFrameBlurred_level1, *previousFrameBlurred_level2, *blurred_level1, *blurred_level2; | ||
18 | F2D *verticalEdgeImage, *horizontalEdgeImage, *verticalEdge_level1, *verticalEdge_level2, *horizontalEdge_level1, *horizontalEdge_level2, *interestPnt; | ||
19 | F2D *lambda, *lambdaTemp, *features; | ||
20 | I2D *Ic, *status; | ||
21 | float SUPPRESION_RADIUS; | ||
22 | F2D *newpoints; | ||
23 | |||
24 | int numFind, m, n; | ||
25 | F2D *np_temp; | ||
26 | |||
27 | char im1[100]; | ||
28 | int counter=2; | ||
29 | float accuracy = 0.03; | ||
30 | int count; | ||
31 | |||
32 | |||
33 | N_FEA = 1600; | ||
34 | WINSZ = 4; | ||
35 | SUPPRESION_RADIUS = 10.0; | ||
36 | LK_ITER = 20; | ||
37 | |||
38 | #ifdef test | ||
39 | WINSZ = 2; | ||
40 | N_FEA = 100; | ||
41 | LK_ITER = 2; | ||
42 | counter = 2; | ||
43 | accuracy = 0.1; | ||
44 | #endif | ||
45 | #ifdef sim_fast | ||
46 | WINSZ = 2; | ||
47 | N_FEA = 100; | ||
48 | LK_ITER = 2; | ||
49 | counter = 4; | ||
50 | #endif | ||
51 | #ifdef sim | ||
52 | WINSZ = 2; | ||
53 | N_FEA = 200; | ||
54 | LK_ITER = 2; | ||
55 | counter = 4; | ||
56 | #endif | ||
57 | #ifdef sqcif | ||
58 | WINSZ = 8; | ||
59 | N_FEA = 500; | ||
60 | LK_ITER = 15; | ||
61 | counter = 2; | ||
62 | #endif | ||
63 | #ifdef qcif | ||
64 | WINSZ = 12; | ||
65 | N_FEA = 400; | ||
66 | LK_ITER = 15; | ||
67 | counter = 4; | ||
68 | #endif | ||
69 | #ifdef cif | ||
70 | WINSZ = 20; | ||
71 | N_FEA = 500; | ||
72 | LK_ITER = 20; | ||
73 | counter = 4; | ||
74 | #endif | ||
75 | #ifdef vga | ||
76 | WINSZ = 32; | ||
77 | N_FEA = 400; | ||
78 | LK_ITER = 20; | ||
79 | counter = 4; | ||
80 | #endif | ||
81 | #ifdef wuxga | ||
82 | WINSZ = 64; | ||
83 | N_FEA = 500; | ||
84 | LK_ITER = 20; | ||
85 | counter = 4; | ||
86 | #endif | ||
87 | #ifdef fullhd | ||
88 | WINSZ = 48; | ||
89 | N_FEA = 500; | ||
90 | LK_ITER = 20; | ||
91 | counter = 4; | ||
92 | #endif | ||
93 | |||
94 | I2D* images[counter]; | ||
95 | /** Read input image **/ | ||
96 | for(count=1; count<=counter; count++) | ||
97 | { | ||
98 | /** Read image **/ | ||
99 | printf("Input image %d: ", count); | ||
100 | scanf("%s", im1); | ||
101 | images[count - 1] = readImage(im1); | ||
102 | if(count == 1) Ic = readImage(im1); | ||
103 | } | ||
104 | |||
105 | |||
106 | rows = Ic->height; | ||
107 | cols = Ic->width; | ||
108 | |||
109 | printf("start\n"); | ||
110 | for_each_job{ | ||
111 | |||
112 | /** IMAGE PRE-PROCESSING **/ | ||
113 | |||
114 | /** Blur the image to remove noise - weighted avergae filter **/ | ||
115 | blurredImage = imageBlur(Ic); | ||
116 | |||
117 | /** Scale down the image to build Image Pyramid. We find features across all scales of the image **/ | ||
118 | blurred_level1 = blurredImage; /** Scale 0 **/ | ||
119 | blurred_level2 = imageResize(blurredImage); /** Scale 1 **/ | ||
120 | |||
121 | |||
122 | /** Edge Images - From pre-processed images, build gradient images, both horizontal and vertical **/ | ||
123 | verticalEdgeImage = calcSobel_dX(blurredImage); | ||
124 | horizontalEdgeImage = calcSobel_dY(blurredImage); | ||
125 | |||
126 | /** Edge images are used for feature detection. So, using the verticalEdgeImage and horizontalEdgeImage images, we compute feature strength | ||
127 | across all pixels. Lambda matrix is the feature strength matrix returned by calcGoodFeature **/ | ||
128 | |||
129 | lambda = calcGoodFeature(verticalEdgeImage, horizontalEdgeImage, verticalEdgeImage->width, verticalEdgeImage->height, WINSZ); | ||
130 | endR = lambda->height; | ||
131 | endC = lambda->width; | ||
132 | lambdaTemp = fReshape(lambda, endR*endC, 1); | ||
133 | |||
134 | /** We sort the lambda matrix based on the strengths **/ | ||
135 | /** Fill features matrix with top N_FEA features **/ | ||
136 | fFreeHandle(lambdaTemp); | ||
137 | lambdaTemp = fillFeatures(lambda, N_FEA, WINSZ); | ||
138 | features = fTranspose(lambdaTemp); | ||
139 | |||
140 | /** Suppress features that have approximately similar strength and belong to close neighborhood **/ | ||
141 | interestPnt = getANMS(features, SUPPRESION_RADIUS); | ||
142 | |||
143 | /** Refill interestPnt in features matrix **/ | ||
144 | fFreeHandle(features); | ||
145 | features = fSetArray(2, interestPnt->height, 0); | ||
146 | for(i=0; i<2; i++) { | ||
147 | for(j=0; j<interestPnt->height; j++) { | ||
148 | subsref(features,i,j) = subsref(interestPnt,j,i); | ||
149 | } | ||
150 | } | ||
151 | |||
152 | |||
153 | fFreeHandle(verticalEdgeImage); | ||
154 | fFreeHandle(horizontalEdgeImage); | ||
155 | fFreeHandle(interestPnt); | ||
156 | fFreeHandle(lambda); | ||
157 | fFreeHandle(lambdaTemp); | ||
158 | /** Until now, we processed base frame. The following for loop processes other frames **/ | ||
159 | for(count=1; count<=counter; count++) | ||
160 | { | ||
161 | /** Read image **/ | ||
162 | //sprintf(im1, "%s/%d.bmp", argv[1], count); | ||
163 | //Ic = readImage(im1); | ||
164 | I2D* Icc = images[count-1]; | ||
165 | rows = Icc->height; | ||
166 | cols = Icc->width; | ||
167 | |||
168 | |||
169 | /** Blur image to remove noise **/ | ||
170 | blurredImage = imageBlur(Icc); | ||
171 | previousFrameBlurred_level1 = fDeepCopy(blurred_level1); | ||
172 | previousFrameBlurred_level2 = fDeepCopy(blurred_level2); | ||
173 | |||
174 | fFreeHandle(blurred_level1); | ||
175 | fFreeHandle(blurred_level2); | ||
176 | |||
177 | /** Image pyramid **/ | ||
178 | blurred_level1 = blurredImage; | ||
179 | blurred_level2 = imageResize(blurredImage); | ||
180 | |||
181 | /** Gradient image computation, for all scales **/ | ||
182 | verticalEdge_level1 = calcSobel_dX(blurred_level1); | ||
183 | horizontalEdge_level1 = calcSobel_dY(blurred_level1); | ||
184 | |||
185 | verticalEdge_level2 = calcSobel_dX(blurred_level2); | ||
186 | horizontalEdge_level2 = calcSobel_dY(blurred_level2); | ||
187 | |||
188 | newpoints = fSetArray(2, features->width, 0); | ||
189 | |||
190 | /** Based on features computed in the previous frame, find correspondence in the current frame. "status" returns the index of corresponding features **/ | ||
191 | status = calcPyrLKTrack(previousFrameBlurred_level1, previousFrameBlurred_level2, verticalEdge_level1, verticalEdge_level2, horizontalEdge_level1, horizontalEdge_level2, blurred_level1, blurred_level2, features, features->width, WINSZ, accuracy, LK_ITER, newpoints); | ||
192 | fFreeHandle(verticalEdge_level1); | ||
193 | fFreeHandle(verticalEdge_level2); | ||
194 | fFreeHandle(horizontalEdge_level1); | ||
195 | fFreeHandle(horizontalEdge_level2); | ||
196 | fFreeHandle(previousFrameBlurred_level1); | ||
197 | fFreeHandle(previousFrameBlurred_level2); | ||
198 | //printf("height = %d, width = %d, numFind = %d\n", newpoints->height, newpoints->width); | ||
199 | |||
200 | /** Populate newpoints with features that had correspondence with previous frame features **/ | ||
201 | np_temp = fDeepCopy(newpoints); | ||
202 | if(status->width > 0 ) | ||
203 | { | ||
204 | k = 0; | ||
205 | numFind=0; | ||
206 | for(i=0; i<status->width; i++) | ||
207 | { | ||
208 | if( asubsref(status,i) == 1) | ||
209 | numFind++; | ||
210 | } | ||
211 | fFreeHandle(newpoints); | ||
212 | newpoints = fSetArray(2, numFind, 0); | ||
213 | |||
214 | for(i=0; i<status->width; i++) | ||
215 | { | ||
216 | if( asubsref(status,i) == 1) | ||
217 | { | ||
218 | subsref(newpoints,0,k) = subsref(np_temp,0,i); | ||
219 | subsref(newpoints,1,k++) = subsref(np_temp,1,i); | ||
220 | } | ||
221 | } | ||
222 | } | ||
223 | |||
224 | iFreeHandle(status); | ||
225 | fFreeHandle(np_temp); | ||
226 | fFreeHandle(features); | ||
227 | |||
228 | /** Populate newpoints into features **/ | ||
229 | features = fDeepCopy(newpoints); | ||
230 | fFreeHandle(newpoints); | ||
231 | } | ||
232 | } | ||
233 | printf("end..\n"); | ||
234 | #ifdef CHECK | ||
235 | /* Self checking */ | ||
236 | { | ||
237 | int ret=0; | ||
238 | float tol = 2.0; | ||
239 | #ifdef GENERATE_OUTPUT | ||
240 | fWriteMatrix(features, argv[1]); | ||
241 | #endif | ||
242 | ret = fSelfCheck(features, "expected_C.txt", tol); | ||
243 | if (ret == -1) | ||
244 | printf("Error in Tracking Map\n"); | ||
245 | } | ||
246 | #endif | ||
247 | |||
248 | fFreeHandle(blurred_level1); | ||
249 | fFreeHandle(blurred_level2); | ||
250 | fFreeHandle(features); | ||
251 | |||
252 | for(count=1; count<=counter; count++) | ||
253 | { | ||
254 | free(images[count - 1] ); | ||
255 | } | ||
256 | iFreeHandle(Ic); | ||
257 | WRITE_TO_FILE | ||
258 | return 0; | ||
259 | |||
260 | } | ||
261 | |||
262 | |||
263 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/c/tracking.h b/SD-VBS/benchmarks/tracking/src/c/tracking.h new file mode 100644 index 0000000..24b8b2d --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/c/tracking.h | |||
@@ -0,0 +1,20 @@ | |||
1 | /******************************** | ||
2 | Author: Sravanthi Kota Venkata | ||
3 | ********************************/ | ||
4 | |||
5 | #ifndef _SCRIPT_TRACK_ | ||
6 | #define _SCRIPT_TRACK_ | ||
7 | |||
8 | #include "sdvbs_common.h" | ||
9 | |||
10 | F2D* calcAreaSum(F2D* src, int cols, int rows, int winSize); | ||
11 | F2D* calcGoodFeature(F2D* dX, F2D* dY, int cols, int rows, int winSize); | ||
12 | I2D* calcPyrLKTrack(F2D* ip1, F2D* ip2, F2D* idxp1, F2D* idxp2, F2D* idyp1, F2D* idyp2, F2D* jp1, F2D* jp2, F2D* fPnt, int nFeatures, int winSize, float accuracy, int maxIter, F2D* newPnt); | ||
13 | F2D *getANMS (F2D *points, float r); | ||
14 | F2D* getInterpolatePatch(F2D* src, int cols, float centerX, float centerY, int winSize); | ||
15 | float polynomial(int d, F2D* a, F2D* b, int dim); | ||
16 | I2D* sortInd(F2D* input, int dim); | ||
17 | F2D* fillFeatures(F2D* lambda, int N_FEA, int win); | ||
18 | |||
19 | #endif | ||
20 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/Filtering.m b/SD-VBS/benchmarks/tracking/src/matlab/Filtering.m new file mode 100755 index 0000000..d42ebb7 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/Filtering.m | |||
@@ -0,0 +1,30 @@ | |||
1 | function imageOut = Filtering(imageIn, rows, cols, kernel, kernelSize) | ||
2 | |||
3 | imageOut = zeros(rows, cols);%initalize output image to all zeros | ||
4 | imageIn = double(imageIn);%convert to double to allow image arithmetic | ||
5 | |||
6 | intialCol = ((kernelSize+1)/2); | ||
7 | endCol = round(cols - ((kernelSize+1)/2)); | ||
8 | halfKernel = (kernelSize-1)/2; | ||
9 | |||
10 | initialRow = ((kernelSize+1)/2); | ||
11 | endRow = (rows - ((kernelSize+1)/2)); | ||
12 | |||
13 | %% Start 1-D filtering row-wise first. | ||
14 | |||
15 | for i=initialRow:endRow | ||
16 | for j=initialCol:endCol | ||
17 | imageOut(i,j) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel)/sum(kernel);%actual filtering step | ||
18 | end | ||
19 | end | ||
20 | |||
21 | %% Start 1-D filtering col-wise first. | ||
22 | |||
23 | % kernelT = kernel'; | ||
24 | % for i=initialRow:endRow | ||
25 | % for j=initialCol:endCol | ||
26 | % imageOut(i,j) = sum(imageOut(i-halfKernel:i+halfKernel,j).*kernelT)/sum(kernel);%kernel to be transposed for performing multiplcation | ||
27 | % end | ||
28 | % end | ||
29 | % | ||
30 | % %imshow(uint8(imageOut)); | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcAreaSum.m b/SD-VBS/benchmarks/tracking/src/matlab/calcAreaSum.m new file mode 100755 index 0000000..f8dd3da --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/calcAreaSum.m | |||
@@ -0,0 +1,48 @@ | |||
1 | %calcAreaSum: | ||
2 | % sizeX = cols | ||
3 | % sizeY = rows | ||
4 | function ret = calcAreaSum(src, sizeX, sizeY, winSize, dataDir) | ||
5 | |||
6 | src = double(src); | ||
7 | nave = winSize; | ||
8 | nave_half = floor((nave+1)/2); | ||
9 | a1=zeros(1,sizeX+nave); | ||
10 | |||
11 | for i=1:sizeY | ||
12 | %pull out one row | ||
13 | for j=1:sizeX | ||
14 | a1(j+nave_half)=src(i,j); | ||
15 | end | ||
16 | |||
17 | a1sum=0; | ||
18 | %sum up values within a window | ||
19 | for k=1:nave | ||
20 | a1sum = a1sum+a1(k); | ||
21 | end | ||
22 | |||
23 | for j=1:sizeX | ||
24 | ret(i,j) = a1sum; | ||
25 | a1sum = a1sum + a1(j+nave) - a1(j); | ||
26 | end | ||
27 | end | ||
28 | |||
29 | a1=zeros(1,sizeY+nave); | ||
30 | for i=1:sizeX | ||
31 | |||
32 | %pull out one col | ||
33 | for j=1:sizeY | ||
34 | a1(j+nave_half)=ret(j,i); | ||
35 | end | ||
36 | |||
37 | a1sum=0; | ||
38 | %sum up values within a window | ||
39 | for k=1:nave | ||
40 | a1sum = a1sum+a1(k); | ||
41 | end | ||
42 | |||
43 | for j=1:sizeY | ||
44 | ret(j,i) = a1sum; | ||
45 | a1sum = a1sum + a1(j+nave) - a1(j); | ||
46 | end | ||
47 | end | ||
48 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcGoodFeature.m b/SD-VBS/benchmarks/tracking/src/matlab/calcGoodFeature.m new file mode 100755 index 0000000..b83faa6 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/calcGoodFeature.m | |||
@@ -0,0 +1,28 @@ | |||
1 | %calcGoodFeature: | ||
2 | |||
3 | function [lambda, tr, det,c_xx, c_xy, c_yy] = calcGoodFeature(dX, dY, sizeX, sizeY, winSize, dataDir) | ||
4 | |||
5 | for i=1:sizeY | ||
6 | for j=1:sizeX | ||
7 | xx(i,j)=dX(i,j)*dX(i,j); | ||
8 | xy(i,j)=dX(i,j)*dY(i,j); | ||
9 | yy(i,j)=dY(i,j)*dY(i,j); | ||
10 | end | ||
11 | end | ||
12 | |||
13 | c_xx=calcAreaSum(xx, sizeX, sizeY, winSize,dataDir); | ||
14 | c_xy=calcAreaSum(xy, sizeX, sizeY, winSize,dataDir); | ||
15 | c_yy=calcAreaSum(yy, sizeX, sizeY, winSize,dataDir); | ||
16 | |||
17 | for i=1:sizeY | ||
18 | for j=1:sizeX | ||
19 | tr(i,j)= c_xx(i,j)+c_yy(i,j); | ||
20 | det(i,j)= c_xx(i,j)*c_yy(i,j)-c_xy(i,j)*c_xy(i,j); | ||
21 | % if( tr(i,j) == 0 ) | ||
22 | % lambda(i,j) = 0; | ||
23 | % else | ||
24 | lambda(i,j)=det(i,j)/(tr(i,j) + 0.00001); | ||
25 | % end | ||
26 | end | ||
27 | end | ||
28 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcPyrLKTrack.m b/SD-VBS/benchmarks/tracking/src/matlab/calcPyrLKTrack.m new file mode 100755 index 0000000..c965c2b --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/calcPyrLKTrack.m | |||
@@ -0,0 +1,108 @@ | |||
1 | function [newFPnt, valid] = calcPyrLKTrack(iP, iDxP, iDyP, jP, fPnt, nFeatures, winSize, accuracy_th, max_iter) | ||
2 | |||
3 | cellDims = size(iP); | ||
4 | GOOD_FEATURE_LAMBDA_TH = accuracy_th; | ||
5 | |||
6 | for i=1:(cellDims(1)) | ||
7 | curImgDims = size(iP{i}); | ||
8 | imgDims(i,1)= curImgDims(1); | ||
9 | imgDims(i,2)= curImgDims(2); | ||
10 | |||
11 | end | ||
12 | |||
13 | pLevel = cellDims(1); | ||
14 | |||
15 | rate=[1, 0.5, 0.25, 0.125, 0.0625, 0.03125]; | ||
16 | winSizeSq=4*winSize*winSize; | ||
17 | iPatch=cell(1, winSizeSq); | ||
18 | jPatch=cell(1, winSizeSq); | ||
19 | iDxPatch=cell(1,winSizeSq); | ||
20 | iDyPatch=cell(1,winSizeSq); | ||
21 | |||
22 | valid(1:nFeatures) = 1; | ||
23 | newFPnt = zeros(2,nFeatures); | ||
24 | |||
25 | for i=1:nFeatures | ||
26 | |||
27 | dX=0; | ||
28 | dY=0; | ||
29 | |||
30 | %% x is rows here and y is cols | ||
31 | |||
32 | x=fPnt(1,i)*rate(pLevel+1); %half size of real level | ||
33 | y=fPnt(2,i)*rate(pLevel+1); | ||
34 | |||
35 | for level=pLevel:-1:1 | ||
36 | |||
37 | x = x+x; | ||
38 | y = y+y; | ||
39 | dX = dX+dX; | ||
40 | dY = dY+dY; | ||
41 | imgSize(1)=imgDims(level,1); %y,x | ||
42 | imgSize(2)=imgDims(level,2); %y,x | ||
43 | |||
44 | c_xx = 0; | ||
45 | c_xy = 0; | ||
46 | c_yy = 0; | ||
47 | |||
48 | %when feature goes out to the boundary. | ||
49 | |||
50 | if ((x-winSize)<1 || (y-winSize)<1 || (y+winSize+1)>imgSize(1) || (x+winSize+1)>imgSize(2)) | ||
51 | %winSize+1due to interpolation | ||
52 | %error or skip the level?? | ||
53 | valid(i) = 0; | ||
54 | break; | ||
55 | end | ||
56 | |||
57 | |||
58 | iPatch = getInterpolatePatch(iP{level}, imgSize(1), imgSize(2), x, y, winSize); | ||
59 | iDxPatch = getInterpolatePatch(iDxP{level}, imgSize(1), imgSize(2), x, y, winSize); | ||
60 | iDyPatch = getInterpolatePatch(iDyP{level}, imgSize(1), imgSize(2), x, y, winSize); | ||
61 | |||
62 | for idx=1:winSizeSq | ||
63 | c_xx = c_xx + iDxPatch(idx) * iDxPatch(idx); | ||
64 | c_xy = c_xy + iDxPatch(idx) * iDyPatch(idx); | ||
65 | c_yy = c_yy + iDyPatch(idx) * iDyPatch(idx); | ||
66 | end | ||
67 | |||
68 | c_det = c_xx * c_yy - c_xy * c_xy; | ||
69 | |||
70 | if (c_det/(c_xx+c_yy+0.00001)) < GOOD_FEATURE_LAMBDA_TH | ||
71 | valid(i)=0; | ||
72 | break; | ||
73 | end | ||
74 | |||
75 | c_det=1/c_det; | ||
76 | |||
77 | for k=1:max_iter | ||
78 | if ((x+dX-winSize)<1 || (y+dY-winSize)<1 || (y+dY+winSize+1)>imgSize(1) || (x+dX+winSize+1)>imgSize(2)) | ||
79 | %winSize+1due to interpolation | ||
80 | %error or skip the level?? | ||
81 | valid(i)=0; | ||
82 | break; | ||
83 | end | ||
84 | |||
85 | jPatch = getInterpolatePatch(jP{level}, imgSize(1), imgSize(2), x+dX, y+dY, winSize); | ||
86 | eX = 0; | ||
87 | eY = 0; | ||
88 | for idx=1:winSizeSq | ||
89 | dIt = iPatch(idx) - jPatch(idx); | ||
90 | eX = eX + (dIt*iDxPatch(idx)); | ||
91 | eY = eY + (dIt*iDyPatch(idx)); | ||
92 | end | ||
93 | |||
94 | mX = c_det*(eX*c_yy-eY*c_xy); | ||
95 | mY = c_det*(-eX*c_xy+eY*c_xx); | ||
96 | dX = dX + mX; | ||
97 | dY = dY + mY; | ||
98 | |||
99 | |||
100 | if ((mX*mX+mY*mY)<accuracy_th) | ||
101 | break; | ||
102 | end | ||
103 | end | ||
104 | end | ||
105 | |||
106 | newFPnt(1, i) = fPnt(1,i)+dX; | ||
107 | newFPnt(2, i) = fPnt(2,i)+dY; | ||
108 | end | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m b/SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m new file mode 100755 index 0000000..8617c25 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/calcSobel.m | |||
@@ -0,0 +1,74 @@ | |||
1 | function [Dx, Dy] = calcSobel(imageIn) | ||
2 | |||
3 | imsize = size(imageIn); | ||
4 | rows = imsize(1); | ||
5 | cols = imsize(2); | ||
6 | |||
7 | Dx = zeros(rows, cols); %initalize output image to all zeros | ||
8 | Dy = zeros(rows, cols); %initalize output image to all zeros | ||
9 | imageIn = double(imageIn); %convert to double to allow image arithmetic | ||
10 | |||
11 | kernel_1 = [1 2 1]; | ||
12 | kernel_2 = [1 0 -1]; | ||
13 | kernelSize = 3; | ||
14 | |||
15 | sum_kernel_1 = 4; | ||
16 | sum_kernel_2 = 2; | ||
17 | |||
18 | startCol = 2; %((kernelSize+1)/2); | ||
19 | endCol = cols - 1; %round(cols - ((kernelSize+1)/2)); | ||
20 | halfKernel = 1; %(kernelSize-1)/2; | ||
21 | |||
22 | startRow = 2; %((kernelSize+1)/2); | ||
23 | endRow = rows - 1; %(rows - ((kernelSize+1)/2)); | ||
24 | |||
25 | %imshow(uint8(imageIn)); | ||
26 | |||
27 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
28 | %% Calculate Gx (gradient in X-dir) | ||
29 | %% Gx = ([1 2 1]') * ([1 0 -1] * imageIn) | ||
30 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
31 | |||
32 | %% Start 1-D filtering row-wise first. | ||
33 | |||
34 | tempOut = zeros(rows, cols);%initalize temp image to all zeros | ||
35 | for i=startRow:endRow | ||
36 | for j=startCol:endCol | ||
37 | tempOut(i,j) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel_2)/sum_kernel_2;%actual filtering step | ||
38 | end | ||
39 | end | ||
40 | |||
41 | % Start 1-D filtering col-wise first. | ||
42 | |||
43 | for i=startRow:endRow | ||
44 | for j=startCol:endCol | ||
45 | Dx(i,j) = sum(tempOut(i-halfKernel:i+halfKernel,j).*kernel_1')/sum_kernel_1;%kernel to be transposed for performing multiplcation | ||
46 | Dx(i,j) = Dx(i,j);% + 128; | ||
47 | end | ||
48 | end | ||
49 | |||
50 | |||
51 | %imshow(uint8(Dx)); | ||
52 | |||
53 | |||
54 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
55 | %% Calculate Gy (gradient in Y-dir) | ||
56 | %% Gy = ([1 0 -1]') * ([1 2 1] * imageIn) | ||
57 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
58 | |||
59 | %% Start 1-D filtering row-wise first. | ||
60 | |||
61 | for i=startRow:endRow | ||
62 | for j=startCol:endCol | ||
63 | tempOut(i,j) = sum(imageIn(i-halfKernel:i+halfKernel,j).*kernel_2')/sum_kernel_2;%kernel to be transposed for performing multiplcation | ||
64 | end | ||
65 | end | ||
66 | |||
67 | for i=startRow:endRow | ||
68 | for j=startCol:endCol | ||
69 | Dy(i,j) = sum(tempOut(i,j-halfKernel:j+halfKernel).*kernel_1)/sum_kernel_1; | ||
70 | end | ||
71 | end | ||
72 | |||
73 | |||
74 | %imshow(uint8(Dy)); | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/getInterpolatePatch.m b/SD-VBS/benchmarks/tracking/src/matlab/getInterpolatePatch.m new file mode 100755 index 0000000..d0a64d3 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/getInterpolatePatch.m | |||
@@ -0,0 +1,22 @@ | |||
1 | function [dstImg] = getInterpolatePatch(srcImg,rows, cols,centerX,centerY,winSize) | ||
2 | |||
3 | a=centerX-floor(centerX); | ||
4 | b=centerY-floor(centerY); | ||
5 | a11=(1-a)*(1-b); | ||
6 | a12=a*(1-b); | ||
7 | a21=(1-a)*b; | ||
8 | a22=a*b; | ||
9 | |||
10 | for i=-winSize:winSize-1 | ||
11 | srcIdxx=floor(centerY)+i; | ||
12 | dstIdxx=i+winSize+1; | ||
13 | for j=-winSize:winSize-1 | ||
14 | srcIdx = srcIdxx * cols + floor(centerX) + j; | ||
15 | dstIdx = dstIdxx*2*winSize+j+winSize+1; | ||
16 | dstImg(dstIdx)=srcImg(srcIdxx, floor(centerX)+j)*a11; | ||
17 | dstImg(dstIdx)= dstImg(dstIdx) + srcImg(srcIdxx, floor(centerX)+j+1)*a12; | ||
18 | dstImg(dstIdx)= dstImg(dstIdx) + srcImg(srcIdxx+1, floor(centerX)+j)*a21; | ||
19 | dstImg(dstIdx)= dstImg(dstIdx) + srcImg(srcIdxx+1, floor(centerX)+j+1)*a22; | ||
20 | end | ||
21 | end | ||
22 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/getPyramid.m b/SD-VBS/benchmarks/tracking/src/matlab/getPyramid.m new file mode 100755 index 0000000..845456a --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/getPyramid.m | |||
@@ -0,0 +1,10 @@ | |||
1 | function pyr=getPyramid(img, level) | ||
2 | kernel=[1/16,1/4,3/8,1/4,1/16]; | ||
3 | pyr=cell(level,1); | ||
4 | pyr{1}=double(img); | ||
5 | for i=2:level | ||
6 | % imgBlur=conv2(pyr{i-1}, kernel, 'same'); | ||
7 | % imgBlur=conv2(imgBlur, kernel, 'same'); | ||
8 | % pyr{i}=imgBlur(1:2:end, 1:2:end); | ||
9 | pyr{i}=calcResizedImgMex(pyr{i-1}); | ||
10 | end | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/imageBlur.m b/SD-VBS/benchmarks/tracking/src/matlab/imageBlur.m new file mode 100755 index 0000000..fd6c199 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/imageBlur.m | |||
@@ -0,0 +1,36 @@ | |||
1 | function imageOut = imageBlur(imageIn) | ||
2 | |||
3 | imsize = size(imageIn); | ||
4 | rows = imsize(1); | ||
5 | cols = imsize(2); | ||
6 | |||
7 | imageOut = zeros(rows, cols);%initalize output image to all zeros | ||
8 | imageIn = double(imageIn);%convert to double to allow image arithmetic | ||
9 | |||
10 | kernel = [1 4 6 4 1]; | ||
11 | kernelSize = 5; | ||
12 | |||
13 | startCol = 3; %((kernelSize+1)/2); | ||
14 | endCol = cols - 2; %round(cols - ((kernelSize+1)/2)); | ||
15 | halfKernel = 2; %(kernelSize-1)/2; | ||
16 | |||
17 | startRow = 3; %((kernelSize+1)/2); | ||
18 | endRow = rows - 2; %(rows - ((kernelSize+1)/2)); | ||
19 | |||
20 | %% Start 1-D filtering row-wise first. | ||
21 | |||
22 | tempOut = zeros(rows, cols);%initalize temp image to all zeros | ||
23 | for i=startRow:endRow | ||
24 | for j=startCol:endCol | ||
25 | tempOut(i,j) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel)/sum(kernel);%actual filtering step | ||
26 | end | ||
27 | end | ||
28 | |||
29 | %% Start 1-D filtering col-wise first. | ||
30 | |||
31 | for i=startRow:endRow | ||
32 | for j=startCol:endCol | ||
33 | imageOut(i,j) = sum(tempOut(i-halfKernel:i+halfKernel,j).*kernel')/sum(kernel);%kernel to be transposed for performing multiplcation | ||
34 | end | ||
35 | end | ||
36 | |||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m b/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m new file mode 100755 index 0000000..e5fa7b8 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/imageResize.m | |||
@@ -0,0 +1,50 @@ | |||
1 | function [imageOut] = imageResize(imageIn) | ||
2 | |||
3 | imageIn = double(imageIn); | ||
4 | imsize = size(imageIn); | ||
5 | rows = imsize(1); | ||
6 | cols = imsize(2); | ||
7 | |||
8 | %% level 1 is the base image. | ||
9 | |||
10 | outputRows = floor((rows+1)/2); | ||
11 | outputCols = floor((cols+1)/2); | ||
12 | |||
13 | kernel = [1,4,6,4,1]; | ||
14 | kernelSize = 5; | ||
15 | |||
16 | temp = zeros(rows, outputCols);%initalize output image to all zeros | ||
17 | imageOut = zeros(outputRows, outputCols);%initalize output image to all zeros | ||
18 | imageIn = double(imageIn);%convert to double to allow image arithmetic | ||
19 | |||
20 | initialCol = 3; %((kernelSize+1)/2); | ||
21 | endCol = cols - 2; %round(cols - ((kernelSize+1)/2)); | ||
22 | halfKernel = 2; %(kernelSize-1)/2; | ||
23 | |||
24 | initialRow = 3; %((kernelSize+1)/2); | ||
25 | endRow = rows - 2; %(rows - ((kernelSize+1)/2)); | ||
26 | |||
27 | %% Start 1-D filtering row-wise first. | ||
28 | |||
29 | for i=initialRow:endRow | ||
30 | k = 1; | ||
31 | for j=initialCol:2:endCol | ||
32 | temp(i,k) = sum(imageIn(i,j-halfKernel:j+halfKernel).*kernel)/sum(kernel);%actual filtering step | ||
33 | k = k+1; | ||
34 | end | ||
35 | end | ||
36 | |||
37 | %imshow(uint8(temp)); | ||
38 | |||
39 | %% Start 1-D filtering col-wise first. | ||
40 | % | ||
41 | kernelT = kernel'; | ||
42 | j = 1; | ||
43 | for i=initialRow:2:endRow | ||
44 | for k=1:outputCols | ||
45 | imageOut(j,k) = sum(temp(i-halfKernel:i+halfKernel,k).*kernelT)/sum(kernel);%kernel to be transposed for performing multiplcation | ||
46 | end | ||
47 | j = j + 1; | ||
48 | end | ||
49 | |||
50 | % %imshow(uint8(imageOut)); | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/rgb2gray_f2_f3.m b/SD-VBS/benchmarks/tracking/src/matlab/rgb2gray_f2_f3.m new file mode 100755 index 0000000..23397a3 --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/rgb2gray_f2_f3.m | |||
@@ -0,0 +1,16 @@ | |||
1 | %! _rgb2gray_f2_f3 | ||
2 | |||
3 | function grayImage = rgb2gray_f2_f3(colorImage) | ||
4 | |||
5 | %0.2989 * R + 0.5870 * G + 0.1140 * B | ||
6 | rows = size(colorImage, 1); | ||
7 | cols = size(colorImage, 2); | ||
8 | rgb = size(colorImage, 3); | ||
9 | |||
10 | grayImage = zeros(rows, cols); | ||
11 | for i = 1:rows | ||
12 | for j = 1:cols | ||
13 | grayImage(i,j) = 0.2989 * colorImage(i,j,1) + 0.5870 * colorImage(i,j,2) + 0.1140 * colorImage(i,j,3); | ||
14 | end | ||
15 | end | ||
16 | \ No newline at end of file | ||
diff --git a/SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m b/SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m new file mode 100755 index 0000000..62d367f --- /dev/null +++ b/SD-VBS/benchmarks/tracking/src/matlab/script_run_profile.m | |||
@@ -0,0 +1,178 @@ | |||
1 | function script_run_profile(dataDir, resultDir, type, common, toolDir) | ||
2 | |||
3 | if(~isdeployed) | ||
4 | addpath(fullfile(toolDir, '/lagrcv/')); | ||
5 | addpath(fullfile(toolDir, '/toolbox_basic/filter/')); | ||
6 | addpath(fullfile(toolDir, '/ikkjin/')); | ||
7 | end | ||
8 | IMAGE_DIR=dataDir; | ||
9 | |||
10 | path(path,common); | ||
11 | |||
12 | tol = 2; | ||
13 | |||
14 | %% Input params | ||
15 | N_FEA=1600; | ||
16 | WINSZ=4; %size of sum-up window | ||
17 | NO_PYR=2; | ||
18 | SUPPRESION_RADIUS=10; | ||
19 | LK_ITER=20; | ||
20 | counter = 2; | ||
21 | accuracy = 0.03; | ||
22 | |||
23 | if(strcmp(type,'test')) | ||
24 | WINSZ = 2; | ||
25 | N_FEA = 10; | ||
26 | LK_ITER = 2; | ||
27 | counter = 2; | ||
28 | accuracy = 0.1; | ||
29 | elseif(strcmp(type, 'sim_fast')) | ||
30 | WINSZ = 2; | ||
31 | N_FEA = 100; | ||
32 | LK_ITER = 2; | ||
33 | counter = 4; | ||
34 | elseif(strcmp(type,'sim')) | ||
35 | WINSZ = 2; | ||
36 | N_FEA = 200; | ||
37 | LK_ITER = 2; | ||
38 | counter = 4; | ||
39 | elseif(strcmp(type,'sqcif')) | ||
40 | WINSZ = 8; | ||
41 | N_FEA = 500; | ||
42 | LK_ITER = 15; | ||
43 | counter = 2; | ||
44 | elseif(strcmp(type, 'qcif')) | ||
45 | WINSZ = 12; | ||
46 | N_FEA = 400; | ||
47 | LK_ITER = 15; | ||
48 | counter = 4; | ||
49 | elseif(strcmp(type,'cif')) | ||
50 | WINSZ = 20; | ||
51 | N_FEA = 500; | ||
52 | LK_ITER = 20; | ||
53 | counter = 4; | ||
54 | elseif(strcmp(type, 'vga')) | ||
55 | WINSZ = 32; | ||
56 | N_FEA = 400; | ||
57 | LK_ITER = 20; | ||
58 | counter = 4; | ||
59 | elseif(strcmp(type,'fullhd')) | ||
60 | WINSZ = 48; | ||
61 | N_FEA = 500; | ||
62 | LK_ITER = 20; | ||
63 | counter = 4; | ||
64 | elseif(strcmp(type,'wuxga')) | ||
65 | WINSZ = 64; | ||
66 | N_FEA = 500; | ||
67 | LK_ITER = 20; | ||
68 | counter = 4; | ||
69 | end | ||
70 | |||
71 | imgName = [dataDir, '/1.bmp']; | ||
72 | Icur=readImage(imgName); | ||
73 | |||
74 | [rows,cols] = size(Icur); | ||
75 | fprintf(1,'Input size\t\t- (%dx%d)\n', rows, cols); | ||
76 | |||
77 | %% Timing | ||
78 | start = photonStartTiming; | ||
79 | |||
80 | Icur = imageBlur(double(Icur)); | ||
81 | |||
82 | Jpyr = cell(2,1); | ||
83 | Jpyr{1} = Icur; | ||
84 | Jpyr{2} = imageResize(Icur); | ||
85 | |||
86 | [dX, dY] = calcSobel(double(Icur)); | ||
87 | sizeWin = size(dX); | ||
88 | [lambda, tr, det, c_xx, c_xy, c_yy] = calcGoodFeature(dX, dY, sizeWin(2), sizeWin(1), WINSZ, dataDir); | ||
89 | |||
90 | imgsz=size(lambda); | ||
91 | lambda([1:WINSZ,end-WINSZ:end],:)=0; | ||
92 | lambda(:,[1:WINSZ,end-WINSZ:end])=0; | ||
93 | |||
94 | [temp,idx]=sort(lambda(:), 'descend'); | ||
95 | featureIdx=idx(1:N_FEA); | ||
96 | features=zeros(3, N_FEA); | ||
97 | features(1,:)=ceil(featureIdx/imgsz(1)); | ||
98 | |||
99 | fIdxT = featureIdx'; | ||
100 | features(2,:)=fIdxT-(features(1,:)-1)*imgsz(1); | ||
101 | features(3,:)=lambda(featureIdx); | ||
102 | |||
103 | for i=1:N_FEA | ||
104 | features(3,i) = lambda(idx(i)); | ||
105 | end | ||
106 | |||
107 | f1T = features(1,:)'; | ||
108 | f2T = features(2,:)'; | ||
109 | f3T = features(3,:)'; | ||
110 | |||
111 | interestPnt=getANMS(f1T, f2T, f3T, SUPPRESION_RADIUS, dataDir); | ||
112 | |||
113 | interestPnt=interestPnt'; | ||
114 | features=interestPnt(1:2,:); | ||
115 | |||
116 | %% Timing | ||
117 | endC = photonEndTiming; | ||
118 | elapsed = photonReportTiming(start, endC); | ||
119 | |||
120 | for iter=1:counter | ||
121 | imgName = [dataDir, '/', num2str(iter), '.bmp']; | ||
122 | Iprev=Icur; | ||
123 | Icur=readImage(imgName); | ||
124 | |||
125 | %% Self check params | ||
126 | tol = 0.1; | ||
127 | %% Timing | ||
128 | start = photonStartTiming; | ||
129 | |||
130 | Icur = imageBlur(double(Icur)); | ||
131 | |||
132 | Ipyr=Jpyr; | ||
133 | |||
134 | Jpyr = cell(2,1); | ||
135 | Jpyr{1} = Icur; | ||
136 | Jpyr{2} = imageResize(Icur); | ||
137 | |||
138 | dxPyr = cell(2,1); | ||
139 | dyPyr = cell(2,1); | ||
140 | |||
141 | [dxPyr{1}, dyPyr{1}] = calcSobel(Jpyr{1}); | ||
142 | [dxPyr{2}, dyPyr{2}] = calcSobel(Jpyr{2}); | ||
143 | |||
144 | sizeWin = size(dxPyr{2}); | ||
145 | nFeatures = size(features); | ||
146 | |||
147 | [newpoints, currStatus] = calcPyrLKTrack(Ipyr, dxPyr, dyPyr, Jpyr, double(features), nFeatures(2), WINSZ, 0.03, LK_ITER); | ||
148 | |||
149 | newpoints=newpoints(:,find(currStatus)); | ||
150 | |||
151 | %% Timing | ||
152 | stop = photonEndTiming; | ||
153 | |||
154 | temp = photonReportTiming(start, stop); | ||
155 | elapsed(1) = elapsed(1) + temp(1); | ||
156 | elapsed(2) = elapsed(2) + temp(2); | ||
157 | |||
158 | % figure(1); | ||
159 | % imagesc(Icur);colormap gray | ||
160 | % hold on; | ||
161 | % scatter(newpoints(1,:), newpoints(2,:), 'r+'); | ||
162 | % hold off; | ||
163 | % drawnow | ||
164 | % | ||
165 | features=newpoints; | ||
166 | |||
167 | end | ||
168 | |||
169 | %% Self checking | ||
170 | fWriteMatrix(features, dataDir); | ||
171 | |||
172 | photonPrintTiming(elapsed); | ||
173 | |||
174 | if(~isdeployed) | ||
175 | rmpath(fullfile(toolDir, '/lagrcv/')); | ||
176 | rmpath(fullfile(toolDir, '/toolbox_basic/filter/')); | ||
177 | rmpath(fullfile(toolDir, '/ikkjin/')); | ||
178 | end | ||