diff options
Diffstat (limited to 'SD-VBS/benchmarks/mser')
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 @@ | |||
1 | include ../../common/makefiles/Makefile.include | ||
2 | include $(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 @@ | |||
1 | include ../../../common/makefiles/Makefile.include | ||
2 | include $(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 @@ | |||
1 | INPUT=cif | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | include $(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 @@ | |||
1 | 91080 | ||
2 | 40916 | ||
3 | 90318 | ||
4 | 48277 | ||
5 | 57285 | ||
6 | 66702 | ||
7 | 66453 | ||
8 | 15757 | ||
9 | 56228 | ||
10 | 9401 | ||
11 | 72213 | ||
12 | 62502 | ||
13 | 50676 | ||
14 | 8016 | ||
15 | 76446 | ||
16 | 4080 | ||
17 | 26989 | ||
18 | 2894 | ||
19 | 15233 | ||
20 | 25177 | ||
21 | 46411 | ||
22 | 77708 | ||
23 | 79330 | ||
24 | 79286 | ||
25 | 7639 | ||
26 | 39100 | ||
27 | 20919 | ||
28 | 24125 | ||
29 | 69034 | ||
30 | 87683 | ||
31 | 33330 | ||
32 | 9587 | ||
33 | 14591 | ||
34 | 37790 | ||
35 | 57107 | ||
36 | 2905 | ||
37 | 72581 | ||
38 | 30138 | ||
39 | 66349 | ||
40 | 69782 | ||
41 | 53208 | ||
42 | 63252 | ||
43 | 8011 | ||
44 | 20400 | ||
45 | 47661 | ||
46 | 59179 | ||
47 | 71075 | ||
48 | 3544 | ||
49 | 75352 | ||
50 | 5143 | ||
51 | 42527 | ||
52 | 49924 | ||
53 | 9933 | ||
54 | 13880 | ||
55 | 38559 | ||
56 | 45184 | ||
57 | 48697 | ||
58 | 51275 | ||
59 | 57095 | ||
60 | 27545 | ||
61 | 41718 | ||
62 | 46519 | ||
63 | 25666 | ||
64 | 31481 | ||
65 | 56792 | ||
66 | 59176 | ||
67 | 29879 | ||
68 | 42197 | ||
69 | 62643 | ||
70 | 58210 | ||
71 | 20334 | ||
72 | 5623 | ||
73 | 43569 | ||
74 | 46210 | ||
75 | 50474 | ||
76 | 62104 | ||
77 | 65808 | ||
78 | 46945 | ||
79 | 52682 | ||
80 | 63195 | ||
81 | 77194 | ||
82 | 50534 | ||
83 | 60544 | ||
84 | 41770 | ||
85 | 48717 | ||
86 | 53246 | ||
87 | 57723 | ||
88 | 3829 | ||
89 | 20457 | ||
90 | 28461 | ||
91 | 32341 | ||
92 | 6413 | ||
93 | 30286 | ||
94 | 41193 | ||
95 | 50243 | ||
96 | 55458 | ||
97 | 56851 | ||
98 | 60038 | ||
99 | 35141 | ||
100 | 59004 | ||
101 | 63503 | ||
102 | 34763 | ||
103 | 48953 | ||
104 | 55092 | ||
105 | 4534 | ||
106 | 70791 | ||
107 | 20249 | ||
108 | 28134 | ||
109 | 33971 | ||
110 | 53439 | ||
111 | 55882 | ||
112 | 30562 | ||
113 | 33993 | ||
114 | 34523 | ||
115 | 67709 | ||
116 | 60469 | ||
117 | 8591 | ||
118 | 20489 | ||
119 | 72123 | ||
120 | 20237 | ||
121 | 62971 | ||
122 | 26046 | ||
123 | 27337 | ||
124 | 27638 | ||
125 | 29497 | ||
126 | 46390 | ||
127 | 18004 | ||
128 | 41108 | ||
129 | 47659 | ||
130 | 72386 | ||
131 | 31584 | ||
132 | 52173 | ||
133 | 58091 | ||
134 | 46624 | ||
135 | 68233 | ||
136 | 25267 | ||
137 | 29768 | ||
138 | 52802 | ||
139 | 63228 | ||
140 | 39529 | ||
141 | 37092 | ||
142 | 48469 | ||
143 | 41074 | ||
144 | 44231 | ||
145 | 18653 | ||
146 | 40524 | ||
147 | 26529 | ||
148 | 32423 | ||
149 | 27131 | ||
150 | 37373 | ||
151 | 39650 | ||
152 | 65233 | ||
153 | 72920 | ||
154 | 12277 | ||
155 | 33656 | ||
156 | 33151 | ||
157 | 40026 | ||
158 | 48408 | ||
159 | 33352 | ||
160 | 91265 | ||
161 | 32307 | ||
162 | 33875 | ||
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 @@ | |||
1 | INPUT=fullhd | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | include $(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 @@ | |||
1 | INPUT=qcif | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | include $(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 @@ | |||
1 | 22308 | ||
2 | 10162 | ||
3 | 14251 | ||
4 | 9500 | ||
5 | 18683 | ||
6 | 5669 | ||
7 | 1501 | ||
8 | 2813 | ||
9 | 5180 | ||
10 | 6119 | ||
11 | 3731 | ||
12 | 3939 | ||
13 | 22065 | ||
14 | 2417 | ||
15 | 5048 | ||
16 | 17994 | ||
17 | 14159 | ||
18 | 15203 | ||
19 | 17195 | ||
20 | 18926 | ||
21 | 13616 | ||
22 | 2192 | ||
23 | 2 | ||
24 | 6900 | ||
25 | 9794 | ||
26 | 11366 | ||
27 | 14679 | ||
28 | 5344 | ||
29 | 17471 | ||
30 | 11778 | ||
31 | 16661 | ||
32 | 10323 | ||
33 | 12856 | ||
34 | 13141 | ||
35 | 7022 | ||
36 | 12740 | ||
37 | 11984 | ||
38 | 14560 | ||
39 | 12982 | ||
40 | 19042 | ||
41 | 13916 | ||
42 | 1250 | ||
43 | 7680 | ||
44 | 159 | ||
45 | 5477 | ||
46 | 13909 | ||
47 | 15632 | ||
48 | 7620 | ||
49 | 6936 | ||
50 | 14660 | ||
51 | 2021 | ||
52 | 12466 | ||
53 | 16436 | ||
54 | 6556 | ||
55 | 12499 | ||
56 | 9457 | ||
57 | 6559 | ||
58 | 13998 | ||
59 | 17616 | ||
60 | 9992 | ||
61 | 12224 | ||
62 | 14654 | ||
63 | 9572 | ||
64 | 6970 | ||
65 | 8661 | ||
66 | 18900 | ||
67 | 3364 | ||
68 | 8379 | ||
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 @@ | |||
1 | INPUT=sim | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | include $(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 @@ | |||
1 | 3611 | ||
2 | 5615 | ||
3 | 3876 | ||
4 | 2441 | ||
5 | 5556 | ||
6 | 127 | ||
7 | 1109 | ||
8 | 71 | ||
9 | 8 | ||
10 | 16 | ||
11 | 3567 | ||
12 | 817 | ||
13 | 3169 | ||
14 | 2121 | ||
15 | 4036 | ||
16 | 3985 | ||
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 | |||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | INPUT=sim_fast | ||
6 | include $(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 @@ | |||
1 | 1214 | ||
2 | 353 | ||
3 | 1146 | ||
4 | 29 | ||
5 | 187 | ||
6 | 829 | ||
7 | 976 | ||
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 @@ | |||
1 | INPUT=sqcif | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | include $(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 @@ | |||
1 | 3549 | ||
2 | 5615 | ||
3 | 3941 | ||
4 | 5626 | ||
5 | 5113 | ||
6 | 1079 | ||
7 | 3840 | ||
8 | 4838 | ||
9 | 4050 | ||
10 | 7 | ||
11 | 1741 | ||
12 | 2778 | ||
13 | 2060 | ||
14 | 3911 | ||
15 | 13 | ||
16 | 1923 | ||
17 | 3918 | ||
18 | 3463 | ||
19 | 480 | ||
20 | 1488 | ||
21 | 344 | ||
22 | 33 | ||
23 | 2158 | ||
24 | 3398 | ||
25 | 1694 | ||
26 | 2420 | ||
27 | 4026 | ||
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 @@ | |||
1 | include ../../../../common/makefiles/Makefile.include | ||
2 | |||
3 | BMARK=mser | ||
4 | INPUT=test | ||
5 | include $(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 @@ | |||
1 | INPUT=vga | ||
2 | include ../../../../common/makefiles/Makefile.include | ||
3 | |||
4 | BMARK=mser | ||
5 | include $(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 @@ | |||
1 | 150188 | ||
2 | 139161 | ||
3 | 226889 | ||
4 | 295683 | ||
5 | 188158 | ||
6 | 218738 | ||
7 | 24760 | ||
8 | 122860 | ||
9 | 234561 | ||
10 | 71415 | ||
11 | 184318 | ||
12 | 25237 | ||
13 | 84868 | ||
14 | 27054 | ||
15 | 73340 | ||
16 | 252342 | ||
17 | 178044 | ||
18 | 251786 | ||
19 | 38543 | ||
20 | 166539 | ||
21 | 265202 | ||
22 | 13175 | ||
23 | 230154 | ||
24 | 241697 | ||
25 | 268924 | ||
26 | 106165 | ||
27 | 87963 | ||
28 | 140157 | ||
29 | 178621 | ||
30 | 3821 | ||
31 | 49293 | ||
32 | 51544 | ||
33 | 87463 | ||
34 | 138676 | ||
35 | 146393 | ||
36 | 153034 | ||
37 | 178140 | ||
38 | 263663 | ||
39 | 35512 | ||
40 | 81293 | ||
41 | 128231 | ||
42 | 24929 | ||
43 | 38545 | ||
44 | 157836 | ||
45 | 201762 | ||
46 | 260875 | ||
47 | 53461 | ||
48 | 58270 | ||
49 | 68286 | ||
50 | 78904 | ||
51 | 123882 | ||
52 | 143979 | ||
53 | 155623 | ||
54 | 289494 | ||
55 | 17912 | ||
56 | 166189 | ||
57 | 172421 | ||
58 | 188794 | ||
59 | 258462 | ||
60 | 80809 | ||
61 | 110040 | ||
62 | 125346 | ||
63 | 193605 | ||
64 | 215682 | ||
65 | 492 | ||
66 | 242242 | ||
67 | 98477 | ||
68 | 204773 | ||
69 | 271899 | ||
70 | 305023 | ||
71 | 20339 | ||
72 | 47220 | ||
73 | 48233 | ||
74 | 48129 | ||
75 | 78890 | ||
76 | 78902 | ||
77 | 121066 | ||
78 | 157838 | ||
79 | 157696 | ||
80 | 222421 | ||
81 | 195436 | ||
82 | 202237 | ||
83 | 222353 | ||
84 | 247870 | ||
85 | 263209 | ||
86 | 60698 | ||
87 | 67419 | ||
88 | 141637 | ||
89 | 168504 | ||
90 | 225211 | ||
91 | 246839 | ||
92 | 16955 | ||
93 | 45396 | ||
94 | 75542 | ||
95 | 167666 | ||
96 | 175462 | ||
97 | 185528 | ||
98 | 186845 | ||
99 | 11725 | ||
100 | 12720 | ||
101 | 17432 | ||
102 | 90532 | ||
103 | 153694 | ||
104 | 157695 | ||
105 | 163260 | ||
106 | 166188 | ||
107 | 228166 | ||
108 | 242515 | ||
109 | 264159 | ||
110 | 24279 | ||
111 | 90873 | ||
112 | 137217 | ||
113 | 178145 | ||
114 | 85543 | ||
115 | 103800 | ||
116 | 121961 | ||
117 | 126261 | ||
118 | 142142 | ||
119 | 149331 | ||
120 | 166705 | ||
121 | 138344 | ||
122 | 192225 | ||
123 | 61171 | ||
124 | 137772 | ||
125 | 159873 | ||
126 | 183201 | ||
127 | 191826 | ||
128 | 12731 | ||
129 | 21743 | ||
130 | 41559 | ||
131 | 116677 | ||
132 | 177659 | ||
133 | 157702 | ||
134 | 163404 | ||
135 | 187318 | ||
136 | 199366 | ||
137 | 216135 | ||
138 | 174026 | ||
139 | 209457 | ||
140 | 218175 | ||
141 | 256531 | ||
142 | 109213 | ||
143 | 205085 | ||
144 | 50229 | ||
145 | 137858 | ||
146 | 155858 | ||
147 | 176013 | ||
148 | 190780 | ||
149 | 10764 | ||
150 | 169116 | ||
151 | 56443 | ||
152 | 99749 | ||
153 | 100683 | ||
154 | 184963 | ||
155 | 34340 | ||
156 | 84582 | ||
157 | 152527 | ||
158 | 225832 | ||
159 | 60575 | ||
160 | 115240 | ||
161 | 226637 | ||
162 | 161966 | ||
163 | 183392 | ||
164 | 197327 | ||
165 | 213856 | ||
166 | 241059 | ||
167 | 240186 | ||
168 | 100504 | ||
169 | 74754 | ||
170 | 81674 | ||
171 | 93395 | ||
172 | 132483 | ||
173 | 183200 | ||
174 | 197487 | ||
175 | 71281 | ||
176 | 78323 | ||
177 | 108050 | ||
178 | 115058 | ||
179 | 156455 | ||
180 | 179831 | ||
181 | 104 | ||
182 | 178270 | ||
183 | 200686 | ||
184 | 205651 | ||
185 | 54048 | ||
186 | 67055 | ||
187 | 157242 | ||
188 | 226147 | ||
189 | 264274 | ||
190 | 97314 | ||
191 | 112166 | ||
192 | 99664 | ||
193 | 112206 | ||
194 | 116049 | ||
195 | 182192 | ||
196 | 21848 | ||
197 | 66537 | ||
198 | 130426 | ||
199 | 152940 | ||
200 | 156285 | ||
201 | 197779 | ||
202 | 209053 | ||
203 | 238177 | ||
204 | 259864 | ||
205 | 61533 | ||
206 | 97798 | ||
207 | 104222 | ||
208 | 176915 | ||
209 | 180751 | ||
210 | 210478 | ||
211 | 63199 | ||
212 | 69447 | ||
213 | 224698 | ||
214 | 238313 | ||
215 | 67034 | ||
216 | 85757 | ||
217 | 85258 | ||
218 | 105388 | ||
219 | 153466 | ||
220 | 180480 | ||
221 | 88659 | ||
222 | 123185 | ||
223 | 176914 | ||
224 | 26649 | ||
225 | 101110 | ||
226 | 109718 | ||
227 | 112129 | ||
228 | 153412 | ||
229 | 169722 | ||
230 | 173098 | ||
231 | 97319 | ||
232 | 122228 | ||
233 | 126071 | ||
234 | 150970 | ||
235 | 186255 | ||
236 | 91527 | ||
237 | 149140 | ||
238 | 222949 | ||
239 | 117832 | ||
240 | 128889 | ||
241 | 129467 | ||
242 | 151042 | ||
243 | 125202 | ||
244 | 126520 | ||
245 | 173763 | ||
246 | 196324 | ||
247 | 207128 | ||
248 | 103415 | ||
249 | 137589 | ||
250 | 149105 | ||
251 | 82420 | ||
252 | 118796 | ||
253 | 137047 | ||
254 | 146660 | ||
255 | 151972 | ||
256 | 118828 | ||
257 | 127476 | ||
258 | 124086 | ||
259 | 68492 | ||
260 | 91587 | ||
261 | 90605 | ||
262 | 113982 | ||
263 | 117387 | ||
264 | 150991 | ||
265 | 152035 | ||
266 | 122974 | ||
267 | 84235 | ||
268 | 212209 | ||
269 | 114957 | ||
270 | 42000 | ||
271 | 242485 | ||
272 | 103945 | ||
273 | 143398 | ||
274 | 116457 | ||
275 | 198008 | ||
276 | 134212 | ||
277 | 257564 | ||
278 | 255173 | ||
279 | 252776 | ||
280 | 107194 | ||
281 | 289726 | ||
282 | 294096 | ||
283 | 161443 | ||
284 | 292606 | ||
285 | 277399 | ||
286 | 105290 | ||
287 | 159533 | ||
288 | 294098 | ||
289 | 276919 | ||
290 | 279700 | ||
291 | 304797 | ||
292 | 90329 | ||
293 | 57239 | ||
294 | 104324 | ||
295 | 58669 | ||
296 | 114859 | ||
297 | 185568 | ||
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 | /******************************** | ||
2 | Author: 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 */ | ||
23 | void | ||
24 | adv(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 **/ | ||
37 | I2D* 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 | /******************************** | ||
2 | Author: 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 | |||
13 | typedef int val_t; | ||
14 | |||
15 | typedef struct | ||
16 | { | ||
17 | int width; | ||
18 | int data[]; | ||
19 | }iArray; | ||
20 | |||
21 | typedef struct | ||
22 | { | ||
23 | int width; | ||
24 | unsigned int data[]; | ||
25 | }uiArray; | ||
26 | |||
27 | typedef 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 | |||
36 | typedef int unsigned idx_t ; | ||
37 | typedef long long int unsigned acc_t ; | ||
38 | |||
39 | /* pairs are used to sort the pixels */ | ||
40 | typedef struct | ||
41 | { | ||
42 | val_t value ; | ||
43 | idx_t index ; | ||
44 | } pair_t ; | ||
45 | |||
46 | /* forest node */ | ||
47 | typedef 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 */ | ||
59 | typedef 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 | |||
71 | int script_mser(); | ||
72 | I2D* 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 | /******************************** | ||
2 | Author: 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 | |||
11 | int 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 | |||