summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/tracking
diff options
context:
space:
mode:
authorLeo Chan <leochanj@live.unc.edu>2020-10-22 01:53:21 -0400
committerJoshua Bakita <jbakita@cs.unc.edu>2020-10-22 01:56:35 -0400
commitd17b33131c14864bd1eae275f49a3f148e21cf29 (patch)
tree0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/benchmarks/tracking
parent601ed25a4c5b66cb75315832c15613a727db2c26 (diff)
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to: - Use libextra to loop as realtime jobs - Preallocate memory before starting their main computation - Accept input via stdin instead of via argc Does not include the SD-VBS matlab code. Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/benchmarks/tracking')
-rw-r--r--SD-VBS/benchmarks/tracking/Makefile3
-rw-r--r--SD-VBS/benchmarks/tracking/data/Makefile3
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/1.bmpbin0 -> 304182 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/2.bmpbin0 -> 304182 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/3.bmpbin0 -> 304182 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/4.bmpbin0 -> 304182 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/5.bmpbin0 -> 304182 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/Makefile7
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/cif/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/1.bmpbin0 -> 6220854 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/2.bmpbin0 -> 6220854 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/3.bmpbin0 -> 6220854 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/4.bmpbin0 -> 6220854 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/Makefile7
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/fullhd/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/1.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/10.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/2.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/3.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/4.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/5.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/6.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/7.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/8.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/9.bmpbin0 -> 76086 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/Makefile7
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/qcif/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/1.bmpbin0 -> 6966 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/2.bmpbin0 -> 6966 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/3.bmpbin0 -> 6966 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/4.bmpbin0 -> 6966 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/Makefile6
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/1.bmpbin0 -> 3126 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/2.bmpbin0 -> 3126 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/3.bmpbin0 -> 3126 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/4.bmpbin0 -> 3126 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/Makefile6
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/sim_fast/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/1.bmpbin0 -> 36918 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/2.bmpbin0 -> 36918 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/3.bmpbin0 -> 36918 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/4.bmpbin0 -> 36918 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/Makefile6
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/sqcif/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/1.bmpbin0 -> 822 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/2.bmpbin0 -> 822 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/3.bmpbin0 -> 822 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/4.bmpbin0 -> 822 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/Makefile5
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/data/test/time.txt1
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/1.bmpbin0 -> 921654 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/2.bmpbin0 -> 921654 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/3.bmpbin0 -> 921654 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/4.bmpbin0 -> 921654 bytes
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/Makefile7
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/expected.m2
-rw-r--r--SD-VBS/benchmarks/tracking/data/vga/expected_C.txt2
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/calcAreaSum.c81
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/calcGoodFeature.c78
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/calcPyrLKTrack.c179
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/fillFeatures.c67
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/getANMS.c156
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/getInterpolatePatch.c43
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/script_tracking.c263
-rw-r--r--SD-VBS/benchmarks/tracking/src/c/tracking.h20
74 files changed, 977 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 @@
1include ../../common/makefiles/Makefile.include
2include $(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 @@
1include ../../../common/makefiles/Makefile.include
2include $(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 @@
1INPUT=cif
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
1269.915165 175.828888 195.635312 172.654409 268.516358 289.931921 267.230697 190.086741
2147.986242 145.928399 148.067509 130.441486 124.919389 64.008098 131.967361 162.460857
diff --git a/SD-VBS/benchmarks/tracking/data/cif/expected_C.txt b/SD-VBS/benchmarks/tracking/data/cif/expected_C.txt
new file mode 100644
index 0000000..7830dcf
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/cif/expected_C.txt
@@ -0,0 +1,2 @@
1268.790955 174.657776 196.000320 105.132706 172.262695 267.902679 288.945984 266.680359 190.432159
2146.301788 144.757889 146.543549 105.004868 130.337677 123.515228 63.038971 130.751785 160.921051
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 @@
1INPUT=fullhd
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
11487.193453 720.553084 1481.188344 382.962678
2308.382612 306.797105 323.948844 369.542919
diff --git a/SD-VBS/benchmarks/tracking/data/fullhd/expected_C.txt b/SD-VBS/benchmarks/tracking/data/fullhd/expected_C.txt
new file mode 100644
index 0000000..5608349
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/fullhd/expected_C.txt
@@ -0,0 +1,2 @@
11486.424561 732.003601 1482.234131 380.614441
2307.157501 334.762909 319.129578 367.587006
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 @@
1INPUT=qcif
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
1142.858025 145.068198 102.770607 141.110282 90.859800 135.351851 80.185357 113.844268 117.388158 142.126183 80.877169
270.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/expected_C.txt b/SD-VBS/benchmarks/tracking/data/qcif/expected_C.txt
new file mode 100644
index 0000000..7796dba
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/qcif/expected_C.txt
@@ -0,0 +1,2 @@
1133.082275 144.054230 100.963028 140.279068 89.887512 134.336441 69.720207 114.998512 116.348083 141.124100 79.836075
255.176003 34.147427 76.485626 61.329086 37.049969 77.030098 83.134308 54.533726 73.046341 45.200169 91.896271
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 @@
1INPUT=sim
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
124.422544 21.868191 40.786198 37.742716 30.302637 16.079615 30.062715 35.344185
214.131628 32.266282 37.315204 24.606535 32.839030 14.301861 22.509506 15.748797
diff --git a/SD-VBS/benchmarks/tracking/data/sim/expected_C.txt b/SD-VBS/benchmarks/tracking/data/sim/expected_C.txt
new file mode 100644
index 0000000..b3e4b48
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/sim/expected_C.txt
@@ -0,0 +1,2 @@
123.679535 20.567358 39.823669 36.499676 30.898752 13.758733 28.141140 34.485920
212.935260 31.359093 36.248371 23.564877 30.130877 11.027717 22.152441 14.522795
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 @@
1INPUT=sim_fast
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
125.330446 17.728868 14.459743
216.949109 9.076394 22.247495
diff --git a/SD-VBS/benchmarks/tracking/data/sim_fast/expected_C.txt b/SD-VBS/benchmarks/tracking/data/sim_fast/expected_C.txt
new file mode 100644
index 0000000..7d624d7
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/sim_fast/expected_C.txt
@@ -0,0 +1,2 @@
115.689241 12.913590
28.660824 21.268520
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 @@
1INPUT=sqcif
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
165.833985 96.386766 76.545247 96.006777 62.175348 60.185245 31.941927 68.970416 85.550211 109.931998 72.298306 74.080821
225.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/expected_C.txt b/SD-VBS/benchmarks/tracking/data/sqcif/expected_C.txt
new file mode 100644
index 0000000..51c3af8
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/sqcif/expected_C.txt
@@ -0,0 +1,2 @@
164.883919 96.402344 76.013298 86.118828 60.236912 59.199661 105.921989 32.250725 52.158295 119.325455 83.300941 69.831062 73.092682 106.911362
224.166391 67.989792 39.654747 42.183876 60.438770 61.022652 18.258587 32.598579 46.195374 35.623253 56.018707 48.722729 62.872787 51.833832
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 @@
1INPUT=test
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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/expected_C.txt b/SD-VBS/benchmarks/tracking/data/test/expected_C.txt
new file mode 100644
index 0000000..139597f
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/test/expected_C.txt
@@ -0,0 +1,2 @@
1
2
diff --git a/SD-VBS/benchmarks/tracking/data/test/time.txt b/SD-VBS/benchmarks/tracking/data/test/time.txt
new file mode 100644
index 0000000..4cc9ce3
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/test/time.txt
@@ -0,0 +1 @@
0 68705406
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 @@
1INPUT=vga
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=tracking
5include $(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 @@
1470.825057 292.917830 182.675337 492.818305 276.157171 504.514201
2216.367613 229.865854 255.912628 150.704991 276.525215 149.690554
diff --git a/SD-VBS/benchmarks/tracking/data/vga/expected_C.txt b/SD-VBS/benchmarks/tracking/data/vga/expected_C.txt
new file mode 100644
index 0000000..2c17eed
--- /dev/null
+++ b/SD-VBS/benchmarks/tracking/data/vga/expected_C.txt
@@ -0,0 +1,2 @@
1469.870941 285.200348 178.385620 159.507050 491.550690 272.205200 502.454071
2215.952835 273.082672 297.375244 132.275696 149.652573 273.382935 148.502777
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/********************************
2Author: 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**/
33F2D* 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/********************************
2Author: 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
27F2D* 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/********************************
2Author: 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
24I2D* 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
3Author: 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
11F2D* 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/********************************
2Author: 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**/
12F2D *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/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "tracking.h"
6
7/** Perform simple interpolation around 2*winSize*2*winSize neighbourhood **/
8F2D* 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/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "tracking.h"
6#include <malloc.h>
7#include "extra.h"
8#define TRACKING_MEM 1<<29
9
10int 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/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#ifndef _SCRIPT_TRACK_
6#define _SCRIPT_TRACK_
7
8#include "sdvbs_common.h"
9
10F2D* calcAreaSum(F2D* src, int cols, int rows, int winSize);
11F2D* calcGoodFeature(F2D* dX, F2D* dY, int cols, int rows, int winSize);
12I2D* 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);
13F2D *getANMS (F2D *points, float r);
14F2D* getInterpolatePatch(F2D* src, int cols, float centerX, float centerY, int winSize);
15float polynomial(int d, F2D* a, F2D* b, int dim);
16I2D* sortInd(F2D* input, int dim);
17F2D* fillFeatures(F2D* lambda, int N_FEA, int win);
18
19#endif
20