summaryrefslogtreecommitdiffstats
path: root/SD-VBS/benchmarks/mser
diff options
context:
space:
mode:
Diffstat (limited to 'SD-VBS/benchmarks/mser')
-rwxr-xr-xSD-VBS/benchmarks/mser/.mser.mex.c.swpbin0 -> 16384 bytes
-rw-r--r--SD-VBS/benchmarks/mser/Makefile3
-rw-r--r--SD-VBS/benchmarks/mser/data/Makefile3
-rw-r--r--SD-VBS/benchmarks/mser/data/cif/1.bmpbin0 -> 278838 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/cif/Makefile6
-rwxr-xr-xSD-VBS/benchmarks/mser/data/cif/VBS_Ver1bin0 -> 79632 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/cif/expected.m162
-rw-r--r--SD-VBS/benchmarks/mser/data/cif/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/fullhd/1.bmpbin0 -> 6220854 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/fullhd/Makefile6
-rw-r--r--SD-VBS/benchmarks/mser/data/fullhd/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/qcif/1.bmpbin0 -> 69750 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/qcif/Makefile6
-rwxr-xr-xSD-VBS/benchmarks/mser/data/qcif/VBS_Ver1bin0 -> 79672 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/qcif/expected.m68
-rw-r--r--SD-VBS/benchmarks/mser/data/qcif/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/sim/1.bmpbin0 -> 17478 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/sim/Makefile6
-rw-r--r--SD-VBS/benchmarks/mser/data/sim/expected.m16
-rw-r--r--SD-VBS/benchmarks/mser/data/sim/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/sim_fast/1.bmpbin0 -> 5238 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/sim_fast/Makefile8
-rw-r--r--SD-VBS/benchmarks/mser/data/sim_fast/expected.m7
-rw-r--r--SD-VBS/benchmarks/mser/data/sim_fast/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/sqcif/1.bmpbin0 -> 17478 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/sqcif/Makefile6
-rw-r--r--SD-VBS/benchmarks/mser/data/sqcif/expected.m27
-rw-r--r--SD-VBS/benchmarks/mser/data/sqcif/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/test/1.bmpbin0 -> 630 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/test/Makefile7
-rw-r--r--SD-VBS/benchmarks/mser/data/test/expected.m1
-rw-r--r--SD-VBS/benchmarks/mser/data/test/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/data/vga/1.bmpbin0 -> 921654 bytes
-rw-r--r--SD-VBS/benchmarks/mser/data/vga/Makefile6
-rw-r--r--SD-VBS/benchmarks/mser/data/vga/expected.m297
-rw-r--r--SD-VBS/benchmarks/mser/data/vga/expected_C.txt1
-rw-r--r--SD-VBS/benchmarks/mser/src/c/mser.c714
-rw-r--r--SD-VBS/benchmarks/mser/src/c/mser.h83
-rw-r--r--SD-VBS/benchmarks/mser/src/c/script_mser.c120
39 files changed, 1560 insertions, 0 deletions
diff --git a/SD-VBS/benchmarks/mser/.mser.mex.c.swp b/SD-VBS/benchmarks/mser/.mser.mex.c.swp
new file mode 100755
index 0000000..4f3a21c
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/.mser.mex.c.swp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/Makefile b/SD-VBS/benchmarks/mser/Makefile
new file mode 100644
index 0000000..60cc0ec
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/Makefile
@@ -0,0 +1,3 @@
1include ../../common/makefiles/Makefile.include
2include $(MAKEFILE_COMMON_DIR)/Makefile.recurse
3
diff --git a/SD-VBS/benchmarks/mser/data/Makefile b/SD-VBS/benchmarks/mser/data/Makefile
new file mode 100644
index 0000000..ba33d35
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/Makefile
@@ -0,0 +1,3 @@
1include ../../../common/makefiles/Makefile.include
2include $(MAKEFILE_COMMON_DIR)/Makefile.recurse
3
diff --git a/SD-VBS/benchmarks/mser/data/cif/1.bmp b/SD-VBS/benchmarks/mser/data/cif/1.bmp
new file mode 100644
index 0000000..df56ca3
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/cif/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/cif/Makefile b/SD-VBS/benchmarks/mser/data/cif/Makefile
new file mode 100644
index 0000000..41c7f38
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/cif/Makefile
@@ -0,0 +1,6 @@
1INPUT=cif
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
diff --git a/SD-VBS/benchmarks/mser/data/cif/VBS_Ver1 b/SD-VBS/benchmarks/mser/data/cif/VBS_Ver1
new file mode 100755
index 0000000..bafb9c7
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/cif/VBS_Ver1
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/cif/expected.m b/SD-VBS/benchmarks/mser/data/cif/expected.m
new file mode 100644
index 0000000..b4123c3
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/cif/expected.m
@@ -0,0 +1,162 @@
191080
240916
390318
448277
557285
666702
766453
815757
956228
109401
1172213
1262502
1350676
148016
1576446
164080
1726989
182894
1915233
2025177
2146411
2277708
2379330
2479286
257639
2639100
2720919
2824125
2969034
3087683
3133330
329587
3314591
3437790
3557107
362905
3772581
3830138
3966349
4069782
4153208
4263252
438011
4420400
4547661
4659179
4771075
483544
4975352
505143
5142527
5249924
539933
5413880
5538559
5645184
5748697
5851275
5957095
6027545
6141718
6246519
6325666
6431481
6556792
6659176
6729879
6842197
6962643
7058210
7120334
725623
7343569
7446210
7550474
7662104
7765808
7846945
7952682
8063195
8177194
8250534
8360544
8441770
8548717
8653246
8757723
883829
8920457
9028461
9132341
926413
9330286
9441193
9550243
9655458
9756851
9860038
9935141
10059004
10163503
10234763
10348953
10455092
1054534
10670791
10720249
10828134
10933971
11053439
11155882
11230562
11333993
11434523
11567709
11660469
1178591
11820489
11972123
12020237
12162971
12226046
12327337
12427638
12529497
12646390
12718004
12841108
12947659
13072386
13131584
13252173
13358091
13446624
13568233
13625267
13729768
13852802
13963228
14039529
14137092
14248469
14341074
14444231
14518653
14640524
14726529
14832423
14927131
15037373
15139650
15265233
15372920
15412277
15533656
15633151
15740026
15848408
15933352
16091265
16132307
16233875
diff --git a/SD-VBS/benchmarks/mser/data/cif/expected_C.txt b/SD-VBS/benchmarks/mser/data/cif/expected_C.txt
new file mode 100644
index 0000000..05b4c67
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/cif/expected_C.txt
@@ -0,0 +1 @@
91081 40917 90319 48278 57286 66703 66454 15758 56229 9402 72214 62503 50677 8017 76447 4081 26990 2895 15234 25178 46412 77709 79331 79287 7640 39101 20920 24126 69035 87684 33331 9588 14592 37791 57108 2906 72582 30139 66350 69783 53209 63253 8012 20401 47662 59180 71076 3545 75353 5144 42528 49925 9934 13881 38560 45185 48698 51276 57096 27546 41719 46520 25667 31482 56793 59177 29880 42198 62644 58211 20335 5624 43570 46211 50475 62105 65809 46946 52683 63196 77195 50535 60545 41771 48718 53247 57724 3830 20458 28462 32342 6414 30287 41194 50244 55459 56852 60039 35142 59005 63504 34764 48954 55093 4535 70792 20250 28135 33972 53440 55883 30563 33994 34524 67710 60470 8592 20490 72124 20238 62972 26047 27338 27639 29498 46391 18005 41109 47660 72387 31585 52174 58092 46625 68234 25268 29769 52803 63229 39530 37093 48470 41075 44232 18654 40525 26530 32424 27132 37374 39651 65234 72921 12278 33657 33152 40027 48409 33353 91266 32308 33876
diff --git a/SD-VBS/benchmarks/mser/data/fullhd/1.bmp b/SD-VBS/benchmarks/mser/data/fullhd/1.bmp
new file mode 100644
index 0000000..c09aaf0
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/fullhd/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/fullhd/Makefile b/SD-VBS/benchmarks/mser/data/fullhd/Makefile
new file mode 100644
index 0000000..5cce221
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/fullhd/Makefile
@@ -0,0 +1,6 @@
1INPUT=fullhd
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
diff --git a/SD-VBS/benchmarks/mser/data/fullhd/expected_C.txt b/SD-VBS/benchmarks/mser/data/fullhd/expected_C.txt
new file mode 100644
index 0000000..4da91c9
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/fullhd/expected_C.txt
@@ -0,0 +1 @@
1529403 2050668 2060219 2065998 1115208 1189974 1103738 1138213 1161232 1631082 1700107 2065921 1076907 1044256 1571996 938727 1276781 1552683 2012388 1608460 1585368 1667945 485340 1734635 96820 170073 825522 1571939 1113544 1350947 1702192 700563 777477 867824 168152 481500 562220 597608 1112457 1330394 273235 405671 571794 624470 1078084 355720 760235 1238216 1608260 1732716 213837 221544 371107 560320 590102 1744632 1159602 1586979 1602528 1792334 284744 557432 568930 833734 1765486 117983 215695 468960 511244 1269602 1275329 1465595 1818735 104343 326933 333496 511419 534515 956235 131244 254368 885381 1270760 1527618 177267 386650 591865 708851 760754 837286 1099035 1144201 1249657 1312035 1383067 1515290 1570495 1583144 1631403 1820636 198667 354025 873795 946545 1527616 1550679 1745877 38379 90228 120941 193864 434629 587939 1007984 1773259 1820631 1778960 238062 236779 243805 295645 463153 615019 802856 959667 1057488 1204079 1350097 1346579 1359848 1373122 1382692 1769004 2051145 172672 114309 175350 444015 453826 470831 490220 547861 599768 866204 932950 1363850 1694218 1692382 1759663 131254 382773 421199 449971 524710 547758 566964 877657 975458 1050648 1123424 1763660 461304 522815 643729 965684 1011794 1066617 1119806 1160136 1302360 1306276 1726958 114304 119653 229092 311581 271376 342533 542244 545922 720510 743464 1138651 1452189 1857862 1856027 67219 272290 276124 386713 379098 733921 845066 847083 1068846 1125711 1254744 1379427 1842559 1913462 1999653 2003666 1786838 80733 129324 240584 523100 571448 666560 848711 1335245 1494247 1540503 1834482 1824959 1849805 1930503 1938248 1978435 1988276 2012993 2049629 2034394 2057165 2068696 285288 321166 607510 873970 1091422 1317427 1335587 1356332 1365994 1500249 1852264 1418 164305 352275 360088 546482 1082435 1232013 1328020 1597868 1671168 1761335 77615 104339 283363 319643 350425 363892 488416 704297 846791 860244 952488 971790 1114038 1241333 1275824 1419185 1442542 1521003 1653652 1655511 1799706 83521 306379 331285 492752 573360 609785 751728 1061431 1137245 1261940 1407996 117731 356213 363877 536887 992690 1033349 1064701 1110678 1141384 1136738 1160061 1448728 1469580 1636301 1655564 1822530 1839151 609266 701280 921337 1006279 1080514 1090610 1096560 1127232 1129081 1141064 1159842 1135074 1183287 1198321 1480633 1442708 1465496 1523318 1592646 1833563 243075 399748 405994 574505 672282 814238 842950 929725 937371 962166 1219325 1248164 1250572 1511842 1519509 1802860 1830413 1230091 1256148 1283800 1287280 1296899 235275 444901 570624 1096443 1196401 1095215 1131755 1206317 1227485 1237055 1453880 1363925 1374951 106760 85487 100502 261326 281437 785434 812320 910139 1248647 1287135 1314019 1346573 1478881 1623149 506366 719077 724038 990365 1051591 1174183 1207798 1262323 1425312 617016 137323 314204 339159 551413 667838 743976 994751 1139456 1090449 1186070 1320014 1350253 1360089 1421847 1467162 1705786 621012 734456 1390932 1419129 81614 381293 652464 675475 677227 988818 1118034 1168707 1176496 1425472 233352 553255 562982 610108 675157 1132282 1216602 1509898 1798254 294220 488649 644265 696125 701011 794413 819343 854441 1680547 918108 1231630 1340325 1388270 1536261 1563174 1599735 1666985 1688540 625058 715603 777156 777763 1182825 1228170 1246733 1332668 1351761 1418003 1621227 328754 446326 488645 502527 524471 636615 763692 908163 1030298 1061656 1230024 1241557 1330721 1329411 1521570 185328 543661 825065 1009921 1041835 1221929 1437044 712401 255681 442688 471566 486911 625361 763594 1045612 1235651 1301825 1419685 1542614 1554155 427603 699090 729151 747077 762336 826798 972870 1042569 1078903 1595810 1548327 1759818 1791736 1799450 656140 798078 848458 1055029 1094434 1197260 1231808 602216 617541 641557 771344 825132 953740 1064863 1297983 388228 674179 963274 1286511 1321042 1339252 1406446 1412128 1484412 1515107 1603571 1809723 110462 444830 506095 711870 728863 730712 734833 736694 790259 826797 871157 1243138 1074342 1084834 1128999 1193422 1480502 1475487 1744099 421752 632714 659748 646385 761457 1313392 1442835 1477440 596528 598482 696121 1056933 1036262 1147370 1219201 8240 177643 450540 606961 728849 734557 828750 876774 897960 932449 1195397 1198110 1434443 1447876 1548512 1895251 38991 671294 797737 1011203 1011141 1172433 1259586 1357565 1435142 60245 844238 847923 840587 842213 842493 1001703 1054989 1024601 1057173 659720 943954 965077 997804 1245272 1579221 793896 813698 811841 819478 834833 869240 955360 1020869 1040032 1490073 870875 928602 1014995 1005448 1508114 531300 803640 844488 1165466 1260561 1294081 1294108 1357441 1376652 1396834 1473725 926843 718928 926679 939850 990022 1480466 856043 888697 1026463 991697 1045522 1470858 799794 850338 849759 1026688 991724 1628326 1810642 527456 982128 1712717 790052 415979 763126 770816 1068373 965288 1788579 623624 602423 1028284 1026381 1070271 763124 862987 1011036 1022845 1026385 778563 642766 792104 1011013 1022523 805527 776642 806832 763165 1009117 767703 883645 763858 638917 761243 1449790 555812 239161 179508 907416 1609320 911260 1795940 237240 878616 905494 684609 978441 965006 786510 1688897 724950 726382 978705 870928 1663995 1331557 1662082 1656339 718709 1683145 1713818 1709983 716793 2025035 2059603 1093129 1988548 2021195 1089300 1873763 1892551 1106648 709148 1951870 1098986 1888734 707207 1077806 902484 712947 896808 1973190 915987 1868004 2071640 1884902 607080 1186616 2015894 2040300 2034541 2055661 2053792 2065339 2071552 2073094 424777 1087211 388261 1093568 686115 705280 1099460 734650 788407 1071699 772406 1054651 912583 845435 849213 891445 958681 1241478 880043 899239
diff --git a/SD-VBS/benchmarks/mser/data/qcif/1.bmp b/SD-VBS/benchmarks/mser/data/qcif/1.bmp
new file mode 100644
index 0000000..f5a4408
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/qcif/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/qcif/Makefile b/SD-VBS/benchmarks/mser/data/qcif/Makefile
new file mode 100644
index 0000000..0c1d924
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/qcif/Makefile
@@ -0,0 +1,6 @@
1INPUT=qcif
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
diff --git a/SD-VBS/benchmarks/mser/data/qcif/VBS_Ver1 b/SD-VBS/benchmarks/mser/data/qcif/VBS_Ver1
new file mode 100755
index 0000000..a973e58
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/qcif/VBS_Ver1
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/qcif/expected.m b/SD-VBS/benchmarks/mser/data/qcif/expected.m
new file mode 100644
index 0000000..41fc7d7
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/qcif/expected.m
@@ -0,0 +1,68 @@
122308
210162
314251
49500
518683
65669
71501
82813
95180
106119
113731
123939
1322065
142417
155048
1617994
1714159
1815203
1917195
2018926
2113616
222192
232
246900
259794
2611366
2714679
285344
2917471
3011778
3116661
3210323
3312856
3413141
357022
3612740
3711984
3814560
3912982
4019042
4113916
421250
437680
44159
455477
4613909
4715632
487620
496936
5014660
512021
5212466
5316436
546556
5512499
569457
576559
5813998
5917616
609992
6112224
6214654
639572
646970
658661
6618900
673364
688379
diff --git a/SD-VBS/benchmarks/mser/data/qcif/expected_C.txt b/SD-VBS/benchmarks/mser/data/qcif/expected_C.txt
new file mode 100644
index 0000000..e4c467b
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/qcif/expected_C.txt
@@ -0,0 +1 @@
22309 10163 14252 9501 18684 5670 1502 2814 5181 6120 3732 3940 22066 2418 5049 17995 14160 15204 17196 18927 13617 2193 3 6901 9795 11367 14680 5345 17472 11779 16662 10324 12857 13142 7023 12741 11985 14561 12983 19043 13917 1251 7681 160 5478 13910 15633 7621 6937 14661 2022 12467 16437 6557 12500 9458 6560 13999 17617 9993 12225 14655 9573 6971 8662 18901 3365 8380
diff --git a/SD-VBS/benchmarks/mser/data/sim/1.bmp b/SD-VBS/benchmarks/mser/data/sim/1.bmp
new file mode 100644
index 0000000..953fe98
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/sim/Makefile b/SD-VBS/benchmarks/mser/data/sim/Makefile
new file mode 100644
index 0000000..fc94f6e
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim/Makefile
@@ -0,0 +1,6 @@
1INPUT=sim
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
diff --git a/SD-VBS/benchmarks/mser/data/sim/expected.m b/SD-VBS/benchmarks/mser/data/sim/expected.m
new file mode 100644
index 0000000..c52e720
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim/expected.m
@@ -0,0 +1,16 @@
13611
25615
33876
42441
55556
6127
71109
871
98
1016
113567
12817
133169
142121
154036
163985
diff --git a/SD-VBS/benchmarks/mser/data/sim/expected_C.txt b/SD-VBS/benchmarks/mser/data/sim/expected_C.txt
new file mode 100644
index 0000000..a468444
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim/expected_C.txt
@@ -0,0 +1 @@
3612 5616 3877 2442 5557 128 1110 72 9 17 3568 818 3170 2122 4037 3986
diff --git a/SD-VBS/benchmarks/mser/data/sim_fast/1.bmp b/SD-VBS/benchmarks/mser/data/sim_fast/1.bmp
new file mode 100644
index 0000000..5ec0de1
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim_fast/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/sim_fast/Makefile b/SD-VBS/benchmarks/mser/data/sim_fast/Makefile
new file mode 100644
index 0000000..f5845eb
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim_fast/Makefile
@@ -0,0 +1,8 @@
1
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5INPUT=sim_fast
6include $(MAKEFILE_COMMON_DIR)/Makefile.common
7
8
diff --git a/SD-VBS/benchmarks/mser/data/sim_fast/expected.m b/SD-VBS/benchmarks/mser/data/sim_fast/expected.m
new file mode 100644
index 0000000..5ba3c55
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim_fast/expected.m
@@ -0,0 +1,7 @@
11214
2353
31146
429
5187
6829
7976
diff --git a/SD-VBS/benchmarks/mser/data/sim_fast/expected_C.txt b/SD-VBS/benchmarks/mser/data/sim_fast/expected_C.txt
new file mode 100644
index 0000000..d5b961e
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sim_fast/expected_C.txt
@@ -0,0 +1 @@
1215 354 1147 30 188 830 977
diff --git a/SD-VBS/benchmarks/mser/data/sqcif/1.bmp b/SD-VBS/benchmarks/mser/data/sqcif/1.bmp
new file mode 100644
index 0000000..9122269
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sqcif/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/sqcif/Makefile b/SD-VBS/benchmarks/mser/data/sqcif/Makefile
new file mode 100644
index 0000000..42808ce
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sqcif/Makefile
@@ -0,0 +1,6 @@
1INPUT=sqcif
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
diff --git a/SD-VBS/benchmarks/mser/data/sqcif/expected.m b/SD-VBS/benchmarks/mser/data/sqcif/expected.m
new file mode 100644
index 0000000..a3ccbad
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sqcif/expected.m
@@ -0,0 +1,27 @@
13549
25615
33941
45626
55113
61079
73840
84838
94050
107
111741
122778
132060
143911
1513
161923
173918
183463
19480
201488
21344
2233
232158
243398
251694
262420
274026
diff --git a/SD-VBS/benchmarks/mser/data/sqcif/expected_C.txt b/SD-VBS/benchmarks/mser/data/sqcif/expected_C.txt
new file mode 100644
index 0000000..172e512
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/sqcif/expected_C.txt
@@ -0,0 +1 @@
3550 5616 3942 5627 5114 1080 3841 4839 4051 8 1742 2779 2061 3912 14 1924 3919 3464 481 1489 345 34 2159 3399 1695 2421 4027
diff --git a/SD-VBS/benchmarks/mser/data/test/1.bmp b/SD-VBS/benchmarks/mser/data/test/1.bmp
new file mode 100644
index 0000000..ba8fb8b
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/test/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/test/Makefile b/SD-VBS/benchmarks/mser/data/test/Makefile
new file mode 100644
index 0000000..8a1c79b
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/test/Makefile
@@ -0,0 +1,7 @@
1include ../../../../common/makefiles/Makefile.include
2
3BMARK=mser
4INPUT=test
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
7
diff --git a/SD-VBS/benchmarks/mser/data/test/expected.m b/SD-VBS/benchmarks/mser/data/test/expected.m
new file mode 100644
index 0000000..30d764c
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/test/expected.m
@@ -0,0 +1 @@
171
diff --git a/SD-VBS/benchmarks/mser/data/test/expected_C.txt b/SD-VBS/benchmarks/mser/data/test/expected_C.txt
new file mode 100644
index 0000000..73baba4
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/test/expected_C.txt
@@ -0,0 +1 @@
172
diff --git a/SD-VBS/benchmarks/mser/data/vga/1.bmp b/SD-VBS/benchmarks/mser/data/vga/1.bmp
new file mode 100644
index 0000000..bbb3e60
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/vga/1.bmp
Binary files differ
diff --git a/SD-VBS/benchmarks/mser/data/vga/Makefile b/SD-VBS/benchmarks/mser/data/vga/Makefile
new file mode 100644
index 0000000..1b0032a
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/vga/Makefile
@@ -0,0 +1,6 @@
1INPUT=vga
2include ../../../../common/makefiles/Makefile.include
3
4BMARK=mser
5include $(MAKEFILE_COMMON_DIR)/Makefile.common
6
diff --git a/SD-VBS/benchmarks/mser/data/vga/expected.m b/SD-VBS/benchmarks/mser/data/vga/expected.m
new file mode 100644
index 0000000..23ca6be
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/vga/expected.m
@@ -0,0 +1,297 @@
1150188
2139161
3226889
4295683
5188158
6218738
724760
8122860
9234561
1071415
11184318
1225237
1384868
1427054
1573340
16252342
17178044
18251786
1938543
20166539
21265202
2213175
23230154
24241697
25268924
26106165
2787963
28140157
29178621
303821
3149293
3251544
3387463
34138676
35146393
36153034
37178140
38263663
3935512
4081293
41128231
4224929
4338545
44157836
45201762
46260875
4753461
4858270
4968286
5078904
51123882
52143979
53155623
54289494
5517912
56166189
57172421
58188794
59258462
6080809
61110040
62125346
63193605
64215682
65492
66242242
6798477
68204773
69271899
70305023
7120339
7247220
7348233
7448129
7578890
7678902
77121066
78157838
79157696
80222421
81195436
82202237
83222353
84247870
85263209
8660698
8767419
88141637
89168504
90225211
91246839
9216955
9345396
9475542
95167666
96175462
97185528
98186845
9911725
10012720
10117432
10290532
103153694
104157695
105163260
106166188
107228166
108242515
109264159
11024279
11190873
112137217
113178145
11485543
115103800
116121961
117126261
118142142
119149331
120166705
121138344
122192225
12361171
124137772
125159873
126183201
127191826
12812731
12921743
13041559
131116677
132177659
133157702
134163404
135187318
136199366
137216135
138174026
139209457
140218175
141256531
142109213
143205085
14450229
145137858
146155858
147176013
148190780
14910764
150169116
15156443
15299749
153100683
154184963
15534340
15684582
157152527
158225832
15960575
160115240
161226637
162161966
163183392
164197327
165213856
166241059
167240186
168100504
16974754
17081674
17193395
172132483
173183200
174197487
17571281
17678323
177108050
178115058
179156455
180179831
181104
182178270
183200686
184205651
18554048
18667055
187157242
188226147
189264274
19097314
191112166
19299664
193112206
194116049
195182192
19621848
19766537
198130426
199152940
200156285
201197779
202209053
203238177
204259864
20561533
20697798
207104222
208176915
209180751
210210478
21163199
21269447
213224698
214238313
21567034
21685757
21785258
218105388
219153466
220180480
22188659
222123185
223176914
22426649
225101110
226109718
227112129
228153412
229169722
230173098
23197319
232122228
233126071
234150970
235186255
23691527
237149140
238222949
239117832
240128889
241129467
242151042
243125202
244126520
245173763
246196324
247207128
248103415
249137589
250149105
25182420
252118796
253137047
254146660
255151972
256118828
257127476
258124086
25968492
26091587
26190605
262113982
263117387
264150991
265152035
266122974
26784235
268212209
269114957
27042000
271242485
272103945
273143398
274116457
275198008
276134212
277257564
278255173
279252776
280107194
281289726
282294096
283161443
284292606
285277399
286105290
287159533
288294098
289276919
290279700
291304797
29290329
29357239
294104324
29558669
296114859
297185568
diff --git a/SD-VBS/benchmarks/mser/data/vga/expected_C.txt b/SD-VBS/benchmarks/mser/data/vga/expected_C.txt
new file mode 100644
index 0000000..0e741d0
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/data/vga/expected_C.txt
@@ -0,0 +1 @@
150189 139162 226890 295684 188159 218739 24761 122861 234562 71416 184319 25238 84869 27055 73341 252343 178045 251787 38544 166540 265203 13176 230155 241698 268925 106166 87964 140158 178622 3822 49294 51545 87464 138677 146394 153035 178141 263664 35513 81294 128232 24930 38546 157837 201763 260876 53462 58271 68287 78905 123883 143980 155624 289495 17913 166190 172422 188795 258463 80810 110041 125347 193606 215683 493 242243 98478 204774 271900 305024 20340 47221 48234 48130 78891 78903 121067 157839 157697 222422 195437 202238 222354 247871 263210 60699 67420 141638 168505 225212 246840 16956 45397 75543 167667 175463 185529 186846 11726 12721 17433 90533 153695 157696 163261 166189 228167 242516 264160 24280 90874 137218 178146 85544 103801 121962 126262 142143 149332 166706 138345 192226 61172 137773 159874 183202 191827 12732 21744 41560 116678 177660 157703 163405 187319 199367 216136 174027 209458 218176 256532 109214 205086 50230 137859 155859 176014 190781 10765 169117 56444 99750 100684 184964 34341 84583 152528 225833 60576 115241 226638 161967 183393 197328 213857 241060 240187 100505 74755 81675 93396 132484 183201 197488 71282 78324 108051 115059 156456 179832 105 178271 200687 205652 54049 67056 157243 226148 264275 97315 112167 99665 112207 116050 182193 21849 66538 130427 152941 156286 197780 209054 238178 259865 61534 97799 104223 176916 180752 210479 63200 69448 224699 238314 67035 85758 85259 105389 153467 180481 88660 123186 176915 26650 101111 109719 112130 153413 169723 173099 97320 122229 126072 150971 186256 91528 149141 222950 117833 128890 129468 151043 125203 126521 173764 196325 207129 103416 137590 149106 82421 118797 137048 146661 151973 118829 127477 124087 68493 91588 90606 113983 117388 150992 152036 122975 84236 212210 114958 42001 242486 103946 143399 116458 198009 134213 257565 255174 252777 107195 289727 294097 161444 292607 277400 105291 159534 294099 276920 279701 304798 90330 57240 104325 58670 114860 185569
diff --git a/SD-VBS/benchmarks/mser/src/c/mser.c b/SD-VBS/benchmarks/mser/src/c/mser.c
new file mode 100644
index 0000000..d886d7a
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/src/c/mser.c
@@ -0,0 +1,714 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5/***
6% MSER Maximally Stable Extremal Regions
7% R=MSER(I,DELTA) computes the Maximally Stable Extremal Regions
8% (MSER) of image I with stability threshold DELTA. I is any
9% array of class UINT8, while DELTA is a scalar of the same class.
10% R is an index set (of class UINT32) which enumerates the
11% representative pixels of the detected regions.
12%
13% A region R can be recovered from a representative pixel X as the
14% connected component of the level set {Y:I(Y) <= I(X)} which
15% contains X.
16***/
17
18
19#include "mser.h"
20#include <string.h>
21
22/* advance N-dimensional subscript */
23void
24adv(iArray *dims, int ndims, iArray *subs_pt)
25{
26 int d = 0 ;
27 while(d < ndims)
28 {
29 sref(subs_pt,d) = sref(subs_pt,d) + 1;
30 if( sref(subs_pt,d) < sref(dims,d) )
31 return ;
32 sref(subs_pt,d++) = 0 ;
33 }
34}
35
36/** driver **/
37I2D* mser(I2D* I, int in_delta,
38 iArray* subs_pt, iArray* nsubs_pt, iArray* strides_pt, iArray* visited_pt, iArray* dims,
39 uiArray* joins_pt,
40 region_t* regions_pt,
41 pair_t* pairs_pt,
42 node_t* forest_pt,
43 ulliArray* acc_pt, ulliArray* ell_pt,
44 I2D* out)
45{
46 idx_t i, rindex=0;
47 int k;
48 int nout = 1;
49
50 int OUT_REGIONS=0;
51 int OUT_ELL = 1;
52 int OUT_PARENTS = 2;
53 int OUT_AREA = 3;
54 int BUCKETS = 256;
55
56 //I2D* out;
57
58 int IN_I = 0;
59 int IN_DELTA = 1;
60
61 /* configuration */
62 int verbose = 1 ; /* be verbose */
63 int small_cleanup= 1 ; /* remove very small regions */
64 int big_cleanup = 1 ; /* remove very big regions */
65 int bad_cleanup = 0 ; /* remove very bad regions */
66 int dup_cleanup = 1 ; /* remove duplicates */
67 val_t delta ; /* stability delta */
68
69 /* node value denoting a void node */
70 idx_t const node_is_void = 0xffffffff ;
71
72 //iArray* subs_pt ; /* N-dimensional subscript
73 //iArray* nsubs_pt ; /* diff-subscript to point to neigh.
74// uiArray* strides_pt ; /* strides to move in image array
75// uiArray* visited_pt ; /* flag
76
77 int nel ; /* number of image elements (pixels) */
78 int ner = 0 ; /* number of extremal regions */
79 int nmer = 0 ; /* number of maximally stable */
80 int ndims ; /* number of dimensions */
81// iArray* dims ; /* dimensions
82 int njoins = 0 ; /* number of join ops */
83
84 I2D* I_pt ; /* source image */
85 //pair_t* pairs_pt ; /* scratch buffer to sort pixels
86// node_t* forest_pt ; /* the extremal regions forest
87// region_t* regions_pt ; /* list of extremal regions found
88 int regions_pt_size;
89 int pairs_pt_size;
90 int forest_pt_size;
91
92 /* ellipses fitting */
93 //ulliArray* acc_pt ; /* accumulator to integrate region moments
94 //ulliArray* ell_pt ; /* ellipses parameters
95 int gdl ; /* number of parameters of an ellipse */
96 //uiArray* joins_pt ; /* sequence of joins
97
98 delta = 0;
99 delta = in_delta;
100
101 /* get dimensions */
102
103 nel = I->height*I->width; /* number of elements of src image */
104 ndims = 2;
105 //dims = malloc(sizeof(iArray) + sizeof(int)*ndims);
106 I_pt = I;
107
108 sref(dims,0) = I->height;
109 sref(dims,1) = I->width;
110
111 /* allocate stuff */
112 //subs_pt = malloc(sizeof(iArray) + sizeof(int)*ndims);
113 //nsubs_pt = malloc(sizeof(iArray) + sizeof(int)*ndims);
114
115 //strides_pt = malloc(sizeof(uiArray)+sizeof(unsigned int)*ndims);
116 //visited_pt = malloc(sizeof(uiArray) + sizeof(unsigned int)*nel);
117 //joins_pt = malloc(sizeof(uiArray) + sizeof(unsigned int)*nel);
118
119 //regions_pt = (region_t*)malloc(sizeof(region_t)*nel);
120 regions_pt_size = nel;
121
122 //pairs_pt = (pair_t*)malloc(sizeof(pair_t)*nel);
123 pairs_pt_size = nel;
124
125 //forest_pt = (node_t*)malloc(sizeof(node_t)*nel);
126 forest_pt_size = nel;
127
128 /* compute strides to move into the N-dimensional image array */
129 sref(strides_pt,0) = 1;
130 for(k = 1 ; k < ndims ; ++k)
131 {
132 sref(strides_pt,k) = sref(strides_pt,k-1) * sref(dims,k-1) ;
133 }
134
135 /* sort pixels in increasing order of intensity: using Bucket Sort */
136 {
137 int unsigned buckets [BUCKETS] ;
138 memset(buckets, 0, sizeof(int unsigned)*BUCKETS) ;
139
140 for(i = 0 ; i < nel ; ++i)
141 {
142 val_t v = asubsref(I_pt,i) ;
143 ++buckets[v] ;
144 }
145
146 for(i = 1 ; i < BUCKETS ; ++i)
147 {
148 arrayref(buckets,i) += arrayref(buckets,i-1) ;
149 }
150
151 for(i = nel ; i >= 1 ; )
152 {
153 val_t v = asubsref(I_pt,--i) ;
154 idx_t j = --buckets[v] ;
155 pairs_pt[j].value = v ;
156 pairs_pt[j].index = i ;
157 }
158 }
159
160 /* initialize the forest with all void nodes */
161 for(i = 0 ; i < nel ; ++i)
162 {
163 forest_pt[i].parent = node_is_void ;
164 }
165
166 /* number of ellipse free parameters */
167 gdl = ndims*(ndims+1)/2 + ndims ;
168
169 /* -----------------------------------------------------------------
170 * Compute extremal regions tree
171 * -------------------------------------------------------------- */
172
173 for(i = 0 ; i < nel ; ++i)
174 {
175 /* pop next node xi */
176 idx_t index = pairs_pt [i].index ;
177 val_t value = pairs_pt [i].value ;
178
179 /* this will be needed later */
180 rindex = index ;
181
182 /* push it into the tree */
183 forest_pt [index] .parent = index ;
184 forest_pt [index] .shortcut = index ;
185 forest_pt [index] .area = 1 ;
186#ifdef USE_RANK_UNION
187 forest_pt [index] .height = 1 ;
188#endif
189
190 /* convert index into a subscript sub; also initialize nsubs
191 to (-1,-1,...,-1) */
192 {
193 idx_t temp = index ;
194 for(k = ndims-1 ; k >=0 ; --k)
195 {
196 sref(nsubs_pt,k) = -1 ;
197 sref(subs_pt,k) = temp / sref(strides_pt,k) ;
198 temp = temp % sref(strides_pt,k) ;
199 }
200 }
201
202 /* process neighbors of xi */
203 while(1)
204 {
205 int good = 1 ;
206 idx_t nindex = 0 ;
207
208 /* compute NSUBS+SUB, the correspoinding neighbor index NINDEX
209 and check that the pixel is within image boundaries. */
210 for(k = 0 ; k < ndims && good ; ++k)
211 {
212 int temp = sref(nsubs_pt,k) + sref(subs_pt,k) ;
213 good &= 0 <= temp && temp < sref(dims,k) ;
214 nindex += temp * sref(strides_pt,k) ;
215 }
216
217
218 /* keep going only if
219 1 - the neighbor is within image boundaries;
220 2 - the neighbor is indeed different from the current node
221 (this happens when nsub=(0,0,...,0));
222 3 - the nieghbor is already in the tree, meaning that
223 is a pixel older than xi.
224 */
225 if(good && nindex != index && forest_pt[nindex].parent != node_is_void )
226 {
227 idx_t nrindex = 0, nvisited ;
228 val_t nrvalue = 0 ;
229
230
231#ifdef USE_RANK_UNION
232 int height = forest_pt [ rindex] .height ;
233 int nheight = forest_pt [nrindex] .height ;
234#endif
235
236 /* RINDEX = ROOT(INDEX) might change as we merge trees, so we
237 need to update it after each merge */
238
239 /* find the root of the current node */
240 /* also update the shortcuts */
241 nvisited = 0 ;
242 while( forest_pt[rindex].shortcut != rindex )
243 {
244 sref(visited_pt,nvisited++) = rindex ;
245 rindex = forest_pt[rindex].shortcut ;
246 }
247 while( nvisited-- )
248 {
249 forest_pt [ sref(visited_pt,nvisited) ] .shortcut = rindex ;
250 }
251
252 /* find the root of the neighbor */
253 nrindex = nindex ;
254 nvisited = 0 ;
255 while( forest_pt[nrindex].shortcut != nrindex )
256 {
257 sref(visited_pt, nvisited++) = nrindex ;
258 nrindex = forest_pt[nrindex].shortcut ;
259 }
260 while( nvisited-- )
261 {
262 forest_pt [ sref(visited_pt,nvisited) ] .shortcut = nrindex ;
263 }
264
265 /*
266 Now we join the two subtrees rooted at
267
268 RINDEX = ROOT(INDEX) and NRINDEX = ROOT(NINDEX).
269
270 Only three things can happen:
271
272 a - ROOT(INDEX) == ROOT(NRINDEX). In this case the two trees
273 have already been joined and we do not do anything.
274
275 b - I(ROOT(INDEX)) == I(ROOT(NRINDEX)). In this case index
276 is extending an extremal region with the same
277 value. Since ROOT(NRINDEX) will NOT be an extremal
278 region of the full image, ROOT(INDEX) can be safely
279 addedd as children of ROOT(NRINDEX) if this reduces
280 the height according to union rank.
281
282 c - I(ROOT(INDEX)) > I(ROOT(NRINDEX)) as index is extending
283 an extremal region, but increasing its level. In this
284 case ROOT(NRINDEX) WILL be an extremal region of the
285 final image and the only possibility is to add
286 ROOT(NRINDEX) as children of ROOT(INDEX).
287 */
288
289 if( rindex != nrindex )
290 {
291 /* this is a genuine join */
292
293 nrvalue = asubsref(I_pt,nrindex) ;
294 if( nrvalue == value
295#ifdef USE_RANK_UNION
296 && height < nheight
297#endif
298 )
299 {
300 /* ROOT(INDEX) becomes the child */
301 forest_pt[rindex] .parent = nrindex ;
302 forest_pt[rindex] .shortcut = nrindex ;
303 forest_pt[nrindex].area += forest_pt[rindex].area ;
304
305#ifdef USE_RANK_UNION
306 forest_pt[nrindex].height = MAX(nheight, height+1) ;
307#endif
308
309 sref(joins_pt,njoins++) = rindex ;
310
311 }
312 else
313 {
314 /* ROOT(index) becomes parent */
315 forest_pt[nrindex] .parent = rindex ;
316 forest_pt[nrindex] .shortcut = rindex ;
317 forest_pt[rindex] .area += forest_pt[nrindex].area ;
318
319#ifdef USE_RANK_UNION
320 forest_pt[rindex].height = MAX(height, nheight+1) ;
321#endif
322 if( nrvalue != value )
323 {
324 /* nrindex is extremal region: save for later */
325 forest_pt[nrindex].region = ner ;
326 regions_pt [ner] .index = nrindex ;
327 regions_pt [ner] .parent = ner ;
328 regions_pt [ner] .value = nrvalue ;
329 regions_pt [ner] .area = forest_pt [nrindex].area ;
330 regions_pt [ner] .area_top = nel ;
331 regions_pt [ner] .area_bot = 0 ;
332 ++ner ;
333 }
334
335 /* annote join operation for post-processing */
336 sref(joins_pt,njoins++) = nrindex ;
337 }
338 }
339
340 } /* neighbor done */
341
342 /* move to next neighbor */
343 k = 0 ;
344 sref(nsubs_pt,k) = sref(nsubs_pt,k) + 1;
345 while( sref(nsubs_pt, k) > 1)
346 {
347 sref(nsubs_pt,k++) = -1 ;
348 if(k == ndims) goto done_all_neighbors ;
349 sref(nsubs_pt,k) = sref(nsubs_pt,k) + 1;
350 }
351 } /* next neighbor */
352 done_all_neighbors : ;
353 } /* next pixel */
354
355
356 /* the root of the last processed pixel must be a region */
357 forest_pt [rindex].region = ner ;
358 regions_pt [ner] .index = rindex ;
359 regions_pt [ner] .parent = ner ;
360 regions_pt [ner] .value = asubsref(I_pt,rindex) ;
361 regions_pt [ner] .area = forest_pt [rindex] .area ;
362 regions_pt [ner] .area_top = nel ;
363 regions_pt [ner] .area_bot = 0 ;
364 ++ner ;
365
366 /* -----------------------------------------------------------------
367 * Compute region parents
368 * -------------------------------------------------------------- */
369 for( i = 0 ; i < ner ; ++i)
370 {
371 idx_t index = regions_pt [i].index ;
372 val_t value = regions_pt [i].value ;
373 idx_t j = i ;
374
375 while(j == i)
376 {
377 idx_t pindex = forest_pt [index].parent ;
378 val_t pvalue = asubsref(I_pt,pindex) ;
379
380 /* top of the tree */
381 if(index == pindex)
382 {
383 j = forest_pt[index].region ;
384 break ;
385 }
386
387 /* if index is the root of a region, either this is still
388 i, or it is the parent region we are looking for. */
389 if(value < pvalue)
390 {
391 j = forest_pt[index].region ;
392 }
393
394 index = pindex ;
395 value = pvalue ;
396 }
397 regions_pt[i]. parent = j ;
398 }
399
400 /* -----------------------------------------------------------------
401 * Compute areas of tops and bottoms
402 * -------------------------------------------------------------- */
403
404 /* We scan the list of regions from the bottom. Let x0 be the current
405 region and be x1 = PARENT(x0), x2 = PARENT(x1) and so on.
406
407 Here we do two things:
408
409 1) Look for regions x for which x0 is the BOTTOM. This requires
410 VAL(x0) <= VAL(x) - DELTA < VAL(x1).
411 We update AREA_BOT(x) for each of such x found.
412
413 2) Look for the region y which is the TOP of x0. This requires
414 VAL(y) <= VAL(x0) + DELTA < VAL(y+1)
415 We update AREA_TOP(x0) as soon as we find such y.
416
417 */
418
419 for( i = 0 ; i < ner ; ++i)
420 {
421 /* fix xi as the region, then xj are the parents */
422 idx_t parent = regions_pt [i].parent ;
423 int val0 = regions_pt [i].value ;
424 int val1 = regions_pt [parent].value ;
425 int val = val0 ;
426 idx_t j = i ;
427
428 while(1)
429 {
430 int valp = regions_pt [parent].value ;
431
432 /* i is the bottom of j */
433 if(val0 <= val - delta && val - delta < val1)
434 {
435 regions_pt [j].area_bot =
436 MAX(regions_pt [j].area_bot, regions_pt [i].area) ;
437 }
438
439 /* j is the top of i */
440 if(val <= val0 + delta && val0 + delta < valp)
441 {
442 regions_pt [i].area_top = regions_pt [j].area ;
443 }
444
445 /* stop if going on is useless */
446 if(val1 <= val - delta && val0 + delta < val)
447 break ;
448
449 /* stop also if j is the root */
450 if(j == parent)
451 break ;
452
453 /* next region upward */
454 j = parent ;
455 parent = regions_pt [j].parent ;
456 val = valp ;
457 }
458 }
459
460 /* -----------------------------------------------------------------
461 * Compute variation
462 * -------------------------------------------------------------- */
463 for(i = 0 ; i < ner ; ++i)
464 {
465 int area = regions_pt [i].area ;
466 int area_top = regions_pt [i].area_top ;
467 int area_bot = regions_pt [i].area_bot ;
468 regions_pt [i].variation = (area_top - area_bot) / (area*1.0) ;
469
470 /* initialize .mastable to 1 for all nodes */
471 regions_pt [i].maxstable = 1 ;
472 }
473
474 /* -----------------------------------------------------------------
475 * Remove regions which are NOT maximally stable
476 * -------------------------------------------------------------- */
477 nmer = ner ;
478 for(i = 0 ; i < ner ; ++i)
479 {
480 idx_t parent = regions_pt [i] .parent ;
481 float var = regions_pt [i] .variation ;
482 float pvar = regions_pt [parent] .variation ;
483 idx_t loser ;
484
485 /* decide which one to keep and put that in loser */
486 if(var < pvar) loser = parent ; else loser = i ;
487
488 /* make loser NON maximally stable */
489 if(regions_pt [loser].maxstable) --nmer ;
490 regions_pt [loser].maxstable = 0 ;
491 }
492
493
494 /* -----------------------------------------------------------------
495 * Remove more regions
496 * -------------------------------------------------------------- */
497
498 /* it is critical for correct duplicate detection to remove regions
499 from the bottom (smallest one first) */
500
501 if( big_cleanup || small_cleanup || bad_cleanup || dup_cleanup )
502 {
503 int nbig = 0 ;
504 int nsmall = 0 ;
505 int nbad = 0 ;
506 int ndup = 0 ;
507
508 /* scann all extremal regions */
509 for(i = 0 ; i < ner ; ++i)
510 {
511
512 /* process only maximally stable extremal regions */
513 if(! regions_pt [i].maxstable) continue ;
514
515 if( bad_cleanup && regions_pt[i].variation >= 1.0f )
516 {
517 ++nbad ;
518 goto remove_this_region ;
519 }
520
521 if( big_cleanup && regions_pt[i].area > nel/2 )
522 {
523 ++nbig ;
524 goto remove_this_region ;
525 }
526
527 if( small_cleanup && regions_pt[i].area < 25 )
528 {
529 ++nsmall ;
530 goto remove_this_region ;
531 }
532
533 /** Remove duplicates */
534
535 if( dup_cleanup )
536 {
537 idx_t parent = regions_pt [i].parent ;
538 int area, parea ;
539 float change ;
540
541 /* the search does not apply to root regions */
542 if(parent != i)
543 {
544
545 /* search for the maximally stable parent region */
546 while(! regions_pt[parent].maxstable)
547 {
548 idx_t next = regions_pt[parent].parent ;
549 if(next == parent) break ;
550 parent = next ;
551 }
552
553 /* compare with the parent region; if the current and parent
554 regions are too similar, keep only the parent */
555
556 area = regions_pt [i].area ;
557 parea = regions_pt [parent].area ;
558 change = (parea - area)/(area*1.0) ;
559
560 if(change < 0.5)
561 {
562 ++ndup ;
563 goto remove_this_region ;
564 }
565
566 } /* drop duplicates */
567 }
568
569 continue ;
570 remove_this_region :
571 regions_pt[i].maxstable = 0 ;
572 --nmer ;
573
574 } /* next region to cleanup */
575
576 if(0)
577 {
578 printf(" Bad regions: %d\n", nbad ) ;
579 printf(" Small regions: %d\n", nsmall ) ;
580 printf(" Big regions: %d\n", nbig ) ;
581 printf(" Duplicated regions: %d\n", ndup ) ;
582 }
583 }
584
585/* printf("Cleaned-up regions: %d (%.1f%%)\n",
586 nmer, 100.0 * (double) nmer / ner) ;
587*/
588 /* -----------------------------------------------------------------
589 * Fit ellipses
590 * -------------------------------------------------------------- */
591 //ell_pt = 0 ;
592 //memset(ell_pt, sizeof(ulliArray) + sizeof(acc_t)*gdl*nmer, 0) ;
593 if (nout >= 1)
594 {
595 int midx = 1 ;
596 int d, index, j ;
597
598 /* enumerate maxstable regions */
599 for(i = 0 ; i < ner ; ++i)
600 {
601 if(! regions_pt [i].maxstable) continue ;
602 regions_pt [i].maxstable = midx++ ;
603 }
604
605 /* allocate space */
606 //acc_pt = malloc(sizeof(ulliArray) + sizeof(acc_t)*nel) ;
607 //printf("nmer = %d\n", nmer);
608 //ell_pt = malloc(sizeof(ulliArray) + sizeof(acc_t)*gdl*nmer) ;
609
610 /* clear accumulators */
611 for(d=0; d<(gdl*nmer); d++)
612 sref(ell_pt,d) = 0;
613
614 /* for each gdl */
615 for(d = 0 ; d < gdl ; ++d)
616 {
617 /* initalize parameter */
618 int counter_i;
619 for(counter_i=0; counter_i<ndims; counter_i++)
620 sref(subs_pt,counter_i) = 0;
621
622 if(d < ndims)
623 {
624 for(index = 0 ; index < nel ; ++ index)
625 {
626 sref(acc_pt,index) = sref(subs_pt,d) ;
627 adv(dims, ndims, subs_pt) ;
628 }
629 }
630 else
631 {
632 /* decode d-ndims into a (i,j) pair */
633 i = d-ndims ;
634 j = 0 ;
635 while(i > j)
636 {
637 i -= j + 1 ;
638 j ++ ;
639 }
640
641 /* add x_i * x_j */
642 for(index = 0 ; index < nel ; ++ index)
643 {
644 sref(acc_pt,index) = sref(subs_pt,i) * sref(subs_pt,j) ;
645 adv(dims, ndims, subs_pt) ;
646 }
647 }
648
649 /* integrate parameter */
650 for(i = 0 ; i < njoins ; ++i)
651 {
652 idx_t index = sref(joins_pt,i);
653 idx_t parent = forest_pt [ index ].parent ;
654 sref(acc_pt,parent) += sref(acc_pt,index) ;
655 }
656
657 /* save back to ellpises */
658 for(i = 0 ; i < ner ; ++i)
659 {
660 idx_t region = regions_pt [i].maxstable ;
661
662 /* skip if not extremal region */
663 if(region-- == 0) continue ;
664 sref(ell_pt,d + gdl*region) = sref(acc_pt, regions_pt[i].index) ;
665 }
666
667 /* next gdl */
668 }
669 //free(acc_pt) ;
670 //free(ell_pt) ;
671 }
672
673 /* -----------------------------------------------------------------
674 * Save back and exit
675 * -------------------------------------------------------------- */
676
677 /*
678 * Save extremal regions
679 */
680 {
681 int dims[2], j=0;
682 I2D* pt ;
683 dims[0] = nmer ;
684 //out = iMallocHandle(1, nmer);
685 out->height = 1;
686 out->width = nmer;
687 pt = out;
688 for (i = 0 ; i < ner ; ++i)
689 {
690 if( regions_pt[i].maxstable )
691 {
692 /* adjust for MATLAB index compatibility */
693// *pt++ = regions_pt[i].index + 1 ;
694 asubsref(pt,j++) = regions_pt[i].index + 1 ;
695 }
696 }
697 }
698
699 /* free stuff */
700 //free(dims);
701 //free( forest_pt ) ;
702 //free( pairs_pt ) ;
703 //free( regions_pt ) ;
704 //free( visited_pt ) ;
705 //free( strides_pt ) ;
706 //free( nsubs_pt ) ;
707 //free( subs_pt ) ;
708 //free( joins_pt ) ;
709
710 return out;
711}
712
713
714
diff --git a/SD-VBS/benchmarks/mser/src/c/mser.h b/SD-VBS/benchmarks/mser/src/c/mser.h
new file mode 100644
index 0000000..8876311
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/src/c/mser.h
@@ -0,0 +1,83 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#ifndef _MSER_
6#define _MSER_
7
8#define sref(a,i) a->data[i]
9
10#include "sdvbs_common.h"
11#define NMER_MAX 756
12
13typedef int val_t;
14
15typedef struct
16{
17 int width;
18 int data[];
19}iArray;
20
21typedef struct
22{
23 int width;
24 unsigned int data[];
25}uiArray;
26
27typedef struct
28{
29 int width;
30 long long int unsigned data[];
31}ulliArray;
32
33#define MIN(a,b) (a<b)?a:b
34#define MAX(a,b) (a>b)?a:b
35
36typedef int unsigned idx_t ;
37typedef long long int unsigned acc_t ;
38
39/* pairs are used to sort the pixels */
40typedef struct
41{
42 val_t value ;
43 idx_t index ;
44} pair_t ;
45
46/* forest node */
47typedef struct
48{
49 idx_t parent ; /**< parent pixel */
50 idx_t shortcut ; /**< shortcut to the root */
51 idx_t region ; /**< index of the region */
52 int area ; /**< area of the region */
53#ifdef USE_RANK_UNION
54 int height ; /**< node height */
55#endif
56} node_t ;
57
58/* extremal regions */
59typedef struct
60{
61 idx_t parent ; /**< parent region */
62 idx_t index ; /**< index of root pixel */
63 val_t value ; /**< value of root pixel */
64 int area ; /**< area of the region */
65 int area_top ; /**< area of the region DELTA levels above */
66 int area_bot ; /**< area of the region DELTA levels below */
67 float variation ; /**< variation */
68 int maxstable ; /**< max stable number (=0 if not maxstable) */
69} region_t ;
70
71int script_mser();
72I2D* mser(I2D* I, int in_delta,
73 iArray* subs_pt, iArray* nsubs_pt, iArray* strides_pt, iArray* visited_pt, iArray* dims,
74 uiArray* joins_pt,
75 region_t* regions_pt,
76 pair_t* pairs_pt,
77 node_t* forest_pt,
78 ulliArray* acc_pt, ulliArray* ell_pt,
79 I2D* out);
80
81#endif
82
83
diff --git a/SD-VBS/benchmarks/mser/src/c/script_mser.c b/SD-VBS/benchmarks/mser/src/c/script_mser.c
new file mode 100644
index 0000000..d4a98cd
--- /dev/null
+++ b/SD-VBS/benchmarks/mser/src/c/script_mser.c
@@ -0,0 +1,120 @@
1/********************************
2Author: Sravanthi Kota Venkata
3********************************/
4
5#include "mser.h"
6#include <malloc.h>
7#include "extra.h"
8#define min(a,b) (a<b)?a:b
9#define max(a,b) (a>b)?a:b
10
11int main(int argc, char* argv[])
12{
13 SET_UP
14 int which_image;
15 int i, j, k;
16 I2D *idx;
17 I2D *I;
18 I2D *It;
19 I2D *out;
20 int rows=196, cols=98;
21 int minVal = 1000;
22 int maxVal = -1000;
23 int lev = 10;
24
25 char im1[100], im2[100];
26
27 iArray *subs_pt, *nsubs_pt, *strides_pt, *visited_pt, *dims;
28 uiArray* joins_pt;
29 ulliArray *acc_pt, *ell_pt;
30 region_t* regions_pt;
31 pair_t* pairs_pt;
32 node_t* forest_pt;
33
34 int ndims, nel, gdl, nmer;
35
36 printf("Input Image: ");
37 scanf("%s", im1);
38
39 I = readImage(im1);
40
41 rows = I->height;
42 cols = I->width;
43
44 It = readImage(im1);
45
46 k = 0;
47 for(i=0; i<cols; i++)
48 {
49 for(j=0; j<rows; j++)
50 {
51 asubsref(It,k++) = subsref(I,j,i);
52 }
53 }
54
55 ndims = 2;
56 nel = It->height * It->width;
57 gdl = ndims * (ndims+1)/2 + ndims;
58 nmer = NMER_MAX;
59
60 dims = malloc(sizeof(iArray) + sizeof(int)*ndims);
61 /* allocate stuff */
62 subs_pt = malloc(sizeof(iArray) + sizeof(int)*ndims);
63 nsubs_pt = malloc(sizeof(iArray) + sizeof(int)*ndims);
64 strides_pt = malloc(sizeof(uiArray)+sizeof(unsigned int)*ndims);
65 visited_pt = malloc(sizeof(uiArray) + sizeof(unsigned int)*nel);
66 joins_pt = malloc(sizeof(uiArray) + sizeof(unsigned int)*nel);
67
68 regions_pt = (region_t*)malloc(sizeof(region_t)*nel);
69 pairs_pt = (pair_t*)malloc(sizeof(pair_t)*nel);
70 forest_pt = (node_t*)malloc(sizeof(node_t)*nel);
71
72 acc_pt = malloc(sizeof(ulliArray) + sizeof(acc_t)*nel) ;
73 ell_pt = malloc(sizeof(ulliArray) + sizeof(acc_t)*gdl*nmer) ;
74
75
76 out = iMallocHandle(1, nmer);
77 printf("start\n");
78 for_each_job{
79 idx = mser(It, 2, subs_pt, nsubs_pt, strides_pt, visited_pt, dims,
80 joins_pt,
81 regions_pt,
82 pairs_pt,
83 forest_pt,
84 acc_pt, ell_pt,
85 out);
86 }
87 printf("end..\n");
88
89#ifdef CHECK
90 /** Self checking - use expected.txt from data directory **/
91 {
92 int tol, ret=0;
93 tol = 1;
94#ifdef GENERATE_OUTPUT
95 writeMatrix(idx, argv[1]);
96#endif
97 ret = selfCheck(idx, "expected_C.txt", tol);
98 if (ret == -1)
99 printf("Error in MSER\n");
100 }
101 /** Self checking done **/
102#endif
103 free(dims);
104 free( forest_pt ) ;
105 free( pairs_pt ) ;
106 free( regions_pt ) ;
107 free( visited_pt ) ;
108 free( strides_pt ) ;
109 free( nsubs_pt ) ;
110 free( subs_pt ) ;
111 free( joins_pt ) ;
112 free( acc_pt ) ;
113 free( ell_pt ) ;
114 iFreeHandle(idx);
115 iFreeHandle(I);
116 iFreeHandle(It);
117 WRITE_TO_FILE
118 return 0;
119}
120