Basic Morphological Operators: Erosion & Dilation
Port erosion / dilation algorithms:
-
documentation -
benchmarks -
tests
On 20 MPixel image:
Clang / 20 MP / Benchmark | Time | CPU | Time Old | Time New | CPU Old | CPU New |
---|---|---|---|---|---|---|
BMDilation/ApproximatedDisc/2 | -0.0538 | -0.0536 | 2045052734 | 1935112164 | 2041162212 | 1931815666 |
BMDilation/ApproximatedDisc/4 | -0.0006 | -0.0007 | 4990348772 | 4987145968 | 4981226680 | 4977691992 |
BMDilation/ApproximatedDisc/8 | -0.0005 | -0.0003 | 7994672175 | 7991029398 | 7978267673 | 7975940702 |
BMDilation/ApproximatedDisc/16 | -0.0208 | -0.0207 | 7364709885 | 7211441228 | 7350938095 | 7198430571 |
BMDilation/ApproximatedDisc/32 | +0.0021 | +0.0021 | 9485570602 | 9505420702 | 9468302246 | 9488355154 |
BMDilation/ApproximatedDisc/64 | +0.0067 | +0.0069 | 9026371079 | 9087190078 | 9008453637 | 9070709550 |
BMDilation/ApproximatedDisc/128 | +0.0517 | +0.0514 | 8770586645 | 9224402214 | 8755619984 | 9205493926 |
BMDilation/EuclideanDisc_incremental/2 | +0.2217 | +0.2212 | 4927711174 | 6020029097 | 4921560933 | 6010200230 |
BMDilation/EuclideanDisc_incremental/4 | +0.2018 | +0.2017 | 7201798446 | 8655045094 | 7193051688 | 8643824928 |
BMDilation/EuclideanDisc_incremental/8 | +0.2864 | +0.2862 | 9527323532 | 12256314443 | 9515781030 | 12239276615 |
BMDilation/EuclideanDisc_incremental/16 | +0.3193 | +0.3185 | 15905139404 | 20983038433 | 15886149530 | 20946359334 |
BMDilation/EuclideanDisc_incremental/32 | +0.3478 | +0.3473 | 28776259977 | 38784191837 | 28742898353 | 38725603035 |
BMDilation/EuclideanDisc_incremental/64 | +0.4413 | +0.4407 | 57327021490 | 82625476035 | 57254568698 | 82487108033 |
BMDilation/EuclideanDisc_incremental/128 | +0.2786 | +0.2786 | 132179872052 | 169007886219 | 131966108887 | 168735045936 |
BMDilation/Square/2 | -0.0544 | -0.0543 | 2041247575 | 1930259314 | 2037574922 | 1926849036 |
BMDilation/Square/4 | -0.0599 | -0.0600 | 1906941701 | 1792799284 | 1903632639 | 1789483970 |
BMDilation/Square/8 | -0.0857 | -0.0859 | 1841290230 | 1683526716 | 1838146725 | 1680257775 |
BMDilation/Square/16 | -0.0722 | -0.0723 | 1713052041 | 1589409230 | 1710009758 | 1586319731 |
BMDilation/Square/32 | -0.0652 | -0.0653 | 1618715818 | 1513198839 | 1615843609 | 1510341905 |
BMDilation/Square/64 | -0.0590 | -0.0591 | 1566999155 | 1474526847 | 1564335531 | 1471825672 |
BMDilation/Square/128 | -0.0339 | -0.0341 | 1524797237 | 1473074573 | 1522220644 | 1470264636 |
Clang / 20 MP /Benchmark | Time | CPU | Time Old | Time New | CPU Old | CPU New |
---|---|---|---|---|---|---|
BMDilation/ApproximatedDisc/2 | -0.0376 | -0.0377 | 1456668787 | 1401871120 | 1453958835 | 1399116515 |
BMDilation/ApproximatedDisc/4 | -0.0041 | -0.0042 | 3693923145 | 3678859109 | 3687222218 | 3671916738 |
BMDilation/ApproximatedDisc/8 | +0.0097 | +0.0097 | 6019192462 | 6077864071 | 6008204380 | 6066733155 |
BMDilation/ApproximatedDisc/16 | +0.0188 | +0.0187 | 5921722820 | 6032902843 | 5911022116 | 6021409792 |
BMDilation/ApproximatedDisc/32 | +0.0266 | +0.0265 | 8095130568 | 8310150102 | 8080398083 | 8294922626 |
BMDilation/ApproximatedDisc/64 | +0.0477 | +0.0476 | 8091038775 | 8476916492 | 8076649430 | 8461071036 |
BMDilation/ApproximatedDisc/128 | +0.0872 | +0.0871 | 8158654103 | 8869799954 | 8143874193 | 8852882649 |
BMDilation/EuclideanDisc_incremental/2 | +0.0781 | +0.0778 | 4830924064 | 5208057082 | 4824342513 | 5199559658 |
BMDilation/EuclideanDisc_incremental/4 | +0.1252 | +0.1252 | 6976637284 | 7850338639 | 6967659201 | 7839795532 |
BMDilation/EuclideanDisc_incremental/8 | +0.1944 | +0.1944 | 9271831420 | 11074569914 | 9259646685 | 11060056613 |
BMDilation/EuclideanDisc_incremental/16 | +0.4539 | +0.4521 | 14896918362 | 21659112044 | 14877214230 | 21602532756 |
BMDilation/EuclideanDisc_incremental/32 | +0.2472 | +0.2465 | 27522678050 | 34327384626 | 27490455084 | 34266801729 |
BMDilation/EuclideanDisc_incremental/64 | +0.2215 | +0.2213 | 54367093084 | 66409643194 | 54300273886 | 66315404348 |
BMDilation/EuclideanDisc_incremental/128 | +0.0632 | +0.0637 | 130317457623 | 138551643733 | 130063345741 | 138352823663 |
BMDilation/Square/2 | -0.0928 | -0.0916 | 1553898371 | 1409756578 | 1549222522 | 1407241082 |
BMDilation/Square/4 | -0.1007 | -0.0998 | 1526135880 | 1372433634 | 1521787235 | 1369933086 |
BMDilation/Square/8 | -0.0772 | -0.0765 | 1479482059 | 1365296756 | 1475740982 | 1362782090 |
BMDilation/Square/16 | -0.0898 | -0.0890 | 1530462480 | 1393029611 | 1525963046 | 1390178801 |
BMDilation/Square/32 | -0.0439 | -0.0440 | 1476493875 | 1411737780 | 1474010075 | 1409205349 |
BMDilation/Square/64 | -0.0326 | -0.0327 | 1473040479 | 1425010029 | 1470407505 | 1422385693 |
BMDilation/Square/128 | -0.0063 | -0.0064 | 1467164079 | 1457961699 | 1464702075 | 1455296350 |
On Lena 512*512
Result of the benchmark are:
GCC Benchmark | Time | CPU | Time Old | Time New | CPU Old | CPU New |
---|---|---|---|---|---|---|
BMDilation/ApproximatedDisc/2 | -0.3011 | -0.3017 | 2739319 | 1914472 | 2732041 | 1907790 |
BMDilation/ApproximatedDisc/4 | -0.3335 | -0.3341 | 5777762 | 3850786 | 5763102 | 3837775 |
BMDilation/ApproximatedDisc/8 | -0.3431 | -0.3443 | 8764095 | 5756744 | 8749783 | 5737605 |
BMDilation/ApproximatedDisc/16 | -0.3167 | -0.3182 | 8313165 | 5680133 | 8300925 | 5659957 |
BMDilation/ApproximatedDisc/32 | -0.2185 | -0.2204 | 11014132 | 8607799 | 10986228 | 8564872 |
BMDilation/ApproximatedDisc/64 | -0.0541 | -0.0564 | 11010319 | 10414576 | 10982685 | 10363225 |
BMDilation/ApproximatedDisc/128 | +0.3446 | +0.3413 | 11146551 | 14987377 | 11118746 | 14913057 |
BMDilation/EuclideanDisc_naive/2 | +3.1132 | +3.1003 | 7962391 | 32751211 | 7951948 | 32605655 |
BMDilation/EuclideanDisc_naive/4 | +0.9761 | +0.9699 | 42168671 | 83329628 | 42077337 | 82889146 |
BMDilation/EuclideanDisc_naive/8 | +0.7384 | +0.7325 | 136879818 | 237952762 | 136727995 | 236884717 |
BMDilation/EuclideanDisc_naive/16 | +0.7048 | +0.7012 | 504513604 | 860071785 | 503250781 | 856138894 |
BMDilation/EuclideanDisc_naive/32 | +0.6990 | +0.6940 | 1952980540 | 3318143400 | 1949407323 | 3302389978 |
BMDilation/EuclideanDisc_naive/64 | +0.7160 | +0.7122 | 7591986182 | 13027906964 | 7572622098 | 12965751440 |
BMDilation/EuclideanDisc_naive/128 | +0.7814 | +0.7780 | 29067690324 | 51779777637 | 28979492013 | 51524620233 |
BMDilation/EuclideanDisc_incremental/2 | +0.1027 | +0.1008 | 17776951 | 19603316 | 17721321 | 19507007 |
BMDilation/EuclideanDisc_incremental/4 | +0.1479 | +0.1459 | 28078186 | 32231871 | 27991593 | 32075338 |
BMDilation/EuclideanDisc_incremental/8 | +0.2473 | +0.2445 | 40024670 | 49924164 | 39911761 | 49670614 |
BMDilation/EuclideanDisc_incremental/16 | +0.2768 | +0.2742 | 62847100 | 80243443 | 62664764 | 79846299 |
BMDilation/EuclideanDisc_incremental/32 | +0.3588 | +0.3567 | 112882370 | 153387229 | 112545794 | 152691925 |
BMDilation/EuclideanDisc_incremental/64 | +0.3015 | +0.2995 | 233226864 | 303539600 | 232506056 | 302133212 |
BMDilation/EuclideanDisc_incremental/128 | +0.3849 | +0.3822 | 470531930 | 651632560 | 469092382 | 648369146 |
BMDilation/Square/2 | -0.2957 | -0.2971 | 2697064 | 1899482 | 2688450 | 1889768 |
BMDilation/Square/4 | -0.3240 | -0.3253 | 2617873 | 1769790 | 2609654 | 1760724 |
BMDilation/Square/8 | -0.2864 | -0.2878 | 2580363 | 1841257 | 2571949 | 1831750 |
BMDilation/Square/16 | -0.2575 | -0.2592 | 2615270 | 1941731 | 2607613 | 1931689 |
BMDilation/Square/32 | -0.1813 | -0.1828 | 2735092 | 2239142 | 2726322 | 2227836 |
BMDilation/Square/64 | +0.0058 | +0.0035 | 2699813 | 2715585 | 2691951 | 2701282 |
BMDilation/Square/128 | +0.4120 | +0.4089 | 2679254 | 3782992 | 2671355 | 3763598 |
Clang Benchmark | Time | CPU | Time Old | Time New | CPU Old | CPU New |
---|---|---|---|---|---|---|
BMDilation/ApproximatedDisc/2 | -0.2223 | -0.2210 | 5427418 | 4220789 | 5410171 | 4214355 |
BMDilation/ApproximatedDisc/4 | -0.2205 | -0.2189 | 11762102 | 9168931 | 11719538 | 9154005 |
BMDilation/ApproximatedDisc/8 | -0.2200 | -0.2184 | 18749839 | 14624766 | 18682161 | 14602032 |
BMDilation/ApproximatedDisc/16 | -0.2512 | -0.2492 | 16376980 | 12263596 | 16306738 | 12243049 |
BMDilation/ApproximatedDisc/32 | -0.1488 | -0.1472 | 19101052 | 16259356 | 19034298 | 16232514 |
BMDilation/ApproximatedDisc/64 | -0.0126 | -0.0108 | 16773257 | 16562330 | 16711427 | 16530346 |
BMDilation/ApproximatedDisc/128 | +0.3116 | +0.3147 | 15457995 | 20274263 | 15392364 | 20237065 |
BMDilation/EuclideanDisc_naive/2 | +3.9386 | +3.9513 | 7328172 | 36191024 | 7300958 | 36149349 |
BMDilation/EuclideanDisc_naive/4 | +1.0343 | +1.0376 | 43461235 | 88414911 | 43331245 | 88292561 |
BMDilation/EuclideanDisc_naive/8 | +0.8319 | +0.8364 | 146905352 | 269112224 | 146349430 | 268759007 |
BMDilation/EuclideanDisc_naive/16 | +0.7508 | +0.7555 | 547140812 | 957948222 | 545027227 | 956775446 |
BMDilation/EuclideanDisc_naive/32 | +0.7777 | +0.7805 | 2098735006 | 3730946836 | 2092804854 | 3726303274 |
BMDilation/EuclideanDisc_naive/64 | +0.8062 | +0.8073 | 8114088855 | 14655578552 | 8098206230 | 14636260339 |
BMDilation/EuclideanDisc_naive/128 | +1.0708 | +1.0690 | 29037416636 | 60131779112 | 28999144371 | 59998110279 |
BMDilation/EuclideanDisc_incremental/2 | +0.2084 | +0.2085 | 18635351 | 22519832 | 18611098 | 22492293 |
BMDilation/EuclideanDisc_incremental/4 | +0.2180 | +0.2180 | 29242890 | 35617087 | 29208399 | 35575255 |
BMDilation/EuclideanDisc_incremental/8 | +0.3065 | +0.3067 | 40898882 | 53434319 | 40845179 | 53373574 |
BMDilation/EuclideanDisc_incremental/16 | +0.2763 | +0.2768 | 69007036 | 88071487 | 68897956 | 87968889 |
BMDilation/EuclideanDisc_incremental/32 | +0.3191 | +0.3195 | 122048591 | 160992032 | 121864619 | 160803595 |
BMDilation/EuclideanDisc_incremental/64 | +0.3541 | +0.3546 | 236782352 | 320636824 | 236417537 | 320241778 |
BMDilation/EuclideanDisc_incremental/128 | +0.3918 | +0.3921 | 487569260 | 678587095 | 486759288 | 677610320 |
BMDilation/Square/2 | -0.2669 | -0.2664 | 5749757 | 4214952 | 5736411 | 4208363 |
BMDilation/Square/4 | -0.2875 | -0.2867 | 5032224 | 3585588 | 5018515 | 3579688 |
BMDilation/Square/8 | -0.2944 | -0.2934 | 4679321 | 3301642 | 4664663 | 3296039 |
BMDilation/Square/16 | -0.2823 | -0.2819 | 4032547 | 2894106 | 4023124 | 2889078 |
BMDilation/Square/32 | -0.2310 | -0.2308 | 3633709 | 2794392 | 3626562 | 2789652 |
BMDilation/Square/64 | -0.0676 | -0.0668 | 3247031 | 3027485 | 3238758 | 3022502 |
BMDilation/Square/128 | +0.2976 | +0.2974 | 2965527 | 3847977 | 2961120 | 3841882 |