diff --git a/data/bun0.pcd b/data/bun0.pcd new file mode 100644 index 0000000..f35c835 --- /dev/null +++ b/data/bun0.pcd @@ -0,0 +1,407 @@ +# .PCD v.5 - Point Cloud Data file format +VERSION .5 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 397 +HEIGHT 1 +POINTS 397 +DATA ascii +0.0054216 0.11349 0.040749 +-0.0017447 0.11425 0.041273 +-0.010661 0.11338 0.040916 +0.026422 0.11499 0.032623 +0.024545 0.12284 0.024255 +0.034137 0.11316 0.02507 +0.02886 0.11773 0.027037 +0.02675 0.12234 0.017605 +0.03575 0.1123 0.019109 +0.015982 0.12307 0.031279 +0.0079813 0.12438 0.032798 +0.018101 0.11674 0.035493 +0.0086687 0.11758 0.037538 +0.01808 0.12536 0.026132 +0.0080861 0.12866 0.02619 +0.02275 0.12146 0.029671 +-0.0018689 0.12456 0.033184 +-0.011168 0.12376 0.032519 +-0.0020063 0.11937 0.038104 +-0.01232 0.11816 0.037427 +-0.0016659 0.12879 0.026782 +-0.011971 0.12723 0.026219 +0.016484 0.12828 0.01928 +0.0070921 0.13103 0.018415 +0.0014615 0.13134 0.017095 +-0.013821 0.12886 0.019265 +-0.01725 0.11202 0.040077 +-0.074556 0.13415 0.051046 +-0.065971 0.14396 0.04109 +-0.071925 0.14545 0.043266 +-0.06551 0.13624 0.042195 +-0.071112 0.13767 0.047518 +-0.079528 0.13416 0.051194 +-0.080421 0.14428 0.042793 +-0.082672 0.1378 0.046806 +-0.08813 0.13514 0.042222 +-0.066325 0.12347 0.050729 +-0.072399 0.12662 0.052364 +-0.066091 0.11973 0.050881 +-0.072012 0.11811 0.052295 +-0.062433 0.12627 0.043831 +-0.068326 0.12998 0.048875 +-0.063094 0.11811 0.044399 +-0.071301 0.11322 0.04841 +-0.080515 0.12741 0.052034 +-0.078179 0.1191 0.051116 +-0.085216 0.12609 0.049001 +-0.089538 0.12621 0.044589 +-0.082659 0.11661 0.04797 +-0.089536 0.11784 0.04457 +-0.0565 0.15248 0.030132 +-0.055517 0.15313 0.026915 +-0.03625 0.17198 0.00017688 +-0.03775 0.17198 0.00022189 +-0.03625 0.16935 0.00051958 +-0.033176 0.15711 0.0018682 +-0.051913 0.1545 0.011273 +-0.041707 0.16642 0.0030522 +-0.049468 0.16414 0.0041988 +-0.041892 0.15669 0.0054879 +-0.051224 0.15878 0.0080283 +-0.062417 0.15317 0.033161 +-0.07167 0.15319 0.033701 +-0.062543 0.15524 0.027405 +-0.07211 0.1555 0.027645 +-0.078663 0.15269 0.032268 +-0.081569 0.15374 0.026085 +-0.08725 0.1523 0.022135 +-0.05725 0.15568 0.010325 +-0.057888 0.1575 0.0073225 +-0.0885 0.15223 0.019215 +-0.056129 0.14616 0.03085 +-0.054705 0.13555 0.032127 +-0.054144 0.14714 0.026275 +-0.046625 0.13234 0.021909 +-0.05139 0.13694 0.025787 +-0.018278 0.12238 0.030773 +-0.021656 0.11643 0.035209 +-0.031921 0.11566 0.032851 +-0.021348 0.12421 0.024562 +-0.03241 0.12349 0.023293 +-0.024869 0.12094 0.028745 +-0.031747 0.12039 0.028229 +-0.052912 0.12686 0.034968 +-0.041672 0.11564 0.032998 +-0.052037 0.1168 0.034582 +-0.042495 0.12488 0.024082 +-0.047946 0.12736 0.028108 +-0.042421 0.12035 0.028633 +-0.047661 0.12024 0.028871 +-0.035964 0.1513 0.0005395 +-0.050598 0.1474 0.013881 +-0.046375 0.13293 0.018289 +-0.049125 0.13856 0.016269 +-0.042976 0.14915 0.0054003 +-0.047965 0.14659 0.0086783 +-0.022926 0.1263 0.018077 +-0.031583 0.1259 0.017804 +-0.041733 0.12796 0.01665 +-0.061482 0.14698 0.036168 +-0.071729 0.15026 0.038328 +-0.060526 0.1368 0.035999 +-0.082619 0.14823 0.035955 +-0.087824 0.14449 0.033779 +-0.089 0.13828 0.037774 +-0.085662 0.15095 0.028208 +-0.089601 0.14725 0.025869 +-0.090681 0.13748 0.02369 +-0.058722 0.12924 0.038992 +-0.060075 0.11512 0.037685 +-0.091812 0.12767 0.038703 +-0.091727 0.11657 0.039619 +-0.093164 0.12721 0.025211 +-0.093938 0.12067 0.024399 +-0.091583 0.14522 0.01986 +-0.090929 0.13667 0.019817 +-0.093094 0.11635 0.018959 +0.024948 0.10286 0.041418 +0.0336 0.092627 0.040463 +0.02742 0.096386 0.043312 +0.03392 0.086911 0.041034 +0.028156 0.086837 0.045084 +0.03381 0.078604 0.040854 +0.028125 0.076874 0.045059 +0.0145 0.093279 0.05088 +0.0074817 0.09473 0.052315 +0.017407 0.10535 0.043139 +0.0079536 0.10633 0.042968 +0.018511 0.097194 0.047253 +0.0086436 0.099323 0.048079 +-0.0020197 0.095698 0.053906 +-0.011446 0.095169 0.053862 +-0.001875 0.10691 0.043455 +-0.011875 0.10688 0.043019 +-0.0017622 0.10071 0.046648 +-0.012498 0.10008 0.045916 +0.016381 0.085894 0.051642 +0.0081167 0.08691 0.055228 +0.017644 0.076955 0.052372 +0.008125 0.076853 0.055536 +0.020575 0.088169 0.049006 +0.022445 0.075721 0.049563 +-0.0017931 0.086849 0.056843 +-0.011943 0.086771 0.057009 +-0.0019567 0.076863 0.057803 +-0.011875 0.076964 0.057022 +0.03325 0.067541 0.040033 +0.028149 0.066829 0.042953 +0.026761 0.057829 0.042588 +0.023571 0.04746 0.040428 +0.015832 0.067418 0.051639 +0.0080431 0.066902 0.055006 +0.013984 0.058886 0.050416 +0.0080973 0.056888 0.05295 +0.020566 0.065958 0.0483 +0.018594 0.056539 0.047879 +0.012875 0.052652 0.049689 +-0.0017852 0.066712 0.056503 +-0.011785 0.066885 0.055015 +-0.001875 0.056597 0.05441 +-0.01184 0.057054 0.052714 +-0.015688 0.052469 0.049615 +0.0066154 0.04993 0.051259 +0.018088 0.046655 0.043321 +0.008841 0.045437 0.046623 +0.017688 0.039719 0.043084 +0.008125 0.039516 0.045374 +-0.0016111 0.049844 0.05172 +-0.01245 0.046773 0.050903 +-0.013851 0.039778 0.051036 +-0.0020294 0.044874 0.047587 +-0.011653 0.04686 0.048661 +-0.0018611 0.039606 0.047339 +-0.0091545 0.03958 0.049415 +0.043661 0.094028 0.02252 +0.034642 0.10473 0.031831 +0.028343 0.1072 0.036339 +0.036339 0.096552 0.034843 +0.031733 0.099372 0.038505 +0.036998 0.10668 0.026781 +0.032875 0.11108 0.02959 +0.040938 0.097132 0.026663 +0.044153 0.086466 0.024241 +0.05375 0.072221 0.020429 +0.04516 0.076574 0.023594 +0.038036 0.086663 0.035459 +0.037861 0.076625 0.035658 +0.042216 0.087237 0.028254 +0.042355 0.076747 0.02858 +0.043875 0.096228 0.015269 +0.044375 0.096797 0.0086445 +0.039545 0.1061 0.017655 +0.042313 0.10009 0.017237 +0.045406 0.087417 0.015604 +0.055118 0.072639 0.017944 +0.048722 0.07376 0.017434 +0.045917 0.086298 0.0094211 +0.019433 0.1096 0.039063 +0.01097 0.11058 0.039648 +0.046657 0.057153 0.031337 +0.056079 0.066335 0.024122 +0.048168 0.06701 0.026298 +0.056055 0.057253 0.024902 +0.051163 0.056662 0.029137 +0.036914 0.067032 0.036122 +0.033 0.06472 0.039903 +0.038004 0.056507 0.033119 +0.030629 0.054915 0.038484 +0.041875 0.066383 0.028357 +0.041434 0.06088 0.029632 +0.044921 0.049904 0.031243 +0.054635 0.050167 0.022044 +0.04828 0.04737 0.025845 +0.037973 0.048347 0.031456 +0.028053 0.047061 0.035991 +0.025595 0.040346 0.03415 +0.038455 0.043509 0.028278 +0.032031 0.043278 0.029253 +0.036581 0.040335 0.025144 +0.03019 0.039321 0.026847 +0.059333 0.067891 0.017361 +0.0465 0.071452 0.01971 +0.059562 0.057747 0.01834 +0.055636 0.049199 0.019173 +0.0505 0.045064 0.019181 +0.023 0.047803 0.039776 +0.022389 0.03886 0.038795 +-0.019545 0.0939 0.052205 +-0.021462 0.10618 0.042059 +-0.031027 0.10395 0.041228 +-0.022521 0.097723 0.045194 +-0.031858 0.097026 0.043878 +-0.043262 0.10412 0.040891 +-0.052154 0.10404 0.040972 +-0.041875 0.096944 0.042424 +-0.051919 0.096967 0.043563 +-0.021489 0.086672 0.054767 +-0.027 0.083087 0.050284 +-0.02107 0.077249 0.054365 +-0.026011 0.089634 0.048981 +-0.031893 0.087035 0.044169 +-0.025625 0.074892 0.047102 +-0.03197 0.0769 0.042177 +-0.041824 0.086954 0.043295 +-0.051825 0.086844 0.044933 +-0.041918 0.076728 0.042564 +-0.051849 0.076877 0.042992 +-0.061339 0.10393 0.041164 +-0.072672 0.10976 0.044294 +-0.061784 0.096825 0.043327 +-0.070058 0.096203 0.041397 +-0.080439 0.11091 0.044343 +-0.061927 0.086724 0.04452 +-0.070344 0.087352 0.041908 +-0.06141 0.077489 0.042178 +-0.068579 0.080144 0.041024 +-0.019045 0.067732 0.052388 +-0.017742 0.058909 0.050809 +-0.023548 0.066382 0.045226 +-0.03399 0.067795 0.040929 +-0.02169 0.056549 0.045164 +-0.036111 0.060706 0.040407 +-0.041231 0.066951 0.041392 +-0.048588 0.070956 0.040357 +-0.0403 0.059465 0.040446 +-0.02192 0.044965 0.052258 +-0.029187 0.043585 0.051088 +-0.021919 0.039826 0.053521 +-0.030331 0.039749 0.052133 +-0.021998 0.049847 0.046725 +-0.031911 0.046848 0.045187 +-0.035276 0.039753 0.047529 +-0.042016 0.044823 0.041594 +-0.05194 0.044707 0.043498 +-0.041928 0.039327 0.043582 +-0.051857 0.039252 0.046212 +-0.059453 0.04424 0.042862 +-0.060765 0.039087 0.044363 +-0.024273 0.11038 0.039129 +-0.032379 0.10878 0.037952 +-0.041152 0.10853 0.037969 +-0.051698 0.10906 0.038258 +-0.062091 0.10877 0.038274 +-0.071655 0.10596 0.037516 +-0.074634 0.097746 0.038347 +-0.07912 0.10508 0.032308 +-0.080203 0.096758 0.033592 +-0.08378 0.10568 0.025985 +-0.087292 0.10314 0.020825 +-0.08521 0.097079 0.02781 +-0.088082 0.096456 0.022985 +-0.07516 0.08604 0.038816 +-0.064577 0.073455 0.03897 +-0.072279 0.076416 0.036413 +-0.076375 0.072563 0.02873 +-0.080031 0.087076 0.03429 +-0.078919 0.079371 0.032477 +-0.084834 0.086686 0.026974 +-0.087891 0.089233 0.022611 +-0.081048 0.077169 0.025829 +-0.086393 0.10784 0.018635 +-0.087672 0.10492 0.017264 +-0.089333 0.098483 0.01761 +-0.086375 0.083067 0.018607 +-0.089179 0.089186 0.018947 +-0.082879 0.076109 0.017794 +-0.0825 0.074674 0.0071175 +-0.026437 0.064141 0.039321 +-0.030035 0.06613 0.038942 +-0.026131 0.056531 0.038882 +-0.031664 0.056657 0.037742 +-0.045716 0.064541 0.039166 +-0.051959 0.066869 0.036733 +-0.042557 0.055545 0.039026 +-0.049406 0.056892 0.034344 +-0.0555 0.062391 0.029498 +-0.05375 0.058574 0.026313 +-0.03406 0.050137 0.038577 +-0.041741 0.04959 0.03929 +-0.050975 0.049435 0.036965 +-0.053 0.051065 0.029209 +-0.054145 0.054568 0.012257 +-0.055848 0.05417 0.0083272 +-0.054844 0.049295 0.011462 +-0.05615 0.050619 0.0092929 +-0.061451 0.068257 0.035376 +-0.069725 0.069958 0.032788 +-0.062823 0.063322 0.026886 +-0.071037 0.066787 0.025228 +-0.060857 0.060568 0.022643 +-0.067 0.061558 0.020109 +-0.0782 0.071279 0.021032 +-0.062116 0.045145 0.037802 +-0.065473 0.039513 0.037964 +-0.06725 0.03742 0.033413 +-0.072702 0.065008 0.018701 +-0.06145 0.059165 0.018731 +-0.0675 0.061479 0.019221 +-0.057411 0.054114 0.0038257 +-0.079222 0.070654 0.017735 +-0.062473 0.04468 0.01111 +-0.06725 0.042258 0.010414 +-0.066389 0.040515 0.01316 +-0.068359 0.038502 0.011958 +-0.061381 0.04748 0.007607 +-0.068559 0.043549 0.0081576 +-0.070929 0.03983 0.0085888 +-0.016625 0.18375 -0.019735 +-0.015198 0.17471 -0.018868 +-0.015944 0.16264 -0.0091037 +-0.015977 0.1607 -0.0088072 +-0.013251 0.16708 -0.015264 +-0.014292 0.16098 -0.011252 +-0.013986 0.184 -0.023739 +-0.011633 0.17699 -0.023349 +-0.0091029 0.16988 -0.021457 +-0.025562 0.18273 -0.0096247 +-0.02725 0.18254 -0.0094384 +-0.025736 0.17948 -0.0089653 +-0.031216 0.17589 -0.0051154 +-0.020399 0.1845 -0.014943 +-0.021339 0.17645 -0.014566 +-0.027125 0.17234 -0.010156 +-0.03939 0.1733 -0.0023575 +-0.022876 0.16406 -0.0078103 +-0.031597 0.16651 -0.0049292 +-0.0226 0.15912 -0.003799 +-0.030372 0.15767 -0.0012672 +-0.021158 0.16849 -0.012383 +-0.027 0.1712 -0.01022 +-0.041719 0.16813 -0.00074958 +-0.04825 0.16748 -0.00015191 +-0.03725 0.16147 -7.2628e-05 +-0.066429 0.15783 -0.0085673 +-0.071284 0.15839 -0.005998 +-0.065979 0.16288 -0.017792 +-0.071623 0.16384 -0.01576 +-0.066068 0.16051 -0.013567 +-0.073307 0.16049 -0.011832 +-0.077 0.16204 -0.019241 +-0.077179 0.15851 -0.01495 +-0.073691 0.17286 -0.037944 +-0.07755 0.17221 -0.039175 +-0.065921 0.16586 -0.025022 +-0.072095 0.16784 -0.024725 +-0.066 0.16808 -0.030916 +-0.073448 0.17051 -0.032045 +-0.07777 0.16434 -0.025938 +-0.077893 0.16039 -0.021299 +-0.078211 0.169 -0.034566 +-0.034667 0.15131 -0.00071029 +-0.066117 0.17353 -0.047453 +-0.071986 0.17612 -0.045384 +-0.06925 0.182 -0.055026 +-0.064992 0.17802 -0.054645 +-0.069935 0.17983 -0.051988 +-0.07793 0.17516 -0.0444 diff --git a/data/bun03.pcd b/data/bun03.pcd new file mode 100644 index 0000000..a391666 --- /dev/null +++ b/data/bun03.pcd @@ -0,0 +1,207 @@ +# .PCD v.5 - Point Cloud Data file format +VERSION .5 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 197 +HEIGHT 1 +POINTS 197 +DATA ascii +0.056079 0.066335 0.024122 +0.048168 0.06701 0.026298 +0.056055 0.057253 0.024902 +0.051163 0.056662 0.029137 +0.036914 0.067032 0.036122 +0.033 0.06472 0.039903 +0.038004 0.056507 0.033119 +0.030629 0.054915 0.038484 +0.041875 0.066383 0.028357 +0.041434 0.06088 0.029632 +0.044921 0.049904 0.031243 +0.054635 0.050167 0.022044 +0.04828 0.04737 0.025845 +0.037973 0.048347 0.031456 +0.028053 0.047061 0.035991 +0.025595 0.040346 0.03415 +0.038455 0.043509 0.028278 +0.032031 0.043278 0.029253 +0.036581 0.040335 0.025144 +0.03019 0.039321 0.026847 +0.059333 0.067891 0.017361 +0.0465 0.071452 0.01971 +0.059562 0.057747 0.01834 +0.055636 0.049199 0.019173 +0.0505 0.045064 0.019181 +0.023 0.047803 0.039776 +0.022389 0.03886 0.038795 +-0.019545 0.0939 0.052205 +-0.021462 0.10618 0.042059 +-0.031027 0.10395 0.041228 +-0.022521 0.097723 0.045194 +-0.031858 0.097026 0.043878 +-0.043262 0.10412 0.040891 +-0.052154 0.10404 0.040972 +-0.041875 0.096944 0.042424 +-0.051919 0.096967 0.043563 +-0.021489 0.086672 0.054767 +-0.027 0.083087 0.050284 +-0.02107 0.077249 0.054365 +-0.026011 0.089634 0.048981 +-0.031893 0.087035 0.044169 +-0.025625 0.074892 0.047102 +-0.03197 0.0769 0.042177 +-0.041824 0.086954 0.043295 +-0.051825 0.086844 0.044933 +-0.041918 0.076728 0.042564 +-0.051849 0.076877 0.042992 +-0.061339 0.10393 0.041164 +-0.072672 0.10976 0.044294 +-0.061784 0.096825 0.043327 +-0.070058 0.096203 0.041397 +-0.080439 0.11091 0.044343 +-0.061927 0.086724 0.04452 +-0.070344 0.087352 0.041908 +-0.06141 0.077489 0.042178 +-0.068579 0.080144 0.041024 +-0.019045 0.067732 0.052388 +-0.017742 0.058909 0.050809 +-0.023548 0.066382 0.045226 +-0.03399 0.067795 0.040929 +-0.02169 0.056549 0.045164 +-0.036111 0.060706 0.040407 +-0.041231 0.066951 0.041392 +-0.048588 0.070956 0.040357 +-0.0403 0.059465 0.040446 +-0.02192 0.044965 0.052258 +-0.029187 0.043585 0.051088 +-0.021919 0.039826 0.053521 +-0.030331 0.039749 0.052133 +-0.021998 0.049847 0.046725 +-0.031911 0.046848 0.045187 +-0.035276 0.039753 0.047529 +-0.042016 0.044823 0.041594 +-0.05194 0.044707 0.043498 +-0.041928 0.039327 0.043582 +-0.051857 0.039252 0.046212 +-0.059453 0.04424 0.042862 +-0.060765 0.039087 0.044363 +-0.024273 0.11038 0.039129 +-0.032379 0.10878 0.037952 +-0.041152 0.10853 0.037969 +-0.051698 0.10906 0.038258 +-0.062091 0.10877 0.038274 +-0.071655 0.10596 0.037516 +-0.074634 0.097746 0.038347 +-0.07912 0.10508 0.032308 +-0.080203 0.096758 0.033592 +-0.08378 0.10568 0.025985 +-0.087292 0.10314 0.020825 +-0.08521 0.097079 0.02781 +-0.088082 0.096456 0.022985 +-0.07516 0.08604 0.038816 +-0.064577 0.073455 0.03897 +-0.072279 0.076416 0.036413 +-0.076375 0.072563 0.02873 +-0.080031 0.087076 0.03429 +-0.078919 0.079371 0.032477 +-0.084834 0.086686 0.026974 +-0.087891 0.089233 0.022611 +-0.081048 0.077169 0.025829 +-0.086393 0.10784 0.018635 +-0.087672 0.10492 0.017264 +-0.089333 0.098483 0.01761 +-0.086375 0.083067 0.018607 +-0.089179 0.089186 0.018947 +-0.082879 0.076109 0.017794 +-0.0825 0.074674 0.0071175 +-0.026437 0.064141 0.039321 +-0.030035 0.06613 0.038942 +-0.026131 0.056531 0.038882 +-0.031664 0.056657 0.037742 +-0.045716 0.064541 0.039166 +-0.051959 0.066869 0.036733 +-0.042557 0.055545 0.039026 +-0.049406 0.056892 0.034344 +-0.0555 0.062391 0.029498 +-0.05375 0.058574 0.026313 +-0.03406 0.050137 0.038577 +-0.041741 0.04959 0.03929 +-0.050975 0.049435 0.036965 +-0.053 0.051065 0.029209 +-0.054145 0.054568 0.012257 +-0.055848 0.05417 0.0083272 +-0.054844 0.049295 0.011462 +-0.05615 0.050619 0.0092929 +-0.061451 0.068257 0.035376 +-0.069725 0.069958 0.032788 +-0.062823 0.063322 0.026886 +-0.071037 0.066787 0.025228 +-0.060857 0.060568 0.022643 +-0.067 0.061558 0.020109 +-0.0782 0.071279 0.021032 +-0.062116 0.045145 0.037802 +-0.065473 0.039513 0.037964 +-0.06725 0.03742 0.033413 +-0.072702 0.065008 0.018701 +-0.06145 0.059165 0.018731 +-0.0675 0.061479 0.019221 +-0.057411 0.054114 0.0038257 +-0.079222 0.070654 0.017735 +-0.062473 0.04468 0.01111 +-0.06725 0.042258 0.010414 +-0.066389 0.040515 0.01316 +-0.068359 0.038502 0.011958 +-0.061381 0.04748 0.007607 +-0.068559 0.043549 0.0081576 +-0.070929 0.03983 0.0085888 +-0.016625 0.18375 -0.019735 +-0.015198 0.17471 -0.018868 +-0.015944 0.16264 -0.0091037 +-0.015977 0.1607 -0.0088072 +-0.013251 0.16708 -0.015264 +-0.014292 0.16098 -0.011252 +-0.013986 0.184 -0.023739 +-0.011633 0.17699 -0.023349 +-0.0091029 0.16988 -0.021457 +-0.025562 0.18273 -0.0096247 +-0.02725 0.18254 -0.0094384 +-0.025736 0.17948 -0.0089653 +-0.031216 0.17589 -0.0051154 +-0.020399 0.1845 -0.014943 +-0.021339 0.17645 -0.014566 +-0.027125 0.17234 -0.010156 +-0.03939 0.1733 -0.0023575 +-0.022876 0.16406 -0.0078103 +-0.031597 0.16651 -0.0049292 +-0.0226 0.15912 -0.003799 +-0.030372 0.15767 -0.0012672 +-0.021158 0.16849 -0.012383 +-0.027 0.1712 -0.01022 +-0.041719 0.16813 -0.00074958 +-0.04825 0.16748 -0.00015191 +-0.03725 0.16147 -7.2628e-05 +-0.066429 0.15783 -0.0085673 +-0.071284 0.15839 -0.005998 +-0.065979 0.16288 -0.017792 +-0.071623 0.16384 -0.01576 +-0.066068 0.16051 -0.013567 +-0.073307 0.16049 -0.011832 +-0.077 0.16204 -0.019241 +-0.077179 0.15851 -0.01495 +-0.073691 0.17286 -0.037944 +-0.07755 0.17221 -0.039175 +-0.065921 0.16586 -0.025022 +-0.072095 0.16784 -0.024725 +-0.066 0.16808 -0.030916 +-0.073448 0.17051 -0.032045 +-0.07777 0.16434 -0.025938 +-0.077893 0.16039 -0.021299 +-0.078211 0.169 -0.034566 +-0.034667 0.15131 -0.00071029 +-0.066117 0.17353 -0.047453 +-0.071986 0.17612 -0.045384 +-0.06925 0.182 -0.055026 +-0.064992 0.17802 -0.054645 +-0.069935 0.17983 -0.051988 +-0.07793 0.17516 -0.0444 diff --git a/data/bun4.pcd b/data/bun4.pcd new file mode 100644 index 0000000..5f64d06 --- /dev/null +++ b/data/bun4.pcd @@ -0,0 +1,371 @@ +# .PCD v.5 - Point Cloud Data file format +VERSION .5 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 361 +HEIGHT 1 +POINTS 361 +DATA ascii +0.053026 0.11349 0.077131 +0.051684 0.12201 0.066413 +0.062 0.11265 0.066529 +0.055908 0.1166 0.069704 +0.042443 0.12161 0.075045 +0.035388 0.12182 0.075395 +0.045215 0.11564 0.07963 +0.035383 0.11586 0.080111 +0.045076 0.12398 0.06937 +0.035184 0.12594 0.069924 +0.049096 0.11996 0.073017 +0.028054 0.12158 0.074732 +0.025599 0.11552 0.077258 +0.017576 0.11347 0.07555 +0.025395 0.12495 0.0696 +0.016659 0.12306 0.067178 +0.021547 0.11966 0.073101 +0.014291 0.11718 0.071342 +0.025508 0.16152 0.024747 +0.019 0.16109 0.024558 +0.023391 0.15964 0.02488 +0.015518 0.1591 0.024838 +0.053674 0.12335 0.059086 +0.063815 0.11446 0.059753 +0.058324 0.11924 0.061264 +0.054518 0.12416 0.053428 +0.062083 0.11783 0.05356 +0.059625 0.12001 0.052404 +0.035531 0.13107 0.056694 +0.029 0.13114 0.055384 +0.045417 0.12747 0.059936 +0.03601 0.12986 0.061236 +0.0486 0.12772 0.052912 +0.024606 0.12917 0.061663 +0.015236 0.12644 0.060387 +0.012375 0.12731 0.052937 +0.01025 0.12147 0.064372 +0.0070479 0.11474 0.067352 +0.01 0.15863 0.024326 +-0.028519 0.15176 0.034557 +-0.017836 0.15234 0.026341 +-0.024507 0.15352 0.030174 +-0.032526 0.15162 0.034783 +-0.034897 0.15386 0.030057 +-0.042837 0.15232 0.028354 +0.0076293 0.12265 0.058842 +0.0033543 0.11729 0.060929 +-0.0018397 0.11354 0.058274 +0.0038646 0.12253 0.050077 +0.0011667 0.12015 0.053042 +-0.0054261 0.11681 0.04938 +-0.013582 0.11389 0.046651 +-0.020208 0.11147 0.045012 +-0.00837 0.13267 0.025693 +-0.028029 0.14605 0.03449 +-0.018429 0.13206 0.034906 +-0.025407 0.13476 0.035987 +-0.016611 0.14559 0.0268 +-0.02349 0.14559 0.032267 +-0.014627 0.13604 0.029351 +-0.022324 0.13856 0.033027 +0.0026518 0.12442 0.039552 +-0.0043614 0.12386 0.039788 +-0.0084583 0.1206 0.043981 +0.0015 0.1272 0.030963 +-0.0057668 0.12829 0.029119 +-0.015724 0.12475 0.036368 +-0.024625 0.12583 0.038915 +-0.015864 0.11807 0.04104 +-0.024688 0.11595 0.03938 +-0.012126 0.1279 0.032376 +-0.047204 0.1229 0.04465 +-0.047018 0.11929 0.044717 +-0.050417 0.12272 0.044499 +-0.05025 0.11971 0.044496 +-0.034626 0.14579 0.035832 +-0.04409 0.14461 0.036654 +-0.034625 0.13576 0.036323 +-0.044625 0.13587 0.039415 +-0.0345 0.1461 0.034078 +-0.046112 0.14903 0.031518 +-0.05152 0.14235 0.035698 +-0.053954 0.13535 0.038733 +-0.059875 0.13142 0.035563 +-0.052841 0.14467 0.030011 +-0.057728 0.13803 0.031201 +-0.060433 0.13266 0.032297 +-0.034625 0.12588 0.040174 +-0.044009 0.12674 0.042363 +-0.034565 0.11587 0.037984 +-0.044045 0.11519 0.040905 +-0.03875 0.11096 0.033816 +-0.04 0.11095 0.033721 +-0.054619 0.12635 0.040984 +-0.060118 0.12786 0.03582 +-0.05294 0.11664 0.040614 +-0.0586 0.12198 0.033761 +-0.061512 0.12449 0.030495 +-0.057008 0.11512 0.03255 +-0.06112 0.11816 0.030082 +0.0519 0.10249 0.084874 +0.054032 0.09516 0.086303 +0.072929 0.071687 0.08539 +0.0605 0.083426 0.084338 +0.055201 0.085765 0.087276 +0.06628 0.073712 0.085036 +0.055358 0.075959 0.087194 +0.0705 0.10143 0.065567 +0.071729 0.094959 0.067077 +0.061948 0.10354 0.075849 +0.055716 0.10619 0.080329 +0.063725 0.095502 0.078225 +0.058481 0.097482 0.082705 +0.065249 0.10581 0.06956 +0.059611 0.11022 0.072937 +0.068522 0.096854 0.071595 +0.07468 0.072192 0.081877 +0.072315 0.086029 0.068587 +0.072393 0.076792 0.069006 +0.064671 0.085875 0.079444 +0.06 0.089204 0.083907 +0.06501 0.075905 0.080066 +0.06025 0.072606 0.084084 +0.069608 0.086554 0.073164 +0.069929 0.077058 0.073436 +0.044782 0.10485 0.08598 +0.035792 0.10503 0.086342 +0.045383 0.095917 0.089513 +0.035383 0.095973 0.090577 +0.026181 0.10301 0.086156 +0.019875 0.10142 0.084727 +0.025383 0.095887 0.088977 +0.015865 0.094621 0.086976 +0.045367 0.085906 0.09132 +0.035367 0.085969 0.092373 +0.045383 0.075813 0.091026 +0.035383 0.075886 0.092179 +0.025367 0.085923 0.091598 +0.015367 0.085844 0.090292 +0.025383 0.075923 0.092747 +0.015383 0.075801 0.090837 +0.047219 0.10911 0.083416 +0.033591 0.10949 0.083303 +0.024831 0.10757 0.080925 +0.015552 0.1058 0.076916 +0.013896 0.099153 0.081242 +0.011167 0.10964 0.073645 +0.074826 0.065745 0.088382 +0.074621 0.056347 0.088327 +0.065632 0.065695 0.090358 +0.055479 0.065913 0.087195 +0.065375 0.056033 0.091985 +0.055298 0.056099 0.089643 +0.072339 0.049116 0.086371 +0.064995 0.047559 0.087867 +0.055411 0.046881 0.088069 +0.081913 0.064726 0.079299 +0.07939 0.068311 0.082383 +0.081855 0.056806 0.078563 +0.079136 0.054077 0.082288 +0.062054 0.069741 0.083176 +0.06025 0.069906 0.084086 +0.080875 0.050303 0.074921 +0.075091 0.047104 0.079888 +0.08075 0.049141 0.073723 +0.075167 0.044186 0.072755 +0.066168 0.042654 0.081303 +0.055182 0.041586 0.083063 +0.062917 0.039942 0.077883 +0.055014 0.038738 0.07856 +0.063187 0.038513 0.07321 +0.05825 0.03681 0.073257 +0.045305 0.065772 0.090352 +0.035367 0.065699 0.090449 +0.045439 0.055816 0.088006 +0.035375 0.055802 0.088881 +0.025422 0.065777 0.090683 +0.015375 0.065995 0.089872 +0.025317 0.055887 0.089034 +0.015367 0.056046 0.087696 +0.04536 0.048424 0.085239 +0.035038 0.046203 0.085223 +0.032295 0.039646 0.08478 +0.026482 0.046538 0.085213 +0.016152 0.049001 0.085353 +0.027711 0.039177 0.08469 +0.045346 0.044164 0.082486 +0.03881 0.042081 0.08329 +0.045332 0.03855 0.078125 +0.03652 0.038323 0.08165 +0.023473 0.044462 0.083228 +0.015083 0.044181 0.080672 +0.02319 0.038494 0.083078 +0.015243 0.038612 0.079365 +0.071397 0.1031 0.057954 +0.07384 0.095619 0.059981 +0.072167 0.10391 0.053634 +0.068356 0.10796 0.059537 +0.07559 0.085968 0.059833 +0.075143 0.075533 0.060371 +0.077062 0.083333 0.052971 +0.076438 0.079968 0.053005 +0.0076424 0.093094 0.085609 +0.0060192 0.08573 0.086947 +0.0053811 0.075964 0.087155 +-0.00013095 0.074553 0.084709 +0.010075 0.10429 0.074344 +0.0046916 0.096622 0.080593 +-0.0031588 0.093766 0.077788 +0.0052825 0.10595 0.070159 +-0.0012049 0.10406 0.065197 +0.0036641 0.1002 0.070391 +-0.004255 0.097377 0.06813 +-0.010313 0.091851 0.070253 +0.0011875 0.0873 0.083725 +-0.0045791 0.085906 0.079921 +0.0006875 0.080199 0.08405 +-0.0048266 0.076168 0.079614 +-0.0095 0.090818 0.072993 +-0.00925 0.07258 0.073127 +-0.010631 0.084427 0.075649 +-0.010512 0.079319 0.075429 +-0.01211 0.086153 0.071833 +-0.01147 0.076673 0.071734 +0.006312 0.066296 0.086592 +0.0080406 0.057028 0.085534 +0.009875 0.050592 0.084468 +0.0015458 0.064734 0.083013 +-0.0033266 0.06623 0.078261 +0.0035435 0.055222 0.08155 +-0.0014049 0.056818 0.077608 +-0.0078859 0.066284 0.072083 +-0.0046546 0.055687 0.071565 +-0.00975 0.07085 0.07107 +0.0061318 0.045774 0.077321 +-0.00032143 0.05024 0.074784 +0.0054133 0.038066 0.075624 +0.0022149 0.045294 0.073223 +-0.0047052 0.045724 0.070733 +0.0006875 0.037568 0.074068 +-0.0046036 0.037691 0.072592 +-0.012428 0.044367 0.068093 +-0.013514 0.037859 0.069409 +-0.0054657 0.10636 0.060458 +-0.0075506 0.097694 0.062484 +-0.0086944 0.11021 0.05353 +-0.011541 0.10362 0.056364 +-0.013885 0.095659 0.057899 +-0.015565 0.10658 0.050582 +-0.023508 0.10513 0.047294 +-0.018386 0.097433 0.05281 +-0.024625 0.096011 0.049559 +-0.015838 0.086249 0.055613 +-0.014127 0.075767 0.054537 +-0.018963 0.086097 0.053885 +-0.024549 0.086099 0.050211 +-0.017487 0.07544 0.053147 +-0.024468 0.076198 0.049065 +-0.027411 0.10799 0.042665 +-0.028386 0.071697 0.043108 +-0.030188 0.10114 0.044485 +-0.032334 0.094737 0.04554 +-0.032408 0.0861 0.046629 +-0.031565 0.078458 0.045536 +-0.034419 0.10576 0.039458 +-0.041727 0.10445 0.035436 +-0.036648 0.096851 0.042004 +-0.042051 0.095478 0.036868 +-0.038917 0.10917 0.033612 +-0.043576 0.10615 0.030757 +-0.045995 0.09632 0.030424 +-0.051481 0.11009 0.033025 +-0.037356 0.085631 0.042394 +-0.04195 0.086274 0.038562 +-0.035224 0.075489 0.040346 +-0.04085 0.079058 0.036551 +-0.046276 0.086015 0.030251 +-0.038536 0.072126 0.032524 +-0.04242 0.076535 0.030884 +-0.0072333 0.051517 0.058253 +-0.008875 0.062792 0.053666 +-0.0082396 0.055954 0.052632 +-0.011703 0.06964 0.054431 +-0.014964 0.065481 0.052867 +-0.021936 0.066492 0.0484 +-0.014635 0.055811 0.05093 +-0.021274 0.056002 0.046945 +-0.0082639 0.050393 0.061368 +-0.014821 0.046141 0.060088 +-0.018467 0.038583 0.062598 +-0.017083 0.047756 0.050249 +-0.02402 0.045082 0.04795 +-0.01945 0.037823 0.051272 +-0.024787 0.037906 0.050271 +-0.026632 0.066911 0.040187 +-0.023393 0.053907 0.0427 +-0.027068 0.063621 0.03252 +-0.026657 0.048859 0.042037 +-0.032506 0.043257 0.046073 +-0.033477 0.038031 0.04716 +-0.031995 0.069 0.037505 +-0.034942 0.068237 0.031801 +-0.034386 0.045375 0.041607 +-0.0385 0.038234 0.041439 +-0.03975 0.03776 0.038847 +0.034068 0.18395 0.015376 +0.042482 0.17428 0.015448 +0.035365 0.17577 0.016213 +0.04247 0.18294 0.012097 +0.038663 0.18498 0.013187 +0.044726 0.17731 0.013053 +0.026182 0.18322 0.017962 +0.019096 0.18141 0.01892 +0.025365 0.17577 0.017043 +0.015836 0.17522 0.019068 +0.042384 0.16872 0.017333 +0.03497 0.16639 0.020602 +0.031464 0.16011 0.022413 +0.025357 0.1664 0.019809 +0.015309 0.16589 0.019019 +0.025259 0.15825 0.023151 +0.014407 0.15545 0.022267 +0.013367 0.1818 -0.043472 +0.012527 0.17933 -0.041149 +0.0074731 0.17284 0.019154 +0.0053916 0.16579 0.019742 +-0.003469 0.16392 0.018748 +0.0053307 0.15589 0.021878 +-0.0046154 0.15591 0.020964 +-0.0103 0.16124 0.015419 +-0.013254 0.15546 0.020111 +-0.022779 0.15602 0.02269 +-0.0079392 0.16511 -0.013325 +-0.016633 0.15886 -0.0033392 +-0.020479 0.15777 -0.001595 +-0.012738 0.16346 -0.010007 +-0.014 0.16066 -0.0064145 +-0.037094 0.15585 0.022717 +-0.044625 0.15325 0.022692 +0.003779 0.1495 0.019065 +-0.0053027 0.14685 0.019659 +-0.0065078 0.13599 0.019338 +-0.005125 0.14153 0.014151 +-0.00395 0.13558 0.013253 +-0.011784 0.14664 0.022568 +-0.010437 0.13946 0.023256 +-0.0033594 0.12997 0.020643 +-0.0485 0.1509 0.024168 +-0.052396 0.14765 0.022512 +-0.00325 0.17117 -0.0244 +0.0031042 0.17404 -0.032821 +-0.00066667 0.17346 -0.030936 +-0.0049337 0.16883 -0.019899 +-0.010188 0.16758 -0.016523 +0.007625 0.18169 -0.042523 +0.0058782 0.17812 -0.038783 +-0.0003 0.17608 -0.036304 +-0.047202 0.10369 0.019192 +-0.048386 0.096486 0.02137 +-0.048375 0.087132 0.022491 +-0.046917 0.080411 0.022365 diff --git a/data/bunny.pcd b/data/bunny.pcd new file mode 100644 index 0000000..f35c835 --- /dev/null +++ b/data/bunny.pcd @@ -0,0 +1,407 @@ +# .PCD v.5 - Point Cloud Data file format +VERSION .5 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 397 +HEIGHT 1 +POINTS 397 +DATA ascii +0.0054216 0.11349 0.040749 +-0.0017447 0.11425 0.041273 +-0.010661 0.11338 0.040916 +0.026422 0.11499 0.032623 +0.024545 0.12284 0.024255 +0.034137 0.11316 0.02507 +0.02886 0.11773 0.027037 +0.02675 0.12234 0.017605 +0.03575 0.1123 0.019109 +0.015982 0.12307 0.031279 +0.0079813 0.12438 0.032798 +0.018101 0.11674 0.035493 +0.0086687 0.11758 0.037538 +0.01808 0.12536 0.026132 +0.0080861 0.12866 0.02619 +0.02275 0.12146 0.029671 +-0.0018689 0.12456 0.033184 +-0.011168 0.12376 0.032519 +-0.0020063 0.11937 0.038104 +-0.01232 0.11816 0.037427 +-0.0016659 0.12879 0.026782 +-0.011971 0.12723 0.026219 +0.016484 0.12828 0.01928 +0.0070921 0.13103 0.018415 +0.0014615 0.13134 0.017095 +-0.013821 0.12886 0.019265 +-0.01725 0.11202 0.040077 +-0.074556 0.13415 0.051046 +-0.065971 0.14396 0.04109 +-0.071925 0.14545 0.043266 +-0.06551 0.13624 0.042195 +-0.071112 0.13767 0.047518 +-0.079528 0.13416 0.051194 +-0.080421 0.14428 0.042793 +-0.082672 0.1378 0.046806 +-0.08813 0.13514 0.042222 +-0.066325 0.12347 0.050729 +-0.072399 0.12662 0.052364 +-0.066091 0.11973 0.050881 +-0.072012 0.11811 0.052295 +-0.062433 0.12627 0.043831 +-0.068326 0.12998 0.048875 +-0.063094 0.11811 0.044399 +-0.071301 0.11322 0.04841 +-0.080515 0.12741 0.052034 +-0.078179 0.1191 0.051116 +-0.085216 0.12609 0.049001 +-0.089538 0.12621 0.044589 +-0.082659 0.11661 0.04797 +-0.089536 0.11784 0.04457 +-0.0565 0.15248 0.030132 +-0.055517 0.15313 0.026915 +-0.03625 0.17198 0.00017688 +-0.03775 0.17198 0.00022189 +-0.03625 0.16935 0.00051958 +-0.033176 0.15711 0.0018682 +-0.051913 0.1545 0.011273 +-0.041707 0.16642 0.0030522 +-0.049468 0.16414 0.0041988 +-0.041892 0.15669 0.0054879 +-0.051224 0.15878 0.0080283 +-0.062417 0.15317 0.033161 +-0.07167 0.15319 0.033701 +-0.062543 0.15524 0.027405 +-0.07211 0.1555 0.027645 +-0.078663 0.15269 0.032268 +-0.081569 0.15374 0.026085 +-0.08725 0.1523 0.022135 +-0.05725 0.15568 0.010325 +-0.057888 0.1575 0.0073225 +-0.0885 0.15223 0.019215 +-0.056129 0.14616 0.03085 +-0.054705 0.13555 0.032127 +-0.054144 0.14714 0.026275 +-0.046625 0.13234 0.021909 +-0.05139 0.13694 0.025787 +-0.018278 0.12238 0.030773 +-0.021656 0.11643 0.035209 +-0.031921 0.11566 0.032851 +-0.021348 0.12421 0.024562 +-0.03241 0.12349 0.023293 +-0.024869 0.12094 0.028745 +-0.031747 0.12039 0.028229 +-0.052912 0.12686 0.034968 +-0.041672 0.11564 0.032998 +-0.052037 0.1168 0.034582 +-0.042495 0.12488 0.024082 +-0.047946 0.12736 0.028108 +-0.042421 0.12035 0.028633 +-0.047661 0.12024 0.028871 +-0.035964 0.1513 0.0005395 +-0.050598 0.1474 0.013881 +-0.046375 0.13293 0.018289 +-0.049125 0.13856 0.016269 +-0.042976 0.14915 0.0054003 +-0.047965 0.14659 0.0086783 +-0.022926 0.1263 0.018077 +-0.031583 0.1259 0.017804 +-0.041733 0.12796 0.01665 +-0.061482 0.14698 0.036168 +-0.071729 0.15026 0.038328 +-0.060526 0.1368 0.035999 +-0.082619 0.14823 0.035955 +-0.087824 0.14449 0.033779 +-0.089 0.13828 0.037774 +-0.085662 0.15095 0.028208 +-0.089601 0.14725 0.025869 +-0.090681 0.13748 0.02369 +-0.058722 0.12924 0.038992 +-0.060075 0.11512 0.037685 +-0.091812 0.12767 0.038703 +-0.091727 0.11657 0.039619 +-0.093164 0.12721 0.025211 +-0.093938 0.12067 0.024399 +-0.091583 0.14522 0.01986 +-0.090929 0.13667 0.019817 +-0.093094 0.11635 0.018959 +0.024948 0.10286 0.041418 +0.0336 0.092627 0.040463 +0.02742 0.096386 0.043312 +0.03392 0.086911 0.041034 +0.028156 0.086837 0.045084 +0.03381 0.078604 0.040854 +0.028125 0.076874 0.045059 +0.0145 0.093279 0.05088 +0.0074817 0.09473 0.052315 +0.017407 0.10535 0.043139 +0.0079536 0.10633 0.042968 +0.018511 0.097194 0.047253 +0.0086436 0.099323 0.048079 +-0.0020197 0.095698 0.053906 +-0.011446 0.095169 0.053862 +-0.001875 0.10691 0.043455 +-0.011875 0.10688 0.043019 +-0.0017622 0.10071 0.046648 +-0.012498 0.10008 0.045916 +0.016381 0.085894 0.051642 +0.0081167 0.08691 0.055228 +0.017644 0.076955 0.052372 +0.008125 0.076853 0.055536 +0.020575 0.088169 0.049006 +0.022445 0.075721 0.049563 +-0.0017931 0.086849 0.056843 +-0.011943 0.086771 0.057009 +-0.0019567 0.076863 0.057803 +-0.011875 0.076964 0.057022 +0.03325 0.067541 0.040033 +0.028149 0.066829 0.042953 +0.026761 0.057829 0.042588 +0.023571 0.04746 0.040428 +0.015832 0.067418 0.051639 +0.0080431 0.066902 0.055006 +0.013984 0.058886 0.050416 +0.0080973 0.056888 0.05295 +0.020566 0.065958 0.0483 +0.018594 0.056539 0.047879 +0.012875 0.052652 0.049689 +-0.0017852 0.066712 0.056503 +-0.011785 0.066885 0.055015 +-0.001875 0.056597 0.05441 +-0.01184 0.057054 0.052714 +-0.015688 0.052469 0.049615 +0.0066154 0.04993 0.051259 +0.018088 0.046655 0.043321 +0.008841 0.045437 0.046623 +0.017688 0.039719 0.043084 +0.008125 0.039516 0.045374 +-0.0016111 0.049844 0.05172 +-0.01245 0.046773 0.050903 +-0.013851 0.039778 0.051036 +-0.0020294 0.044874 0.047587 +-0.011653 0.04686 0.048661 +-0.0018611 0.039606 0.047339 +-0.0091545 0.03958 0.049415 +0.043661 0.094028 0.02252 +0.034642 0.10473 0.031831 +0.028343 0.1072 0.036339 +0.036339 0.096552 0.034843 +0.031733 0.099372 0.038505 +0.036998 0.10668 0.026781 +0.032875 0.11108 0.02959 +0.040938 0.097132 0.026663 +0.044153 0.086466 0.024241 +0.05375 0.072221 0.020429 +0.04516 0.076574 0.023594 +0.038036 0.086663 0.035459 +0.037861 0.076625 0.035658 +0.042216 0.087237 0.028254 +0.042355 0.076747 0.02858 +0.043875 0.096228 0.015269 +0.044375 0.096797 0.0086445 +0.039545 0.1061 0.017655 +0.042313 0.10009 0.017237 +0.045406 0.087417 0.015604 +0.055118 0.072639 0.017944 +0.048722 0.07376 0.017434 +0.045917 0.086298 0.0094211 +0.019433 0.1096 0.039063 +0.01097 0.11058 0.039648 +0.046657 0.057153 0.031337 +0.056079 0.066335 0.024122 +0.048168 0.06701 0.026298 +0.056055 0.057253 0.024902 +0.051163 0.056662 0.029137 +0.036914 0.067032 0.036122 +0.033 0.06472 0.039903 +0.038004 0.056507 0.033119 +0.030629 0.054915 0.038484 +0.041875 0.066383 0.028357 +0.041434 0.06088 0.029632 +0.044921 0.049904 0.031243 +0.054635 0.050167 0.022044 +0.04828 0.04737 0.025845 +0.037973 0.048347 0.031456 +0.028053 0.047061 0.035991 +0.025595 0.040346 0.03415 +0.038455 0.043509 0.028278 +0.032031 0.043278 0.029253 +0.036581 0.040335 0.025144 +0.03019 0.039321 0.026847 +0.059333 0.067891 0.017361 +0.0465 0.071452 0.01971 +0.059562 0.057747 0.01834 +0.055636 0.049199 0.019173 +0.0505 0.045064 0.019181 +0.023 0.047803 0.039776 +0.022389 0.03886 0.038795 +-0.019545 0.0939 0.052205 +-0.021462 0.10618 0.042059 +-0.031027 0.10395 0.041228 +-0.022521 0.097723 0.045194 +-0.031858 0.097026 0.043878 +-0.043262 0.10412 0.040891 +-0.052154 0.10404 0.040972 +-0.041875 0.096944 0.042424 +-0.051919 0.096967 0.043563 +-0.021489 0.086672 0.054767 +-0.027 0.083087 0.050284 +-0.02107 0.077249 0.054365 +-0.026011 0.089634 0.048981 +-0.031893 0.087035 0.044169 +-0.025625 0.074892 0.047102 +-0.03197 0.0769 0.042177 +-0.041824 0.086954 0.043295 +-0.051825 0.086844 0.044933 +-0.041918 0.076728 0.042564 +-0.051849 0.076877 0.042992 +-0.061339 0.10393 0.041164 +-0.072672 0.10976 0.044294 +-0.061784 0.096825 0.043327 +-0.070058 0.096203 0.041397 +-0.080439 0.11091 0.044343 +-0.061927 0.086724 0.04452 +-0.070344 0.087352 0.041908 +-0.06141 0.077489 0.042178 +-0.068579 0.080144 0.041024 +-0.019045 0.067732 0.052388 +-0.017742 0.058909 0.050809 +-0.023548 0.066382 0.045226 +-0.03399 0.067795 0.040929 +-0.02169 0.056549 0.045164 +-0.036111 0.060706 0.040407 +-0.041231 0.066951 0.041392 +-0.048588 0.070956 0.040357 +-0.0403 0.059465 0.040446 +-0.02192 0.044965 0.052258 +-0.029187 0.043585 0.051088 +-0.021919 0.039826 0.053521 +-0.030331 0.039749 0.052133 +-0.021998 0.049847 0.046725 +-0.031911 0.046848 0.045187 +-0.035276 0.039753 0.047529 +-0.042016 0.044823 0.041594 +-0.05194 0.044707 0.043498 +-0.041928 0.039327 0.043582 +-0.051857 0.039252 0.046212 +-0.059453 0.04424 0.042862 +-0.060765 0.039087 0.044363 +-0.024273 0.11038 0.039129 +-0.032379 0.10878 0.037952 +-0.041152 0.10853 0.037969 +-0.051698 0.10906 0.038258 +-0.062091 0.10877 0.038274 +-0.071655 0.10596 0.037516 +-0.074634 0.097746 0.038347 +-0.07912 0.10508 0.032308 +-0.080203 0.096758 0.033592 +-0.08378 0.10568 0.025985 +-0.087292 0.10314 0.020825 +-0.08521 0.097079 0.02781 +-0.088082 0.096456 0.022985 +-0.07516 0.08604 0.038816 +-0.064577 0.073455 0.03897 +-0.072279 0.076416 0.036413 +-0.076375 0.072563 0.02873 +-0.080031 0.087076 0.03429 +-0.078919 0.079371 0.032477 +-0.084834 0.086686 0.026974 +-0.087891 0.089233 0.022611 +-0.081048 0.077169 0.025829 +-0.086393 0.10784 0.018635 +-0.087672 0.10492 0.017264 +-0.089333 0.098483 0.01761 +-0.086375 0.083067 0.018607 +-0.089179 0.089186 0.018947 +-0.082879 0.076109 0.017794 +-0.0825 0.074674 0.0071175 +-0.026437 0.064141 0.039321 +-0.030035 0.06613 0.038942 +-0.026131 0.056531 0.038882 +-0.031664 0.056657 0.037742 +-0.045716 0.064541 0.039166 +-0.051959 0.066869 0.036733 +-0.042557 0.055545 0.039026 +-0.049406 0.056892 0.034344 +-0.0555 0.062391 0.029498 +-0.05375 0.058574 0.026313 +-0.03406 0.050137 0.038577 +-0.041741 0.04959 0.03929 +-0.050975 0.049435 0.036965 +-0.053 0.051065 0.029209 +-0.054145 0.054568 0.012257 +-0.055848 0.05417 0.0083272 +-0.054844 0.049295 0.011462 +-0.05615 0.050619 0.0092929 +-0.061451 0.068257 0.035376 +-0.069725 0.069958 0.032788 +-0.062823 0.063322 0.026886 +-0.071037 0.066787 0.025228 +-0.060857 0.060568 0.022643 +-0.067 0.061558 0.020109 +-0.0782 0.071279 0.021032 +-0.062116 0.045145 0.037802 +-0.065473 0.039513 0.037964 +-0.06725 0.03742 0.033413 +-0.072702 0.065008 0.018701 +-0.06145 0.059165 0.018731 +-0.0675 0.061479 0.019221 +-0.057411 0.054114 0.0038257 +-0.079222 0.070654 0.017735 +-0.062473 0.04468 0.01111 +-0.06725 0.042258 0.010414 +-0.066389 0.040515 0.01316 +-0.068359 0.038502 0.011958 +-0.061381 0.04748 0.007607 +-0.068559 0.043549 0.0081576 +-0.070929 0.03983 0.0085888 +-0.016625 0.18375 -0.019735 +-0.015198 0.17471 -0.018868 +-0.015944 0.16264 -0.0091037 +-0.015977 0.1607 -0.0088072 +-0.013251 0.16708 -0.015264 +-0.014292 0.16098 -0.011252 +-0.013986 0.184 -0.023739 +-0.011633 0.17699 -0.023349 +-0.0091029 0.16988 -0.021457 +-0.025562 0.18273 -0.0096247 +-0.02725 0.18254 -0.0094384 +-0.025736 0.17948 -0.0089653 +-0.031216 0.17589 -0.0051154 +-0.020399 0.1845 -0.014943 +-0.021339 0.17645 -0.014566 +-0.027125 0.17234 -0.010156 +-0.03939 0.1733 -0.0023575 +-0.022876 0.16406 -0.0078103 +-0.031597 0.16651 -0.0049292 +-0.0226 0.15912 -0.003799 +-0.030372 0.15767 -0.0012672 +-0.021158 0.16849 -0.012383 +-0.027 0.1712 -0.01022 +-0.041719 0.16813 -0.00074958 +-0.04825 0.16748 -0.00015191 +-0.03725 0.16147 -7.2628e-05 +-0.066429 0.15783 -0.0085673 +-0.071284 0.15839 -0.005998 +-0.065979 0.16288 -0.017792 +-0.071623 0.16384 -0.01576 +-0.066068 0.16051 -0.013567 +-0.073307 0.16049 -0.011832 +-0.077 0.16204 -0.019241 +-0.077179 0.15851 -0.01495 +-0.073691 0.17286 -0.037944 +-0.07755 0.17221 -0.039175 +-0.065921 0.16586 -0.025022 +-0.072095 0.16784 -0.024725 +-0.066 0.16808 -0.030916 +-0.073448 0.17051 -0.032045 +-0.07777 0.16434 -0.025938 +-0.077893 0.16039 -0.021299 +-0.078211 0.169 -0.034566 +-0.034667 0.15131 -0.00071029 +-0.066117 0.17353 -0.047453 +-0.071986 0.17612 -0.045384 +-0.06925 0.182 -0.055026 +-0.064992 0.17802 -0.054645 +-0.069935 0.17983 -0.051988 +-0.07793 0.17516 -0.0444 diff --git a/data/car6.pcd b/data/car6.pcd new file mode 100644 index 0000000..262be43 Binary files /dev/null and b/data/car6.pcd differ diff --git a/data/colored_cloud.pcd b/data/colored_cloud.pcd new file mode 100644 index 0000000..6358c1c Binary files /dev/null and b/data/colored_cloud.pcd differ diff --git a/data/cturtle.pcd b/data/cturtle.pcd new file mode 100644 index 0000000..ab0a0c1 Binary files /dev/null and b/data/cturtle.pcd differ diff --git a/data/cube.ply b/data/cube.ply new file mode 100644 index 0000000..681156a --- /dev/null +++ b/data/cube.ply @@ -0,0 +1,24 @@ +ply +format ascii 1.0 +comment created by platoply +element vertex 8 +property float32 x +property float32 y +property float32 z +element face 6 +property list uint8 int32 vertex_indices +end_header +-1 -1 -1 +1 -1 -1 +1 1 -1 +-1 1 -1 +-1 -1 1 +1 -1 1 +1 1 1 +-1 1 1 +4 0 1 2 3 +4 5 4 7 6 +4 6 2 1 5 +4 3 7 4 0 +4 7 3 2 6 +4 5 1 0 4 diff --git a/data/curve2d.pcd b/data/curve2d.pcd new file mode 100644 index 0000000..21c5e5e --- /dev/null +++ b/data/curve2d.pcd @@ -0,0 +1,62 @@ +# .PCD v0.7 - Point Cloud Data file format +VERSION 0.7 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 51 +HEIGHT 1 +VIEWPOINT 0 0 0 1 0 0 0 +POINTS 51 +DATA ascii +0 0 0 +0.02 0.039733864 0 +0.039999999 0.077883668 0 +0.059999999 0.11292849 0 +0.079999998 0.14347121 0 +0.1 0.16829421 0 +0.12 0.18640782 0 +0.14 0.19708996 0 +0.16 0.19991472 0 +0.18000001 0.19476953 0 +0.2 0.18185949 0 +0.22 0.16169928 0 +0.23999999 0.13509266 0 +0.25999999 0.10310029 0 +0.28 0.06699764 0 +0.30000001 0.028224003 0 +0.31999999 -0.011674791 0 +0.34 -0.051108241 0 +0.36000001 -0.088504113 0 +0.38 -0.12237157 0 +0.40000001 -0.1513605 0 +0.41999999 -0.17431514 0 +0.44 -0.19032042 0 +0.46000001 -0.1987382 0 +0.47999999 -0.19923294 0 +0.5 -0.19178486 0 +0.51999998 -0.17669095 0 +0.54000002 -0.15455289 0 +0.56 -0.12625335 0 +0.57999998 -0.09292049 0 +0.60000002 -0.055883102 0 +0.62 -0.016617918 0 +0.63999999 0.023309765 0 +0.66000003 0.062308345 0 +0.68000001 0.098822705 0 +0.69999999 0.13139732 0 +0.72000003 0.15873361 0 +0.74000001 0.17974164 0 +0.75999999 0.19358394 0 +0.77999997 0.19970867 0 +0.80000001 0.19787166 0 +0.81999999 0.18814613 0 +0.83999997 0.17091982 0 +0.86000001 0.14687937 0 +0.88 0.11698341 0 +0.89999998 0.082423702 0 +0.92000002 0.04457802 0 +0.94 0.0049551614 0 +0.95999998 -0.034865245 0 +0.98000002 -0.073295861 0 +1 -0.10880423 0 diff --git a/data/curve3d.pcd b/data/curve3d.pcd new file mode 100644 index 0000000..c000d13 --- /dev/null +++ b/data/curve3d.pcd @@ -0,0 +1,121 @@ +# .PCD v0.7 - Point Cloud Data file format +VERSION 0.7 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 110 +HEIGHT 1 +VIEWPOINT 0 0 0 1 0 0 0 +POINTS 110 +DATA ascii +0.2618683 0 0 +0.23598622 0.018518519 0.018412856 +0.21542533 0.037037037 0.036196072 +0.19700167 0.055555556 0.052741542 +0.1793666 0.074074075 0.067483477 +0.16249448 0.09259259 0.079917766 +0.14649306 0.11111111 0.089619219 +0.1314856 0.12962963 0.096256085 +0.11800964 0.14814815 0.09960141 +0.10627577 0.16666667 0.099540792 +0.095726058 0.18518518 0.096076325 +0.086137742 0.2037037 0.089326456 +0.077171393 0.22222222 0.079521999 +0.068787947 0.24074075 0.066998243 +0.061007451 0.25925925 0.05218346 +0.054010641 0.27777779 0.035584185 +0.047754258 0.2962963 0.017768109 +0.04215797 0.31481481 -0.00065553596 +0.037152704 0.33333334 -0.019056812 +0.032678664 0.35185185 -0.036806382 +0.028683878 0.37037036 -0.053297356 +0.025122928 0.3888889 -0.067965791 +0.021955969 0.4074074 -0.080310076 +0.019137207 0.42592594 -0.089908138 +0.016587136 0.44444445 -0.096431717 +0.014241778 0.46296296 -0.099657737 +0.012085292 0.48148149 -0.099475905 +0.010127963 0.5 -0.095892429 +0.0083744582 0.51851851 -0.089029856 +0.0067965016 0.53703701 -0.079122856 +0.0053896443 0.55555558 -0.066510133 +0.0041495762 0.57407409 -0.051623113 +0.0030721382 0.5925926 -0.034970772 +0.0021732643 0.6111111 -0.017122623 +0.0014556401 0.62962961 0.0013110437 +0.00088436273 0.64814812 0.019699879 +0.00044764121 0.66666669 0.037415154 +0.0001472009 0.68518519 0.0538509 +0 0.7037037 0.068445183 +2.8663799e-05 0.72222221 0.080698974 +0.00026614798 0.74074072 0.090193182 +0.00073131552 0.75925928 0.0966032 +0.0014744347 0.77777779 0.099709786 +0.0025484858 0.7962963 0.099406742 +0.004015225 0.81481481 0.095704429 +0.0059407689 0.83333331 0.088729426 +0.0083649782 0.85185188 0.078720249 +0.011356608 0.87037039 0.066019177 +0.015023956 0.8888889 0.051060531 +0.019546311 0.9074074 0.03435592 +0.025265677 0.92592591 0.0164764 +0.032836832 0.94444442 -0.0019665428 +0.043834809 0.96296299 -0.020342238 +0.061845049 0.98148149 -0.038022228 +0.15132776 1 -0.054402109 +0.34258369 1 -0.054402109 +0.41924065 0.98148149 -0.038022228 +0.58897847 0.96296299 -0.020342238 +0.79374248 0.94444442 -0.0019665428 +0.85289252 0.92592591 0.0164764 +0.88434827 0.9074074 0.03435592 +0.90612453 0.8888889 0.051060531 +0.92375213 0.87037039 0.066019177 +0.9383359 0.85185188 0.078720249 +0.95078009 0.83333331 0.088729426 +0.96137315 0.81481481 0.095704429 +0.97035372 0.7962963 0.099406742 +0.9777773 0.77777779 0.099709786 +0.98388577 0.75925928 0.0966032 +0.98879784 0.74074072 0.090193182 +0.99261862 0.72222221 0.080698974 +0.9954412 0.7037037 0.068445183 +0.99734282 0.68518519 0.0538509 +0.99836522 0.66666669 0.037415154 +0.99906462 0.64814812 0.019699879 +0.99955368 0.62962961 0.0013110437 +0.99986094 0.6111111 -0.017122623 +1 0.5925926 -0.034970772 +0.99998313 0.57407409 -0.051623113 +0.99980038 0.55555558 -0.066510133 +0.99945331 0.53703701 -0.079122856 +0.99897438 0.51851851 -0.089029856 +0.99835813 0.5 -0.095892429 +0.99758673 0.48148149 -0.099475905 +0.99659848 0.46296296 -0.099657737 +0.99541795 0.44444445 -0.096431717 +0.99403375 0.42592594 -0.089908138 +0.99242485 0.4074074 -0.080310076 +0.99056482 0.3888889 -0.067965791 +0.98835915 0.37037036 -0.053297356 +0.98559433 0.35185185 -0.036806382 +0.98212183 0.33333334 -0.019056812 +0.97785318 0.31481481 -0.00065553596 +0.9726848 0.2962963 0.017768109 +0.96649384 0.27777779 0.035584185 +0.95894098 0.25925925 0.05218346 +0.94836944 0.24074075 0.066998243 +0.93344718 0.22222222 0.079521999 +0.9140386 0.2037037 0.089326456 +0.88825113 0.18518518 0.096076325 +0.8574475 0.16666667 0.099540792 +0.8254683 0.14814815 0.09960141 +0.7929576 0.12962963 0.096256085 +0.75959456 0.11111111 0.089619219 +0.71776718 0.09259259 0.079917766 +0.663634 0.074074075 0.067483477 +0.59795892 0.055555556 0.052741542 +0.53159815 0.037037037 0.036196072 +0.47132188 0.018518519 0.018412856 +0.4157775 0 0 diff --git a/data/octants.pcd b/data/octants.pcd new file mode 100644 index 0000000..c1be992 --- /dev/null +++ b/data/octants.pcd @@ -0,0 +1,19 @@ +# .PCD v0.7 - Point Cloud Data file format +VERSION 0.7 +FIELDS x y z +SIZE 4 4 4 +TYPE F F F +COUNT 1 1 1 +WIDTH 8 +HEIGHT 1 +VIEWPOINT 0 0 0 1 0 0 0 +POINTS 8 +DATA ascii +-9.0 -9.0 -9.0 +-6.0 -9.0 -9.0 +-3.0 -9.0 -9.0 +-2.0 -9.0 -9.0 +1.0 -3.0 -3.0 +3.0 -3.0 -3.0 +6.0 -3.0 -3.0 +9.0 -3.0 -3.0 diff --git a/etc/FOSSEE_Image_Processing_Toolbox.quit b/etc/FOSSEE_Image_Processing_Toolbox.quit deleted file mode 100755 index 459eb07..0000000 --- a/etc/FOSSEE_Image_Processing_Toolbox.quit +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the BSD. -// This source file is licensed as described in the file LICENSE, which -// you should have received as part of this distribution. The terms -// are also available at -// https://opensource.org/licenses/BSD-3-Clause -// Author: Shamika Mohanan -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - - -function quitModule() - - etc_tlbx = get_absolute_file_path("FOSSEE_Image_Processing_Toolbox.quit"); - etc_tlbx = getshortpathname(etc_tlbx); - root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); - - //unlink libraries - [bOK, ilib] = c_link('FOSSEE_Optimization_Toolbox'); - if bOK then - ulink(ilib); - end - - // Remove Preferences GUI - // ============================================================================= - if getscilabmode() == "STD" then - removeModulePreferences(root_tlbx); - end - ulink(); -endfunction - -clear quitModule; - diff --git a/etc/FOSSEE_Image_Processing_Toolbox.quit~ b/etc/FOSSEE_Image_Processing_Toolbox.quit~ deleted file mode 100755 index ca53a1c..0000000 --- a/etc/FOSSEE_Image_Processing_Toolbox.quit~ +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the BSD. -// This source file is licensed as described in the file LICENSE, which -// you should have received as part of this distribution. The terms -// are also available at -// https://opensource.org/licenses/BSD-3-Clause -// Author: Shamika Mohanan -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - - -function quitModule() - - etc_tlbx = get_absolute_file_path("FOSSEE_Image_Processin_Toolbox.quit"); - etc_tlbx = getshortpathname(etc_tlbx); - root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); - - //unlink libraries - [bOK, ilib] = c_link('FOSSEE_Optimization_Toolbox'); - if bOK then - ulink(ilib); - end - - // Remove Preferences GUI - // ============================================================================= - if getscilabmode() == "STD" then - removeModulePreferences(root_tlbx); - end - ulink(); -endfunction - -clear quitModule; - diff --git a/etc/FOSSEE_Image_Processing_Toolbox.start b/etc/FOSSEE_Image_Processing_Toolbox.start deleted file mode 100755 index 0dee6d9..0000000 --- a/etc/FOSSEE_Image_Processing_Toolbox.start +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (C) 2017 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the BSD. -// This source file is licensed as described in the file LICENSE, which -// you should have received as part of this distribution. The terms -// are also available at -// https://opensource.org/licenses/BSD-3-Clause -// Author: Shamika Mohanan -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -mprintf("Start FOSSEE Image Processing Toolbox\n"); - -[a, opt] = getversion(); -Version = opt(2); - -etc_tlbx = get_absolute_file_path("FOSSEE_Image_Processing_Toolbox.start"); -etc_tlbx = getshortpathname(etc_tlbx); -root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); - -//Load functions library -// ============================================================================= -mprintf("\tLoad macros\n"); -pathmacros = pathconvert( root_tlbx ) + "macros" + filesep(); -fipt_lib = lib(pathmacros); -clear pathmacros; - -// load gateways -// ============================================================================= - -mprintf("\tLoad gateways\n"); -[a, opt] = getversion(); -Version = opt(2); -ilib_verbose(0); -if getos()=="Windows" then -// lib_path = root_tlbx + "/thirdparty/windows/bin/" + Version;*/ -// link(lib_path+filesep()+"IpOptFSS.dll");*/ -// link(lib_path+filesep()+"IpOpt-vc10.dll");*/ -else - //lib_path = root_tlbx + "/thirdparty/linux/lib/" + Version; -// lib_path="/usr/lib";*/ - //link(lib_path + "/libopencv_core.so"); - //link(lib_path + "/libopencv_highgui.so"); - //link(lib_path + "/libopencv_imgproc.so"); - lib_path="/usr/local/lib"; - link(lib_path + "/libopencv_core.so"); - link(lib_path + "/libopencv_highgui.so"); - link(lib_path + "/libopencv_imgproc.so"); - - -end -exec(pathconvert(root_tlbx + filesep() + "sci_gateway" + filesep() + "loader_gateway.sce",%f)); - -// Load and add help chapter -// ============================================================================= -if ( %t ) then -if or(getscilabmode() == ["NW";"STD"]) then - mprintf("\tLoad help\n"); - path_addchapter = pathconvert(root_tlbx+"/jar"); - if ( isdir(path_addchapter) <> [] ) then - add_help_chapter("FOSSEE_Image_Processing_Toolbox", path_addchapter, %F); - clear add_help_chapter; - end - clear path_addchapter; -end -end - -// add demos -// ============================================================================= - -if ( %t ) then -if or(getscilabmode() == ["NW";"STD"]) then - mprintf("\tLoad demos\n"); - //pathdemos = pathconvert(root_tlbx+"/demos/sci_FOSSEE_Image_Processing_Toolbox.dem.gateway.sce",%f,%t); - //add_demo("FOSSEE_Image_Processing_Toolbox",pathdemos); - //clear pathdemos ; -end -end - -// ============================================================================= - -clear etc_tlbx root_tlbx Version a opt lib_path; diff --git a/etc/FOSSEE_Image_Processing_Toolbox.start~ b/etc/FOSSEE_Image_Processing_Toolbox.start~ deleted file mode 100755 index bf6a60e..0000000 --- a/etc/FOSSEE_Image_Processing_Toolbox.start~ +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (C) 2017 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the BSD. -// This source file is licensed as described in the file LICENSE, which -// you should have received as part of this distribution. The terms -// are also available at -// https://opensource.org/licenses/BSD-3-Clause -// Author: Shamika Mohanan -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -mprintf("Start FOSSEE Image Processing Toolbox\n"); - -[a, opt] = getversion(); -Version = opt(2); - -etc_tlbx = get_absolute_file_path("FOSSEE_Image_Processing_Toolbox.start"); -etc_tlbx = getshortpathname(etc_tlbx); -root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); - -//Load functions library -// ============================================================================= -mprintf("\tLoad macros\n"); -pathmacros = pathconvert( root_tlbx ) + "macros" + filesep(); -fipt_lib = lib(pathmacros); -clear pathmacros; - -// load gateways -// ============================================================================= - -mprintf("\tLoad gateways\n"); -[a, opt] = getversion(); -Version = opt(2); -ilib_verbose(0); -if getos()=="Windows" then -// lib_path = root_tlbx + "/thirdparty/windows/bin/" + Version;*/ -// link(lib_path+filesep()+"IpOptFSS.dll");*/ -// link(lib_path+filesep()+"IpOpt-vc10.dll");*/ -else - lib_path = root_tlbx + "/thirdparty/linux/lib/" + Version; -// lib_path="/usr/lib";*/ -// link(lib_path + "/libopencv_core.so");*/ -// link(lib_path + "/libopencv_highgui.so");*/ -// link(lib_path + "/libopencv_imgproc.so");*/ - -end -exec(pathconvert(root_tlbx + filesep() + "sci_gateway" + filesep() + "loader_gateway.sce",%f)); - -// Load and add help chapter -// ============================================================================= -if ( %t ) then -if or(getscilabmode() == ["NW";"STD"]) then - mprintf("\tLoad help\n"); - path_addchapter = pathconvert(root_tlbx+"/jar"); - if ( isdir(path_addchapter) <> [] ) then - add_help_chapter("FOSSEE_Image_Processing_Toolbox", path_addchapter, %F); - clear add_help_chapter; - end - clear path_addchapter; -end -end - -// add demos -// ============================================================================= - -if ( %t ) then -if or(getscilabmode() == ["NW";"STD"]) then - mprintf("\tLoad demos\n"); - //pathdemos = pathconvert(root_tlbx+"/demos/sci_FOSSEE_Image_Processing_Toolbox.dem.gateway.sce",%f,%t); - //add_demo("FOSSEE_Image_Processing_Toolbox",pathdemos); - //clear pathdemos ; -end -end - -// ============================================================================= - -clear etc_tlbx root_tlbx Version a opt lib_path; diff --git a/etc/FOSSEE_Optimization_Toolbox.quit~ b/etc/FOSSEE_Optimization_Toolbox.quit~ deleted file mode 100755 index 86ed18a..0000000 --- a/etc/FOSSEE_Optimization_Toolbox.quit~ +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the BSD. -// This source file is licensed as described in the file LICENSE, which -// you should have received as part of this distribution. The terms -// are also available at -// https://opensource.org/licenses/BSD-3-Clause -// Author: Harpreet Singh -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - - -function quitModule() - - etc_tlbx = get_absolute_file_path("FOSSEE_Optimization_Toolbox.quit"); - etc_tlbx = getshortpathname(etc_tlbx); - root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); - - //unlink libraries - [bOK, ilib] = c_link('FOSSEE_Optimization_Toolbox'); - if bOK then - ulink(ilib); - end - - // Remove Preferences GUI - // ============================================================================= - if getscilabmode() == "STD" then - removeModulePreferences(root_tlbx); - end - ulink(); -endfunction - -clear quitModule; - diff --git a/etc/FOSSEE_Optimization_Toolbox.start~ b/etc/FOSSEE_Optimization_Toolbox.start~ deleted file mode 100755 index f2a5a06..0000000 --- a/etc/FOSSEE_Optimization_Toolbox.start~ +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (C) 2017 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the BSD. -// This source file is licensed as described in the file LICENSE, which -// you should have received as part of this distribution. The terms -// are also available at -// https://opensource.org/licenses/BSD-3-Clause -// Author: Shamika Mohanan -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -mprintf("Start FOSSEE Image Processing Toolbox\n"); - -[a, opt] = getversion(); -Version = opt(2); - -etc_tlbx = get_absolute_file_path("FOSSEE_Image_Processing_Toolbox.start"); -etc_tlbx = getshortpathname(etc_tlbx); -root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") ); - -//Load functions library -// ============================================================================= -mprintf("\tLoad macros\n"); -pathmacros = pathconvert( root_tlbx ) + "macros" + filesep(); -symphony_lib = lib(pathmacros); -clear pathmacros; - -// load gateways -// ============================================================================= - -mprintf("\tLoad gateways\n"); -[a, opt] = getversion(); -Version = opt(2); -ilib_verbose(0); -if getos()=="Windows" then - lib_path = root_tlbx + "/thirdparty/windows/bin/" + Version; - link(lib_path+filesep()+"IpOptFSS.dll"); - link(lib_path+filesep()+"IpOpt-vc10.dll"); -else - lib_path = root_tlbx + "/thirdparty/linux/lib/" + Version; - link(lib_path + "/libCoinUtils.so"); - link(lib_path + "/libClp.so"); - link(lib_path + "/libClpSolver.so"); - link(lib_path + "/libOsi.so"); - link(lib_path + "/libOsiCommonTests.so"); - link(lib_path + "/libOsiClp.so"); - link(lib_path + "/libCgl.so"); - link(lib_path + "/libSym.so"); - link(lib_path + "/libOsiSym.so"); - link(lib_path + "/libcoinblas.so"); - link(lib_path + "/libcoinlapack.so"); - link(lib_path + "/libcoinmumps.so"); - link(lib_path + "/libipopt.so"); -end -exec(pathconvert(root_tlbx + filesep() + "sci_gateway" + filesep() + "loader_gateway.sce",%f)); - -// Load and add help chapter -// ============================================================================= -if ( %t ) then -if or(getscilabmode() == ["NW";"STD"]) then - mprintf("\tLoad help\n"); - path_addchapter = pathconvert(root_tlbx+"/jar"); - if ( isdir(path_addchapter) <> [] ) then - add_help_chapter("FOSSEE_Optimization_Toolbox", path_addchapter, %F); - clear add_help_chapter; - end - clear path_addchapter; -end -end - -// add demos -// ============================================================================= - -if ( %t ) then -if or(getscilabmode() == ["NW";"STD"]) then - mprintf("\tLoad demos\n"); - pathdemos = pathconvert(root_tlbx+"/demos/sci_FOSSEE_Image_Processing_Toolbox.dem.gateway.sce",%f,%t); - add_demo("FOSSEE_Image_Processing_Toolbox",pathdemos); - clear pathdemos ; -end -end - -// ============================================================================= - -clear etc_tlbx root_tlbx Version a opt lib_path; diff --git a/help/builder_help.sce b/help/builder_help.sce old mode 100755 new mode 100644 diff --git a/help/builder_help.sce~ b/help/builder_help.sce~ old mode 100755 new mode 100644 diff --git a/help/en_US/CascadeObjectDetector.xml b/help/en_US/CascadeObjectDetector.xml deleted file mode 100755 index cc2aab3..0000000 --- a/help/en_US/CascadeObjectDetector.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - CascadeObjectDetector - This function is used to detect objects in an image. - - - - - Calling Sequence - - - detect=CascadeObjectDetector(inputImage,classifierList); - detect=CascadeObjectDetector(inputImage,classifierList,scale); - detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors); - detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags); - detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags,minSize); - detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags,minSize,maxSize); - - - - - - Parameters - - out: - the output image with all specified detections. - inputImage: - input image on which the objects should be detected. - classifierList: - a matrix of strings containing the location of the xml files which are to be used in the detection. - scale: - Parameter specifying how much the image size is reduced at each image scale. - minNeighbors: - Parameter specifying how many neighbors each candidate rectangle should have to retain it. - flags: - the method used in detection.it should be either 1 or 4 or 2 or 8. - min size: - Minimum possible object size. Objects smaller than that are ignored. - max size: - Maximum possible object size. Objects larger than that are ignored. - - - - - Description - - - -This function is used to detect objects in an image. - - - - - - - Examples - - - diff --git a/help/en_US/demosaic.xml b/help/en_US/DCT.xml old mode 100755 new mode 100644 similarity index 50% rename from help/en_US/demosaic.xml rename to help/en_US/DCT.xml index 14b34bf..04c3a6a --- a/help/en_US/demosaic.xml +++ b/help/en_US/DCT.xml @@ -2,11 +2,11 @@ - - demosaic - This function converts the Bayer pattern encoded image to the truecolor image, RGB. + DCT + Performs forward Discrete Cosine Transform of the 1D or 2D array. Calling Sequence - image=imread("lena.jpeg",0) - dem=demosaic(image,"gbrg"); - dem=demosaic(image,"bggr"); - dem=demosaic(image,"rggb"); - dem=demosaic(image,"grbg"); + dstMat = DCT(srcMat) @@ -36,19 +32,18 @@ Parameters - dem: - the output image - image: - the image which should be converted. + srcMat : + 1D or 2D floating type array + dstMat : + The output matrix Description - - -This function converts the Bayer pattern encoded image to the truecolor image, RGB. +dstMat = DCT(srcMat) +Returns the DCT of the input matrix. @@ -57,10 +52,16 @@ This function converts the Bayer pattern encoded image to the truecolor image, Examples + + + Authors + + Deepshikha + + diff --git a/help/en_US/rgb2xyz.xml b/help/en_US/FFT.xml old mode 100755 new mode 100644 similarity index 55% rename from help/en_US/rgb2xyz.xml rename to help/en_US/FFT.xml index 69bc795..653e16f --- a/help/en_US/rgb2xyz.xml +++ b/help/en_US/FFT.xml @@ -2,11 +2,11 @@ - - rgb2xyz - This function is used to convert rgb values of an image to their CIE 1931 xyz. + FFT + This function returns discrete Fourier Transform of 2D input matrix Calling Sequence - image=imread("lena.jpeg"); - xyz=imread(image); + fourierTransform=FFT(inputMatrix) @@ -33,19 +32,15 @@ Parameters - xyz: - the converted image - image: - Input Image. + inputMatrix: + Input matrix must be 2-D. Description - - -This function is used to convert rgb values of an image to their CIE 1931 xyz. +It returns the 2D discrete Fourier transform of two dimensional input matrix. @@ -54,9 +49,17 @@ This function is used to convert rgb values of an image to their CIE 1931 xyz. Examples + + + Authors + + Sridhar Reddy + + diff --git a/help/en_US/imresize.xml b/help/en_US/affine2d.xml old mode 100755 new mode 100644 similarity index 50% rename from help/en_US/imresize.xml rename to help/en_US/affine2d.xml index ad5855d..28962ba --- a/help/en_US/imresize.xml +++ b/help/en_US/affine2d.xml @@ -2,11 +2,11 @@ - - imresize - This function is used to resize the image + affine2d + Creates an affine2d object for input 3x3 matrix. Calling Sequence - - newImage=imresize(inputImage,alpha,beta); + y = affine2d(mat) @@ -33,23 +32,18 @@ Parameters - newImage: - the new resized image - inputImage: - the image which should be resized. - alpha: - new number of rows. - beta: - new number of columns. + mat : + It is a 3x3 matrix which specifies forward affine2d transformation. + y : + an affine2d object with similar properties as the input. Description - - -This function is used to resize the image +y = affine2d(mat) returns the affine2d object where a 3x3 numeric matrix is given as input +It encapsulates 2d affine geometri transformation. @@ -58,10 +52,16 @@ This function is used to resize the image Examples + + + Authors + + Yash S. Bhalgat + + diff --git a/help/en_US/arrowedline.xml b/help/en_US/arrowedline.xml deleted file mode 100755 index 35e4553..0000000 --- a/help/en_US/arrowedline.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - arrowedline - - - - diff --git a/help/en_US/bagOfFeatures.xml b/help/en_US/bagOfFeatures.xml deleted file mode 100755 index d2430f8..0000000 --- a/help/en_US/bagOfFeatures.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - bagOfFeatures - This function is used to create a Bag-of-Words model (BoW model). - - - - - Calling Sequence - - bag = bagOfFeatures(imgSet); - bag = bagOfFeatures(imgSet, Name, Value, ...); - - - - - - Parameters - - bag: - Bag of visual words - imgSet: - An imageSet structure - VocabularySize: - (Optional) Number of visual words (Default- 500) - StrongestFeatures: - (Optional) Fraction of strongest features (Default- 1.0) - Upright: - (Optional) Orientation of SURF feature vector (Default- true) - Verbose: - (Optional) Enable progress display to screen (Default- true) - - - - - Description - -BoW model is applied to classify images by treating image features as words. The bagOfFeatures object contains a bag of visual words that help in image classification. - - - - - - - Examples - - - - - Authors - - Rohit Suri - Umang Agrawal - - - diff --git a/help/en_US/bboxOverlapRatio.xml b/help/en_US/bboxOverlapRatio.xml new file mode 100644 index 0000000..8c2b5af --- /dev/null +++ b/help/en_US/bboxOverlapRatio.xml @@ -0,0 +1,78 @@ + + + + + + + + bboxOverlapRatio + Compute the overlap ratio between the bounding boxes A and B. + + + + + Calling Sequence + + [ overlapRatio ] = bboxOverlapRatio(bboxA, bboxB); + [ overlapRatio ] = bboxOverlapRatio(bboxA, bboxB, ratioType); + + + + + + Parameters + + bboxA: + Bounding box A of the form [x, y, width, height]; + bboxB: + Boundng box B of the form [x, y, width, height]; + ratioType (Optional Argument): + Method to be used to compute the ratio. Set this to either 'Union' or 'Min'. Default computation method is set to 'Union'. + overlapRatio: + Overlap ratio between the bounding boxes A and B. + + + + + Description + +Compute the overlap ratio between the bounding boxes A and B. + + + + + + + Examples + + + + + Authors + + Tanmay Chaudhari + + + diff --git a/help/en_US/blur.xml b/help/en_US/blur.xml deleted file mode 100755 index ff16114..0000000 --- a/help/en_US/blur.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - blur - This function is used to blur an image using the normalized box filter. - - - - - Calling Sequence - - B = blur(input_image ,ksize_width,ksize_height,anchorX,anchorY); - - - - - - Parameters - - A: - image matrix of the source image. - ksize_width : - Defines the width of the kernel to be used in pixels. - ksize_width : - Defines the height of the kernel to be used in pixels. - anchorX : - Indicates where the x coordinate of the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point. - anchorY : - Indicates where the y coordinate of the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point. - B : - output image with the applied blur fucntion. - - - - - Description - -The function smoothes an image using the kernel specified with its dimesnsions. - - - - - - - Examples - - - diff --git a/help/en_US/build_help.sce b/help/en_US/build_help.sce old mode 100755 new mode 100644 index ad64f19..b13779c --- a/help/en_US/build_help.sce +++ b/help/en_US/build_help.sce @@ -8,7 +8,11 @@ // you should have received as part of this distribution. The terms // are also available at // https://opensource.org/licenses/BSD-3-Clause +<<<<<<< HEAD + +======= TOOLBOX_TITLE="FOSSEE_Image_Processing_Toolbox" +>>>>>>> 404a7f2a4f72456d4df64dde1e76243bd43b9e42 help_lang_dir = get_absolute_file_path('build_help.sce'); tbx_build_help(TOOLBOX_TITLE, help_lang_dir); diff --git a/help/en_US/build_help.sce~ b/help/en_US/build_help.sce~ old mode 100755 new mode 100644 diff --git a/help/en_US/calfocal.xml b/help/en_US/calfocal.xml new file mode 100644 index 0000000..7fac16e --- /dev/null +++ b/help/en_US/calfocal.xml @@ -0,0 +1,80 @@ + + + + + + + + calfocal + Estimates focal lengths for each given camera. + + + + + Calling Sequence + + res = calfocal(image1,image2) + res = calfocal(image1,image2,image3) + res = calfocal(image1,image2,image3,image4) + res = calfocal(image1,image2,image3,image4,image5) + res = calfocal(image1,image2,image3,image4,image5,image6) + + + + + + Parameters + + image1 : + an image + image2 : + an image + image3 : + an image + image4 : + an image + image5 : + an image + image6 : + an image + + + + + Description + +res = calfocal(image1,image2) return a 1x2 matrix. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated along with their focal lengths are estimated. + + + + + + + Examples + + + + + Authors + + Manoj Sree Harsha + + + diff --git a/help/en_US/cameraMatrix.xml b/help/en_US/cameraMatrix.xml new file mode 100644 index 0000000..9d58700 --- /dev/null +++ b/help/en_US/cameraMatrix.xml @@ -0,0 +1,72 @@ + + + + + + + + cameraMatrix + Returns camera projection matrix. + + + + + Calling Sequence + + camMatrix = cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector); + + + + + + Parameters + + camMatrix: + A 4x3 camera projection matrix, which can be used to project 3-D world points in homogenous co-ordinates into an image. + instrinsicMatrix: + Projection matrix of size 3x3. + rotationMatrix: + A 3x3 matrix which specifies the rotation of a camera. + translationVector: + A 1x3 vector which specifies the translation of a camera. + + + + + Description + +Return a matrix of size 4-by-3, which can be used to project 3-D world points in homogenous co-ordinates into an image. + + + + + + + Examples + + + + + Authors + + Tanmay Chaudhari + + + diff --git a/help/en_US/circle.xml b/help/en_US/circle.xml deleted file mode 100755 index 5721562..0000000 --- a/help/en_US/circle.xml +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - circle - This function circle draws a simple or filled circle on an image with a given center and radius. - - - - - Calling Sequence - - cir=circle(inputImage,xcor,ycor,radius,r,g,b); - cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness); - cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness,linetype); - cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness,linetype,shift); - - - - - - Parameters - - cir: - The output image with the circle drawn in it. - inputImage: - The input image on which the circle should be drawn. - xcor: - X-coordinate of the center - ycor: - Y-coordinate of the center - r: - red color value of the circle.It should be in the range 0-255. - b: - blue color value of the circle.It should be in the range 0-255. - g: - green color value of the circle.It should be in the range 0-255. - thickness: - Line thickness. - linetype: - Type of the circle boundary.It can be 0 or 4 or 8. - shift: - Number of fractional bits in the point coordinates. - - - - - Description - -This function circle draws a simple or filled circle on an image with a given center and radius. - - - - - - - - - Examples - - - diff --git a/help/en_US/convolver.xml b/help/en_US/convolver.xml new file mode 100644 index 0000000..d053db6 --- /dev/null +++ b/help/en_US/convolver.xml @@ -0,0 +1,75 @@ + + + + + + + + convolver + Convolves an image with the kernel. + + + + + Calling Sequence + + out_image = convolver(in_image,ksize,kvalues,scalar) + + + + + + Parameters + + in_image : + an image + out_image : + the output image + ksize : + kernel size (belongs to {3,4,5}) + kvalues : + kernel matrix values + scalar : + any floating value + + + + + Description + +out_image = convolver(in_image,ksize,kvalues,scalar) +Returns the convoluted image of the input image. It uses filter2d function to perform convolution. +The convolution is with the given kernel. + + + + + + + Examples + + + + + Authors + + Kevin George , Manoj Sree Harsha + + + diff --git a/help/en_US/cornerEigenValsAndVecs.xml b/help/en_US/cornerEigenValsAndVecs.xml new file mode 100644 index 0000000..d5e5ea5 --- /dev/null +++ b/help/en_US/cornerEigenValsAndVecs.xml @@ -0,0 +1,77 @@ + + + + + + + + cornerEigenValsAndVecs + Calculates eigenvalues and eigenvectors of image blocks for corner detection. + + + + + Calling Sequence + + inputImage=imread('path of the image file') + outputImg = cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType) + imshow(outputImg) + + + + + + Parameters + + inputImage : + an image. + blockSize : + Neighborhood size + kSize : + Aperture parameter for the Sobel() operator. + borderType : + Pixel extrapolation method + + + + + Description + +outputImg = cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType) +For every pixel p , the function cornerEigenValsAndVecs considers a blockSize x blockSize neighborhood S(p) . It calculates the covariation matrix of derivatives over the neighbourhood +After that, it finds eigenvectors and eigenvalues and stores them in the destination image(outputImg). + + + + + + + Examples + + + + + Authors + + Shubheksha Jalan + + + diff --git a/help/en_US/cornerHarris.xml b/help/en_US/cornerHarris.xml new file mode 100644 index 0000000..ff1fd8a --- /dev/null +++ b/help/en_US/cornerHarris.xml @@ -0,0 +1,80 @@ + + + + + + + + cornerHarris + Harris edge detector. + + + + + Calling Sequence + + inputImage=imread('path of the image file') + outputImg = cornerHarris(inputImage, blockSize, kSize, k, borderType) + imshow(outputImg) + + + + + + Parameters + + inputImage : + an image. + blockSize : + Neighborhood size + kSize : + Aperture parameter for the Sobel() operator. + k : + Harris detector free parameter. + borderType : + Pixel extrapolation method + + + + + Description + +outputImg = cornerHarris(inputImage, blockSize, kSize, k, borderType) +This function runs the Harris edge detector on the image. +outputImg is used to store the Harris detector responses + + + + + + + Examples + + + + + Authors + + Shubheksha Jalan + + + diff --git a/help/en_US/cornerMinEigenVal.xml b/help/en_US/cornerMinEigenVal.xml new file mode 100644 index 0000000..fd49ba6 --- /dev/null +++ b/help/en_US/cornerMinEigenVal.xml @@ -0,0 +1,78 @@ + + + + + + + + cornerMinEigenVal + Calculates the minimal eigenvalue of gradient matrices for corner detection. + + + + + Calling Sequence + + inputImage=imread('path of the image file') + outputImg = cornerMinEigenVal(inputImage, blockSize, kSize, borderType) + imshow(outputImg) + + + + + + Parameters + + inputImage : + an image. + blockSize : + Neighborhood size + kSize : + Aperture parameter for the Sobel() operator. + borderType : + Pixel extrapolation method + + + + + Description + +outputImg = cornerMinEigenVal(inputImage, blockSize, kSize, borderType) +The function is similar to cornerEigenValsAndVecs() but it calculates only the minimal eigenvalue of the covariance matrix of derivatives. +After that, it stores them in the destination image(outputImg). + + + + + + + Examples + + + + + Authors + + Shubheksha Jalan + + + diff --git a/help/en_US/correctMatches.xml b/help/en_US/correctMatches.xml deleted file mode 100755 index cd99c0f..0000000 --- a/help/en_US/correctMatches.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - correctMatches - This function Refines coordinates of corresponding points using openCV's functions. - - - - - Calling Sequence - - [newPoints1, newPoints2] = correctMatches(F, points1, points2) - - - - - - Parameters - - - - - - Description - -The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] <-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] <-> newPoints2[i] that minimize the geometric error d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2 (where d(a,b) is the geometric distance between points a and b ) subject to the epipolar constraint newPoints2^T * F * newPoints1 = 0 . - - - - - - - Examples - - - diff --git a/help/en_US/cvtColor.xml b/help/en_US/cvtColor.xml deleted file mode 100755 index 54caaf3..0000000 --- a/help/en_US/cvtColor.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - cvtColor - This function is used to transform a image from one space to other like rgb to gray and vice versa. - - - - - Calling Sequence - - - inputImage=imread("lena.jpeg"); - outputImage=cvtColor(inputImage,codeString); - outputImage=cvtColor(inputImage,codeString,dstCn); - - - - - - - Parameters - - dstCn: - number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code - codeString: - A string which specifies the type of conversion.The different types are listed below. - "CV_BGR2GRAY": - Conversion is from BGR(blue-green-red) space to GRAY. - "CV_RGB2GRAY": - Conversion is from RGB(red-green-blue) space to GRAY. - "CV_GRAY2BGR": - Conversion is from BGR(blue-green-red) space. - "CV_GRAY2RGB": - Conversion is from to GRAY to RGB(blue-green-red) space. - "CV_BGR2XYZ" : - Conversion is from BGR(blue-green-red) space to CIE XYZ. - "CV_RGB2XYZ" : - Conversion is from RGB(red-green-blue) space to CIE XYZ. - "CV_XYZ2BGR" : - Conversion is from to CIE XYZ to BGR space. - "CV_XYZ2RGB" : - Conversion is from to CIE XYZ to RGB(red-green-blue) space. - "CV_BGR2YCrCb": - Conversion is from BGR(blue-green-red) space to luma-chroma. - "CV_RGB2YCrCb" : - Conversion is from RGB(red-green-blue) space to luma chroma. - "CV_YCrCb2BGR" : - Conversion is from luma-chroma to BGR(blue-green-red) space. - "CV_YCrCb2RGB" : - Conversion is from luma-chroma to RGB(red-green-blue) space. - "CV_BGR2HSV": - Conversion is from BGR(blue-green-red) space to HSV. - "CV_RGB2HSV": - Conversion is from RGB space to HSV. - "CV_HSV2BGR": - Conversion is from to HSV to BGR(blue-green-red) space. - "CV_HSV2RGB": - Conversion is from to HSV to RGB(red-green-blue) space. - "CV_BGR2HLS": - Conversion is from BGR(blue-green-red) space to HLS. - "CV_RGB2HLS": - Conversion is from RGB space to HSV. - "CV_HLS2BGR": - Conversion is from HLS to BGR(blue-green-red) space. - "CV_HLS2RGB": - Conversion is from HLS to RGB(red-green-blue) space. - "CV_BGR2Lab": - Conversion is from BGR(blue-green-red) space to CIE Lab. - "CV_RGB2Lab": - Conversion is from RGB space to CIE Lab. - "CV_Lab2BGR": - Conversion is from CIE Lab to BGR(blue-green-red) space. - "CV_Lab2RGB": - Conversion is from CIE Lab to RGB space. - "CV_BGR2Luv": - Conversion is from BGR(blue-green-red) space to CIE Luv. - "CV_RGB2Luv": - Conversion is from RGB space to CIE Luv. - "CV_Luv2BGR": - Conversion is from CIE Luv to BGR(blue-green-red) space. - "CV_Luv2RGB": - Conversion is from CIE Luv to RGB space. - - - - - Description - - - -This function is used to transform a image from one space to other like rgb to gray and vice versa. - - - - - - - Examples - - - diff --git a/help/en_US/deconvlucy.xml b/help/en_US/deconvlucy.xml deleted file mode 100755 index e38df1a..0000000 --- a/help/en_US/deconvlucy.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - deconvlucy - This function is used to Deblur image using Lucy-Richardson method - - - - - Calling Sequence - - J = deconvlucy(I1, I2); - J = deconvlucy(I1, I2, NUMIT) - - - - - - Parameters - - I1: - image matrix of the source image . - I2: - image matrix of the source image from last iteraion. - NUMIT: - The number if iterations specified to achieve the desired result. - B : - output image in the deconvoluted form. - - - - - Description - -J = deconvlucy(I, PSF, NUMIT) specifies the number of iterations the deconvlucy function performs. If this value is not specified, the default is 10. - - - - - - - Examples - - - diff --git a/help/en_US/detectMinEigenFeatures.xml b/help/en_US/detectMinEigenFeatures.xml deleted file mode 100755 index 597f8b6..0000000 --- a/help/en_US/detectMinEigenFeatures.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - detectMinEigenFeatures - This function is used to find corner points in an image using Minimum Eigen Value algorithm. - - - - - Calling Sequence - - points = detectMinEigenFeatures(I); - points = detectMinEigenFeatures(I, Name, Value, ...); - - - - - - Parameters - - points: - Structure of corner points - I: - Input image to detectHarrisFeatures() - MinQuality: - (Optional) Minimum accepted quality of corners (Default- 0.01) - FilterSize: - (Optional) Dimension of Gaussian Filter (Default: 5) - ROI: - (Optional) Rectangular region for corner detection - - - - - Description - -This function detects corners in an image I. These corner points are used to extract features and hence recognize the contents of an image. - - - - - - - Examples - - - diff --git a/help/en_US/ellipse.xml b/help/en_US/ellipse.xml deleted file mode 100755 index 1149ec7..0000000 --- a/help/en_US/ellipse.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - ellipse - This function draws a simple or thick elliptic arc or fills an ellipse sector. - - - - - Calling Sequence - - elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b); - elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness); - elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness,linetype); - elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness,linetype,shift); - - - - - - Parameters - - elli: - The output image with the ellipse drawn in it. - inputImage: - The input image on which the ellipse should be drawn. - xcor: - X-coordinate of the center - ycor: - Y-coordinate of the center - firstAxis: - the first axis of the ellipse. - secondAxis: - the second axis of the ellipse. - angle: - Ellipse rotation angle in degrees. - startAngle: - Starting angle of the elliptic arc in degrees. - endAngle: - Ending angle of the elliptic arc in degrees. - r: - red color value of the ellipse.It should be in the range 0-255. - b: - blue color value of the ellipse.It should be in the range 0-255. - g: - green color value of the ellipse.It should be in the range 0-255. - thickness: - Line thickness. - linetype: - Type of the ellipse boundary.It can be 0 or 4 or 8. - shift: - Number of fractional bits in the point coordinates. - - - - - Description - - - -This function draws a simple or thick elliptic arc or fills an ellipse sector. - - - - - - - Examples - - - diff --git a/help/en_US/erode.xml b/help/en_US/erode.xml deleted file mode 100755 index 7c62b9a..0000000 --- a/help/en_US/erode.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - erode - This function Erodes an image by using a specific structuring element. - - - - - Calling Sequence - - - z=imread("lena.jpeg"); - ero=erode(inputImage,kernel,anchorX,anchorY,iterations); - - - - - - Parameters - - z: - input image which should be eroded. - ero: - the output eroded image - kernel: - structuring element used for erosion - anchorX: - x coordinate of Anchor. - anchorY: - y coordinate of Anchor. - Anchor: - position of the anchor within the element. - Iterations: - number of times erosion is applied. - - - - - Description - - - -This function Erodes an image by using a specific structuring element. - - - - - - - Examples - - - diff --git a/help/en_US/estimateFundamentalMat.xml b/help/en_US/estimateFundamentalMat.xml deleted file mode 100755 index 0629254..0000000 --- a/help/en_US/estimateFundamentalMat.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - estimateFundamentalMat - It returns the 3-by-3 fundamental matrix corresponding to the input points - - - - - Calling Sequence - - fundamentalMat=estimateFundamentalMatrix(matchedPoints1,matchedPoints2); - fundamentalMat=estimateFundamentalMatrix(matchedPoints1,matchedPoints2,'method','RANSAC','param1',2,'param2',0.99); - - - - - - Parameters - - matchedPoints1: - M-by-2 array of first image points. These points can be SURFPoints, MSERRegions, cornerPoints. - matchedPoints2: - M-by-2 array of the second image points of the same size and format as matchedPoints1. - method: - method for computing fundamental matrix. Possible methods are 7POINT,8POINT,RANSAC,LMEDS and RANSAC is the default one. - param1: - It indiacates maximum distance from a point to an epipolar line in pixels - param2: - It specifies a desirable level of confidence - - - - - Description - -estimateFundamentalMatrix function calculates a fundamental matrix from the corresponding points in two images. - - - - - - - Examples - - - diff --git a/help/en_US/exposure.xml b/help/en_US/exposure.xml new file mode 100644 index 0000000..ea42260 --- /dev/null +++ b/help/en_US/exposure.xml @@ -0,0 +1,95 @@ + + + + + + + + exposure + Compensate exposure in the specified image. + + + + + Calling Sequence + + stacksize('max') + image1=imread('path of the image file') + image2=imread('path of the image file') + y = exposure(algo_type,img_index,image1,image2) + image3=imread('path of the image file') + y = exposure(algo_type,img_index,image1,image2,image3) + image4=imread('path of the image file') + y = exposure(algo_type,img_index,image1,image2,image3,image4) + image5=imread('path of the image file') + y = exposure(algo_type,img_index,image1,image2,image3,image4,image5) + image6=imread('path of the image file') + y = exposure(algo_type,img_index,image1,image2,image3,image4,image6) + + + + + + Parameters + + algo_type : + an integer between 1 and 3 (both inclusive) specifying the algorithm to be used for exposure compensation. + img_index : + index of the image on which exposure compensator will be applied + image1 : + an image + image2 : + an image + image3 : + an image + image4 : + an image + image5 : + an image + image6 : + an image + + + + + Description + +y = exposure(algo_type,img_index,image1,image2) returns an image whose exposure is compensated. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated which is required to do particular type of warping. +After warping is done exposure is compensated in an image whose index is mentioned. + + + + + + + Examples + + + + + Authors + + Manoj Sree Harsha + + + diff --git a/help/en_US/findHomography.xml b/help/en_US/findHomography.xml deleted file mode 100755 index 97fa2cf..0000000 --- a/help/en_US/findHomography.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - findHomography - This Function Finds a perspective transformation between two planes. - - - - - Calling Sequence - - homographyMatrix=findHomography(points1,points2); - homographyMatrix=findHomography(points1,points2,method); - homographyMatrix=findHomography(points1,points2,method,threshold); - - - - - - Parameters - - homographyMatrix: - perspective transformation H between the source and the destination planes - points1: - Coordinates of the points in the original plane - points2: - Coordinates of the points in the target plane - method: - Method used to computed a homography matrix. - threshold: - Maximum allowed reprojection error to treat a point pair as an inlier. - Note: - the number of points should be same in the points1 and points2 - - - - - Description - -The function finds and returns the perspective transformation H between the source and the destination planes - - - - - - - Examples - - - diff --git a/help/en_US/fitellipse.xml b/help/en_US/fitellipse.xml deleted file mode 100755 index 6355085..0000000 --- a/help/en_US/fitellipse.xml +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - - fitellipse - The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. - - - - - Calling Sequence - - - felli=fitellipse(points); - - - - - - Parameters - - felli: - a struct containing all the details about the ellipse Params. - points: - Input 2D point set - - - - - Description - - - -The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. - - - - - - - Examples - - - diff --git a/help/en_US/graycoprops.xml b/help/en_US/graycoprops.xml deleted file mode 100755 index b85f0c3..0000000 --- a/help/en_US/graycoprops.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - graycoprops - - - - - - Calling Sequence - - z=imread("lena.jpeg"); //in grayscale or color - //Note: z can be a image or simply a Matrix. - gray=graycoprops(z) //get all 4 properties - gray=graycoprops(z,"contrast") //compute only contrast - gray=graycoprops(z,["contrast" "energy"]) //compute contrast and energy.the properties can be passed in any order - gray=graycoprops(z,["contrast" "correlation" "energy"]) - gray=graycoprops(z,["contrast" "correlation" "energy" "homogeneity"]) - - - - - - Parameters - - gray: - A struct containing all the parameters - z: - A image or a matrix - contrast: - a measure of the intensity contrast between a pixel and its neighbor over the whole image. - energy: - the sum of squared elements - homogeneity: - a value that measures the closeness of the distribution of elements. - correlation: - a measure of how correlated a pixel is to its neighbor over the whole image - - - - - Description - -This function computes the Properties of gray-level co-occurrence matrix.The properties being "correlation","contrast","energy" and "homogeneity". - - - - - - - - - Examples - - - diff --git a/help/en_US/imattributes.xml b/help/en_US/imattributes.xml new file mode 100644 index 0000000..c8aec69 --- /dev/null +++ b/help/en_US/imattributes.xml @@ -0,0 +1,68 @@ + + + + + + + + imattributes + Provides information about image attributes. + + + + + Calling Sequence + + inputImage=imread('path of the image file') + imattributes(inputImage) + + + + + + Parameters + + inputImage : + an image. + + + + + Description + +imattributes gives image attribute information in the form of a 4-by-2 or 6-by-2 cell array, depending on the image type. +The first column of the cell array contains the name of the attribute. +The second column contains the value of the attribute. Both attribute names and values are character vectors +'Minimum intensity': Regarding intensity images, this value represents the lowest intensity value of any pixel. In case ofindexed images, this value represents the lowest index value into a color map. +'Maximum intensity':Regarding intensity images, this value represents the highest intensity value of any pixel. In case of indexed images, this value represents the highest index value into a color map. + + + + + + + Examples + + + + + Authors + + Dhruti Shah , Manoj Sree Harsha + + + diff --git a/help/en_US/imread.xml b/help/en_US/imread.xml deleted file mode 100755 index 5368203..0000000 --- a/help/en_US/imread.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - - - imread - - - - - - Calling Sequence - - image=imread("image_path"); - image=imread("image_path",options) - - - - - - Parameters - - image_path: - a String which contains the path of the image that is to be read. - options: - an Integer, containing the option for user to specify. See below for details. - 0 : - convert image to the single channel grayscale image. - 1 : - convert image to the 3 channel BGR color image. - 2 : - load 16-bit/32-bit image when the input image has the corresponding depth, otherwise convert it to 8-bit. - 4 : - the image is read in any possible color format. - 8 : - use the gdal driver for loading the image. - 16 : - convert image to the single channel grayscale image and the image size reduced 1/2. - 17 : - convert image to the 3 channel BGR color image and the image size reduced 1/2. - 32 : - convert image to the single channel grayscale image and the image size reduced 1/4. - 33 : - convert image to the 3 channel BGR color image and the image size reduced 1/4. - 64 : - convert image to the single channel grayscale image and the image size reduced 1/8. - 65 : - convert image to the 3 channel BGR color image and the image size reduced 1/8. - 128 : - do not rotate the image according to EXIF's orientation flag. - - - - - Description - -This function is used to Read/Load an image from the disk - - - - - - - - - Examples - - - diff --git a/help/en_US/indexImages.xml b/help/en_US/indexImages.xml deleted file mode 100755 index 14359b9..0000000 --- a/help/en_US/indexImages.xml +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - indexImages - This function creates image search index - - - - - Calling Sequence - - imageIndex = indexImages(imgSet, bagOfFeatures, Name, Value... ); - - - - - - Parameters - - imgSet: - Collection of images with their location and labels - bagOfFeatures: - Bag of Visual Words - Verbose [Optional Input Argument]: - Enable Progress display to Screen - SaveFeatureLocations [Optional Input Argument]: - A boolean value indicating whether feature locations has to be saved or not. Values: [True(default)|False] - imageIndex: - Search Index Object containing the mapping of visual vocabulary to each image in the image set - - - - - Description - -Creates a search Index Object that has been mapped to visual words that can be used for retrieve Images - - - - - - - Examples - - - - - Authors - - Umang Agrawal - Rohit Suri - Sridhar Reddy - - - diff --git a/help/en_US/master_help.xml b/help/en_US/master_help.xml deleted file mode 100755 index b3d446e..0000000 --- a/help/en_US/master_help.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - -]> - - - blur[en_US] - - - -blur[en_US] -&a1c783313efc44b1ff24d7f67ed09f9fa; -&a6057a2931c9ba06bf69b0718253a7f43; -&a249387f1e2010a0af784c47d1a0593d6; -&ae75ca7637710d4e262b1f0b51673fa51; -&af663a9ccea5b2ef374b470f5c0fbf78f; -&a1a4bf079dfff742308b6e99c80cab145; -&a9621c4caec3cf66d0796544955a72b9f; -&a5d5e4694041f56c7a8ea0dbae2fc2080; -&a52a2afd0b74f2cf38c69ad333f1e6e80; -&ae6f9cd868ae117193f4a61e921e7ecf4; -&ad1291297f626147a8f547efc784a53d8; -&a0a00d9bf5355279f3501f57a068f271c; -&ae07678a0d7b13b0c1e4a706af7cba772; -&a7e03210de8e0700e2b8afec91945f6fe; -&a90378f8702bbd352e1c43c65fc0e74a5; -&a9764533c75b7404fda073b3573d6fbd2; -&a7980cae396dfbb28f16e9aa428dcf8d0; -&a8087f56e69588df90bf4ba21cc3827da; -&a63c8d02f85102ddf8ccb4695c7599141; - - diff --git a/help/en_US/match.xml b/help/en_US/match.xml new file mode 100644 index 0000000..08a9006 --- /dev/null +++ b/help/en_US/match.xml @@ -0,0 +1,69 @@ + + + + + + + + match + Performs matching features between two images. + + + + + Calling Sequence + + img1=imread('path of the image file') + img2=imread('path of the image file') + x=match(img1,img2) + + + + + + Parameters + + img1 : + an image + img2 : + an image + + + + + Description + +The images pass through a stiching pipeline. +Features are extracted from each image and matching is done on two images. + + + + + + + Examples + + + + + Authors + + Manoj Sree Harsha + + + diff --git a/help/en_US/matMulDeriv.xml b/help/en_US/opticalflow.xml old mode 100755 new mode 100644 similarity index 56% rename from help/en_US/matMulDeriv.xml rename to help/en_US/opticalflow.xml index d438a45..d38a81b --- a/help/en_US/matMulDeriv.xml +++ b/help/en_US/opticalflow.xml @@ -2,11 +2,11 @@ - - matMulDeriv - this function Computes partial derivatives of the matrix product for each multiplied matrix + opticalflow + Calculates optical flow. Calling Sequence - [da db]=matMulDeriv(A,B); + opticalflow(vid) @@ -32,28 +32,32 @@ Parameters + vid : + a video Description -this function Computes partial derivatives of the matrix product for each multiplied matrix +opticalflow(vid) returns an opticalflow video and it will be written to 'out.avi' file (In the current working directory). + + Examples + + + Authors + + Manoj Sree Harsha , M Avinash Reddy + + diff --git a/help/en_US/pana.xml b/help/en_US/pana.xml new file mode 100644 index 0000000..f8c0e3c --- /dev/null +++ b/help/en_US/pana.xml @@ -0,0 +1,107 @@ + + + + + + + + pana + Creates the output panorama image using two or more images + + + + + Calling Sequence + + stacksize('max') + img1=imread('path of the image file') + img2=imread('path of the image file') + out = pana(img1,img2) + img3=imread('path of the image file') + out = pana(img1,img2,img3) + img4=imread('path of the image file') + out = pana(img1,img2,img3,img4) + img5=imread('path of the image file') + out = pana(img1,img2,img3,img4,img5) + img6=imread('path of the image file') + out = pana(img1,img2,img3,img4,img5,img6) + + + + + + Parameters + + img1 : + an image + img2 : + an image + img3 : + an image + img4 : + an image + img5 : + an image + img6 : + an image + + + + + Description + +The images pass through a stiching pipeline before the final panorama is formed. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated which is required to do particular type of warping. +After warping is done exposure is compensated in all images so as to get a uniform exposure throughout the panaroma. +Seam estimation is done next to get the exact portions of images to be blended. +Finally, the images are blended to form the panorama. + + + + + + + Examples + + + + + Examples + + + + + Authors + + M Avinash Reddy , Manoj Sree Harsha , Ebey Abraham + + + diff --git a/help/en_US/pclradius.xml b/help/en_US/pclradius.xml new file mode 100644 index 0000000..0574d7a --- /dev/null +++ b/help/en_US/pclradius.xml @@ -0,0 +1,78 @@ + + + + + + + + pclradius + Finds all the points within the circle of radius r with centre as query point q, in the pointcloud pcloud + + + + + Calling Sequence + + y = pclradius(pcloud,q,r) + + + + + + Parameters + + pcloud : + pointCloud object. + q : + a row vector containing the query point + r : + a positive integer specifying the radius. + out : + a matrix. + + + + + Description + +out = pclradius(pcloud,q,r) return a 2x(Number of points) matrix . +The first row of out contains the indices of all the points in the pointCloud within the circle of radius r. +The second row contains the corresponding squared distances(squared euclidean distance). + + + + + + + Examples + + + + + Authors + + Manoj Sree Harsha + + + diff --git a/help/en_US/radius.xml b/help/en_US/radius.xml new file mode 100644 index 0000000..368141e --- /dev/null +++ b/help/en_US/radius.xml @@ -0,0 +1,74 @@ + + + + + + + + radius + Finds all the points within the circle of radius r with centre as query point q, in the dataset f + + + + + Calling Sequence + + y = radius(q,f,r) + y = radius(q,f,r,algo_type) + + + + + + Parameters + + q : + a row vector containing the query point + f : + f is the set of data points and the number of columns in f should be same as that of q to match point dimensionality + r : + a positive integer specifying the radius. + algo_type : + a integer between 1 and 4 (both inclusive) specifying the algorithm to be used for the radius search. + + + + + Description + +y = radius(q,f,r) return a 2x(Number of points) matrix . +The first row of y contains the indices of all the points in the dataset(f) within the circle of radius r. +The second row contains the corresponding distances(squared euclidean distance). + + + + + + + Examples + + + + + Authors + + Manoj Sree Harsha + + + diff --git a/help/en_US/integralKernel.xml b/help/en_US/rotationVectorToMatrix.xml old mode 100755 new mode 100644 similarity index 50% rename from help/en_US/integralKernel.xml rename to help/en_US/rotationVectorToMatrix.xml index 373ba90..59b1c67 --- a/help/en_US/integralKernel.xml +++ b/help/en_US/rotationVectorToMatrix.xml @@ -2,11 +2,11 @@ - - integralKernel - This function creates a filter to be used with integral images. + rotationVectorToMatrix + Returns rotation matrix. Calling Sequence - results = intergralKernel(bbox, weight); + matrix = rotationVectorToMatrix(vector); @@ -32,19 +32,17 @@ Parameters - results: - A structure kernel which contains bounding boxes, weights, filter coefficients, center of filter, size of filter, orientation of filter - bboxes: - bounding boxes that define the filter - weights: - weights corresponding to each of the bbox + matrix: + rotation matrix + vector: + 3-D rotation vector Description -Integral kernel creates box filter which can be used with integral images. +Converts rotation vector to rotation matrix. @@ -53,9 +51,8 @@ Integral kernel creates box filter which can be used with integral images. Examples diff --git a/help/en_US/rotestimate.xml b/help/en_US/rotestimate.xml new file mode 100644 index 0000000..5b6e0e4 --- /dev/null +++ b/help/en_US/rotestimate.xml @@ -0,0 +1,89 @@ + + + + + + + + rotestimate + Estimates camera intrinsic parameters matrix(K). + + + + + Calling Sequence + + img1=imread('path of the image file') + img2=imread('path of the image file') + res = rotestimate(cam_index,img1,img2) + img3=imread('path of the image file') + res = rotestimate(cam_index,img1,img2,img3) + img4=imread('path of the image file') + res = rotestimate(cam_index,img1,img2,img3,img4) + img5=imread('path of the image file') + res = rotestimate(cam_index,img1,img2,img3,img4,img5) + img6=imread('path of the image file') + res = rotestimate(cam_index,img1,img2,img3,img4,img5,img6) + + + + + + Parameters + + cam_index : + cam_index of the camera for which K is returned. + img1 : + an image + img2 : + an image + img3 : + an image + img4 : + an image + img5 : + an image + img6 : + an image + + + + + Description + +The images pass through a stiching pipeline. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated. + + + + + + + Examples + + + + + Authors + + Manoj Sree Harsha + + + diff --git a/help/en_US/scilab_en_US_help/CascadeObjectDetector.html b/help/en_US/scilab_en_US_help/CascadeObjectDetector.html deleted file mode 100755 index 4c6335f..0000000 --- a/help/en_US/scilab_en_US_help/CascadeObjectDetector.html +++ /dev/null @@ -1,119 +0,0 @@ - - - CascadeObjectDetector - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > CascadeObjectDetector - -

-

CascadeObjectDetector

-

This function is used to detect objects in an image.

- - -

Calling Sequence

-
detect=CascadeObjectDetector(inputImage,classifierList);
-detect=CascadeObjectDetector(inputImage,classifierList,scale);
-detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors);
-detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags);
-detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags,minSize);
-detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags,minSize,maxSize);
- -

Parameters

-
out: -

the output image with all specified detections.

-
inputImage: -

input image on which the objects should be detected.

-
classifierList: -

a matrix of strings containing the location of the xml files which are to be used in the detection.

-
scale: -

Parameter specifying how much the image size is reduced at each image scale.

-
minNeighbors: -

Parameter specifying how many neighbors each candidate rectangle should have to retain it.

-
flags: -

the method used in detection.it should be either 1 or 4 or 2 or 8.

-
min size: -

Minimum possible object size. Objects smaller than that are ignored.

-
max size: -

Maximum possible object size. Objects larger than that are ignored.

- -

Description

-

-

This function is used to detect objects in an image.

-

- -

Examples

-
// A example detecting all faces,eyes in an image.
-//read the input image.
-z=imread("oscarSelfie.jpg");
-//increase stacksize of scilab
-stacksize('max')
-declare string martrix with the xml locations.Here the general opencv's .xml files are used.
-s=["/home/nihar/Desktop/opencv/data/haarcascades/haarcascade_eye_tree_eyeglasses.xml" "/home/nihar/Desktop/opencv/data/haarcascades/haarcascade_frontalface_alt.xml"];
-//call function
-//Note:-the value of scale and other optional inputs must be adjusted to get proper/desired detection.
-p=CascadeObjectDetector(z,s,1.05);
-//show the detection
-imshow(p);
-
-Detect only faces.
-
-//read the input image.
-z=imread("oscarSelfie.jpg");
-//increase stacksize of scilab
-stacksize('max')
-declare string martrix with the xml locations.Here the general opencv's .xml files are used.
-s=["/home/nihar/Desktop/opencv/data/haarcascades/haarcascade_frontalface_alt.xml"];
-//call function
-//Note:-the value of scale and other optional inputs must be adjusted to get proper/desired detection.
-p=CascadeObjectDetector(z,s,1.05);
-//show the detection
-imshow(p);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/DCT.html b/help/en_US/scilab_en_US_help/DCT.html new file mode 100644 index 0000000..f608112 --- /dev/null +++ b/help/en_US/scilab_en_US_help/DCT.html @@ -0,0 +1,82 @@ + + + DCT + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > DCT + +

+

DCT

+

Performs forward Discrete Cosine Transform of the 1D or 2D array.

+ + +

Calling Sequence

+
dstMat = DCT(srcMat)
+ +

Parameters

+
srcMat : +

1D or 2D floating type array

+
dstMat : +

The output matrix

+ +

Description

+

dstMat = DCT(srcMat) +Returns the DCT of the input matrix.

+

+ +

Examples

+
srcMat = [230.3 23.1 432.5; 321 543.1 89.5]
+dstMAt = DCT(srcMat)
+disp(dstMAt)
+ +

Authors

+
  • Deepshikha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/FFT.html b/help/en_US/scilab_en_US_help/FFT.html new file mode 100644 index 0000000..3d48797 --- /dev/null +++ b/help/en_US/scilab_en_US_help/FFT.html @@ -0,0 +1,80 @@ + + + FFT + + + +
+ + + + +
+ << DCT + + + FOSSEE Image Processing Toolbox + + + affine2d >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > FFT + +

+

FFT

+

This function returns discrete Fourier Transform of 2D input matrix

+ + +

Calling Sequence

+
fourierTransform=FFT(inputMatrix)
+ +

Parameters

+
inputMatrix: +

Input matrix must be 2-D.

+ +

Description

+

It returns the 2D discrete Fourier transform of two dimensional input matrix.

+

+ +

Examples

+
I=imread('images/lena.jpeg',0);
+I=double(I);
+fourier=FFT(I)
+imshow(fourier)
+ +

Authors

+
  • Sridhar Reddy
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS old mode 100755 new mode 100644 index ef46423..dc8b5d4 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB old mode 100755 new mode 100644 index e3c71bf..b936101 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB and b/help/en_US/scilab_en_US_help/JavaHelpSearch/DOCS.TAB differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS old mode 100755 new mode 100644 index 1324712..9161a48 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/OFFSETS @@ -1 +1,6 @@ - \ No newline at end of file +<<<<<<< HEAD +Ka/)'ڤh)H4-vHF(l +@=ͫMYz݌يc8V "욠LW>l5aZX# +======= + +>>>>>>> 404a7f2a4f72456d4df64dde1e76243bd43b9e42 diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS old mode 100755 new mode 100644 index 60477b1..f66bf63 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS and b/help/en_US/scilab_en_US_help/JavaHelpSearch/POSITIONS differ diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA old mode 100755 new mode 100644 index a646b00..84d23e8 --- a/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA +++ b/help/en_US/scilab_en_US_help/JavaHelpSearch/SCHEMA @@ -1,2 +1,6 @@ JavaSearch 1.0 +<<<<<<< HEAD +TMAP bs=2048 rt=1 fl=-1 id1=484 id2=1 +======= TMAP bs=2048 rt=0 fl=-1 id1=10 id2=1 +>>>>>>> 404a7f2a4f72456d4df64dde1e76243bd43b9e42 diff --git a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP old mode 100755 new mode 100644 index fced7c7..75ddfb4 Binary files a/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP and b/help/en_US/scilab_en_US_help/JavaHelpSearch/TMAP differ diff --git a/help/en_US/scilab_en_US_help/ScilabCaution.png b/help/en_US/scilab_en_US_help/ScilabCaution.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/ScilabEdit.png b/help/en_US/scilab_en_US_help/ScilabEdit.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/ScilabExecute.png b/help/en_US/scilab_en_US_help/ScilabExecute.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/ScilabImportant.png b/help/en_US/scilab_en_US_help/ScilabImportant.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/ScilabNote.png b/help/en_US/scilab_en_US_help/ScilabNote.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/ScilabTip.png b/help/en_US/scilab_en_US_help/ScilabTip.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/ScilabWarning.png b/help/en_US/scilab_en_US_help/ScilabWarning.png old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/affine2d.html b/help/en_US/scilab_en_US_help/affine2d.html new file mode 100644 index 0000000..aef9b07 --- /dev/null +++ b/help/en_US/scilab_en_US_help/affine2d.html @@ -0,0 +1,82 @@ + + + affine2d + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > affine2d + +

+

affine2d

+

Creates an affine2d object for input 3x3 matrix.

+ + +

Calling Sequence

+
y = affine2d(mat)
+ +

Parameters

+
mat : +

It is a 3x3 matrix which specifies forward affine2d transformation.

+
y : +

an affine2d object with similar properties as the input.

+ +

Description

+

y = affine2d(mat) returns the affine2d object where a 3x3 numeric matrix is given as input +It encapsulates 2d affine geometri transformation.

+

+ +

Examples

+
a=[1 2 0;3 4 0;5 1 1];
+y=affine2d(a);
+disp(y);
+ +

Authors

+
  • Yash S. Bhalgat
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/arrowedline.html b/help/en_US/scilab_en_US_help/arrowedline.html deleted file mode 100755 index 46c4d00..0000000 --- a/help/en_US/scilab_en_US_help/arrowedline.html +++ /dev/null @@ -1,59 +0,0 @@ - - - arrowedline - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > arrowedline - -

-

arrowedline

-

-
- - - - diff --git a/help/en_US/scilab_en_US_help/bboxOverlapRatio.html b/help/en_US/scilab_en_US_help/bboxOverlapRatio.html new file mode 100644 index 0000000..ca00fea --- /dev/null +++ b/help/en_US/scilab_en_US_help/bboxOverlapRatio.html @@ -0,0 +1,92 @@ + + + bboxOverlapRatio + + + +
+ + + + +
+ << affine2d + + + FOSSEE Image Processing Toolbox + + + calfocal >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > bboxOverlapRatio + +

+

bboxOverlapRatio

+

Compute the overlap ratio between the bounding boxes A and B.

+ + +

Calling Sequence

+
[ overlapRatio ] = bboxOverlapRatio(bboxA, bboxB);
+[ overlapRatio ] = bboxOverlapRatio(bboxA, bboxB, ratioType);
+ +

Parameters

+
bboxA: +

Bounding box A of the form [x, y, width, height];

+
bboxB: +

Boundng box B of the form [x, y, width, height];

+
ratioType (Optional Argument): +

Method to be used to compute the ratio. Set this to either 'Union' or 'Min'. Default computation method is set to 'Union'.

+
overlapRatio: +

Overlap ratio between the bounding boxes A and B.

+ +

Description

+

Compute the overlap ratio between the bounding boxes A and B.

+

+ +

Examples

+
bboxA = [1 2 3 4];
+bboxB = bboxA + 100;
+overlapRatioMin = bboxOverlapRatio(bboxA, bboxB, 'Min');
+overlapRatioUnion = bboxOverlapRatio(bboxA, bboxB);
+
+bboxA = [0 0 50 50];
+bboxB = [0 0 200 200];
+overlapRatioMin = bboxOverlapRatio(bboxA, bboxB, 'Min');
+overlapRatioUnion = bboxOverlapRatio(bboxA, bboxB);
+ +

Authors

+
  • Tanmay Chaudhari
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/blur.html b/help/en_US/scilab_en_US_help/blur.html deleted file mode 100755 index 5cefd26..0000000 --- a/help/en_US/scilab_en_US_help/blur.html +++ /dev/null @@ -1,86 +0,0 @@ - - - blur - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > blur - -

-

blur

-

This function is used to blur an image using the normalized box filter.

- - -

Calling Sequence

-
B = blur(input_image ,ksize_width,ksize_height,anchorX,anchorY);
- -

Parameters

-
A: -

image matrix of the source image.

-
ksize_width : -

Defines the width of the kernel to be used in pixels.

-
ksize_width : -

Defines the height of the kernel to be used in pixels.

-
anchorX : -

Indicates where the x coordinate of the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point.

-
anchorY : -

Indicates where the y coordinate of the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point.

-
B : -

output image with the applied blur fucntion.

- -

Description

-

The function smoothes an image using the kernel specified with its dimesnsions.

-

- -

Examples

-
i = imread('right1.jpg',0);
-i2 =blur(i,5,5,1,1)
-imshow(i2);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/boundingRect.html b/help/en_US/scilab_en_US_help/boundingRect.html deleted file mode 100755 index 090d97e..0000000 --- a/help/en_US/scilab_en_US_help/boundingRect.html +++ /dev/null @@ -1,80 +0,0 @@ - - - boundingRect - - - -
- - - - -
- << blur - - - FOSSEE_Image_Processing_Toolbox - - - circle >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > boundingRect - -

-

boundingRect

-

this function Calculates the up-right bounding rectangle of a point set.

- - -

Calling Sequence

-
z=imread("lena.jpeg",0);
-rect=boundingRect(points);
- -

Parameters

-
rect: -

the rectangle coordinates

-
points: -

the set of 2D points. It must be N*2.

- -

Description

-

-

Calculates the up-right bounding rectangle of a point set.

-

- -

Examples

-
z=imread("lena.jpeg",0);
-kaze=detectKAZEFeatures(z)x
-rect=boundingRect(kaze.KeyPoints);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/c_code.css b/help/en_US/scilab_en_US_help/c_code.css old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/calfocal.html b/help/en_US/scilab_en_US_help/calfocal.html new file mode 100644 index 0000000..c191384 --- /dev/null +++ b/help/en_US/scilab_en_US_help/calfocal.html @@ -0,0 +1,95 @@ + + + calfocal + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > calfocal + +

+

calfocal

+

Estimates focal lengths for each given camera.

+ + +

Calling Sequence

+
res = calfocal(image1,image2)
+res = calfocal(image1,image2,image3)
+res = calfocal(image1,image2,image3,image4)
+res = calfocal(image1,image2,image3,image4,image5)
+res = calfocal(image1,image2,image3,image4,image5,image6)
+ +

Parameters

+
image1 : +

an image

+
image2 : +

an image

+
image3 : +

an image

+
image4 : +

an image

+
image5 : +

an image

+
image6 : +

an image

+ +

Description

+

res = calfocal(image1,image2) return a 1x2 matrix. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated along with their focal lengths are estimated.

+

+ +

Examples

+
a=imread('images/campus_000.jpg');
+b=imread('images/campus_001.jpg');
+res=calfocal(a,b);
+ +

Authors

+
  • Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/cameraMatrix.html b/help/en_US/scilab_en_US_help/cameraMatrix.html new file mode 100644 index 0000000..eea48da --- /dev/null +++ b/help/en_US/scilab_en_US_help/cameraMatrix.html @@ -0,0 +1,86 @@ + + + cameraMatrix + + + +
+ + + + +
+ << calfocal + + + FOSSEE Image Processing Toolbox + + + convolver >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > cameraMatrix + +

+

cameraMatrix

+

Returns camera projection matrix.

+ + +

Calling Sequence

+
camMatrix = cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector);
+ +

Parameters

+
camMatrix: +

A 4x3 camera projection matrix, which can be used to project 3-D world points in homogenous co-ordinates into an image.

+
instrinsicMatrix: +

Projection matrix of size 3x3.

+
rotationMatrix: +

A 3x3 matrix which specifies the rotation of a camera.

+
translationVector: +

A 1x3 vector which specifies the translation of a camera.

+ +

Description

+

Return a matrix of size 4-by-3, which can be used to project 3-D world points in homogenous co-ordinates into an image.

+

+ +

Examples

+
instrinsicMatrix = [1 0 0; 1 2 0; 3 4 0];
+rotationMatrix = [   0.1417   -0.7409    0.6565; 0.9661   -0.0410   -0.2548;    0.2157    0.6703    0.7100];
+translationVector = [ -29.2584   35.7824  725.5824];
+camMatrix = cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector)
+ +

Authors

+
  • Tanmay Chaudhari
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/circle.html b/help/en_US/scilab_en_US_help/circle.html deleted file mode 100755 index 9ef9447..0000000 --- a/help/en_US/scilab_en_US_help/circle.html +++ /dev/null @@ -1,101 +0,0 @@ - - - circle - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > circle - -

-

circle

-

This function circle draws a simple or filled circle on an image with a given center and radius.

- - -

Calling Sequence

-
cir=circle(inputImage,xcor,ycor,radius,r,g,b);
-cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness);
-cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness,linetype);
-cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness,linetype,shift);
- -

Parameters

-
cir: -

The output image with the circle drawn in it.

-
inputImage: -

The input image on which the circle should be drawn.

-
xcor: -

X-coordinate of the center

-
ycor: -

Y-coordinate of the center

-
r: -

red color value of the circle.It should be in the range 0-255.

-
b: -

blue color value of the circle.It should be in the range 0-255.

-
g: -

green color value of the circle.It should be in the range 0-255.

-
thickness: -

Line thickness.

-
linetype: -

Type of the circle boundary.It can be 0 or 4 or 8.

-
shift: -

Number of fractional bits in the point coordinates.

- -

Description

-

This function circle draws a simple or filled circle on an image with a given center and radius.

-

-

- -

Examples

-
//read the input image
-z=imread("lena.jpeg");
-//call the function
-cir=circle(z,100,100,15,255,0,0,1,8,0);
-finally show the circle drawn
-imshow(cir)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/convolver.html b/help/en_US/scilab_en_US_help/convolver.html new file mode 100644 index 0000000..8d44ef1 --- /dev/null +++ b/help/en_US/scilab_en_US_help/convolver.html @@ -0,0 +1,90 @@ + + + convolver + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > convolver + +

+

convolver

+

Convolves an image with the kernel.

+ + +

Calling Sequence

+
out_image = convolver(in_image,ksize,kvalues,scalar)
+ +

Parameters

+
in_image : +

an image

+
out_image : +

the output image

+
ksize : +

kernel size (belongs to {3,4,5})

+
kvalues : +

kernel matrix values

+
scalar : +

any floating value

+ +

Description

+

out_image = convolver(in_image,ksize,kvalues,scalar) +Returns the convoluted image of the input image. It uses filter2d function to perform convolution. +The convolution is with the given kernel.

+

+ +

Examples

+
a = imread('images/lena.jpeg')
+b=[1 1 1;1 1 1;1 1 1]
+y=convolver(a,3,b,9)
+imshow(y)
+ +

Authors

+
  • Kevin George , Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/cornerEigenValsAndVecs.html b/help/en_US/scilab_en_US_help/cornerEigenValsAndVecs.html new file mode 100644 index 0000000..8ecd277 --- /dev/null +++ b/help/en_US/scilab_en_US_help/cornerEigenValsAndVecs.html @@ -0,0 +1,92 @@ + + + cornerEigenValsAndVecs + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > cornerEigenValsAndVecs + +

+

cornerEigenValsAndVecs

+

Calculates eigenvalues and eigenvectors of image blocks for corner detection.

+ + +

Calling Sequence

+
inputImage=imread('path of the image file')
+outputImg = cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType)
+imshow(outputImg)
+ +

Parameters

+
inputImage : +

an image.

+
blockSize : +

Neighborhood size

+
kSize : +

Aperture parameter for the Sobel() operator.

+
borderType : +

Pixel extrapolation method

+ +

Description

+

outputImg = cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType) +For every pixel p , the function cornerEigenValsAndVecs considers a blockSize x blockSize neighborhood S(p) . It calculates the covariation matrix of derivatives over the neighbourhood +After that, it finds eigenvectors and eigenvalues and stores them in the destination image(outputImg).

+

+ +

Examples

+
inputImage=imread('images/lena.jpeg');
+blockSize = 7;
+kSize=3;
+borderType="BORDER_DEFAULT"
+outputImg=cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType);
+imshow(outputImg)
+ +

Authors

+
  • Shubheksha Jalan
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/cornerHarris.html b/help/en_US/scilab_en_US_help/cornerHarris.html new file mode 100644 index 0000000..321bad0 --- /dev/null +++ b/help/en_US/scilab_en_US_help/cornerHarris.html @@ -0,0 +1,95 @@ + + + cornerHarris + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > cornerHarris + +

+

cornerHarris

+

Harris edge detector.

+ + +

Calling Sequence

+
inputImage=imread('path of the image file')
+outputImg = cornerHarris(inputImage, blockSize, kSize, k, borderType)
+imshow(outputImg)
+ +

Parameters

+
inputImage : +

an image.

+
blockSize : +

Neighborhood size

+
kSize : +

Aperture parameter for the Sobel() operator.

+
k : +

Harris detector free parameter.

+
borderType : +

Pixel extrapolation method

+ +

Description

+

outputImg = cornerHarris(inputImage, blockSize, kSize, k, borderType) +This function runs the Harris edge detector on the image. +outputImg is used to store the Harris detector responses

+

+ +

Examples

+
inputImage=imread('images/lena.jpeg');
+blockSize = 7;
+kSize=3;
+k=0.04;
+borderType="BORDER_DEFAULT"
+outputImg=cornerHarris(inputImage, blockSize, kSize, k, borderType);
+imshow(outputImg)
+ +

Authors

+
  • Shubheksha Jalan
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/cornerMinEigenVal.html b/help/en_US/scilab_en_US_help/cornerMinEigenVal.html new file mode 100644 index 0000000..878bc39 --- /dev/null +++ b/help/en_US/scilab_en_US_help/cornerMinEigenVal.html @@ -0,0 +1,93 @@ + + + cornerMinEigenVal + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > cornerMinEigenVal + +

+

cornerMinEigenVal

+

Calculates the minimal eigenvalue of gradient matrices for corner detection.

+ + +

Calling Sequence

+
inputImage=imread('path of the image file')
+outputImg = cornerMinEigenVal(inputImage, blockSize, kSize, borderType)
+imshow(outputImg)
+ +

Parameters

+
inputImage : +

an image.

+
blockSize : +

Neighborhood size

+
kSize : +

Aperture parameter for the Sobel() operator.

+
borderType : +

Pixel extrapolation method

+ +

Description

+

outputImg = cornerMinEigenVal(inputImage, blockSize, kSize, borderType) +The function is similar to cornerEigenValsAndVecs() but it calculates only the minimal eigenvalue of the covariance matrix of derivatives. +After that, it stores them in the destination image(outputImg).

+

+ +

Examples

+
inputImage=imread('images/lena.jpeg');
+blockSize = 7;
+kSize=3;
+k=0.04;
+borderType="BORDER_DEFAULT"
+outputImg=cornerMinEigenVal(inputImage, blockSize, kSize, borderType);
+imshow(outputImg)
+ +

Authors

+
  • Shubheksha Jalan
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/correctMatches.html b/help/en_US/scilab_en_US_help/correctMatches.html deleted file mode 100755 index b6ce5b0..0000000 --- a/help/en_US/scilab_en_US_help/correctMatches.html +++ /dev/null @@ -1,84 +0,0 @@ - - - correctMatches - - - -
- - - - -
- << circle - - - FOSSEE_Image_Processing_Toolbox - - - cvtColor >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > correctMatches - -

-

correctMatches

-

This function Refines coordinates of corresponding points using openCV's functions.

- - -

Calling Sequence

-
[newPoints1, newPoints2] = correctMatches(F, points1, points2)
- -

Parameters

-
- -

Description

-

The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] <-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] <-> newPoints2[i] that minimize the geometric error d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2 (where d(a,b) is the geometric distance between points a and b ) subject to the epipolar constraint newPoints2^T * F * newPoints1 = 0 .

-

- -

Examples

-
//read first image
-I=imread("oscarSelfie.jpg",0);
-//increase stack size of scilab
-stacksize('max')
-// get points from first image
-cornerPoints1=detectMSERFeatures(I);
-//read second image
-I2=imread("oscarSelfie.jpg",0);
-//get points for 2nd image
-cornerPoints2=detectMSERFeatures(I2);
-fundamentalMat=estimateFundamentalMat(cornerPoints1.Location,cornerPoints2.Location);
-[new1 new2]=correctMatches(fundamentalMat,cornerPoints2.Location,cornerPoints1.Location);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/cvtColor.html b/help/en_US/scilab_en_US_help/cvtColor.html deleted file mode 100755 index f14a99f..0000000 --- a/help/en_US/scilab_en_US_help/cvtColor.html +++ /dev/null @@ -1,137 +0,0 @@ - - - cvtColor - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > cvtColor - -

-

cvtColor

-

This function is used to transform a image from one space to other like rgb to gray and vice versa.

- - -

Calling Sequence

-
inputImage=imread("lena.jpeg");
-outputImage=cvtColor(inputImage,codeString);
-outputImage=cvtColor(inputImage,codeString,dstCn);
- -

Parameters

-
dstCn: -

number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code

-
codeString: -

A string which specifies the type of conversion.The different types are listed below.

-
"CV_BGR2GRAY": -

Conversion is from BGR(blue-green-red) space to GRAY.

-
"CV_RGB2GRAY": -

Conversion is from RGB(red-green-blue) space to GRAY.

-
"CV_GRAY2BGR": -

Conversion is from BGR(blue-green-red) space.

-
"CV_GRAY2RGB": -

Conversion is from to GRAY to RGB(blue-green-red) space.

-
"CV_BGR2XYZ" : -

Conversion is from BGR(blue-green-red) space to CIE XYZ.

-
"CV_RGB2XYZ" : -

Conversion is from RGB(red-green-blue) space to CIE XYZ.

-
"CV_XYZ2BGR" : -

Conversion is from to CIE XYZ to BGR space.

-
"CV_XYZ2RGB" : -

Conversion is from to CIE XYZ to RGB(red-green-blue) space.

-
"CV_BGR2YCrCb": -

Conversion is from BGR(blue-green-red) space to luma-chroma.

-
"CV_RGB2YCrCb" : -

Conversion is from RGB(red-green-blue) space to luma chroma.

-
"CV_YCrCb2BGR" : -

Conversion is from luma-chroma to BGR(blue-green-red) space.

-
"CV_YCrCb2RGB" : -

Conversion is from luma-chroma to RGB(red-green-blue) space.

-
"CV_BGR2HSV": -

Conversion is from BGR(blue-green-red) space to HSV.

-
"CV_RGB2HSV": -

Conversion is from RGB space to HSV.

-
"CV_HSV2BGR": -

Conversion is from to HSV to BGR(blue-green-red) space.

-
"CV_HSV2RGB": -

Conversion is from to HSV to RGB(red-green-blue) space.

-
"CV_BGR2HLS": -

Conversion is from BGR(blue-green-red) space to HLS.

-
"CV_RGB2HLS": -

Conversion is from RGB space to HSV.

-
"CV_HLS2BGR": -

Conversion is from HLS to BGR(blue-green-red) space.

-
"CV_HLS2RGB": -

Conversion is from HLS to RGB(red-green-blue) space.

-
"CV_BGR2Lab": -

Conversion is from BGR(blue-green-red) space to CIE Lab.

-
"CV_RGB2Lab": -

Conversion is from RGB space to CIE Lab.

-
"CV_Lab2BGR": -

Conversion is from CIE Lab to BGR(blue-green-red) space.

-
"CV_Lab2RGB": -

Conversion is from CIE Lab to RGB space.

-
"CV_BGR2Luv": -

Conversion is from BGR(blue-green-red) space to CIE Luv.

-
"CV_RGB2Luv": -

Conversion is from RGB space to CIE Luv.

-
"CV_Luv2BGR": -

Conversion is from CIE Luv to BGR(blue-green-red) space.

-
"CV_Luv2RGB": -

Conversion is from CIE Luv to RGB space.

- -

Description

-

-

This function is used to transform a image from one space to other like rgb to gray and vice versa.

-

- -

Examples

-
z=imread("lena.jpeg",0);
-ss=cvtColor(z,"CV_GRAY2BGR");
-imshow(ss)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/daddy.tar.gz b/help/en_US/scilab_en_US_help/daddy.tar.gz deleted file mode 100755 index 6bb8e04..0000000 Binary files a/help/en_US/scilab_en_US_help/daddy.tar.gz and /dev/null differ diff --git a/help/en_US/scilab_en_US_help/deconvlucy.html b/help/en_US/scilab_en_US_help/deconvlucy.html deleted file mode 100755 index 1eda998..0000000 --- a/help/en_US/scilab_en_US_help/deconvlucy.html +++ /dev/null @@ -1,83 +0,0 @@ - - - deconvlucy - - - -
- - - - -
- << dctmtx - - - FOSSEE_Image_Processing_Toolbox - - - demosaic >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > deconvlucy - -

-

deconvlucy

-

This function is used to Deblur image using Lucy-Richardson method

- - -

Calling Sequence

-
J = deconvlucy(I1, I2);
-J = deconvlucy(I1, I2, NUMIT)
- -

Parameters

-
I1: -

image matrix of the source image .

-
I2: -

image matrix of the source image from last iteraion.

-
NUMIT: -

The number if iterations specified to achieve the desired result.

-
B : -

output image in the deconvoluted form.

- -

Description

-

J = deconvlucy(I, PSF, NUMIT) specifies the number of iterations the deconvlucy function performs. If this value is not specified, the default is 10.

-

- -

Examples

-
i = imread("lena.jpeg",0);
-i1 = imread("lena.jpeg",0);
-rs = deconvlucy(i,i1);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/demosaic.html b/help/en_US/scilab_en_US_help/demosaic.html deleted file mode 100755 index a8265a4..0000000 --- a/help/en_US/scilab_en_US_help/demosaic.html +++ /dev/null @@ -1,83 +0,0 @@ - - - demosaic - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > demosaic - -

-

demosaic

-

This function converts the Bayer pattern encoded image to the truecolor image, RGB.

- - -

Calling Sequence

-
image=imread("lena.jpeg",0)
-dem=demosaic(image,"gbrg");
-dem=demosaic(image,"bggr");
-dem=demosaic(image,"rggb");
-dem=demosaic(image,"grbg");
- -

Parameters

-
dem: -

the output image

-
image: -

the image which should be converted.

- -

Description

-

-

This function converts the Bayer pattern encoded image to the truecolor image, RGB.

-

- -

Examples

-
z=imread("lena.jpeg");
-dem=demosaic(z,"rggb");
-imshow(dem);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/detectGFTTFeatures.html b/help/en_US/scilab_en_US_help/detectGFTTFeatures.html deleted file mode 100755 index 29ae319..0000000 --- a/help/en_US/scilab_en_US_help/detectGFTTFeatures.html +++ /dev/null @@ -1,98 +0,0 @@ - - - detectGFTTFeatures - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > detectGFTTFeatures - -

-

detectGFTTFeatures

-

This function is used to detect GFTT Features in a grayscale Image.

- - -

Calling Sequence

-
result = detectGFTTFeatures(Image);
-result = detectGFTTFeatures(Image,Name,Value,....)
- -

Parameters

-
result: -

a struct containing features and keypoints

-
Image: -

a grayscale image whose GFTT features is to be found

-
blocksize: -

the blocksize to be used for detecting the keypoints

-
minDistance: -

the minimum distance between the points for feature computation

-
useHarrisDetector: -

an option to use the HarrisDetector.default value is false.

-
maxCorners: -

the maximum number of corners that should be used for feature computation.

-
ROI or Mask : -

(Optional) Region Of Interest. This is taken as a vector [u v width height]. When specified, the function detects the key points within region of area width*height with u and v being the top left corner coordinates.

- -

Description

-

This function is used to detect GFTT Features in a grayscale Image.

- -

Examples

-
//read image in grayscale
-z=imread("people.jpg",0);
-image=imread("pls.jpg",0);
-stacksize('max')
-//call the function to detect features for image- z
-pls=detectGFTTFeatures(z,"minDistance",4);
-// call the function to detect features for image- image
-pls1=detectGFTTFeatures(image);
-//match features using the features detected using the above function
-[op ir]=matchFeatures(pls.Features,pls1.Features);
-//finally draw those matches
-final=drawMatch(z,image,pls.KeyPoints,pls1.KeyPoints,op,ir);
-imshow(final)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/detectKAZEFeatures.html b/help/en_US/scilab_en_US_help/detectKAZEFeatures.html deleted file mode 100755 index d4a1f4f..0000000 --- a/help/en_US/scilab_en_US_help/detectKAZEFeatures.html +++ /dev/null @@ -1,91 +0,0 @@ - - - detectKAZEFeatures - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > detectKAZEFeatures - -

-

detectKAZEFeatures

-

This function is used to detect KAZE Features in a grayscale Image.

- - -

Calling Sequence

-
result = detectKAZEFeatures(Image);
-result = detectKAZEFeatures(Image,Name,Value,....)
- -

Parameters

-
NumOctaves : -

(Optional)The number of Octaves that the detector uses. (Default - 4) The value must be an integer scalar in between 1 and 4.

-
diffusivity: -

-KAZE's diffusivity'

-
ROI or Mask : -

(Optional) Region Of Interest. This is taken as a vector [u v width height]. When specified, the function detects the key points within region of area width*height with u and v being the top left corner coordinates.

- -

Description

-

This function is used to detect KAZE Features in a grayscale Image.

-

- -

Examples

-
//read image in grayscale
-z=imread("people.jpg",0);
-image=imread("pls.jpg",0);
-stacksize('max')
-//call the function to detect features for image- z
-pls=detectKAZEFeatures(z,"diffusivity",2.1);
-// call the function to detect features for image- image
-pls1=detectKAZEFeatures(image);
-//match features using the features detected using the above function
-[op ir]=matchFeatures(pls.Features,pls1.Features);
-//finally draw those matches
-final=drawMatch(z,image,pls.KeyPoints,pls1.KeyPoints,op,ir);
-imshow(final)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/detectMinEigenFeatures.html b/help/en_US/scilab_en_US_help/detectMinEigenFeatures.html deleted file mode 100755 index 85b8387..0000000 --- a/help/en_US/scilab_en_US_help/detectMinEigenFeatures.html +++ /dev/null @@ -1,84 +0,0 @@ - - - detectMinEigenFeatures - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > detectMinEigenFeatures - -

-

detectMinEigenFeatures

-

This function is used to find corner points in an image using Minimum Eigen Value algorithm.

- - -

Calling Sequence

-
points = detectMinEigenFeatures(I);
-points = detectMinEigenFeatures(I, Name, Value, ...);
- -

Parameters

-
points: -

Structure of corner points

-
I: -

Input image to detectHarrisFeatures()

-
MinQuality: -

(Optional) Minimum accepted quality of corners (Default- 0.01)

-
FilterSize: -

(Optional) Dimension of Gaussian Filter (Default: 5)

-
ROI: -

(Optional) Rectangular region for corner detection

- -

Description

-

This function detects corners in an image I. These corner points are used to extract features and hence recognize the contents of an image.

-

- -

Examples

-
I = imread('sample.jpg');
-points = detectMinEigenFeatures(I);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/ellipse.html b/help/en_US/scilab_en_US_help/ellipse.html deleted file mode 100755 index 4ec5ea9..0000000 --- a/help/en_US/scilab_en_US_help/ellipse.html +++ /dev/null @@ -1,111 +0,0 @@ - - - ellipse - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > ellipse - -

-

ellipse

-

This function draws a simple or thick elliptic arc or fills an ellipse sector.

- - -

Calling Sequence

-
elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b);
-elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness);
-elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness,linetype);
-elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness,linetype,shift);
- -

Parameters

-
elli: -

The output image with the ellipse drawn in it.

-
inputImage: -

The input image on which the ellipse should be drawn.

-
xcor: -

X-coordinate of the center

-
ycor: -

Y-coordinate of the center

-
firstAxis: -

the first axis of the ellipse.

-
secondAxis: -

the second axis of the ellipse.

-
angle: -

Ellipse rotation angle in degrees.

-
startAngle: -

Starting angle of the elliptic arc in degrees.

-
endAngle: -

Ending angle of the elliptic arc in degrees.

-
r: -

red color value of the ellipse.It should be in the range 0-255.

-
b: -

blue color value of the ellipse.It should be in the range 0-255.

-
g: -

green color value of the ellipse.It should be in the range 0-255.

-
thickness: -

Line thickness.

-
linetype: -

Type of the ellipse boundary.It can be 0 or 4 or 8.

-
shift: -

Number of fractional bits in the point coordinates.

- -

Description

-

-

This function draws a simple or thick elliptic arc or fills an ellipse sector.

-

- -

Examples

-
// read the input image on which the ellipse shpuld be drawn.
-z=imread("lena.jpeg",0);
-call the function
-elli=ellipse(z,0,0,45,45,45,0,45,255,0,0,1,0);
-// show the image drawn on it.
-imshow(elli)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/erode.html b/help/en_US/scilab_en_US_help/erode.html deleted file mode 100755 index c6061fc..0000000 --- a/help/en_US/scilab_en_US_help/erode.html +++ /dev/null @@ -1,89 +0,0 @@ - - - erode - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > erode - -

-

erode

-

This function Erodes an image by using a specific structuring element.

- - -

Calling Sequence

-
z=imread("lena.jpeg");
-ero=erode(inputImage,kernel,anchorX,anchorY,iterations);
- -

Parameters

-
z: -

input image which should be eroded.

-
ero: -

the output eroded image

-
kernel: -

structuring element used for erosion

-
anchorX: -

x coordinate of Anchor.

-
anchorY: -

y coordinate of Anchor.

-
Anchor: -

position of the anchor within the element.

-
Iterations: -

number of times erosion is applied.

- -

Description

-

-

This function Erodes an image by using a specific structuring element.

-

- -

Examples

-
z=imread("lena.jpeg");
-ero=erode(z,[6 4],1,1,4);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/estimateFundamentalMat.html b/help/en_US/scilab_en_US_help/estimateFundamentalMat.html deleted file mode 100755 index fb69a0c..0000000 --- a/help/en_US/scilab_en_US_help/estimateFundamentalMat.html +++ /dev/null @@ -1,87 +0,0 @@ - - - estimateFundamentalMat - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > estimateFundamentalMat - -

-

estimateFundamentalMat

-

It returns the 3-by-3 fundamental matrix corresponding to the input points

- - -

Calling Sequence

-
fundamentalMat=estimateFundamentalMatrix(matchedPoints1,matchedPoints2);
-fundamentalMat=estimateFundamentalMatrix(matchedPoints1,matchedPoints2,'method','RANSAC','param1',2,'param2',0.99);
- -

Parameters

-
matchedPoints1: -

M-by-2 array of first image points. These points can be SURFPoints, MSERRegions, cornerPoints.

-
matchedPoints2: -

M-by-2 array of the second image points of the same size and format as matchedPoints1.

-
method: -

method for computing fundamental matrix. Possible methods are 7POINT,8POINT,RANSAC,LMEDS and RANSAC is the default one.

-
param1: -

It indiacates maximum distance from a point to an epipolar line in pixels

-
param2: -

It specifies a desirable level of confidence

- -

Description

-

estimateFundamentalMatrix function calculates a fundamental matrix from the corresponding points in two images.

-

- -

Examples

-
I=imread("lena_left.jpeg");
-cornerPoints1=detectMinEigenFeatures(I);
-I2=imread("lena_right.jpeg");
-cornerPoints2=detectMinEigenFeatures(I2);
-fundamentalMat=(cornerPoints1.Location,cornerPoints2.Location);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/exposure.html b/help/en_US/scilab_en_US_help/exposure.html new file mode 100644 index 0000000..48210ce --- /dev/null +++ b/help/en_US/scilab_en_US_help/exposure.html @@ -0,0 +1,110 @@ + + + exposure + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > exposure + +

+

exposure

+

Compensate exposure in the specified image.

+ + +

Calling Sequence

+
stacksize('max')
+image1=imread('path of the image file')
+image2=imread('path of the image file')
+y = exposure(algo_type,img_index,image1,image2)
+image3=imread('path of the image file')
+y = exposure(algo_type,img_index,image1,image2,image3)
+image4=imread('path of the image file')
+y = exposure(algo_type,img_index,image1,image2,image3,image4)
+image5=imread('path of the image file')
+y = exposure(algo_type,img_index,image1,image2,image3,image4,image5)
+image6=imread('path of the image file')
+y = exposure(algo_type,img_index,image1,image2,image3,image4,image6)
+ +

Parameters

+
algo_type : +

an integer between 1 and 3 (both inclusive) specifying the algorithm to be used for exposure compensation.

+
img_index : +

index of the image on which exposure compensator will be applied

+
image1 : +

an image

+
image2 : +

an image

+
image3 : +

an image

+
image4 : +

an image

+
image5 : +

an image

+
image6 : +

an image

+ +

Description

+

y = exposure(algo_type,img_index,image1,image2) returns an image whose exposure is compensated. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated which is required to do particular type of warping. +After warping is done exposure is compensated in an image whose index is mentioned.

+

+ +

Examples

+
a=imread('images/lenahi.jpg');
+b=imread('images/lenalow.jpg');
+algo_type=1;
+img_index=1;
+y=exposure(algo_type,img_index,a,b);
+imshow(y)
+ +

Authors

+
  • Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/findHomography.html b/help/en_US/scilab_en_US_help/findHomography.html deleted file mode 100755 index 38dee6f..0000000 --- a/help/en_US/scilab_en_US_help/findHomography.html +++ /dev/null @@ -1,94 +0,0 @@ - - - findHomography - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > findHomography - -

-

findHomography

-

This Function Finds a perspective transformation between two planes.

- - -

Calling Sequence

-
homographyMatrix=findHomography(points1,points2);
-homographyMatrix=findHomography(points1,points2,method);
-homographyMatrix=findHomography(points1,points2,method,threshold);
- -

Parameters

-
homographyMatrix: -

perspective transformation H between the source and the destination planes

-
points1: -

Coordinates of the points in the original plane

-
points2: -

Coordinates of the points in the target plane

-
method: -

Method used to computed a homography matrix.

-
threshold: -

Maximum allowed reprojection error to treat a point pair as an inlier.

-
Note: -

the number of points should be same in the points1 and points2

- -

Description

-

The function finds and returns the perspective transformation H between the source and the destination planes

-

- -

Examples

-
read first image
-z=imread("lena.jpeg",0);
-get points from first image
-yo=detectGFTTFeatures(z);
-read second image
-image=imread("lena2.jpg",0);
-yo1=detectGFTTFeatures(image);
-// call function with same number of points in both(first arg has 594 so passig 594 points from second arg)
-lou=findHomography(yo.KeyPoints,yo1.KeyPoints(1:594,:));
-
- - - - diff --git a/help/en_US/scilab_en_US_help/fitellipse.html b/help/en_US/scilab_en_US_help/fitellipse.html deleted file mode 100755 index 11ebb1e..0000000 --- a/help/en_US/scilab_en_US_help/fitellipse.html +++ /dev/null @@ -1,82 +0,0 @@ - - - fitellipse - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > fitellipse - -

-

fitellipse

-

The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all.

- - -

Calling Sequence

-
felli=fitellipse(points);
- -

Parameters

-
felli: -

a struct containing all the details about the ellipse Params.

-
points: -

Input 2D point set

- -

Description

-

-

The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all.

-

- -

Examples

-
// read image
-z=imread("lena.jpeg",0);
-//get points using KAZE detector or the points can also be hardcoded.
-pio=detectKAZEFeatures(z);
-// call function
-sss=fitellipse(pio.KeyPoints)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/graycoprops.html b/help/en_US/scilab_en_US_help/graycoprops.html deleted file mode 100755 index 3c247ce..0000000 --- a/help/en_US/scilab_en_US_help/graycoprops.html +++ /dev/null @@ -1,97 +0,0 @@ - - - graycoprops - - - -
- - - - -
- << fitellipse - - - FOSSEE_Image_Processing_Toolbox - - - imfuse >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > graycoprops - -

-

graycoprops

-

- - -

Calling Sequence

-
z=imread("lena.jpeg"); //in grayscale or color
-//Note: z can be a image or simply a Matrix.
-gray=graycoprops(z)   //get all 4 properties
-gray=graycoprops(z,"contrast") //compute only contrast
-gray=graycoprops(z,["contrast" "energy"]) //compute contrast and energy.the properties can be passed in any order
-gray=graycoprops(z,["contrast" "correlation" "energy"])
-gray=graycoprops(z,["contrast" "correlation" "energy" "homogeneity"])
- -

Parameters

-
gray: -

A struct containing all the parameters

-
z: -

A image or a matrix

-
contrast: -

a measure of the intensity contrast between a pixel and its neighbor over the whole image.

-
energy: -

the sum of squared elements

-
homogeneity: -

a value that measures the closeness of the distribution of elements.

-
correlation: -

a measure of how correlated a pixel is to its neighbor over the whole image

- -

Description

-

This function computes the Properties of gray-level co-occurrence matrix.The properties being "correlation","contrast","energy" and "homogeneity".

-

-

- -

Examples

-
//compute for a image
-z=imread("lena.jpeg",0);
-sss=graycoprops(z,["contrast"])
-
-//compute for a matrix
-glcm = [0 1 2 3;1 1 2 3;1 0 2 0;0 0 0 3]
-sss=graycoprops(glcm,["contrast" "energy" "correlation"])
-
- - - - diff --git a/help/en_US/scilab_en_US_help/imattributes.html b/help/en_US/scilab_en_US_help/imattributes.html new file mode 100644 index 0000000..f4f3487 --- /dev/null +++ b/help/en_US/scilab_en_US_help/imattributes.html @@ -0,0 +1,83 @@ + + + imattributes + + + +
+ + + + +
+ << exposure + + + FOSSEE Image Processing Toolbox + + + knn >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > imattributes + +

+

imattributes

+

Provides information about image attributes.

+ + +

Calling Sequence

+
inputImage=imread('path of the image file')
+imattributes(inputImage)
+ +

Parameters

+
inputImage : +

an image.

+ +

Description

+

imattributes gives image attribute information in the form of a 4-by-2 or 6-by-2 cell array, depending on the image type. +The first column of the cell array contains the name of the attribute. +The second column contains the value of the attribute. Both attribute names and values are character vectors +'Minimum intensity': Regarding intensity images, this value represents the lowest intensity value of any pixel. In case ofindexed images, this value represents the lowest index value into a color map. +'Maximum intensity':Regarding intensity images, this value represents the highest intensity value of any pixel. In case of indexed images, this value represents the highest index value into a color map.

+

+ +

Examples

+
inputImage=imread('images/lena.jpeg');
+imattributes(inputImage)
+ +

Authors

+
  • Dhruti Shah , Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/imread.html b/help/en_US/scilab_en_US_help/imread.html deleted file mode 100755 index 12094f4..0000000 --- a/help/en_US/scilab_en_US_help/imread.html +++ /dev/null @@ -1,108 +0,0 @@ - - - imread - - - -
- - - - -
- << impixel - - - FOSSEE_Image_Processing_Toolbox - - - imsharpen >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > imread - -

-

imread

-

- - -

Calling Sequence

-
image=imread("image_path");
-image=imread("image_path",options)
- -

Parameters

-
image_path: -

a String which contains the path of the image that is to be read.

-
options: -

an Integer, containing the option for user to specify. See below for details.

-
0 : -

convert image to the single channel grayscale image.

-
1 : -

convert image to the 3 channel BGR color image.

-
2 : -

load 16-bit/32-bit image when the input image has the corresponding depth, otherwise convert it to 8-bit.

-
4 : -

the image is read in any possible color format.

-
8 : -

use the gdal driver for loading the image.

-
16 : -

convert image to the single channel grayscale image and the image size reduced 1/2.

-
17 : -

convert image to the 3 channel BGR color image and the image size reduced 1/2.

-
32 : -

convert image to the single channel grayscale image and the image size reduced 1/4.

-
33 : -

convert image to the 3 channel BGR color image and the image size reduced 1/4.

-
64 : -

convert image to the single channel grayscale image and the image size reduced 1/8.

-
65 : -

convert image to the 3 channel BGR color image and the image size reduced 1/8.

-
128 : -

do not rotate the image according to EXIF's orientation flag.

- -

Description

-

This function is used to Read/Load an image from the disk

-

-

- -

Examples

-
Read a image as it is(Unchanged).
-//Calling imread
-image=imread("test.jpg");
-
-Read image as grayscale
-//Calling imread
-image=imread("test.jpg",0);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/imresize.html b/help/en_US/scilab_en_US_help/imresize.html deleted file mode 100755 index b3aec70..0000000 --- a/help/en_US/scilab_en_US_help/imresize.html +++ /dev/null @@ -1,83 +0,0 @@ - - - imresize - - - -
- - - - -
- << imread - - - FOSSEE_Image_Processing_Toolbox - - - imsharpen >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > imresize - -

-

imresize

-

This function is used to resize the image

- - -

Calling Sequence

-
newImage=imresize(inputImage,alpha,beta);
- -

Parameters

-
newImage: -

the new resized image

-
inputImage: -

the image which should be resized.

-
alpha: -

new number of rows.

-
beta: -

new number of columns.

- -

Description

-

-

This function is used to resize the image

-

- -

Examples

-
z=imread("lena.jpeg",0);
-zz=imresize(z,35,12);
-imshow(zz)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/index.html b/help/en_US/scilab_en_US_help/index.html deleted file mode 100755 index 651ec0d..0000000 --- a/help/en_US/scilab_en_US_help/index.html +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - -
- - - - -
- - - - - -
-
-
- - - - -

-

FOSSEE Image Processing Toolbox

- -
- -
- - - - - - -
Report an issue
- - - - - -
-
-
- - diff --git a/help/en_US/scilab_en_US_help/indexImages.html b/help/en_US/scilab_en_US_help/indexImages.html deleted file mode 100755 index ad4089d..0000000 --- a/help/en_US/scilab_en_US_help/indexImages.html +++ /dev/null @@ -1,93 +0,0 @@ - - - indexImages - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > indexImages - -

-

indexImages

-

This function creates image search index

- - -

Calling Sequence

-
imageIndex = indexImages(imgSet, bagOfFeatures, Name, Value... );
- -

Parameters

-
imgSet: -

Collection of images with their location and labels

-
bagOfFeatures: -

Bag of Visual Words

-
Verbose [Optional Input Argument]: -

Enable Progress display to Screen

-
SaveFeatureLocations [Optional Input Argument]: -

A boolean value indicating whether feature locations has to be saved or not. Values: [True(default)|False]

-
imageIndex: -

Search Index Object containing the mapping of visual vocabulary to each image in the image set

- -

Description

-

Creates a search Index Object that has been mapped to visual words that can be used for retrieve Images

-

- -

Examples

-
imgSet = imageSet(directory,'recursive');
-[trainingSet testSet] = partition(imgSet,[0.8]);
-bag = bagOfFeatures(trainingSet);
-imageindex = indexImages(trainingSet, bag);
-
-With Optional Arguments:
-imageindex = indexImages(trainingSet, bag, "Verbose", 1);
- -

Authors

-
  • Umang Agrawal
  • -
  • Rohit Suri
  • -
  • Sridhar Reddy
-
- - - - diff --git a/help/en_US/scilab_en_US_help/integralKernel.html b/help/en_US/scilab_en_US_help/integralKernel.html deleted file mode 100755 index 4a57ef6..0000000 --- a/help/en_US/scilab_en_US_help/integralKernel.html +++ /dev/null @@ -1,83 +0,0 @@ - - - integralKernel - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > integralKernel - -

-

integralKernel

-

This function creates a filter to be used with integral images.

- - -

Calling Sequence

-
results = intergralKernel(bbox, weight);
- -

Parameters

-
results: -

A structure kernel which contains bounding boxes, weights, filter coefficients, center of filter, size of filter, orientation of filter

-
bboxes: -

bounding boxes that define the filter

-
weights: -

weights corresponding to each of the bbox

- -

Description

-

Integral kernel creates box filter which can be used with integral images.

-

- -

Examples

-
bbox = [1 2 3 4; 5 6 7 8];
-weights = [10 11];
-results = integralKernel(bbox, weights);
- -

Authors

-
  • Tanmay Chaudhari
-
- - - - diff --git a/help/en_US/scilab_en_US_help/jhelpidx.xml b/help/en_US/scilab_en_US_help/jhelpidx.xml old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/jhelpmap.jhm b/help/en_US/scilab_en_US_help/jhelpmap.jhm old mode 100755 new mode 100644 index cdbcb20..050a670 --- a/help/en_US/scilab_en_US_help/jhelpmap.jhm +++ b/help/en_US/scilab_en_US_help/jhelpmap.jhm @@ -2,4 +2,29 @@ +<<<<<<< HEAD + + + + + + + + + + + + + + + + + + + + + + +======= +>>>>>>> 404a7f2a4f72456d4df64dde1e76243bd43b9e42 \ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/jhelpset.hs b/help/en_US/scilab_en_US_help/jhelpset.hs old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/jhelptoc.xml b/help/en_US/scilab_en_US_help/jhelptoc.xml old mode 100755 new mode 100644 index 5ef8b88..2da9911 --- a/help/en_US/scilab_en_US_help/jhelptoc.xml +++ b/help/en_US/scilab_en_US_help/jhelptoc.xml @@ -2,5 +2,31 @@ +<<<<<<< HEAD + + + + + + + + + + + + + + + + + + + + + + + +======= +>>>>>>> 404a7f2a4f72456d4df64dde1e76243bd43b9e42 \ No newline at end of file diff --git a/help/en_US/scilab_en_US_help/matMulDeriv.html b/help/en_US/scilab_en_US_help/matMulDeriv.html deleted file mode 100755 index e9beb04..0000000 --- a/help/en_US/scilab_en_US_help/matMulDeriv.html +++ /dev/null @@ -1,79 +0,0 @@ - - - matMulDeriv - - - -
- - - - -
- << line - - - FOSSEE_Image_Processing_Toolbox - - - mean1 >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > matMulDeriv - -

-

matMulDeriv

-

this function Computes partial derivatives of the matrix product for each multiplied matrix

- - -

Calling Sequence

-
[da db]=matMulDeriv(A,B);
- -

Parameters

-
- -

Description

-

this function Computes partial derivatives of the matrix product for each multiplied matrix

- -

Examples

-
Declare mattrices
-a=[1 2 ;3 4];
-b=[1 2 ;3 4];
-//call function
-[da db]=matMulDeriv(a,b);
-//view output
-da
-db
-
- -
- - - - - - -
Report an issue
- << line - - - FOSSEE_Image_Processing_Toolbox - - - mean1 >> - -
-
-
- - diff --git a/help/en_US/scilab_en_US_help/match.html b/help/en_US/scilab_en_US_help/match.html new file mode 100644 index 0000000..b3d4bc5 --- /dev/null +++ b/help/en_US/scilab_en_US_help/match.html @@ -0,0 +1,84 @@ + + + match + + + +
+ + + + +
+ << knn + + + FOSSEE Image Processing Toolbox + + + opticalflow >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > match + +

+

match

+

Performs matching features between two images.

+ + +

Calling Sequence

+
img1=imread('path of the image file')
+img2=imread('path of the image file')
+x=match(img1,img2)
+ +

Parameters

+
img1 : +

an image

+
img2 : +

an image

+ +

Description

+

The images pass through a stiching pipeline. +Features are extracted from each image and matching is done on two images.

+

+ +

Examples

+
img1=imread('images/campus_000.jpg');
+img2=imread('images/campus_001.jpg');
+x=match(img1,img2);
+ +

Authors

+
  • Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/opticalflow.html b/help/en_US/scilab_en_US_help/opticalflow.html new file mode 100644 index 0000000..fd444c3 --- /dev/null +++ b/help/en_US/scilab_en_US_help/opticalflow.html @@ -0,0 +1,78 @@ + + + opticalflow + + + +
+ + + + +
+ << match + + + FOSSEE Image Processing Toolbox + + + pana >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > opticalflow + +

+

opticalflow

+

Calculates optical flow.

+ + +

Calling Sequence

+
opticalflow(vid)
+ +

Parameters

+
vid : +

a video

+ +

Description

+

opticalflow(vid) returns an opticalflow video and it will be written to 'out.avi' file (In the current working directory).

+

+ +

Examples

+
opticalflow('ball.mp4');
+opticalflow('vtest.avi');
+ +

Authors

+
  • Manoj Sree Harsha , M Avinash Reddy
+
+ +
+ + + + + + +
Report an issue
+ << match + + + FOSSEE Image Processing Toolbox + + + pana >> + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/pana.html b/help/en_US/scilab_en_US_help/pana.html new file mode 100644 index 0000000..d7d6952 --- /dev/null +++ b/help/en_US/scilab_en_US_help/pana.html @@ -0,0 +1,117 @@ + + + pana + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > pana + +

+

pana

+

Creates the output panorama image using two or more images

+ + +

Calling Sequence

+
stacksize('max')
+img1=imread('path of the image file')
+img2=imread('path of the image file')
+out = pana(img1,img2)
+img3=imread('path of the image file')
+out = pana(img1,img2,img3)
+img4=imread('path of the image file')
+out = pana(img1,img2,img3,img4)
+img5=imread('path of the image file')
+out = pana(img1,img2,img3,img4,img5)
+img6=imread('path of the image file')
+out = pana(img1,img2,img3,img4,img5,img6)
+ +

Parameters

+
img1 : +

an image

+
img2 : +

an image

+
img3 : +

an image

+
img4 : +

an image

+
img5 : +

an image

+
img6 : +

an image

+ +

Description

+

The images pass through a stiching pipeline before the final panorama is formed. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated which is required to do particular type of warping. +After warping is done exposure is compensated in all images so as to get a uniform exposure throughout the panaroma. +Seam estimation is done next to get the exact portions of images to be blended. +Finally, the images are blended to form the panorama.

+

+ +

Examples

+
stacksize('max');
+img1=imread('images/campus_017.jpg');
+img2=imread('images/campus_016.jpg');
+img3=imread('images/campus_015.jpg');
+img4=imread('images/campus_014.jpg');
+img5=imread('images/campus_013.jpg');
+img6=imread('images/campus_012.jpg');
+out=pana(img1,img2,img3,img4,img5,img6);
+ +

Examples

+
stacksize('max');
+a=imread('images/s1.jpg');
+b=imread('images/s2.jpg');
+c=imread('images/s3.jpg');
+y=pana(a,b,c);
+ +

Authors

+
  • M Avinash Reddy , Manoj Sree Harsha , Ebey Abraham
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/pclradius.html b/help/en_US/scilab_en_US_help/pclradius.html new file mode 100644 index 0000000..c1dc7d0 --- /dev/null +++ b/help/en_US/scilab_en_US_help/pclradius.html @@ -0,0 +1,93 @@ + + + pclradius + + + +
+ + + + +
+ << pana + + + FOSSEE Image Processing Toolbox + + + radius >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > pclradius + +

+

pclradius

+

Finds all the points within the circle of radius r with centre as query point q, in the pointcloud pcloud

+ + +

Calling Sequence

+
y = pclradius(pcloud,q,r)
+ +

Parameters

+
pcloud : +

pointCloud object.

+
q : +

a row vector containing the query point

+
r : +

a positive integer specifying the radius.

+
out : +

a matrix.

+ +

Description

+

out = pclradius(pcloud,q,r) return a 2x(Number of points) matrix . +The first row of out contains the indices of all the points in the pointCloud within the circle of radius r. +The second row contains the corresponding squared distances(squared euclidean distance).

+

+ +

Examples

+
a=pcread('data/cube.ply');
+q=[1 1 -1];
+r=10;
+out=pclradius(a,q,r);
+
+a=pcread('data/bun0.pcd');
+q=[0.5 0.5 0.5];
+r=2;
+out=pclradius(a,q,r);
+ +

Authors

+
  • Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/radius.html b/help/en_US/scilab_en_US_help/radius.html new file mode 100644 index 0000000..c1f731c --- /dev/null +++ b/help/en_US/scilab_en_US_help/radius.html @@ -0,0 +1,89 @@ + + + radius + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > radius + +

+

radius

+

Finds all the points within the circle of radius r with centre as query point q, in the dataset f

+ + +

Calling Sequence

+
y = radius(q,f,r)
+y = radius(q,f,r,algo_type)
+ +

Parameters

+
q : +

a row vector containing the query point

+
f : +

f is the set of data points and the number of columns in f should be same as that of q to match point dimensionality

+
r : +

a positive integer specifying the radius.

+
algo_type : +

a integer between 1 and 4 (both inclusive) specifying the algorithm to be used for the radius search.

+ +

Description

+

y = radius(q,f,r) return a 2x(Number of points) matrix . +The first row of y contains the indices of all the points in the dataset(f) within the circle of radius r. +The second row contains the corresponding distances(squared euclidean distance).

+

+ +

Examples

+
q=[1 2 3];
+f=[1 2 3;4 5 6;7 8 9];
+r=30;
+y=radius(q,f,r);
+ +

Authors

+
  • Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/rgb2xyz.html b/help/en_US/scilab_en_US_help/rgb2xyz.html deleted file mode 100755 index c5524c2..0000000 --- a/help/en_US/scilab_en_US_help/rgb2xyz.html +++ /dev/null @@ -1,80 +0,0 @@ - - - rgb2xyz - - - -
- - - - -
- << rgb2ntsc - - - FOSSEE_Image_Processing_Toolbox - - - sobel >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > rgb2xyz - -

-

rgb2xyz

-

This function is used to convert rgb values of an image to their CIE 1931 xyz.

- - -

Calling Sequence

-
image=imread("lena.jpeg");
-xyz=imread(image);
- -

Parameters

-
xyz: -

the converted image

-
image: -

Input Image.

- -

Description

-

-

This function is used to convert rgb values of an image to their CIE 1931 xyz.

-

- -

Examples

-
z=imread("lena.jpeg");
-xyz=rgb2xyz(z);
-imshow(xyz);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/rotationVectorToMatrix.html b/help/en_US/scilab_en_US_help/rotationVectorToMatrix.html new file mode 100644 index 0000000..af5b24c --- /dev/null +++ b/help/en_US/scilab_en_US_help/rotationVectorToMatrix.html @@ -0,0 +1,80 @@ + + + rotationVectorToMatrix + + + +
+ + + + +
+ << radius + + + FOSSEE Image Processing Toolbox + + + rotestimate >> + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > rotationVectorToMatrix + +

+

rotationVectorToMatrix

+

Returns rotation matrix.

+ + +

Calling Sequence

+
matrix = rotationVectorToMatrix(vector);
+ +

Parameters

+
matrix: +

rotation matrix

+
vector: +

3-D rotation vector

+ +

Description

+

Converts rotation vector to rotation matrix.

+

+ +

Examples

+
vector = pi/4 * [1, 2, 3];
+matrix = rotationVectorToMatrix(vector);
+ +

Authors

+
  • Tanmay Chaudhari
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/rotestimate.html b/help/en_US/scilab_en_US_help/rotestimate.html new file mode 100644 index 0000000..9bcffdd --- /dev/null +++ b/help/en_US/scilab_en_US_help/rotestimate.html @@ -0,0 +1,104 @@ + + + rotestimate + + + + + + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox > rotestimate + +

+

rotestimate

+

Estimates camera intrinsic parameters matrix(K).

+ + +

Calling Sequence

+
img1=imread('path of the image file')
+img2=imread('path of the image file')
+res = rotestimate(cam_index,img1,img2)
+img3=imread('path of the image file')
+res = rotestimate(cam_index,img1,img2,img3)
+img4=imread('path of the image file')
+res = rotestimate(cam_index,img1,img2,img3,img4)
+img5=imread('path of the image file')
+res = rotestimate(cam_index,img1,img2,img3,img4,img5)
+img6=imread('path of the image file')
+res = rotestimate(cam_index,img1,img2,img3,img4,img5,img6)
+ +

Parameters

+
cam_index : +

cam_index of the camera for which K is returned.

+
img1 : +

an image

+
img2 : +

an image

+
img3 : +

an image

+
img4 : +

an image

+
img5 : +

an image

+
img6 : +

an image

+ +

Description

+

The images pass through a stiching pipeline. +Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. +After this camera parameters are estimated.

+

+ +

Examples

+
img1=imread('images/campus_000.jpg');
+img2=imread('images/campus_001.jpg');
+cam_index=1
+res=rotestimate(1,img1,img2);
+ +

Authors

+
  • Manoj Sree Harsha
+
+ + + + diff --git a/help/en_US/scilab_en_US_help/scilab_code.css b/help/en_US/scilab_en_US_help/scilab_code.css old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/section_df69b7946d692d1fc3c4781d13d82733.html b/help/en_US/scilab_en_US_help/section_df69b7946d692d1fc3c4781d13d82733.html new file mode 100644 index 0000000..853e895 --- /dev/null +++ b/help/en_US/scilab_en_US_help/section_df69b7946d692d1fc3c4781d13d82733.html @@ -0,0 +1,175 @@ + + + + + + +
+ + + + +
+ + + FOSSEE Image Processing Toolbox + + + +
+
+
+ + + + FOSSEE Image Processing Toolbox >> FOSSEE Image Processing Toolbox + +

+

FOSSEE Image Processing Toolbox

+ +
+ +
+ + + + + + +
Report an issue
+ + + FOSSEE Image Processing Toolbox + + + +
+
+
+ + diff --git a/help/en_US/scilab_en_US_help/stereoCalibrate.html b/help/en_US/scilab_en_US_help/stereoCalibrate.html deleted file mode 100755 index 2df02e9..0000000 --- a/help/en_US/scilab_en_US_help/stereoCalibrate.html +++ /dev/null @@ -1,132 +0,0 @@ - - - stereoCalibrate - - - -
- - - - -
- << sobel - - - FOSSEE_Image_Processing_Toolbox - - - threshold >> - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > stereoCalibrate - -

-

stereoCalibrate

-

this function Performs stereo calibration for the fisheye model.

- - -

Calling Sequence

-
stereo=stereoCalibrate(objectpoints,imagepoints1,imagepoints2);
-stereo=stereoCalibrate(objectpoints,imagepoints1,imagepoints2,cameraMatrix1,distCoeffs1,cameraMatrix2,distCoeffs2);
- -

Parameters

-
stereo: -

a Struct containing all the camera Params

-
objectpoints: -

a 2d set of actual object points.

-
imagepoints1: -

a list of imagepoints of image1.

-
imagepoints2: -

a list of imagepoints of image2.

-
cameraMatrix1: -

camera matrix of first camera.

-
distCoeffs1: -

distortion coefficients of first camera.it should be 4*1 or 1*4.

-
cameraMatrix2: -

camera matrix of second camera.

-
distCoeffs2: -

distortion coefficients of second camera.it should be 4*1 or 1*4.

- -

Description

-

-

this function Performs stereo calibration for the fisheye model.

-

- -

Examples

-
// A example to show calibration, using the traditional chessboard/checkerboard example.
-
-//generate checkerboardpoints for calibration
-yo=genCheckerboardPoints([7 10],8);
-//read first image
-z=imread("left1.jpg",0);
-//read second image
-image=imread("right1.jpg",0);
-//detect checkerboardpoints for image 1
-ii=detectCheckerboardCorner(z,[7 10]);
-//detect checkerboardpoints for image 2
-ii2=detectCheckerboardCorner(image,[7 10]);
-//convert imagepoints to list
-ii=list(ii);
-ii2=list(ii2);
-// call function
-final=stereoCalibrate(yo,ii,ii2);
-// show the struct
-final
-// use the above calibration further
-uu = undistortImage(image,final.cameraMatrix2);
-imshow(uu);
-
-//generate checkerboardpoints for calibration
-yo=genCheckerboardPoints([7 10],8);
-//read first image
-z=imread("left1.jpg",0);
-//read second image
-image=imread("right1.jpg",0);
-//detect checkerboardpoints for image 1
-ii=detectCheckerboardCorner(z,[7 10]);
-//detect checkerboardpoints for image 2
-ii2=detectCheckerboardCorner(image,[7 10]);
-//convert imagepoints to list
-ii=list(ii);
-ii2=list(ii2);
-// call function
-final=stereoCalibrate(yo,ii,ii2);
-// show the struct
-final
-// use the above calibration further
-uu = undistortImage(image,final.cameraMatrix2,'distCoeffs',final.distortionCoefficients2);
-imshow(uu);
-
- - - - diff --git a/help/en_US/scilab_en_US_help/style.css b/help/en_US/scilab_en_US_help/style.css old mode 100755 new mode 100644 diff --git a/help/en_US/scilab_en_US_help/trainSVMClassifier.html b/help/en_US/scilab_en_US_help/trainSVMClassifier.html deleted file mode 100755 index c84a288..0000000 --- a/help/en_US/scilab_en_US_help/trainSVMClassifier.html +++ /dev/null @@ -1,136 +0,0 @@ - - - trainSVMClassifier - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > trainSVMClassifier - -

-

trainSVMClassifier

-

This function is used to train an image classifier using the SVM(Support Vector Machines) Model.

- - -

Calling Sequence

-
imgSet = imageSet(directory,'recursive');
-'or'
-imgSet = imageSet(image);
-bag = bagOfFeatures(imgSet);
-classifier = trainSVMClassifier(imgSets, bag);
-classifier = trainSVMClassifier(imgSets, bag,'nameclass')
-classifier = trainSVMClassifier(imgSets, bag,'nameclass')
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C)
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff)
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree)
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma)
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu)
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu,P)
-classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu,P,setType)
- -

Parameters

-
classifier: -

Image category classifier location

-
BagofFeaturesLocation : -

location of the xml or yml file.

-
Description : -

features obtained after training.

-
imgSets: -

Input imageSet to train the classifier on

-
bag: -

The bagOfFeatures of the imageSet provided

-
image: -

The set of images used for creating the imageset used for training

-
nameclass: -

Name of the classifier one wants for their trained model .xml or .yml file

-
C: -

Parameter C of a SVM optimization problem that should be used to train the model

-
coef: -

Parameter coef0 of a kernel function that should be used to train the model

-
degree: -

Parameter degree of a kernel function that should be used to train the model

-
gamma: -

Parameter γ of a kernel function that should be used to train the model.

-
kernelType: -

Type of a SVM kernel that should be used to train the model.it should be [-1,5].

-
Nu: -

Parameter ν of a SVM optimization problem that should be used to train the model.

-
P: -

Parameter ϵ of a SVM optimization problem that should be used to train the model.

-
type: -

Type of a SVM formulation that should be used to train the model.it should be [100,104].

- -

Description

-

this function is used to train an image classifier using the SVM(Support Vector Machines) Model.

-

-

- -

Examples

-
//get imageset from 'images2' folder
-image=imageSet('images2','recursive');
-//get bag of features
-x=bagOfFeatures(image);
-//train thew model and name the saved .yml file as "SVM"
-d=trainSVMClassifier(image,x,"SVM");
-//read image to get prediction from mthe above trained data
-z=imread("fish.jpg");
-//finally predict the class using SVM's prediction function for the input image
-resp=predict(d,z,"SVM");
-
-//get imageset from 'images2' folder
-image=imageSet('images2','recursive');
-//get bag of features
-x=bagOfFeatures(image);
-//train the model with the given parameters  and name  the saved .yml file as "SVM"
-d=trainSVMClassifier(image,x,"SVM",1.1,0.2);
-//read image to get prediction from mthe above trained data
-z=imread("fish.jpg");
-//finally predict the class for the input image
-resp=predict(d,z,"SVM");
-
- - - - diff --git a/help/en_US/scilab_en_US_help/trainSVMSGDClassifier.html b/help/en_US/scilab_en_US_help/trainSVMSGDClassifier.html deleted file mode 100755 index 0315f73..0000000 --- a/help/en_US/scilab_en_US_help/trainSVMSGDClassifier.html +++ /dev/null @@ -1,130 +0,0 @@ - - - trainSVMSGDClassifier - - - - - - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > trainSVMSGDClassifier - -

-

trainSVMSGDClassifier

-

This function is used to train an image classifier using the SVMSGD(Stochastic Gradient Descent SVM) Model.

- - -

Calling Sequence

-
imgSet = imageSet(directory,'recursive');
-'or'
-imgSet = imageSet(image);
-bag = bagOfFeatures(imgSet);
-classifier = trainSVMSGDClassifier(imgSets, bag);`
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass')
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass')
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize)
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg)
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType)
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams)
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams,stepDecreasingPower)
-classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams,stepDecreasingPower,svmsgdType)
- -

Parameters

-
classifier: -

Image category classifier location

-
BagofFeaturesLocation : -

location of the xml or yml file.

-
Description : -

features obtained after training.

-
imgSets: -

Input imageSet to train the classifier on

-
bag: -

The bagOfFeatures of the imageSet provided

-
image: -

The set of images used for creating the imageset used for training

-
nameclass: -

Name of the classifier one wants for their trained model .xml or .yml file

-
initialStepSize: -

Parameter initialStepSize of a SVMSGD optimization problem that should be used to train the model.

-
marginReg: -

Parameter marginRegularization of a SVMSGD optimization problem that should be used to train the model

-
marginType: -

Parameter marginType of a SVMSGD optimization problem that should be used to train the model.it should be either 0 or 1.

-
optimalParams: -

sets optimal parameters values for chosen SVM SGD model.

-
stepDecreasingPower: -

Parameter stepDecreasingPower of a SVMSGD optimization problem that should be used to train the model.

-
svmsgdType: -

Algorithm type of SVMSGD that should be used to train the model.it should be either 0 or 1.

- -

Description

-

This function is used to train an image classifier using the SVMSGD(Stochastic Gradient Descent SVM) Model.

-

- -

Examples

-
//get imageset from 'images2' folder
-image=imageSet('images2','recursive');
-//get bag of features
-x=bagOfFeatures(image);
-//train thew model and name the saved .yml file as "pbrr" using the given parameters
-r=trainSVMSGDClassifier(image,x,"pbrr",0,0,0,1,0,1);
-//read image to get prediction from the above trained data
-z=imread("fish.jpg");
-//finally predict the class using SVMSGD's prediction function for the input image
-resp=predict(r,z,"SVMSGD");
-
-//get imageset from 'images2' folder
-image=imageSet('images2','recursive');
-//get bag of features
-x=bagOfFeatures(image);
-//train the model and name the saved .yml file as "pbrr"
-r=trainSVMSGDClassifier(image,x,"pbrr");
-//read image to get prediction from the above trained data
-z=imread("fish.jpg");
-//finally predict the class using SVMSGD's prediction function for the input image
-resp=predict(r,z,"SVMSGD");
-
- - - - diff --git a/help/en_US/scilab_en_US_help/undistortPoints.html b/help/en_US/scilab_en_US_help/undistortPoints.html deleted file mode 100755 index 097ad48..0000000 --- a/help/en_US/scilab_en_US_help/undistortPoints.html +++ /dev/null @@ -1,87 +0,0 @@ - - - undistortPoints - - - -
- - - - -
- << undistortImage - - - FOSSEE_Image_Processing_Toolbox - - - -
-
-
- - - - FOSSEE_Image_Processing_Toolbox >> FOSSEE_Image_Processing_Toolbox > undistortPoints - -

-

undistortPoints

-

Returns the ideal point coordinates from the observed point coordinates

- - -

Calling Sequence

-
[idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat)
- -

Parameters

-
observedPoints: -

1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2).

-
camMat: -

\vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1}

-
disCoefMat: -

Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed.

-
rectMat: -

Rectification transformation in the object space (3x3 matrix). If the matrix is empty, the identity transformation is used.

-
newCamMat: -

New camera matrix (3x3) or new projection matrix (3x4. If the matrix is empty, the identity new camera matrix is used.

-
idealPoints: -

ideal point coordinates matrix. If matrix newCamMat is identity or omitted, idealPoints will contain normalized point coordinates.

- -

Description

-

Returns the ideal points coordinates from the observed point coordinates after undistortion and reverse perpective transformation.

-

- -

Examples

-
[observedPoints] = [1 2 3 4; 4 3 2 1]
-[camMat] = [450 0 231; 0 876.3 87.1; 0 0 1]
-[disCoefMat] = [3 2 0 9]
-[rectMat] = [1 0 0; 0 1 0; 0 0 1]
-[newCamMat] = []
-[idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat)
-
- - - - diff --git a/help/en_US/scilab_en_US_help/xml_code.css b/help/en_US/scilab_en_US_help/xml_code.css old mode 100755 new mode 100644 diff --git a/help/en_US/stereoCalibrate.xml b/help/en_US/stereoCalibrate.xml deleted file mode 100755 index dc83117..0000000 --- a/help/en_US/stereoCalibrate.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - stereoCalibrate - this function Performs stereo calibration for the fisheye model. - - - - - Calling Sequence - - - stereo=stereoCalibrate(objectpoints,imagepoints1,imagepoints2); - stereo=stereoCalibrate(objectpoints,imagepoints1,imagepoints2,cameraMatrix1,distCoeffs1,cameraMatrix2,distCoeffs2); - - - - - - Parameters - - stereo: - a Struct containing all the camera Params - objectpoints: - a 2d set of actual object points. - imagepoints1: - a list of imagepoints of image1. - imagepoints2: - a list of imagepoints of image2. - cameraMatrix1: - camera matrix of first camera. - distCoeffs1: - distortion coefficients of first camera.it should be 4*1 or 1*4. - cameraMatrix2: - camera matrix of second camera. - distCoeffs2: - distortion coefficients of second camera.it should be 4*1 or 1*4. - - - - - Description - - - -this function Performs stereo calibration for the fisheye model. - - - - - - - Examples - - - diff --git a/help/en_US/trainSVMClassifier.xml b/help/en_US/trainSVMClassifier.xml deleted file mode 100755 index fb20ded..0000000 --- a/help/en_US/trainSVMClassifier.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - trainSVMClassifier - This function is used to train an image classifier using the SVM(Support Vector Machines) Model. - - - - - Calling Sequence - - imgSet = imageSet(directory,'recursive'); - 'or' - imgSet = imageSet(image); - bag = bagOfFeatures(imgSet); - classifier = trainSVMClassifier(imgSets, bag); - classifier = trainSVMClassifier(imgSets, bag,'nameclass') - classifier = trainSVMClassifier(imgSets, bag,'nameclass') - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C) - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff) - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree) - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma) - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu) - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu,P) - classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu,P,setType) - - - - - - Parameters - - classifier: - Image category classifier location - BagofFeaturesLocation : - location of the xml or yml file. - Description : - features obtained after training. - imgSets: - Input imageSet to train the classifier on - bag: - The bagOfFeatures of the imageSet provided - image: - The set of images used for creating the imageset used for training - nameclass: - Name of the classifier one wants for their trained model .xml or .yml file - C: - Parameter C of a SVM optimization problem that should be used to train the model - coef: - Parameter coef0 of a kernel function that should be used to train the model - degree: - Parameter degree of a kernel function that should be used to train the model - gamma: - Parameter γ of a kernel function that should be used to train the model. - kernelType: - Type of a SVM kernel that should be used to train the model.it should be [-1,5]. - Nu: - Parameter ν of a SVM optimization problem that should be used to train the model. - P: - Parameter ϵ of a SVM optimization problem that should be used to train the model. - type: - Type of a SVM formulation that should be used to train the model.it should be [100,104]. - - - - - Description - -this function is used to train an image classifier using the SVM(Support Vector Machines) Model. - - - - - - - - - Examples - - - diff --git a/help/en_US/trainSVMSGDClassifier.xml b/help/en_US/trainSVMSGDClassifier.xml deleted file mode 100755 index f30584c..0000000 --- a/help/en_US/trainSVMSGDClassifier.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - trainSVMSGDClassifier - This function is used to train an image classifier using the SVMSGD(Stochastic Gradient Descent SVM) Model. - - - - - Calling Sequence - - imgSet = imageSet(directory,'recursive'); - 'or' - imgSet = imageSet(image); - bag = bagOfFeatures(imgSet); - classifier = trainSVMSGDClassifier(imgSets, bag);` - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass') - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass') - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize) - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg) - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType) - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams) - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams,stepDecreasingPower) - classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams,stepDecreasingPower,svmsgdType) - - - - - - Parameters - - classifier: - Image category classifier location - BagofFeaturesLocation : - location of the xml or yml file. - Description : - features obtained after training. - imgSets: - Input imageSet to train the classifier on - bag: - The bagOfFeatures of the imageSet provided - image: - The set of images used for creating the imageset used for training - nameclass: - Name of the classifier one wants for their trained model .xml or .yml file - initialStepSize: - Parameter initialStepSize of a SVMSGD optimization problem that should be used to train the model. - marginReg: - Parameter marginRegularization of a SVMSGD optimization problem that should be used to train the model - marginType: - Parameter marginType of a SVMSGD optimization problem that should be used to train the model.it should be either 0 or 1. - optimalParams: - sets optimal parameters values for chosen SVM SGD model. - stepDecreasingPower: - Parameter stepDecreasingPower of a SVMSGD optimization problem that should be used to train the model. - svmsgdType: - Algorithm type of SVMSGD that should be used to train the model.it should be either 0 or 1. - - - - - Description - -This function is used to train an image classifier using the SVMSGD(Stochastic Gradient Descent SVM) Model. - - - - - - - Examples - - - diff --git a/help/en_US/undistortPoints.xml b/help/en_US/undistortPoints.xml deleted file mode 100755 index 4f9c08d..0000000 --- a/help/en_US/undistortPoints.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - undistortPoints - Returns the ideal point coordinates from the observed point coordinates - - - - - Calling Sequence - - [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) - - - - - - Parameters - - observedPoints: - 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). - camMat: - \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1} - disCoefMat: - Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. - rectMat: - Rectification transformation in the object space (3x3 matrix). If the matrix is empty, the identity transformation is used. - newCamMat: - New camera matrix (3x3) or new projection matrix (3x4. If the matrix is empty, the identity new camera matrix is used. - idealPoints: - ideal point coordinates matrix. If matrix newCamMat is identity or omitted, idealPoints will contain normalized point coordinates. - - - - - Description - -Returns the ideal points coordinates from the observed point coordinates after undistortion and reverse perpective transformation. - - - - - - - Examples - - - diff --git a/images/1.jpg b/images/1.jpg new file mode 100644 index 0000000..e9f5bee Binary files /dev/null and b/images/1.jpg differ diff --git a/images/1.png b/images/1.png new file mode 100644 index 0000000..a1d4b3c Binary files /dev/null and b/images/1.png differ diff --git a/images/1low.png b/images/1low.png new file mode 100644 index 0000000..6b138e2 Binary files /dev/null and b/images/1low.png differ diff --git a/images/2.png b/images/2.png new file mode 100644 index 0000000..68c7a75 Binary files /dev/null and b/images/2.png differ diff --git a/images/3.png b/images/3.png new file mode 100644 index 0000000..e800ee7 Binary files /dev/null and b/images/3.png differ diff --git a/images/3hi.png b/images/3hi.png new file mode 100644 index 0000000..51362b0 Binary files /dev/null and b/images/3hi.png differ diff --git a/images/4.png b/images/4.png new file mode 100644 index 0000000..931cfa1 Binary files /dev/null and b/images/4.png differ diff --git a/images/CCITT_1.TIF b/images/CCITT_1.TIF new file mode 100644 index 0000000..fe51399 Binary files /dev/null and b/images/CCITT_1.TIF differ diff --git a/images/G4S.TIF b/images/G4S.TIF new file mode 100644 index 0000000..31ff418 Binary files /dev/null and b/images/G4S.TIF differ diff --git a/images/b b/images/b new file mode 100644 index 0000000..b8755b3 Binary files /dev/null and b/images/b differ diff --git a/images/b1.jpg b/images/b1.jpg new file mode 100644 index 0000000..ffc44cf Binary files /dev/null and b/images/b1.jpg differ diff --git a/images/b1hi.jpg b/images/b1hi.jpg new file mode 100644 index 0000000..50dc68a Binary files /dev/null and b/images/b1hi.jpg differ diff --git a/images/b2.jpg b/images/b2.jpg new file mode 100644 index 0000000..8b94952 Binary files /dev/null and b/images/b2.jpg differ diff --git a/images/b3.jpg b/images/b3.jpg new file mode 100644 index 0000000..180e47b Binary files /dev/null and b/images/b3.jpg differ diff --git a/images/b4.jpg b/images/b4.jpg new file mode 100644 index 0000000..a4e9d22 Binary files /dev/null and b/images/b4.jpg differ diff --git a/images/campus_000.jpg b/images/campus_000.jpg new file mode 100644 index 0000000..2bfba8d Binary files /dev/null and b/images/campus_000.jpg differ diff --git a/images/campus_001.jpg b/images/campus_001.jpg new file mode 100644 index 0000000..8993474 Binary files /dev/null and b/images/campus_001.jpg differ diff --git a/images/campus_002.jpg b/images/campus_002.jpg new file mode 100644 index 0000000..90b8749 Binary files /dev/null and b/images/campus_002.jpg differ diff --git a/images/campus_003.jpg b/images/campus_003.jpg new file mode 100644 index 0000000..f78e7b1 Binary files /dev/null and b/images/campus_003.jpg differ diff --git a/images/campus_004.jpg b/images/campus_004.jpg new file mode 100644 index 0000000..c6ba5b1 Binary files /dev/null and b/images/campus_004.jpg differ diff --git a/images/campus_005.jpg b/images/campus_005.jpg new file mode 100644 index 0000000..66e4d87 Binary files /dev/null and b/images/campus_005.jpg differ diff --git a/images/campus_006.jpg b/images/campus_006.jpg new file mode 100644 index 0000000..0f44c50 Binary files /dev/null and b/images/campus_006.jpg differ diff --git a/images/campus_007.jpg b/images/campus_007.jpg new file mode 100644 index 0000000..d5ad621 Binary files /dev/null and b/images/campus_007.jpg differ diff --git a/images/campus_008.jpg b/images/campus_008.jpg new file mode 100644 index 0000000..3c5aa77 Binary files /dev/null and b/images/campus_008.jpg differ diff --git a/images/campus_009.jpg b/images/campus_009.jpg new file mode 100644 index 0000000..7717381 Binary files /dev/null and b/images/campus_009.jpg differ diff --git a/images/campus_010.jpg b/images/campus_010.jpg new file mode 100644 index 0000000..ad63293 Binary files /dev/null and b/images/campus_010.jpg differ diff --git a/images/campus_011.jpg b/images/campus_011.jpg new file mode 100644 index 0000000..1dfa809 Binary files /dev/null and b/images/campus_011.jpg differ diff --git a/images/campus_012.jpg b/images/campus_012.jpg new file mode 100644 index 0000000..909109b Binary files /dev/null and b/images/campus_012.jpg differ diff --git a/images/campus_013.jpg b/images/campus_013.jpg new file mode 100644 index 0000000..5568c6a Binary files /dev/null and b/images/campus_013.jpg differ diff --git a/images/campus_014.jpg b/images/campus_014.jpg new file mode 100644 index 0000000..8a17067 Binary files /dev/null and b/images/campus_014.jpg differ diff --git a/images/campus_015.jpg b/images/campus_015.jpg new file mode 100644 index 0000000..d04e729 Binary files /dev/null and b/images/campus_015.jpg differ diff --git a/images/campus_016.jpg b/images/campus_016.jpg new file mode 100644 index 0000000..91cc629 Binary files /dev/null and b/images/campus_016.jpg differ diff --git a/images/campus_017.jpg b/images/campus_017.jpg new file mode 100644 index 0000000..3a5ae8d Binary files /dev/null and b/images/campus_017.jpg differ diff --git a/images/card.png b/images/card.png new file mode 100644 index 0000000..6f01082 Binary files /dev/null and b/images/card.png differ diff --git a/images/cardhi.png b/images/cardhi.png new file mode 100644 index 0000000..e820eaa Binary files /dev/null and b/images/cardhi.png differ diff --git a/images/child(1).jpg b/images/child(1).jpg new file mode 100644 index 0000000..b9e45e7 Binary files /dev/null and b/images/child(1).jpg differ diff --git a/images/child.jpg b/images/child.jpg new file mode 100644 index 0000000..b9e45e7 Binary files /dev/null and b/images/child.jpg differ diff --git a/images/disparity.jpg b/images/disparity.jpg new file mode 100644 index 0000000..0fb11f5 Binary files /dev/null and b/images/disparity.jpg differ diff --git a/images/disparity2.jpg b/images/disparity2.jpg new file mode 100644 index 0000000..2f9f4f1 Binary files /dev/null and b/images/disparity2.jpg differ diff --git a/images/disparitylow.jpg b/images/disparitylow.jpg new file mode 100644 index 0000000..176873f Binary files /dev/null and b/images/disparitylow.jpg differ diff --git a/images/dog.png b/images/dog.png new file mode 100644 index 0000000..fb5d2da Binary files /dev/null and b/images/dog.png differ diff --git a/images/eggs.jpg b/images/eggs.jpg new file mode 100644 index 0000000..f3036dd Binary files /dev/null and b/images/eggs.jpg differ diff --git a/images/ex1.jpg b/images/ex1.jpg new file mode 100644 index 0000000..0d56e2d Binary files /dev/null and b/images/ex1.jpg differ diff --git a/images/first.jpg b/images/first.jpg new file mode 100644 index 0000000..2686c70 Binary files /dev/null and b/images/first.jpg differ diff --git a/images/flower.png b/images/flower.png new file mode 100644 index 0000000..212cea1 Binary files /dev/null and b/images/flower.png differ diff --git a/images/hill1.jpg b/images/hill1.jpg new file mode 100644 index 0000000..5ed9f8e Binary files /dev/null and b/images/hill1.jpg differ diff --git a/images/hill2.jpg b/images/hill2.jpg new file mode 100644 index 0000000..602e582 Binary files /dev/null and b/images/hill2.jpg differ diff --git a/images/hill3.jpg b/images/hill3.jpg new file mode 100644 index 0000000..5f46070 Binary files /dev/null and b/images/hill3.jpg differ diff --git a/images/ledge1.jpg b/images/ledge1.jpg new file mode 100644 index 0000000..4501015 Binary files /dev/null and b/images/ledge1.jpg differ diff --git a/images/ledge2.jpg b/images/ledge2.jpg new file mode 100644 index 0000000..6caed87 Binary files /dev/null and b/images/ledge2.jpg differ diff --git a/images/ledge3.jpg b/images/ledge3.jpg new file mode 100644 index 0000000..02f97b6 Binary files /dev/null and b/images/ledge3.jpg differ diff --git a/images/lena1.jpg b/images/lena1.jpg new file mode 100644 index 0000000..83d5324 Binary files /dev/null and b/images/lena1.jpg differ diff --git a/images/lenahi.jpg b/images/lenahi.jpg new file mode 100644 index 0000000..994a672 Binary files /dev/null and b/images/lenahi.jpg differ diff --git a/images/lenalow.jpg b/images/lenalow.jpg new file mode 100644 index 0000000..c2a5a91 Binary files /dev/null and b/images/lenalow.jpg differ diff --git a/images/monkey.jpeg b/images/monkey.jpeg new file mode 100644 index 0000000..c8f6cf7 Binary files /dev/null and b/images/monkey.jpeg differ diff --git a/images/monkeyhi.jpg b/images/monkeyhi.jpg new file mode 100644 index 0000000..f71c969 Binary files /dev/null and b/images/monkeyhi.jpg differ diff --git a/images/pana.png b/images/pana.png new file mode 100644 index 0000000..355f1b9 Binary files /dev/null and b/images/pana.png differ diff --git a/images/pier1.jpg b/images/pier1.jpg new file mode 100644 index 0000000..f49c666 Binary files /dev/null and b/images/pier1.jpg differ diff --git a/images/pier2.jpg b/images/pier2.jpg new file mode 100644 index 0000000..f3e2090 Binary files /dev/null and b/images/pier2.jpg differ diff --git a/images/pier3.jpg b/images/pier3.jpg new file mode 100644 index 0000000..30e1aed Binary files /dev/null and b/images/pier3.jpg differ diff --git a/images/polar.jpg b/images/polar.jpg new file mode 100644 index 0000000..baed443 Binary files /dev/null and b/images/polar.jpg differ diff --git a/images/polarhi.jpg b/images/polarhi.jpg new file mode 100644 index 0000000..6f650d7 Binary files /dev/null and b/images/polarhi.jpg differ diff --git a/images/polarlow.jpg b/images/polarlow.jpg new file mode 100644 index 0000000..ba8e0b2 Binary files /dev/null and b/images/polarlow.jpg differ diff --git a/images/s.jpg b/images/s.jpg new file mode 100644 index 0000000..4472ce4 Binary files /dev/null and b/images/s.jpg differ diff --git a/images/s1.jpg b/images/s1.jpg new file mode 100644 index 0000000..f4474a0 Binary files /dev/null and b/images/s1.jpg differ diff --git a/images/s2.jpg b/images/s2.jpg new file mode 100644 index 0000000..b59b7c5 Binary files /dev/null and b/images/s2.jpg differ diff --git a/images/s3.jpg b/images/s3.jpg new file mode 100644 index 0000000..ca9a13a Binary files /dev/null and b/images/s3.jpg differ diff --git a/images/sample.tif b/images/sample.tif new file mode 100644 index 0000000..a7cc229 Binary files /dev/null and b/images/sample.tif differ diff --git a/images/seam.jpg b/images/seam.jpg new file mode 100644 index 0000000..540125f Binary files /dev/null and b/images/seam.jpg differ diff --git a/images/second.jpg b/images/second.jpg new file mode 100644 index 0000000..729d876 Binary files /dev/null and b/images/second.jpg differ diff --git a/images/station1.jpg b/images/station1.jpg new file mode 100644 index 0000000..6b55deb Binary files /dev/null and b/images/station1.jpg differ diff --git a/images/station2.jpg b/images/station2.jpg new file mode 100644 index 0000000..99b65d1 Binary files /dev/null and b/images/station2.jpg differ diff --git a/images/third.jpg b/images/third.jpg new file mode 100644 index 0000000..e79edef Binary files /dev/null and b/images/third.jpg differ diff --git a/images/utleft.jpg b/images/utleft.jpg new file mode 100644 index 0000000..5cc9549 Binary files /dev/null and b/images/utleft.jpg differ diff --git a/images/utright.jpg b/images/utright.jpg new file mode 100644 index 0000000..a861f33 Binary files /dev/null and b/images/utright.jpg differ diff --git a/macros/CascadeObjectDetector.bin b/macros/CascadeObjectDetector.bin deleted file mode 100644 index cfda964..0000000 Binary files a/macros/CascadeObjectDetector.bin and /dev/null differ diff --git a/macros/CascadeObjectDetector.sci b/macros/CascadeObjectDetector.sci deleted file mode 100644 index 6f6335c..0000000 --- a/macros/CascadeObjectDetector.sci +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - - -function [out,bbox]=CascadeObjectDetector(input_image,classifierList,varargin) -// This function is used to detect objects in an image. -// -// Calling Sequence -// -// detect=CascadeObjectDetector(inputImage,classifierList); -// detect=CascadeObjectDetector(inputImage,classifierList,scale); -// detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors); -// detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags); -// detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags,minSize); -// detect=CascadeObjectDetector(inputImage,classifierList,scale,minNeighbors,flags,minSize,maxSize); -// -// Parameters -// out: the output image with all specified detections. -// inputImage: input image on which the objects should be detected. -// classifierList: a matrix of strings containing the location of the xml files which are to be used in the detection. -// scale: Parameter specifying how much the image size is reduced at each image scale. -// minNeighbors: Parameter specifying how many neighbors each candidate rectangle should have to retain it. -// flags: the method used in detection.it should be either 1 or 4 or 2 or 8. -// min size: Minimum possible object size. Objects smaller than that are ignored. -// max size: Maximum possible object size. Objects larger than that are ignored. -// -// Description -// -// This function is used to detect objects in an image. -// -// Examples -// // A example detecting all faces,eyes in an image. -// //read the input image. -// z=imread("oscarSelfie.jpg"); -// //increase stacksize of scilab -// stacksize('max') -// declare string martrix with the xml locations.Here the general opencv's .xml files are used. -// s=["/home/nihar/Desktop/opencv/data/haarcascades/haarcascade_eye_tree_eyeglasses.xml" "/home/nihar/Desktop/opencv/data/haarcascades/haarcascade_frontalface_alt.xml"]; -// //call function -// //Note:-the value of scale and other optional inputs must be adjusted to get proper/desired detection. -// p=CascadeObjectDetector(z,s,1.05); -// //show the detection -//imshow(p); -// -// Detect only faces. -// -// //read the input image. -// z=imread("oscarSelfie.jpg"); -// //increase stacksize of scilab -// stacksize('max') -// declare string martrix with the xml locations.Here the general opencv's .xml files are used. -// s=["/home/nihar/Desktop/opencv/data/haarcascades/haarcascade_frontalface_alt.xml"]; -// //call function -// //Note:-the value of scale and other optional inputs must be adjusted to get proper/desired detection. -// p=CascadeObjectDetector(z,s,1.05); -// //show the detection -// imshow(p); - - - - input_image1=mattolist(input_image); - [lhs rhs]=argn(0); - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>7 - error(msprintf(" Too many input arguments")); - elseif rhs<2 - error(msprintf("Too less arguments provided!,minimum is 2!")); - end - select rhs - case 2 then - [a,bbox]=raw_CascadeObjectDetector(input_image1,classifierList); - case 3 then - [a,bbox]=raw_CascadeObjectDetector(input_image1,classifierList,varargin(1)); - case 4 then - [a,bbox]=raw_CascadeObjectDetector(input_image1,classifierList,varargin(1),varargin(2)); - case 5 then - [a,bbox]=raw_CascadeObjectDetector(input_image1,classifierList,varargin(1),varargin(2),varargin(3)); - case 6 then - [a,bbox]=raw_CascadeObjectDetector(input_image1,classifierList,varargin(1),varargin(2),varargin(3),varargin(4)); - case 7 then - [a,bbox]=raw_CascadeObjectDetector(input_image1,classifierList,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)); - end - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end - -endfunction; diff --git a/macros/DCT.bin b/macros/DCT.bin new file mode 100644 index 0000000..5ee5e5c Binary files /dev/null and b/macros/DCT.bin differ diff --git a/macros/DCT.sci b/macros/DCT.sci new file mode 100644 index 0000000..5370a65 --- /dev/null +++ b/macros/DCT.sci @@ -0,0 +1,41 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Deepshikha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [dstImg] = DCT(srcImg) + //Performs forward Discrete Cosine Transform of the 1D or 2D array. + // + //Calling Sequence + //dstMat = DCT(srcMat) + // + //Parameters + //srcMat : 1D or 2D floating type array + //dstMat : The output matrix + // + //Description + //dstMat = DCT(srcMat) + //Returns the DCT of the input matrix. + // + //Examples + //srcMat = [230.3 23.1 432.5; 321 543.1 89.5] + //dstMAt = DCT(srcMat) + //disp(dstMAt) + //Authors + // Deepshikha + + srcMat = mattolist(srcImg) + output = raw_DCT(srcMat) + + channels = size(output) + + for i = 1:channels // for i channel image + dstImg(:,:,i) = output(i) + end +endfunction \ No newline at end of file diff --git a/macros/FFT.bin b/macros/FFT.bin new file mode 100644 index 0000000..1284f9a Binary files /dev/null and b/macros/FFT.bin differ diff --git a/macros/FFT.sci b/macros/FFT.sci new file mode 100644 index 0000000..4017225 --- /dev/null +++ b/macros/FFT.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Sridhar Reddy +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function fourierTransform=FFT(inputMatrix) + // This function returns discrete Fourier Transform of 2D input matrix + // + // Calling Sequence + // fourierTransform=FFT(inputMatrix) + // + // Parameters + // inputMatrix: Input matrix must be 2-D. + // + // Description + // It returns the 2D discrete Fourier transform of two dimensional input matrix. + // + // Examples + // I=imread('images/lena.jpeg',0); + // I=double(I); + // fourier=FFT(I) + // imshow(fourier) + //Authors + // Sridhar Reddy + + [rows cols channels]=size(inputMatrix); + if channels <> 1 then + error(msprintf("Wrong input, input must be 2-D matrix")); + end + fourierTransform=raw_FFT(inputMatrix); +endfunction diff --git a/macros/affine2d.bin b/macros/affine2d.bin new file mode 100644 index 0000000..f403c1c Binary files /dev/null and b/macros/affine2d.bin differ diff --git a/macros/affine2d.sci b/macros/affine2d.sci new file mode 100644 index 0000000..f42b6cb --- /dev/null +++ b/macros/affine2d.sci @@ -0,0 +1,43 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Yash S. Bhalgat +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function tform = affine2d(image) + //Creates an affine2d object for input 3x3 matrix. + // + //Calling Sequence + //y = affine2d(mat) + // + //Parameters + //mat : It is a 3x3 matrix which specifies forward affine2d transformation. + //y : an affine2d object with similar properties as the input. + // + //Description + //y = affine2d(mat) returns the affine2d object where a 3x3 numeric matrix is given as input + //It encapsulates 2d affine geometri transformation. + // + //Examples + //a=[1 2 0;3 4 0;5 1 1]; + //y=affine2d(a); + //disp(y); + //Authors + // Yash S. Bhalgat + + + image_list = mattolist(image) + + out = raw_affine2d(image) + + sz = size(out) + for i=1:sz + tform(:, :, i) = out(i) + end + +endfunction diff --git a/macros/arrowedline.bin b/macros/arrowedline.bin deleted file mode 100644 index 3a7b2a0..0000000 Binary files a/macros/arrowedline.bin and /dev/null differ diff --git a/macros/arrowedline.sci b/macros/arrowedline.sci deleted file mode 100644 index 7ba5e46..0000000 --- a/macros/arrowedline.sci +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function[dstImg] = arrowedline(srcImg, x1, y1, x2, y2, R, G, B, varargin) -// This Function Draws a arrow segment pointing from the first point to the second one. -// -// Calling Sequence -// -// z=imread("lena.jpeg"); -// arrow=arrowedline(z,x1,y1,x2,y2,R,G,B); -// arrow=arrowedline(z,x1,y1,x2,y2,R,G,B,thickness); -// arrow=arrowedline(z,x1,y1,x2,y2,R,G,B,thickness,linetype); -// arrow=arrowedline(z,x1,y1,x2,y2,R,G,B,thickness,linetype,shift); -// -// Parameters -// -// z: input image on which the arrowd line should be drawn. -// arrow: the output image with the arrowed line drawn on it. -// x1: x coordinate of first point -// y1: y coordinate of first point -// x2: x coordinate of second point -// R: red color value of the circle.It should be in the range 0-255. -// G: blue color value of the circle.It should be in the range 0-255. -// B: green color value of the circle.It should be in the range 0-255. -// thickness: Line thickness. -// linetype: Type of the circle boundary.It can be 0 or 4 or 8. -// shift: Number of fractional bits in the point coordinates. -// -// Description -// This Function Draws a arrow segment pointing from the first point to the second one. -// -// Examples -// -// z=imread("lena.jpeg"); -// arrow=arrowedline(z,200,200,150,10,255,255,0,13); -// imshow(arrow) - - - - - [lhs, rhs] = argn(0) - - srcMat = mattolist(srcImg) - - select rhs - case 8 then - out = raw_arrowedline(srcMat, x1, y1, x2, y2, R, G, B) - case 9 then - out = raw_arrowedline(srcMat, x1, y1, x2, y2, R, G, B,varargin(1)) - case 10 then - out = raw_arrowedline(srcMat, x1, y1, x2, y2, R, G, B, varargin(1),varargin(2)) - case 11 then - out = raw_arrowedline(srcMat, x1, y1, x2, y2, R, G, B, varargin(1),varargin(2), varargin(3)) - case 12 then - out = raw_arrowedline(srcMat, x1, y1, x2, y2, R, G, B, varargin(1),varargin(2), varargin(3), varargin(4)) - end - - channels = size(out) - - for i = 1:channels - dstImg(:,:,i) = out(i) - end -endfunction diff --git a/macros/bboxOverlapRatio.bin b/macros/bboxOverlapRatio.bin new file mode 100644 index 0000000..e38f5ea Binary files /dev/null and b/macros/bboxOverlapRatio.bin differ diff --git a/macros/bboxOverlapRatio.sci b/macros/bboxOverlapRatio.sci new file mode 100644 index 0000000..2d6e1f6 --- /dev/null +++ b/macros/bboxOverlapRatio.sci @@ -0,0 +1,53 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Tanmay Chaudhari +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + + function [ out ] = bboxOverlapRatio(bboxA, bboxB, varargin) + // Compute the overlap ratio between the bounding boxes A and B. + // + // Calling Sequence + // [ overlapRatio ] = bboxOverlapRatio(bboxA, bboxB); + // [ overlapRatio ] = bboxOverlapRatio(bboxA, bboxB, ratioType); + // + // Parameters + // bboxA: Bounding box A of the form [x, y, width, height]; + // bboxB: Boundng box B of the form [x, y, width, height]; + // ratioType (Optional Argument): Method to be used to compute the ratio. Set this to either 'Union' or 'Min'. Default computation method is set to 'Union'. + // overlapRatio: Overlap ratio between the bounding boxes A and B. + // + // Description + // Compute the overlap ratio between the bounding boxes A and B. + // + // Examples + // bboxA = [1 2 3 4]; + // bboxB = bboxA + 100; + // overlapRatioMin = bboxOverlapRatio(bboxA, bboxB, 'Min'); + // overlapRatioUnion = bboxOverlapRatio(bboxA, bboxB); + // + // bboxA = [0 0 50 50]; + // bboxB = [0 0 200 200]; + // overlapRatioMin = bboxOverlapRatio(bboxA, bboxB, 'Min'); + // overlapRatioUnion = bboxOverlapRatio(bboxA, bboxB); + // + // Authors + // Tanmay Chaudhari + + [lhs rhs] = argn(0) + if rhs>3 then + error(msprintf("Too many input arguments")) + elseif rhs==3 then + a=raw_bboxOverlapRatio(bboxA,bboxB,varargin(1)) + out=a + elseif rhs==2 then + a=raw_bboxOverlapRatio(bboxA,bboxB) + out=a + end + +endfunction diff --git a/macros/blur.bin b/macros/blur.bin deleted file mode 100644 index 17a7178..0000000 Binary files a/macros/blur.bin and /dev/null differ diff --git a/macros/blur.sci b/macros/blur.sci deleted file mode 100644 index b52c278..0000000 --- a/macros/blur.sci +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [out]=blur(input_image ,ksize_width,ksize_height,anchorX,anchorY) -// This function is used to blur an image using the normalized box filter. -// -// Calling Sequence -// B = blur(input_image ,ksize_width,ksize_height,anchorX,anchorY); -// -// Parameters -// A: image matrix of the source image. -// ksize_width : Defines the width of the kernel to be used in pixels. -// ksize_width : Defines the height of the kernel to be used in pixels. -// anchorX : Indicates where the x coordinate of the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point. -// anchorY : Indicates where the y coordinate of the anchor point (the pixel evaluated) is located with respect to the neighborhood. If there is a negative value, then the center of the kernel is considered the anchor point. -// B : output image with the applied blur fucntion. -// -// Description -// The function smoothes an image using the kernel specified with its dimesnsions. -// -// Examples -// i = imread('right1.jpg',0); -// i2 =blur(i,5,5,1,1) -// imshow(i2); -// - - input_image1=mattolist(input_image); - a=raw_blur(input_image1, ksize_width,ksize_height,anchorX,anchorY); - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end - -endfunction; diff --git a/macros/boundingRect.bin b/macros/boundingRect.bin deleted file mode 100644 index 2dffd9b..0000000 Binary files a/macros/boundingRect.bin and /dev/null differ diff --git a/macros/boundingRect.sci b/macros/boundingRect.sci deleted file mode 100644 index 400828e..0000000 --- a/macros/boundingRect.sci +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Sukul Bagai -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [rectMat]=boundingRect(points) -//this function Calculates the up-right bounding rectangle of a point set. -// -// Calling Sequence -// -// z=imread("lena.jpeg",0); -// rect=boundingRect(points); -// -// Parameters -// -// rect: the rectangle coordinates -// points: the set of 2D points. It must be N*2. -// -// Description -// -// Calculates the up-right bounding rectangle of a point set. -// -// Examples -// -// z=imread("lena.jpeg",0); -// kaze=detectKAZEFeatures(z)x -// rect=boundingRect(kaze.KeyPoints); - rectMat=raw_boundingRect(points); -endfunction diff --git a/macros/calfocal.bin b/macros/calfocal.bin new file mode 100644 index 0000000..25252ad Binary files /dev/null and b/macros/calfocal.bin differ diff --git a/macros/calfocal.sci b/macros/calfocal.sci new file mode 100644 index 0000000..163c87b --- /dev/null +++ b/macros/calfocal.sci @@ -0,0 +1,68 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [res]=calfocal(image,varargin) + //Estimates focal lengths for each given camera. + // + //Calling Sequence + //res = calfocal(image1,image2) + //res = calfocal(image1,image2,image3) + //res = calfocal(image1,image2,image3,image4) + //res = calfocal(image1,image2,image3,image4,image5) + //res = calfocal(image1,image2,image3,image4,image5,image6) + // + //Parameters + //image1 : an image + //image2 : an image + //image3 : an image + //image4 : an image + //image5 : an image + //image6 : an image + // + //Description + //res = calfocal(image1,image2) return a 1x2 matrix. + //Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. + //After this camera parameters are estimated along with their focal lengths are estimated. + // + //Examples + //a=imread('images/campus_000.jpg'); + //b=imread('images/campus_001.jpg'); + //res=calfocal(a,b); + //Authors + // Manoj Sree Harsha + +[lhs rhs]=argn(0) + + if lhs>1 + error(msprintf(" Too many output arguments")) + elseif rhs>6 + error(msprintf(" Too many input arguments,maximum number of arguments is 6")) + elseif rhs<2 + error(msprintf("the function needs atleast 2 arguments")) + end + image=mattolist(image) + for i=1:rhs-1 + varargin(i)=mattolist(varargin(i)) + end + if rhs==2 + res=raw_focals(image,varargin(1)) + elseif rhs==3 + res=raw_focals(image,varargin(1),varargin(2)) + elseif rhs==4 + res=raw_focals(image,varargin(1),varargin(2),varargin(3)) + elseif rhs==5 + res=raw_focals(image,varargin(1),varargin(2),varargin(3),varargin(4)) + elseif rhs==6 + res=raw_focals(image,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)) + end + + res=double(res) +endfunction diff --git a/macros/cameraMatrix.bin b/macros/cameraMatrix.bin new file mode 100644 index 0000000..3d0ed1f Binary files /dev/null and b/macros/cameraMatrix.bin differ diff --git a/macros/cameraMatrix.sci b/macros/cameraMatrix.sci new file mode 100644 index 0000000..7c7099c --- /dev/null +++ b/macros/cameraMatrix.sci @@ -0,0 +1,39 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Tanmay Chaudhari +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [ camMatrix ] = cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector) + // Returns camera projection matrix. + // + // Calling Sequence + // camMatrix = cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector); + // + // Parameters + // camMatrix: A 4x3 camera projection matrix, which can be used to project 3-D world points in homogenous co-ordinates into an image. + // instrinsicMatrix: Projection matrix of size 3x3. + // rotationMatrix: A 3x3 matrix which specifies the rotation of a camera. + // translationVector: A 1x3 vector which specifies the translation of a camera. + // + // Description + // Return a matrix of size 4-by-3, which can be used to project 3-D world points in homogenous co-ordinates into an image. + // + // Examples + // instrinsicMatrix = [1 0 0; 1 2 0; 3 4 0]; + // rotationMatrix = [ 0.1417 -0.7409 0.6565; 0.9661 -0.0410 -0.2548; 0.2157 0.6703 0.7100]; + // translationVector = [ -29.2584 35.7824 725.5824]; + // camMatrix = cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector) + // + // Authors + // Tanmay Chaudhari + + a=raw_cameraMatrix(instrinsicMatrix,rotationMatrix,translationVector); + camMatrix(:,:,1)=a(1); + +endfunction diff --git a/macros/circle.bin b/macros/circle.bin deleted file mode 100644 index 090afe5..0000000 Binary files a/macros/circle.bin and /dev/null differ diff --git a/macros/circle.sci b/macros/circle.sci deleted file mode 100644 index 918ea76..0000000 --- a/macros/circle.sci +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Abhilasha Sancheti & Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [out]=circle(input_image , x_coordinate_of_centre , y_coordinate_centre , radius, r_value,g_value,b_value,varargin) -// This function circle draws a simple or filled circle on an image with a given center and radius. -// -// Calling Sequence -// cir=circle(inputImage,xcor,ycor,radius,r,g,b); -// cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness); -// cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness,linetype); -// cir=circle(inputImage,xcor,ycor,radius,r,g,b,thickness,linetype,shift); -// -// Parameters -// cir: The output image with the circle drawn in it. -// inputImage: The input image on which the circle should be drawn. -// xcor: X-coordinate of the center -// ycor: Y-coordinate of the center -// r: red color value of the circle.It should be in the range 0-255. -// b: blue color value of the circle.It should be in the range 0-255. -// g: green color value of the circle.It should be in the range 0-255. -// thickness: Line thickness. -// linetype: Type of the circle boundary.It can be 0 or 4 or 8. -// shift: Number of fractional bits in the point coordinates. -// -// Description -// This function circle draws a simple or filled circle on an image with a given center and radius. -// -// -// Examples -// -// //read the input image -// z=imread("lena.jpeg"); -// //call the function -// cir=circle(z,100,100,15,255,0,0,1,8,0); -// finally show the circle drawn -// imshow(cir) - - - input_image1=mattolist(input_image); - [lhs,rhs]=argn(0); - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>10 - error(msprintf(" Too many input arguments,maximum number of arguments is 10\n")); - elseif rhs<7 - error(msprintf("the function needs atleast 11 arguments")); - end - if rhs==7 - a=raw_circle(input_image1 , x_coordinate_of_centre , y_coordinate_centre , radius, r_value,g_value,b_value); - elseif rhs==8 - a=raw_circle(input_image1 , x_coordinate_of_centre , y_coordinate_centre , radius, r_value,g_value,b_value,varargin(1)); - elseif rhs==9 - a=raw_circle(input_image1 , x_coordinate_of_centre , y_coordinate_centre , radius, r_value,g_value,b_value,varargin(1),varargin(2)); - elseif rhs==10 - a=raw_circle(input_image1 , x_coordinate_of_centre , y_coordinate_centre , radius, r_value,g_value,b_value,varargin(1),varargin(2),varargin(3)); - end - dimension=size(a); - for i = 1:dimension - out(:,:,i)=a(i); - end - -endfunction; diff --git a/macros/convolver.bin b/macros/convolver.bin new file mode 100644 index 0000000..f975025 Binary files /dev/null and b/macros/convolver.bin differ diff --git a/macros/convolver.sci b/macros/convolver.sci new file mode 100644 index 0000000..b73283c --- /dev/null +++ b/macros/convolver.sci @@ -0,0 +1,44 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Kevin George , Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [output] = convolver(image1,ksize,values1,scalar) + //Convolves an image with the kernel. + // + //Calling Sequence + //out_image = convolver(in_image,ksize,kvalues,scalar) + // + //Parameters + //in_image : an image + //out_image : the output image + //ksize : kernel size (belongs to {3,4,5}) + //kvalues : kernel matrix values + //scalar : any floating value + // + //Description + //out_image = convolver(in_image,ksize,kvalues,scalar) + //Returns the convoluted image of the input image. It uses filter2d function to perform convolution. + //The convolution is with the given kernel. + // + //Examples + //a = imread('images/lena.jpeg') + //b=[1 1 1;1 1 1;1 1 1] + //y=convolver(a,3,b,9) + //imshow(y) + //Authors + // Kevin George , Manoj Sree Harsha + + image = mattolist(image1) + a = raw_convolver(image,ksize,values1,scalar); + d = size(a); + for i = 1:d + output(:,:,i) = a(i); + end +endfunction diff --git a/macros/cornerEigenValsAndVecs.bin b/macros/cornerEigenValsAndVecs.bin new file mode 100644 index 0000000..69f8ff4 Binary files /dev/null and b/macros/cornerEigenValsAndVecs.bin differ diff --git a/macros/cornerEigenValsAndVecs.sci b/macros/cornerEigenValsAndVecs.sci new file mode 100644 index 0000000..c596896 --- /dev/null +++ b/macros/cornerEigenValsAndVecs.sci @@ -0,0 +1,46 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Shubheksha Jalan +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [outputImg]= cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType) + //Calculates eigenvalues and eigenvectors of image blocks for corner detection. + // + //Calling Sequence + //inputImage=imread('path of the image file') + //outputImg = cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType) + //imshow(outputImg) + // + //Parameters + //inputImage : an image. + //blockSize : Neighborhood size + //kSize : Aperture parameter for the Sobel() operator. + //borderType : Pixel extrapolation method + // + //Description + //outputImg = cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType) + //For every pixel p , the function cornerEigenValsAndVecs considers a blockSize x blockSize neighborhood S(p) . It calculates the covariation matrix of derivatives over the neighbourhood + //After that, it finds eigenvectors and eigenvalues and stores them in the destination image(outputImg). + // + //Examples + //inputImage=imread('images/lena.jpeg'); + //blockSize = 7; + //kSize=3; + //borderType="BORDER_DEFAULT" + //outputImg=cornerEigenValsAndVecs(inputImage, blockSize, kSize, borderType); + //imshow(outputImg) + //Authors + // Shubheksha Jalan + + inputList=mattolist(inputImage); + outputList=raw_cornerEigenValsAndVecs(inputList, blockSize, kSize, borderType); + for i=1:size(outputList) + outputImg(:,:,i)=outputList(i) + end +endfunction diff --git a/macros/cornerHarris.bin b/macros/cornerHarris.bin new file mode 100644 index 0000000..b7d6c4a Binary files /dev/null and b/macros/cornerHarris.bin differ diff --git a/macros/cornerHarris.sci b/macros/cornerHarris.sci new file mode 100644 index 0000000..5c03ef1 --- /dev/null +++ b/macros/cornerHarris.sci @@ -0,0 +1,48 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Shubheksha Jalan +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [outputImg]= cornerHarris(inputImage, blockSize, kSize, k, borderType) + //Harris edge detector. + // + //Calling Sequence + //inputImage=imread('path of the image file') + //outputImg = cornerHarris(inputImage, blockSize, kSize, k, borderType) + //imshow(outputImg) + // + //Parameters + //inputImage : an image. + //blockSize : Neighborhood size + //kSize : Aperture parameter for the Sobel() operator. + //k : Harris detector free parameter. + //borderType : Pixel extrapolation method + // + //Description + //outputImg = cornerHarris(inputImage, blockSize, kSize, k, borderType) + //This function runs the Harris edge detector on the image. + //outputImg is used to store the Harris detector responses + // + //Examples + //inputImage=imread('images/lena.jpeg'); + //blockSize = 7; + //kSize=3; + //k=0.04; + //borderType="BORDER_DEFAULT" + //outputImg=cornerHarris(inputImage, blockSize, kSize, k, borderType); + //imshow(outputImg) + //Authors + // Shubheksha Jalan + + inputList=mattolist(inputImage); + outputList=raw_cornerHarris(inputList, blockSize, kSize, k, borderType); + for i=1:size(outputList) + outputImg(:,:,i)=outputList(i) + end +endfunction diff --git a/macros/cornerMinEigenVal.bin b/macros/cornerMinEigenVal.bin new file mode 100644 index 0000000..3556873 Binary files /dev/null and b/macros/cornerMinEigenVal.bin differ diff --git a/macros/cornerMinEigenVal.sci b/macros/cornerMinEigenVal.sci new file mode 100644 index 0000000..8f3904e --- /dev/null +++ b/macros/cornerMinEigenVal.sci @@ -0,0 +1,47 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Shubheksha Jalan +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [outputImg]= cornerMinEigenVal(inputImage, blockSize, kSize, borderType) + //Calculates the minimal eigenvalue of gradient matrices for corner detection. + // + //Calling Sequence + //inputImage=imread('path of the image file') + //outputImg = cornerMinEigenVal(inputImage, blockSize, kSize, borderType) + //imshow(outputImg) + // + //Parameters + //inputImage : an image. + //blockSize : Neighborhood size + //kSize : Aperture parameter for the Sobel() operator. + //borderType : Pixel extrapolation method + // + //Description + //outputImg = cornerMinEigenVal(inputImage, blockSize, kSize, borderType) + //The function is similar to cornerEigenValsAndVecs() but it calculates only the minimal eigenvalue of the covariance matrix of derivatives. + //After that, it stores them in the destination image(outputImg). + // + //Examples + //inputImage=imread('images/lena.jpeg'); + //blockSize = 7; + //kSize=3; + //k=0.04; + //borderType="BORDER_DEFAULT" + //outputImg=cornerMinEigenVal(inputImage, blockSize, kSize, borderType); + //imshow(outputImg) + //Authors + // Shubheksha Jalan + + inputList=mattolist(inputImage); + outputList=raw_cornerMinEigenVal(inputList, blockSize, kSize, borderType); + for i=1:size(outputList) + outputImg(:,:,i)=outputList(i) + end +endfunction diff --git a/macros/correctMatches.bin b/macros/correctMatches.bin deleted file mode 100644 index 34d6e5c..0000000 Binary files a/macros/correctMatches.bin and /dev/null differ diff --git a/macros/correctMatches.sci b/macros/correctMatches.sci deleted file mode 100644 index 7dfc2da..0000000 --- a/macros/correctMatches.sci +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [newPoints1, newPoints2] = correctMatches(F, points1, points2) -// This function Refines coordinates of corresponding points -// -// Calling Sequence -// [newPoints1, newPoints2] = correctMatches(F, points1, points2) -// -// Parameters -// F – 3x3 fundamental matrix. -// points1 – 2xN array containing the first set of points. -// points2 – 2xN array containing the second set of points. -// newPoints1 – The optimized points1. -// newPoints2 – The optimized points2. -// -// Description -// The function implements the Optimal Triangulation Method (see Multiple View Geometry for details). For each given point correspondence points1[i] <-> points2[i], and a fundamental matrix F, it computes the corrected correspondences newPoints1[i] <-> newPoints2[i] that minimize the geometric error d(points1[i], newPoints1[i])^2 + d(points2[i],newPoints2[i])^2 (where d(a,b) is the geometric distance between points a and b ) subject to the epipolar constraint newPoints2^T * F * newPoints1 = 0 . -// -// Examples -// //read first image -// I=imread("oscarSelfie.jpg",0); -// //increase stack size of scilab -// stacksize('max') -// // get points from first image -// cornerPoints1=detectMSERFeatures(I); -// //read second image -// I2=imread("oscarSelfie.jpg",0); -// //get points for 2nd image -// cornerPoints2=detectMSERFeatures(I2); -// fundamentalMat=estimateFundamentalMat(cornerPoints1.Location,cornerPoints2.Location); -// [new1 new2]=correctMatches(fundamentalMat,cornerPoints2.Location,cornerPoints1.Location); - [lhs rhs]=argn(0); - - if lhs>2 - error(msprintf(" Too many output arguments,maximum number of output arguments is 2")); - elseif rhs>3 - error(msprintf(" Too many input arguments,maximum number of arguments is 3`")); - elseif rhs<3 - error(msprintf("the function needs atleast 3 arguments")); - end - - [newPoints1, newPoints2]=raw_correctMatches(F, points1, points2); - - - -endfunction diff --git a/macros/cvtColor.bin b/macros/cvtColor.bin deleted file mode 100644 index be515eb..0000000 Binary files a/macros/cvtColor.bin and /dev/null differ diff --git a/macros/cvtColor.sci b/macros/cvtColor.sci deleted file mode 100644 index 6f235e2..0000000 --- a/macros/cvtColor.sci +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Shubheksha Jalan & Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function new_image = cvtColor(image, code, varargin) -// This function is used to transform a image from one space to other like rgb to gray and vice versa. -// -// Calling Sequence -// -// inputImage=imread("lena.jpeg"); -// outputImage=cvtColor(inputImage,codeString); -// outputImage=cvtColor(inputImage,codeString,dstCn); -// -// -// Parameters -// dstCn: number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code -// codeString: A string which specifies the type of conversion.The different types are listed below. -// "CV_BGR2GRAY": Conversion is from BGR(blue-green-red) space to GRAY. -// "CV_RGB2GRAY": Conversion is from RGB(red-green-blue) space to GRAY. -// "CV_GRAY2BGR": Conversion is from BGR(blue-green-red) space. -// "CV_GRAY2RGB": Conversion is from to GRAY to RGB(blue-green-red) space. -// "CV_BGR2XYZ" : Conversion is from BGR(blue-green-red) space to CIE XYZ. -// "CV_RGB2XYZ" : Conversion is from RGB(red-green-blue) space to CIE XYZ. -// "CV_XYZ2BGR" : Conversion is from to CIE XYZ to BGR space. -// "CV_XYZ2RGB" : Conversion is from to CIE XYZ to RGB(red-green-blue) space. -// "CV_BGR2YCrCb": Conversion is from BGR(blue-green-red) space to luma-chroma. -// "CV_RGB2YCrCb" :Conversion is from RGB(red-green-blue) space to luma chroma. -// "CV_YCrCb2BGR" :Conversion is from luma-chroma to BGR(blue-green-red) space. -// "CV_YCrCb2RGB" :Conversion is from luma-chroma to RGB(red-green-blue) space. -// "CV_BGR2HSV": Conversion is from BGR(blue-green-red) space to HSV. -// "CV_RGB2HSV": Conversion is from RGB space to HSV. -// "CV_HSV2BGR": Conversion is from to HSV to BGR(blue-green-red) space. -// "CV_HSV2RGB": Conversion is from to HSV to RGB(red-green-blue) space. -// "CV_BGR2HLS": Conversion is from BGR(blue-green-red) space to HLS. -// "CV_RGB2HLS": Conversion is from RGB space to HSV. -// "CV_HLS2BGR": Conversion is from HLS to BGR(blue-green-red) space. -// "CV_HLS2RGB": Conversion is from HLS to RGB(red-green-blue) space. -// "CV_BGR2Lab": Conversion is from BGR(blue-green-red) space to CIE Lab. -// "CV_RGB2Lab": Conversion is from RGB space to CIE Lab. -// "CV_Lab2BGR": Conversion is from CIE Lab to BGR(blue-green-red) space. -// "CV_Lab2RGB": Conversion is from CIE Lab to RGB space. -// "CV_BGR2Luv": Conversion is from BGR(blue-green-red) space to CIE Luv. -// "CV_RGB2Luv": Conversion is from RGB space to CIE Luv. -// "CV_Luv2BGR": Conversion is from CIE Luv to BGR(blue-green-red) space. -// "CV_Luv2RGB": Conversion is from CIE Luv to RGB space. -// -// Description -// -// This function is used to transform a image from one space to other like rgb to gray and vice versa. -// -// Examples -// -// z=imread("lena.jpeg",0); -// ss=cvtColor(z,"CV_GRAY2BGR"); -// imshow(ss) - - - - [ lhs, rhs ] = argn(0) - - image_list = mattolist(image) - - select rhs - case 2 then - - out = raw_cvtColor(image_list, code) - - case 3 then - out = raw_cvtColor(image_list, code, varargin(1)) - end - - sz=size(out); - for i=1:sz - new_image(:, :, i) = out(i) - end - -endfunction diff --git a/macros/deconvlucy.bin b/macros/deconvlucy.bin deleted file mode 100644 index 2886042..0000000 Binary files a/macros/deconvlucy.bin and /dev/null differ diff --git a/macros/deconvlucy.sci b/macros/deconvlucy.sci deleted file mode 100644 index 547a27c..0000000 --- a/macros/deconvlucy.sci +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [out]=deconvlucy(image1,image2,varargin) -// This function is used to Deblur image using Lucy-Richardson method -// -// Calling Sequence -// J = deconvlucy(I1, I2); -// J = deconvlucy(I1, I2, NUMIT) -// -// Parameters -// I1: image matrix of the source image . -// I2: image matrix of the source image from last iteraion. -// NUMIT: The number if iterations specified to achieve the desired result. -// B : output image in the deconvoluted form. -// -// Description -// J = deconvlucy(I, PSF, NUMIT) specifies the number of iterations the deconvlucy function performs. If this value is not specified, the default is 10. -// -// Examples -// i = imread("lena.jpeg",0); -// i1 = imread("lena.jpeg",0); -// rs = deconvlucy(i,i1); -// - - - - input_image1=mattolist(image1); - input_image2=mattolist(image2); - [lhs,rhs]=argn(0); - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>3 - error(msprintf(" Too many input arguments,maximum number of arguments is 3\n")); - elseif rhs<2 - error(msprintf("the function needs atleast 2 arguments")); - end - if rhs==2 - a=raw_deconvlucy(input_image1,input_image2); - elseif rhs==3 - a=raw_deconvlucy(input_image1,input_image2,varargin(1)); - end - - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end - - -endfunction diff --git a/macros/demosaic.bin b/macros/demosaic.bin deleted file mode 100644 index 6ae4b9f..0000000 Binary files a/macros/demosaic.bin and /dev/null differ diff --git a/macros/demosaic.sci b/macros/demosaic.sci deleted file mode 100644 index c006a19..0000000 --- a/macros/demosaic.sci +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: V Srininivas -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [out]=demosaic(src,code,dstCn) -// This function converts the Bayer pattern encoded image to the truecolor image, RGB. -// -// Calling Sequence -// image=imread("lena.jpeg",0) -// dem=demosaic(image,"gbrg"); -// dem=demosaic(image,"bggr"); -// dem=demosaic(image,"rggb"); -// dem=demosaic(image,"grbg"); -// -// Parameters -// -// dem: the output image -// image: the image which should be converted. -// -// Description -// -// This function converts the Bayer pattern encoded image to the truecolor image, RGB. -// -// Examples -// -// z=imread("lena.jpeg"); -// dem=demosaic(z,"rggb"); -// imshow(dem); - - - input_image1=mattolist(src); - a=raw_demosaic( input_image1,code); - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end -endfunction; diff --git a/macros/detectGFTTFeatures.bin b/macros/detectGFTTFeatures.bin deleted file mode 100644 index 3a9b4ff..0000000 Binary files a/macros/detectGFTTFeatures.bin and /dev/null differ diff --git a/macros/detectGFTTFeatures.sci b/macros/detectGFTTFeatures.sci deleted file mode 100644 index 63676bb..0000000 --- a/macros/detectGFTTFeatures.sci +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [varargout] = detectGFTTFeatures(image, varargin) -// This function is used to detect GFTT Features in a grayscale Image. -// -// Calling Sequence -// result = detectGFTTFeatures(Image); -// result = detectGFTTFeatures(Image,Name,Value,....) -// -// Parameters -// result: a struct containing features and keypoints -// Image: a grayscale image whose GFTT features is to be found -// blocksize: the blocksize to be used for detecting the keypoints -// minDistance: the minimum distance between the points for feature computation -// useHarrisDetector: an option to use the HarrisDetector.default value is false. -// maxCorners: the maximum number of corners that should be used for feature computation. -// ROI or Mask : (Optional) Region Of Interest. This is taken as a vector [u v width height]. When specified, the function detects the key points within region of area width*height with u and v being the top left corner coordinates. -// Description -// This function is used to detect GFTT Features in a grayscale Image. -// Examples -// -// //read image in grayscale -// z=imread("people.jpg",0); -// image=imread("pls.jpg",0); -// stacksize('max') -// //call the function to detect features for image- z -// pls=detectGFTTFeatures(z,"minDistance",4); -// // call the function to detect features for image- image -// pls1=detectGFTTFeatures(image); -// //match features using the features detected using the above function -// [op ir]=matchFeatures(pls.Features,pls1.Features); -// //finally draw those matches -// final=drawMatch(z,image,pls.KeyPoints,pls1.KeyPoints,op,ir); -// imshow(final) - - - - image_list = mattolist(image); - [ lhs, rhs ] = argn(0) - if rhs > 15 then - error(msprintf("Too many input arguments")) - end - if lhs > 1 then - error(msprintf("Too many output arguments")) - end - - select rhs - case 1 then - [a b c d e]= raw_detectGFTTFeatures(image_list) - case 3 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2)) - case 5 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4)) - case 7 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6)) - case 9 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8)) - case 11 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8),varargin(9),varargin(10)) - case 13 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8),varargin(9),varargin(10),varargin(11),varargin(12)); - case 15 then - [a b c d e]= raw_detectGFTTFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8),varargin(9),varargin(10),varargin(11),varargin(12),varargin(13),varargin(14)); - - end -varargout(1) = struct("Type","binaryFeatures",'Features',a,'NumBits',b,'NumFeatures',c,'KeyPoints',d,'keypointsCount',e); -endfunction diff --git a/macros/detectKAZEFeatures.bin b/macros/detectKAZEFeatures.bin deleted file mode 100644 index a837f08..0000000 Binary files a/macros/detectKAZEFeatures.bin and /dev/null differ diff --git a/macros/detectKAZEFeatures.sci b/macros/detectKAZEFeatures.sci deleted file mode 100644 index 37f6170..0000000 --- a/macros/detectKAZEFeatures.sci +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [varargout] = detectKAZEFeatures(image, varargin) -// This function is used to detect KAZE Features in a grayscale Image. -// -// Calling Sequence -// result = detectKAZEFeatures(Image); -// result = detectKAZEFeatures(Image,Name,Value,....) -// Parameters -// result=a struct containing features and keypoints -// Image=a grayscale image whose KAZE features is to be found -// extended-Set to enable extraction of extended (128-byte) descriptor. -// upright-Set to enable use of upright descriptors (non rotation-invariant) -// Threshold-response threshold to accept point -// NumLayers-Default number of sublevels per scale level -// NumOctaves : (Optional)The number of Octaves that the detector uses. (Default - 4) The value must be an integer scalar in between 1 and 4. -// diffusivity:-KAZE's diffusivity' -// ROI or Mask : (Optional) Region Of Interest. This is taken as a vector [u v width height]. When specified, the function detects the key points within region of area width*height with u and v being the top left corner coordinates. -// -// -// Description -// This function is used to detect KAZE Features in a grayscale Image. -// -// Examples -// -// //read image in grayscale -// z=imread("people.jpg",0); -// image=imread("pls.jpg",0); -// stacksize('max') -// //call the function to detect features for image- z -// pls=detectKAZEFeatures(z,"diffusivity",2.1); -// // call the function to detect features for image- image -// pls1=detectKAZEFeatures(image); -// //match features using the features detected using the above function -// [op ir]=matchFeatures(pls.Features,pls1.Features); -// //finally draw those matches -// final=drawMatch(z,image,pls.KeyPoints,pls1.KeyPoints,op,ir); -// imshow(final) - - - - image_list = mattolist(image); - [ lhs, rhs ] = argn(0) - if rhs > 15 then - error(msprintf("Too many input arguments")) - end - if lhs > 1 then - error(msprintf("Too many output arguments")) - end - - select rhs - case 1 then - [a b c d e]= raw_detectKAZEFeatures(image_list) - case 3 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2)) - case 5 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4)) - case 7 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6)) - case 9 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8)) - case 11 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8),varargin(9),varargin(10)) - case 13 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8),varargin(9),varargin(10),varargin(11),varargin(12)); - case 15 then - [a b c d e]= raw_detectKAZEFeatures(image_list, varargin(1), varargin(2), varargin(3), varargin(4), varargin(5), varargin(6), varargin(7), varargin(8),varargin(9),varargin(10),varargin(11),varargin(12),varargin(13),varargin(14)); - - end -varargout(1) = struct("Type","binaryFeatures",'Features',a,'NumBits',b,'NumFeatures',c,'KeyPoints',d,'keypointsCount',e); -endfunction diff --git a/macros/detectMSERFeatures.bin b/macros/detectMSERFeatures.bin deleted file mode 100644 index a569805..0000000 Binary files a/macros/detectMSERFeatures.bin and /dev/null differ diff --git a/macros/detectMSERFeatures.sci b/macros/detectMSERFeatures.sci deleted file mode 100644 index 358c1ce..0000000 --- a/macros/detectMSERFeatures.sci +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Umang Agarwal & Sridhar Reddy -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [regions]=detectMSERFeatures(image,varargin) -// This function is used to detect MSER features -// -// Calling Sequence -// list_pixels = detectMSERFeatures(image, Name, Value... ) -// [list_pixels Count Location Axes Orientation] = detectMSERFeatures(image, Name, Value... ) -// -// Parameters -// Image: Input Image, should be a 2-D grayscale. The Input Image should be real -// ThresholdDelta [Optional Input Argument]: Step Size between intensity to be checked for measurement of stability. Values: Percentage numeric value. Default: 2.0 -// RegionAreaRange [Optional Input Argument]: Size of the region in Pixels specified as [minArea maxArea]. Default Value: [30 14000] -// ROI [Optional Input Argument]: Specify a rectangular region of operation. Format [ x y width height ]. Default: [1 1 size(Image,2) size(Image,1)] -// MaxAreaVariation [Optional Input Argument]: Maximum Area Variation between external regions at varying thresholds for determination of stability. Values in range of (0,1]. Default 0.25 -// list_pixels: Array of point coordinates for detected regions -// Location: A M-by-2 Matrix of [x y] coordinates of centroid of the ellipsoidal fit to the region -// Count: Count of the number of stable regions detected -// Axes: A M-by-2 Matrix of [majorAxis minorAxis] values for each ellipsoidal fit to the detected regions -// Orientation: A M-by-1 Vector containing the angle of orientation of the ellipsoidal fit in the range of [-pi/2 +pi/2] radians -// -// Description -// This function is used to detect the MSER regions, and also the corresponding ellipsoidal fit to the detected regions. -// -// Examples -// image = imread('sample.jpg'); -// [regions] = detectMSERFeatures(image); -// -// With Optional Arguments: -// [regions location axes] = detectMSERFeatures(image, "ThresholdDelta", 10.0) -// - - - [lhs rhs]=argn(0); - if rhs>9 - error(msprintf(" Too many input arguments")); - elseif modulo(rhs-1,2)<>0 - error(msprintf("Either Argument Name or its Value missing")); - end - imageList=mattolist(image); - select rhs-1 - case 0 then - [pixelIdxList count location axes orientation]=raw_detectMSERFeatures(imageList); - case 2 then - [pixelIdxList count location axes orientation]=raw_detectMSERFeatures(imageList,varargin(1),varargin(2)); - case 4 then - [pixelIdxList count location axes orientation]=raw_detectMSERFeatures(imageList,varargin(1),varargin(2),varargin(3),varargin(4)); - case 6 then - [pixelIdxList count location axes orientation]=raw_detectMSERFeatures(imageList,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6)); - case 8 then - [pixelIdxList count location axes orientation]=raw_detectMSERFeatures(imageList,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6),varargin(7),varargin(8)); - end - //for i=1:size(pixelIdxList) - // regions(i)=struct('Count',1,'Location',location(i,:),'Axes',axes(i,:),'Orientation',orientation(i,:),'PixelIdxList',pixelIdxList(i)); - //end - regions=struct('Type','MSERObject','Count',count,'Location',location,'Axes',axes,'Orientation',orientation,'PixelIdxList',pixelIdxList), -endfunction diff --git a/macros/detectMinEigenFeatures.bin b/macros/detectMinEigenFeatures.bin deleted file mode 100644 index 9bc5a3a..0000000 Binary files a/macros/detectMinEigenFeatures.bin and /dev/null differ diff --git a/macros/detectMinEigenFeatures.sci b/macros/detectMinEigenFeatures.sci deleted file mode 100644 index 5a6ad2a..0000000 --- a/macros/detectMinEigenFeatures.sci +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Rohit Suri & Sridhar Reddy -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [cornerPoints]=detectMinEigenFeatures(image,varargin) -// This function is used to find corner points in an image using Minimum Eigen Value algorithm. -// -// Calling Sequence -// points = detectMinEigenFeatures(I); -// points = detectMinEigenFeatures(I, Name, Value, ...); -// -// Parameters -// points: Structure of corner points -// I: Input image to detectHarrisFeatures() -// MinQuality: (Optional) Minimum accepted quality of corners (Default- 0.01) -// FilterSize: (Optional) Dimension of Gaussian Filter (Default: 5) -// ROI: (Optional) Rectangular region for corner detection -// -// Description -// This function detects corners in an image I. These corner points are used to extract features and hence recognize the contents of an image. -// -// Examples -// I = imread('sample.jpg'); -// points = detectMinEigenFeatures(I); -// - - - [lhs rhs]=argn(0); - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>7 - error(msprintf(" Too many input arguments")); - elseif modulo(rhs,2)==0 - error(msprintf("Either Argument Name or its Value missing")); - end - imageList=mattolist(image); - select rhs-1 - case 0 then - [location metric count]=raw_detectMinEigenFeaturess(imageList); - case 2 then - [location metric count]=raw_detectMinEigenFeatures(imageList,varargin(1),varargin(2)); - case 4 then - [location metric count]=raw_detectMinEigenFeatures(imageList,varargin(1),varargin(2),varargin(3),varargin(4)); - case 6 then - [location metric count]=raw_detectMinEigenFeatures(imageList,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6)); - end - //disp(count(1,1)); - cornerPoints=struct('Type','cornerPoints','Location',location,'Metric',metric,'Count',count); - //for i=1:count(1,1) - // cornerPoints(i)=struct('Type','cornerPoints','Location',location(i,:),'Metric',metric(i,:),'Count',1); - //end -endfunction diff --git a/macros/ellipse.bin b/macros/ellipse.bin deleted file mode 100644 index bdf3b7c..0000000 Binary files a/macros/ellipse.bin and /dev/null differ diff --git a/macros/ellipse.sci b/macros/ellipse.sci deleted file mode 100644 index 3dece5c..0000000 --- a/macros/ellipse.sci +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Sukul Bagai -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [out]=ellipse(input_image , x_coordinate_of_centre , y_coordinate_centre , first_axis, second_axis, angle, startAngle, endAngle, r_value,g_value,b_value,varargin) -// This function draws a simple or thick elliptic arc or fills an ellipse sector. -// -// -// Calling Sequence -// elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b); -// elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness); -// elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness,linetype); -// elli=ellipse(inputImage,xcor,ycor,firstAxis,secondAxis,angle,startAngle,endAngle,r,g,b,thickness,linetype,shift); -// -// Parameters -// elli: The output image with the ellipse drawn in it. -// inputImage: The input image on which the ellipse should be drawn. -// xcor: X-coordinate of the center -// ycor: Y-coordinate of the center -// firstAxis: the first axis of the ellipse. -// secondAxis: the second axis of the ellipse. -// angle: Ellipse rotation angle in degrees. -// startAngle: Starting angle of the elliptic arc in degrees. -// endAngle: Ending angle of the elliptic arc in degrees. -// r: red color value of the ellipse.It should be in the range 0-255. -// b: blue color value of the ellipse.It should be in the range 0-255. -// g: green color value of the ellipse.It should be in the range 0-255. -// thickness: Line thickness. -// linetype: Type of the ellipse boundary.It can be 0 or 4 or 8. -// shift: Number of fractional bits in the point coordinates. -// -// Description -// -// This function draws a simple or thick elliptic arc or fills an ellipse sector. -// -// Examples -// // read the input image on which the ellipse shpuld be drawn. -// z=imread("lena.jpeg",0); -// call the function -// elli=ellipse(z,0,0,45,45,45,0,45,255,0,0,1,0); -// // show the image drawn on it. -// imshow(elli) - - - input_image1=mattolist(input_image); - [lhs,rhs]=argn(0); - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>14 - error(msprintf(" Too many input arguments,maximum number of arguments is 14\n")); - elseif rhs<11 - error(msprintf("the function needs atleast 11 arguments")); - end - if rhs==11 - a=raw_ellipse(input_image1 , x_coordinate_of_centre , y_coordinate_centre , first_axis, second_axis, angle, startAngle, endAngle, r_value,g_value,b_value); - elseif rhs==12 - a=raw_ellipse(input_image1 , x_coordinate_of_centre , y_coordinate_centre , first_axis, second_axis, angle, startAngle, endAngle, r_value,g_value,b_value,varargin(1)); - elseif rhs==13 - a=raw_ellipse(input_image1 , x_coordinate_of_centre , y_coordinate_centre , first_axis, second_axis, angle, startAngle, endAngle, r_value,g_value,b_value,varargin(1),varargin(2)); - elseif rhs==14 - a=raw_ellipse(input_image1 , x_coordinate_of_centre , y_coordinate_centre , first_axis, second_axis, angle, startAngle, endAngle, r_value,g_value,b_value,varargin(1),varargin(2),varargin(3)); - end - - - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end - -endfunction; diff --git a/macros/erode.bin b/macros/erode.bin deleted file mode 100644 index 39385e7..0000000 Binary files a/macros/erode.bin and /dev/null differ diff --git a/macros/erode.sci b/macros/erode.sci deleted file mode 100644 index d65cb3e..0000000 --- a/macros/erode.sci +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Sukul Bagai -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [out]=erode(input_image ,kernel,anchorX,anchorY,iterations) -// This function Erodes an image by using a specific structuring element. -// -// Calling Sequence -// -// z=imread("lena.jpeg"); -// ero=erode(inputImage,kernel,anchorX,anchorY,iterations); -// -// Parameters -// -// z: input image which should be eroded. -// ero: the output eroded image -// kernel: structuring element used for erosion -// anchorX: x coordinate of Anchor. -// anchorY: y coordinate of Anchor. -// Anchor: position of the anchor within the element. -// Iterations: number of times erosion is applied. -// -// Description -// -// This function Erodes an image by using a specific structuring element. -// -// Examples -// -// z=imread("lena.jpeg"); -// ero=erode(z,[6 4],1,1,4); - - -input_image1=mattolist(input_image); - a=raw_erode(input_image1 ,kernel,anchorX,anchorY,iterations); - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end - -endfunction; diff --git a/macros/estimateFundamentalMat.bin b/macros/estimateFundamentalMat.bin deleted file mode 100644 index 3f318a1..0000000 Binary files a/macros/estimateFundamentalMat.bin and /dev/null differ diff --git a/macros/estimateFundamentalMat.sci b/macros/estimateFundamentalMat.sci deleted file mode 100644 index 5318011..0000000 --- a/macros/estimateFundamentalMat.sci +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [fundamentalMatrix]=estimateFundamentalMat(matchedPoints1,matchedPoints2,varargin) -// It returns the 3-by-3 fundamental matrix corresponding to the input points -// -// Calling Sequence -// fundamentalMat=estimateFundamentalMatrix(matchedPoints1,matchedPoints2); -// fundamentalMat=estimateFundamentalMatrix(matchedPoints1,matchedPoints2,'method','RANSAC','param1',2,'param2',0.99); -// -// Parameters -// matchedPoints1: M-by-2 array of first image points. These points can be SURFPoints, MSERRegions, cornerPoints. -// matchedPoints2: M-by-2 array of the second image points of the same size and format as matchedPoints1. -// method: method for computing fundamental matrix. Possible methods are 7POINT,8POINT,RANSAC,LMEDS and RANSAC is the default one. -// param1: It indiacates maximum distance from a point to an epipolar line in pixels -// param2: It specifies a desirable level of confidence -// -// Description -// estimateFundamentalMatrix function calculates a fundamental matrix from the corresponding points in two images. -// -// Examples -// I=imread("lena_left.jpeg"); -// cornerPoints1=detectMinEigenFeatures(I); -// I2=imread("lena_right.jpeg"); -// cornerPoints2=detectMinEigenFeatures(I2); -// fundamentalMat=(cornerPoints1.Location,cornerPoints2.Location); - - [lhs rhs]=argn(0); - if rhs>10 - error(msprintf(" Too many input arguments")); - - end - select rhs - case 2 then - [fundamentalMatrix]=raw_estimateFundamentalMat(matchedPoints1,matchedPoints2); - case 3 then - [fundamentalMatrix]=raw_estimateFundamentalMat(matchedPoints1,matchedPoints2,varargin(1)); - case 4 then - [fundamentalMatrix]=raw_estimateFundamentalMat(matchedPoints1,matchedPoints2,varargin(1),varargin(2)); - case 5 then - [fundamentalMatrix]=opencv_estimateFundametanlMatrix(matchedPoints1,matchedPoints2,varargin(1),varargin(2),varargin(3)); - - - end -endfunction diff --git a/macros/exposure.bin b/macros/exposure.bin new file mode 100644 index 0000000..5c91fe9 Binary files /dev/null and b/macros/exposure.bin differ diff --git a/macros/exposure.sci b/macros/exposure.sci new file mode 100644 index 0000000..b73f344 --- /dev/null +++ b/macros/exposure.sci @@ -0,0 +1,81 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function x = exposure(algo_type,img_index,varargin) + //Compensate exposure in the specified image. + // + //Calling Sequence + //stacksize('max') + //image1=imread('path of the image file') + //image2=imread('path of the image file') + //y = exposure(algo_type,img_index,image1,image2) + //image3=imread('path of the image file') + //y = exposure(algo_type,img_index,image1,image2,image3) + //image4=imread('path of the image file') + //y = exposure(algo_type,img_index,image1,image2,image3,image4) + //image5=imread('path of the image file') + //y = exposure(algo_type,img_index,image1,image2,image3,image4,image5) + //image6=imread('path of the image file') + //y = exposure(algo_type,img_index,image1,image2,image3,image4,image6) + // + //Parameters + //algo_type : an integer between 1 and 3 (both inclusive) specifying the algorithm to be used for exposure compensation. + //img_index : index of the image on which exposure compensator will be applied + //image1 : an image + //image2 : an image + //image3 : an image + //image4 : an image + //image5 : an image + //image6 : an image + // + //Description + //y = exposure(algo_type,img_index,image1,image2) returns an image whose exposure is compensated. + //Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. + //After this camera parameters are estimated which is required to do particular type of warping. + //After warping is done exposure is compensated in an image whose index is mentioned. + // + //Examples + //a=imread('images/lenahi.jpg'); + //b=imread('images/lenalow.jpg'); + //algo_type=1; + //img_index=1; + //y=exposure(algo_type,img_index,a,b); + //imshow(y) + //Authors + // Manoj Sree Harsha + +[lhs rhs]=argn(0) +if rhs<4 + error(msprintf("Function need atleast 4 arguments")) +elseif rhs>8 + error(msprintf("Too many input arguments,max. no of arguments is 8")) +end +for i=1:(rhs-2) + varargin(i)=mattolist(varargin(i)) +end + +if rhs==4 + y=raw_exposure(algo_type,img_index,varargin(1),varargin(2)); +elseif rhs==5 + y=raw_exposure(algo_type,img_index,varargin(1),varargin(2),varargin(3)); +elseif rhs==6 + y=raw_exposure(algo_type,img_index,varargin(1),varargin(2),varargin(3),varargin(4)); +elseif rhs==7 + y=raw_exposure(algo_type,img_index,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)); +elseif rhs==8 + y=raw_exposure(algo_type,img_index,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6)); +end +channels = size(y) + for i = 1:channels + x(:, :, i) = (y(i)) + end + x=double(x); +endfunction diff --git a/macros/extractFeatures.bin b/macros/extractFeatures.bin deleted file mode 100644 index 3884232..0000000 Binary files a/macros/extractFeatures.bin and /dev/null differ diff --git a/macros/extractFeatures.sci b/macros/extractFeatures.sci deleted file mode 100644 index 02691ee..0000000 --- a/macros/extractFeatures.sci +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Umang Agarwal & Sridhar Reddy -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [featureVector, ValidPoints]=extractFeatures(image,points,class,varargin) -// This function is used to extract interest point descriptors -// -// Calling Sequence -// [features, validPoints] = raw_extractFeatures(Image, points, Class, Name, Value... ) -// -// Parameters -// Image: Input Image, should be a 2-D grayscale. The Input Image should be real -// points: M-by-2 vector containing the list of Interest Points -// Class: The Name of the feature detecting algorithm used for interest point detection -// Method: The desired algorithm to be used for feature vector calculation -// Metric: M-by-1 vector containing the strength of eack interest Point -// BlockSize: An odd integer scalar for defining a square neighbourhood centered at each interest point for Block Detection Method -// Upright: Rotation Invariance Flag specified as a boolean 'True' or 'False'. Default Value: False(0) -// SURFSize: Length of SURF Feature Vector. Values: [64(default)|128] -// Orientation: M-by-1 vector containing the orientation of the detected feature in radians -// Axes: M-by-2 vector containing the axes length values detected for MSER Object -// Scale: M-by-1 vector containing the scale of detection of each Interest Point -// SignOfLaplacian: M-by-1 vector containing the values of Sign of Laplacian of a SURF Object -// features: M-by-N Feature Matrix containing M feature vectors each of length N -// validPoints: M-by-2 Matrix containing the set of valid points whose features have been extracted -// -// Description -// The function derives the descriptors from pixels surrounding an interest point, where each interest point specifies the location of the detected region center. -// -// Examples -// image = imread('sample.jpg'); -// [corners count metric] = detectHarrisFeatures(image); -// [features, valid_corners] = raw_extractFeatures(image, corners, "Class", "cornerPoints", "Metric", metric); -// - - - [lhs rhs]=argn(0); - if lhs>2 - error(msprintf(" Too many output arguments")); - elseif rhs>13 - error(msprintf(" Too many input arguments")); - end - imageList=mattolist(image); - - //default values - blockSize=0; - upright=1; - surfSize=64; - if (class=="cornerPoints" | class=="BRISKPoints") - method="FREAK"; - elseif (class=="MSERRegions" | class=="SURFPoints") - method="SURF"; - elseif (class=="Matrix") - method="Block"; - else - error(msprintf(" Invalid class type, check documentation for the list of valid types")); - end - - //Count to ensure argument called only once - count_metric=0,count_orientation=0,count_scale=0,count_axes=0,count_signOfLaplacian=0; - count_method=0, count_block=0, count_surf=0, count_upright=0; - blockSize=1; - metric=1; - //Parsing input arguments - for i=1:2:rhs-3 - if (varargin(i)=="Metric") - if(count_metric==0) - i=i+1; - metric=varargin(i); - count_metric=1; - else - error(msprintf(" Metric argument has been called twice")); - end - elseif (varargin(i)=="Orientation") - if(count_orientation==0) - - i=i+1; - orientation=varargin(i); - count_orientation=1; - - else - error(msprintf(" Orientation argument has been called twice")); - end - elseif (varargin(i)=="Scale") - if(count_scale==0) - i=i+1; - scale=varargin(i); - count_scale=1; - else - error(msprintf(" Scale argument has been called twice")); - end - elseif (varargin(i)=="Axes") - if(count_axes==0) - i=i+1; - axes=varargin(i); - count_axes=1; - else - error(msprintf(" Axes argument has been called twice")); - end - elseif (varargin(i)=="SignOfLaplacian") - if(count_signOfLaplacian==0) - i=i+1; - signOfLaplacian=varargin(i); - count_signOfLaplacian=1; - else - error(msprintf("SignOfLaplacian argument has been called twice")); - end - elseif (varargin(i)=="Method") - if(count_method==0) - i=i+1; - method=varargin(i); - count_method=1; - else - error(msprintf("Method argument has been called twice")); - end - elseif (varargin(i)=="BlockSize") - if(count_block==0) - i=i+1; - blockSize=varargin(i); - count_block=1; - else - error(msprintf("BlockSize argument has been called twice")); - end - elseif (varargin(i)=="SurfSize") - if(count_surf==0) - i=i+1; - surfSize=varargin(i); - count_surf=1; - else - error(msprintf("SurfSize argument has been called twice")); - end - elseif (varargin(i)=="Upright") - if(count_upright==0) - i=i+1; - upright=varargin(i); - count_upright=1; - else - error(msprintf("Upright argument has been called twice")); - end - else - error(msprintf("Wrong argument, check documentation for the list of valid arguments")); - end - end - - - select class - case "cornerPoints" then - if(count_metric==0) - error(msprintf("For cornerPoints Class Metric argument is necessary")); - end - [featureVectors ValidPoints numBits numFeatures count metric]= raw_extractFeatures(imageList, points, "Class", class, "Method", method, "surfSize", surfSize, "blockSize", blockSize, "upright", upright, "Metric",metric); - - case "BRISKPoints" then - if(count_metric==0 | count_scale==0 | count_orientation==0) - error(msprintf("For BRISKPoints Class Metric, Orientation and Scale arguments are necessary")); - end - [featureVectors ValidPoints numBits numFeatures scale metrix orientation count]= raw_extractFeatures(imageList, points, "Class", class, "Method", method, "surfSize", surfSize, "blockSize", blockSize, "upright", upright, "Metric",metric,"Orientation",orientation,"Scale",scale); - - case "MSERRegions" then - - if( count_orientation==0 | count_axes==0) - error(msprintf("For MSERRegions Class Orientation Matrix and Axes Matrix arguments are necessary.")); - end - - [featureVectors, ValidPoints, numBits, numFeatures, count, axes, orientation]=raw_extractFeatures(imageList, points, "Class", class, "Method", method, "surfSize", surfSize, "blockSize", blockSize, "upright", upright, "Orientation",orientation,"Axes",axes); - - - case "SURFPoints" then - if(count_scale==0 | count_metric==0 | count_signOfLaplacian==0 | count_orientation==0) - error(msprintf("For SURFPoints Class Metric, Orientation, Scale and SignOfLaplacian arguments are necessary")); - end - [featureVectors ValidPoints numBits numFeatures count scale metrix signOfLaplacian orientation]= raw_extractFeatures(imageList, points, "Class", class, "Method", method, "surfSize", surfSize, "blockSize", blockSize, "upright", upright, "Metric",metric,"Orientation",orientation,"Scale",scale,"SignOfLaplacian",signOfLaplacian); - - - case "Matrix" then - if(count_block==0) - error(msprintf("For Matrix Class BlockSize argument is necessary")); - end - [featureVectors ValidPoints numBits numFeatures]= raw_extractFeatures(imageList, points, "Class", class, "Method", method, "surfSize", surfSize, "blockSize", blockSize, "upright", upright,"BlockSize",blockSize); - end - - - - featureVector=struct("Type","binaryFeatures",'Features',featureVectors,'NumBits',numBits,'NumFeatures',numFeatures); - -endfunction diff --git a/macros/findHomography.bin b/macros/findHomography.bin deleted file mode 100644 index f00ebaf..0000000 Binary files a/macros/findHomography.bin and /dev/null differ diff --git a/macros/findHomography.sci b/macros/findHomography.sci deleted file mode 100644 index 2cfe4a0..0000000 --- a/macros/findHomography.sci +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [homography_matrix]= findHomography(points1,points2,varargin) -// This Function Finds a perspective transformation between two planes. -// -// Calling Sequence -// homographyMatrix=findHomography(points1,points2); -// homographyMatrix=findHomography(points1,points2,method); -// homographyMatrix=findHomography(points1,points2,method,threshold); -// -// Parameters -// homographyMatrix: perspective transformation H between the source and the destination planes -// points1: Coordinates of the points in the original plane -// points2: Coordinates of the points in the target plane -// method: Method used to computed a homography matrix. -// Here are the different options for method -// 0 - a regular method using all the points -// 4 - RANSAC-based robust method -// 8 - Least-Median robust method -// 16 - PROSAC-based robust method -// threshold: Maximum allowed reprojection error to treat a point pair as an inlier. -// Note: the number of points should be same in the points1 and points2 -// Description -// The function finds and returns the perspective transformation H between the source and the destination planes -// -//Examples -// -// read first image -// z=imread("lena.jpeg",0); -// get points from first image -// yo=detectGFTTFeatures(z); -// read second image -// image=imread("lena2.jpg",0); -// yo1=detectGFTTFeatures(image); -// // call function with same number of points in both(first arg has 594 so passig 594 points from second arg) -// lou=findHomography(yo.KeyPoints,yo1.KeyPoints(1:594,:)); - - - - - - [lhs rhs]=argn(0); - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>4 - error(msprintf(" Too many input arguments,maximum number of arguments is 4")); - elseif rhs<2 - error(msprintf("the function needs atleast 2 arguments")); - end - - if rhs==2 then - homography_matrix=raw_findHomography(points1,points2); - elseif rhs==3 - homography_matrix=raw_findHomography(points1,points2,varargin(1)); - elseif rhs==4 - homography_matrix=raw_findHomography(points1,points2,varargin(1),varargin(2)); - end - - - -endfunction diff --git a/macros/fitellipse.bin b/macros/fitellipse.bin deleted file mode 100644 index b314a18..0000000 Binary files a/macros/fitellipse.bin and /dev/null differ diff --git a/macros/fitellipse.sci b/macros/fitellipse.sci deleted file mode 100644 index 3eabc50..0000000 --- a/macros/fitellipse.sci +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao & Priyanka Gandhi -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [out]=fitellipse(InputArraypoints) -// The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. -// -// Calling Sequence -// -// felli=fitellipse(points); -// -// Parameters -// felli: a struct containing all the details about the ellipse Params. -// points: Input 2D point set -// -// Description -// -// The function calculates the ellipse that fits (in a least-squares sense) a set of 2D points best of all. -// -// Examples -// -// // read image -// z=imread("lena.jpeg",0); -// //get points using KAZE detector or the points can also be hardcoded. -// pio=detectKAZEFeatures(z); -// // call function -// sss=fitellipse(pio.KeyPoints) - - [t1 t2 t3 t4 t5]= raw_fitellipse(InputArraypoints); - out=struct("size1",t1,"size2",t2,"center1",t3,"center2",t4,"angle",t3); -endfunction; diff --git a/macros/graycoprops.bin b/macros/graycoprops.bin deleted file mode 100644 index 2ff4084..0000000 Binary files a/macros/graycoprops.bin and /dev/null differ diff --git a/macros/graycoprops.sci b/macros/graycoprops.sci deleted file mode 100644 index ae4b002..0000000 --- a/macros/graycoprops.sci +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function[stats] = graycoprops(srcImg, varargin) -// This function computes the Properties of gray-level co-occurrence matrix. -// -// Calling Sequence -// z=imread("lena.jpeg"); //in grayscale or color -// //Note: z can be a image or simply a Matrix. -// gray=graycoprops(z) //get all 4 properties -// gray=graycoprops(z,"contrast") //compute only contrast -// gray=graycoprops(z,["contrast" "energy"]) //compute contrast and energy.the properties can be passed in any order -// gray=graycoprops(z,["contrast" "correlation" "energy"]) -// gray=graycoprops(z,["contrast" "correlation" "energy" "homogeneity"]) -// -// Parameters -// -// gray: A struct containing all the parameters -// z: A image or a matrix -// contrast: a measure of the intensity contrast between a pixel and its neighbor over the whole image. -// energy: the sum of squared elements -// homogeneity: a value that measures the closeness of the distribution of elements. -// correlation:a measure of how correlated a pixel is to its neighbor over the whole image -// -// Description -// This function computes the Properties of gray-level co-occurrence matrix.The properties being "correlation","contrast","energy" and "homogeneity". -// -// -// Examples -// //compute for a image -// z=imread("lena.jpeg",0); -// sss=graycoprops(z,["contrast"]) -// -// //compute for a matrix -// glcm = [0 1 2 3;1 1 2 3;1 0 2 0;0 0 0 3] -// sss=graycoprops(glcm,["contrast" "energy" "correlation"]) - - - [lhs, rhs] = argn(0) - - srcMat = mattolist(srcImg) - - select rhs - case 1 then - [contrast correlation energy homo] = raw_graycoprops(srcMat); - stats=struct('Contrast',contrast,'Correlation',correlation,'Energy',energy,'Homogeniety',homo); - case 2 then - [rows cols]=size(varargin(1)); - n=rows*cols; - if n>4 - error(msprintf("the string matrix must have maximimum of 4 entries")); - end - inputString=varargin(1); - if n==1 - [out]=raw_graycoprops(srcMat,varargin(1)); - stats=struct(inputString(1),out); - elseif n==2 - [out out1]=raw_graycoprops(srcMat,varargin(1)); - stats=struct(inputString(1),out,inputString(2),out1); - - elseif n==3 - [out out1 out2]=raw_graycoprops(srcMat,varargin(1)); - stats=struct(inputString(1),out,inputString(2),out1,inputString(3),out2); - - elseif n==4 - [out out1 out2 out3]=raw_graycoprops(srcMat,varargin(1)); - stats=struct(inputString(1),out,inputString(2),out1,inputString(3),out2,inputString(4),out3); - - end - - - end - - - -endfunction diff --git a/macros/imattributes.bin b/macros/imattributes.bin new file mode 100644 index 0000000..a923f14 Binary files /dev/null and b/macros/imattributes.bin differ diff --git a/macros/imattributes.sci b/macros/imattributes.sci new file mode 100644 index 0000000..af859f2 --- /dev/null +++ b/macros/imattributes.sci @@ -0,0 +1,37 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Dhruti Shah , Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [] = imattributes(image) + //Provides information about image attributes. + // + //Calling Sequence + //inputImage=imread('path of the image file') + //imattributes(inputImage) + // + //Parameters + //inputImage : an image. + // + //Description + //imattributes gives image attribute information in the form of a 4-by-2 or 6-by-2 cell array, depending on the image type. + //The first column of the cell array contains the name of the attribute. + // The second column contains the value of the attribute. Both attribute names and values are character vectors + //'Minimum intensity': Regarding intensity images, this value represents the lowest intensity value of any pixel. In case ofindexed images, this value represents the lowest index value into a color map. + //'Maximum intensity':Regarding intensity images, this value represents the highest intensity value of any pixel. In case of indexed images, this value represents the highest index value into a color map. + // + //Examples + //inputImage=imread('images/lena.jpeg'); + //imattributes(inputImage) + //Authors + // Dhruti Shah , Manoj Sree Harsha + +img=mattolist(image); +raw_imattributes(img); +endfunction diff --git a/macros/imread.bin b/macros/imread.bin deleted file mode 100644 index d344d4d..0000000 Binary files a/macros/imread.bin and /dev/null differ diff --git a/macros/imread.sci b/macros/imread.sci deleted file mode 100644 index 3aaf9b0..0000000 --- a/macros/imread.sci +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Sukul Bagai & Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function[dstMat] = imread(matA,varargin) -// This function is used to Read/Load an image from the disk -// -// -// -// Calling Sequence -// image=imread("image_path"); -// image=imread("image_path",options) -// -// Parameters -// image_path: a String which contains the path of the image that is to be read. -// options: an Integer, containing the option for user to specify. See below for details. -// 0 : convert image to the single channel grayscale image. -// 1 : convert image to the 3 channel BGR color image. -// 2 : load 16-bit/32-bit image when the input image has the corresponding depth, otherwise convert it to 8-bit. -// 4 : the image is read in any possible color format. -// 8 : use the gdal driver for loading the image. -// 16 : convert image to the single channel grayscale image and the image size reduced 1/2. -// 17 : convert image to the 3 channel BGR color image and the image size reduced 1/2. -// 32 : convert image to the single channel grayscale image and the image size reduced 1/4. -// 33 : convert image to the 3 channel BGR color image and the image size reduced 1/4. -// 64 : convert image to the single channel grayscale image and the image size reduced 1/8. -// 65 : convert image to the 3 channel BGR color image and the image size reduced 1/8. -// 128 : do not rotate the image according to EXIF's orientation flag. -// -// Description -// This function is used to Read/Load an image from the disk -// -// -// Examples -// Read a image as it is(Unchanged). -// //Calling imread -// image=imread("test.jpg"); -// -// Read image as grayscale -// //Calling imread -// image=imread("test.jpg",0); - - [lhs rhs]=argn(0); - - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>2 - error(msprintf(" Too many input arguments,maximum number of arguments is 2\n")); - elseif rhs<1 - error(msprintf("the function needs atleast 1 arguments")); - end - if rhs==1 - out = raw_imread(matA); - else - out=raw_imread(matA,varargin(1)); - end - - - channel = size(out) - - for i = 1: channel - dstMat(:,:,i) = (out(i)) - end - -endfunction diff --git a/macros/imresize.bin b/macros/imresize.bin deleted file mode 100644 index 3506f9b..0000000 Binary files a/macros/imresize.bin and /dev/null differ diff --git a/macros/imresize.sci b/macros/imresize.sci deleted file mode 100644 index 0ae3438..0000000 --- a/macros/imresize.sci +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [out]=imresize(image,alpha,beta) -// This function is used to resize the image -// -// Calling Sequence -// -// newImage=imresize(inputImage,alpha,beta); -// -// Parameters -// -// newImage: the new resized image -// inputImage: the image which should be resized. -// alpha: new number of rows. -// beta: new number of columns. -// -// Description -// -// This function is used to resize the image -// -// Examples -// -// z=imread("lena.jpeg",0); -// zz=imresize(z,35,12); -// imshow(zz) - image1=mattolist(image); - a=raw_imresize(image1,alpha,beta); - dimension=size(a) - for i = 1:dimension - out(:,:,i)=a(i); - end -endfunction; diff --git a/macros/indexImages.bin b/macros/indexImages.bin deleted file mode 100644 index a129b23..0000000 Binary files a/macros/indexImages.bin and /dev/null differ diff --git a/macros/indexImages.sci b/macros/indexImages.sci deleted file mode 100644 index 928ad28..0000000 --- a/macros/indexImages.sci +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Rohit Suri ,Umang Agarwal & Sridhar Reddy -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - - -function [imageIndex]=indexImages(imgSet,varargin) -// This function creates image search index -// -// Calling Sequence -// imageIndex = indexImages(imgSet, bagOfFeatures, Name, Value... ); -// -// Parameters -// imgSet: Collection of images with their location and labels -// bagOfFeatures: Bag of Visual Words -// Verbose [Optional Input Argument]: Enable Progress display to Screen -// SaveFeatureLocations [Optional Input Argument]: A boolean value indicating whether feature locations has to be saved or not. Values: [True(default)|False] -// imageIndex: Search Index Object containing the mapping of visual vocabulary to each image in the image set -// -// Description -// Creates a search Index Object that has been mapped to visual words that can be used for retrieve Images -// -// Examples -// imgSet = imageSet(directory,'recursive'); -// [trainingSet testSet] = partition(imgSet,[0.8]); -// bag = bagOfFeatures(trainingSet); -// imageindex = indexImages(trainingSet, bag); -// -// With Optional Arguments: -// imageindex = indexImages(trainingSet, bag, "Verbose", 1); -// -// Authors -// Umang Agrawal -// Rohit Suri -// Sridhar Reddy - - [lhs rhs]=argn(0); - if rhs>6 - error(msprintf(" Too many input arguments")); - end - imgSetList=imageSetToList(imgSet); - if modulo(lhs,2)==0 - bagList=bagStructToList(varargin(1)); - select rhs - case 1 then - [imageIndexList]=raw_indexImages(imgSetList); - case 2 then - [imageIndexList]=raw_indexImages(imgSetList,bagList); - case 3 then - [imageIndexList]=raw_indexImages(imgSetList,varargin(1),varargin(2)); - case 4 then - [imageIndexList]=raw_indexImages(imgSetList,bagList,varargin(2),varargin(3)); - case 5 then - [imageIndexList]=raw_indexImages(imgSetList,varargin(1),varargin(2),varargin(3),varargin(4)); - case 6 then - [imageIndexList]=raw_indexImages(imgSetList,bagList,varargin(2),varargin(3),varargin(4),varargin(5)); - end - end - -endfunction diff --git a/macros/integralImage.bin b/macros/integralImage.bin deleted file mode 100644 index 38b5e6c..0000000 Binary files a/macros/integralImage.bin and /dev/null differ diff --git a/macros/integralImage.sci b/macros/integralImage.sci deleted file mode 100644 index 00801cb..0000000 --- a/macros/integralImage.sci +++ /dev/null @@ -1,20 +0,0 @@ -function[dstMat] = integralImage(srcImg, varargin) - - [lhs, rhs] = argn(0) - - srcMat = mattolist(srcImg) - - select rhs - case 1 then - out = opencv_integralImage(srcMat) - case 3 then - out = opencv_integralImage(srcMat, varargin(1)) - end - - channel = size(out) - - for i = 1: channel - dstMat(:,:,i) = out(i) - end - -endfunction diff --git a/macros/lab2double.bin b/macros/lab2double.bin deleted file mode 100644 index d47da03..0000000 Binary files a/macros/lab2double.bin and /dev/null differ diff --git a/macros/lab2double.sci b/macros/lab2double.sci deleted file mode 100644 index 34e0438..0000000 --- a/macros/lab2double.sci +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Tess Zacharias -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [output] = lab2double(pstData) -// This function used to convert a matrix of L*a*b to double. -// -// Calling Sequence -// -// doub=lab2double(matrix); -// -// Parameters -// -// doub: The output matrix with double values. -// matrix: the input matrix with Lab values. -// -// Description -// -// This function used to convert a matrix of L*a*b to double. -// -// Examples -// a=[1 0 1]; -// doub=lab2double(a); -// -// z=imread("lena.jpeg"); -// cvt=cvtColor(z,"CV_RGB2Lab"); -// doub=lab2double(cvt); - - pstData=mattolist(pstData); - a = raw_lab2double(pstData); - d = size(a); - for i=1:d - output(:,:,i) = a(i); - end -endfunction diff --git a/macros/matMulDeriv.bin b/macros/matMulDeriv.bin deleted file mode 100644 index a672b32..0000000 Binary files a/macros/matMulDeriv.bin and /dev/null differ diff --git a/macros/matMulDeriv.sci b/macros/matMulDeriv.sci deleted file mode 100644 index 02793e5..0000000 --- a/macros/matMulDeriv.sci +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [DA,DB]= matMulDeriv(A,B) -// this function Computes partial derivatives of the matrix product for each multiplied matrix -// -// Calling Sequence -// [da db]=matMulDeriv(A,B); -// -// Parameters -// A First multiplied matrix. -// B Second multiplied matrix. -// da First output derivative matrix d(A*B)/dA of size (A.rows * B.cols)x(A.rows * A.cols) and same type as A. -// db Second output derivative matrix d(A*B)/dB of size (A.rows * B.cols)x(B.rows * B.cols) and same type as A. -// -// Description -// this function Computes partial derivatives of the matrix product for each multiplied matrix -// Examples -// -// Declare mattrices -//a=[1 2 ;3 4]; -//b=[1 2 ;3 4]; -// //call function -//[da db]=matMulDeriv(a,b); -// //view output -//da -//db - [lhs rhs]=argn(0); - - if lhs>2 - error(msprintf(" Too many output arguments,maximum number of output arguments is 2")); - elseif rhs>2 - error(msprintf(" Too many input arguments,maximum number of arguments is 2`")); - elseif rhs<2 - error(msprintf("the function needs atleast 2 arguments")); - end - - [DA,DB]=raw_matMulDeriv(A,B); - - -endfunction diff --git a/macros/match.bin b/macros/match.bin new file mode 100644 index 0000000..cc52f12 Binary files /dev/null and b/macros/match.bin differ diff --git a/macros/match.sci b/macros/match.sci new file mode 100644 index 0000000..93fc64c --- /dev/null +++ b/macros/match.sci @@ -0,0 +1,42 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: M Avinash Reddy & Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [x] = match(a,b) + //Performs matching features between two images. + // + //Calling Sequence + //img1=imread('path of the image file') + //img2=imread('path of the image file') + //x=match(img1,img2) + // + //Parameters + //img1 : an image + //img2 : an image + // + //Description + //The images pass through a stiching pipeline. + //Features are extracted from each image and matching is done on two images. + // + //Examples + //img1=imread('images/campus_000.jpg'); + //img2=imread('images/campus_001.jpg'); + //x=match(img1,img2); + //Authors + // Manoj Sree Harsha + +c=mattolist(a); +d=mattolist(b); +[y]=raw_match(c,d); +channels = size(y) + for i = 1:channels + x(:, :, i) = ((y(i))) + end +endfunction diff --git a/macros/opticalflow.bin b/macros/opticalflow.bin new file mode 100644 index 0000000..40bf5d2 Binary files /dev/null and b/macros/opticalflow.bin differ diff --git a/macros/opticalflow.sci b/macros/opticalflow.sci new file mode 100644 index 0000000..d9b55a8 --- /dev/null +++ b/macros/opticalflow.sci @@ -0,0 +1,32 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Manoj Sree Harsha & M Avinash Reddy +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in +// +function [] = opticalflow(a) + //Calculates optical flow. + // + //Calling Sequence + //opticalflow(vid) + // + //Parameters + //vid : a video + // + //Description + //opticalflow(vid) returns an opticalflow video and it will be written to 'out.avi' file (In the current working directory). + // + //Examples + //opticalflow('ball.mp4'); + //opticalflow('vtest.avi'); + //Authors + // Manoj Sree Harsha , M Avinash Reddy + + raw_opticalflow(a); + +endfunction diff --git a/macros/pana.bin b/macros/pana.bin new file mode 100644 index 0000000..362fa76 Binary files /dev/null and b/macros/pana.bin differ diff --git a/macros/pana.sci b/macros/pana.sci new file mode 100644 index 0000000..0dad110 --- /dev/null +++ b/macros/pana.sci @@ -0,0 +1,94 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: M Avinash Reddy & Manoj Sree Harsha & Ebey Abraham +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [out]=pana(img1,varargin) + //Creates the output panorama image using two or more images + // + //Calling Sequence + //stacksize('max') + //img1=imread('path of the image file') + //img2=imread('path of the image file') + //out = pana(img1,img2) + //img3=imread('path of the image file') + //out = pana(img1,img2,img3) + //img4=imread('path of the image file') + //out = pana(img1,img2,img3,img4) + //img5=imread('path of the image file') + //out = pana(img1,img2,img3,img4,img5) + //img6=imread('path of the image file') + //out = pana(img1,img2,img3,img4,img5,img6) + // + //Parameters + //img1 : an image + //img2 : an image + //img3 : an image + //img4 : an image + //img5 : an image + //img6 : an image + // + //Description + //The images pass through a stiching pipeline before the final panorama is formed. + //Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. + //After this camera parameters are estimated which is required to do particular type of warping. + //After warping is done exposure is compensated in all images so as to get a uniform exposure throughout the panaroma. + //Seam estimation is done next to get the exact portions of images to be blended. + //Finally, the images are blended to form the panorama. + // + //Examples + //stacksize('max'); + //img1=imread('images/campus_017.jpg'); + //img2=imread('images/campus_016.jpg'); + //img3=imread('images/campus_015.jpg'); + //img4=imread('images/campus_014.jpg'); + //img5=imread('images/campus_013.jpg'); + //img6=imread('images/campus_012.jpg'); + //out=pana(img1,img2,img3,img4,img5,img6); + // + //Examples + //stacksize('max'); + //a=imread('images/s1.jpg'); + //b=imread('images/s2.jpg'); + //c=imread('images/s3.jpg'); + //y=pana(a,b,c); + //Authors + // M Avinash Reddy , Manoj Sree Harsha , Ebey Abraham + [lhs rhs]=argn(0) + if lhs>1 + error(msprintf(" Too many output arguments")) + end + if rhs>6 + error(msprintf(" Too many input arguments,maximum number of arguments is 6")) + end + if rhs<2 + error(msprintf("the function needs atleast 2 arguments")) + end + image=mattolist(img1) + for i=1:rhs-1 + varargin(i)=mattolist(varargin(i)) + end + if rhs==2 + res=raw_panorama(image,varargin(1)) + elseif rhs==3 + res=raw_panorama(image,varargin(1),varargin(2)) + elseif rhs==4 + res=raw_panorama(image,varargin(1),varargin(2),varargin(3)) + elseif rhs==5 + res=raw_panorama(image,varargin(1),varargin(2),varargin(3),varargin(4)) + elseif rhs==6 + res=raw_panorama(image,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)) + end + + channel=size(res) + for i = 1: channel + out(:,:,i) = (res(i)) + end + out=double(out) +endfunction diff --git a/macros/pclradius.bin b/macros/pclradius.bin new file mode 100644 index 0000000..8e700be Binary files /dev/null and b/macros/pclradius.bin differ diff --git a/macros/pclradius.sci b/macros/pclradius.sci new file mode 100644 index 0000000..6796136 --- /dev/null +++ b/macros/pclradius.sci @@ -0,0 +1,45 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [out] = pclradius(pcloud,q,r) + //Finds all the points within the circle of radius r with centre as query point q, in the pointcloud pcloud + // + //Calling Sequence + //y = pclradius(pcloud,q,r) + // + //Parameters + //pcloud : pointCloud object. + //q : a row vector containing the query point + //r : a positive integer specifying the radius. + //out : a matrix. + // + //Description + //out = pclradius(pcloud,q,r) return a 2x(Number of points) matrix . + //The first row of out contains the indices of all the points in the pointCloud within the circle of radius r. + //The second row contains the corresponding squared distances(squared euclidean distance). + // + //Examples + //a=pcread('data/cube.ply'); + //q=[1 1 -1]; + //r=10; + //out=pclradius(a,q,r); + // + //a=pcread('data/bun0.pcd'); + //q=[0.5 0.5 0.5]; + //r=2; + //out=pclradius(a,q,r); + //Authors + // Manoj Sree Harsha + + data=pcloud.Location; + out = raw_radsearch(data,q,r); + +endfunction diff --git a/macros/pcread.bin b/macros/pcread.bin deleted file mode 100644 index e62e48f..0000000 Binary files a/macros/pcread.bin and /dev/null differ diff --git a/macros/pcread.sci b/macros/pcread.sci deleted file mode 100644 index e45727f..0000000 --- a/macros/pcread.sci +++ /dev/null @@ -1,26 +0,0 @@ -//Author-Nihar Rao -function[point] = pcread(inputPath) - - [lhs rhs]=argn(0); - - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>1 - error(msprintf(" Too many input arguments,maximum number of arguments is 1\n")); - elseif rhs<1 - error(msprintf("the function needs atleast 1 arguments")); - end - - [location count width height rgb xlimit ylimit zlimit dense intensity Normal]=raw_pcread(inputPath); - - - -point=struct('dataType','PointCloud','Width',width,'Height',height,'is_dense',dense,'Location',location,'Count',count,'Color',rgb,'XLimits',xlimit,'YLimits',ylimit,'ZLimits',zlimit,'Intensity',intensity,'Normal',Normal); - - - - - - - -endfunction diff --git a/macros/radius.bin b/macros/radius.bin new file mode 100644 index 0000000..ed661f3 Binary files /dev/null and b/macros/radius.bin differ diff --git a/macros/radius.sci b/macros/radius.sci new file mode 100644 index 0000000..9c9611c --- /dev/null +++ b/macros/radius.sci @@ -0,0 +1,55 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [y]=radius(q,f,r,varargin) + //Finds all the points within the circle of radius r with centre as query point q, in the dataset f + // + //Calling Sequence + //y = radius(q,f,r) + //y = radius(q,f,r,algo_type) + // + //Parameters + //q : a row vector containing the query point + //f : f is the set of data points and the number of columns in f should be same as that of q to match point dimensionality + //r : a positive integer specifying the radius. + //algo_type : a integer between 1 and 4 (both inclusive) specifying the algorithm to be used for the radius search. + // + //Description + //y = radius(q,f,r) return a 2x(Number of points) matrix . + //The first row of y contains the indices of all the points in the dataset(f) within the circle of radius r. + //The second row contains the corresponding distances(squared euclidean distance). + // + //Examples + //q=[1 2 3]; + //f=[1 2 3;4 5 6;7 8 9]; + //r=30; + //y=radius(q,f,r); + //Authors + // Manoj Sree Harsha + +[lhs rhs]=argn(0) + + if lhs>1 + error(msprintf(" Too many output arguments")) + elseif rhs>4 + error(msprintf(" Too many input arguments,maximum number of arguments is 4")) + elseif rhs<3 + error(msprintf("the function needs atleast 3 arguments")) + end + f1=mattolist(f); + + if rhs==3 + y=raw_radius(q,f1,r) + elseif rhs==4 + y=raw_radius(q,f1,r,varargin(1)) + end + +endfunction diff --git a/macros/rotationVectorToMatrix.bin b/macros/rotationVectorToMatrix.bin new file mode 100644 index 0000000..c4abfdc Binary files /dev/null and b/macros/rotationVectorToMatrix.bin differ diff --git a/macros/rotationVectorToMatrix.sci b/macros/rotationVectorToMatrix.sci new file mode 100644 index 0000000..ad5cc41 --- /dev/null +++ b/macros/rotationVectorToMatrix.sci @@ -0,0 +1,34 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Tanmay Chaudhari +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function [ out ] = rotationVectorToMatrix(vector) + // Returns rotation matrix. + // + // Calling Sequence + // matrix = rotationVectorToMatrix(vector); + // + // Parameters + // matrix: rotation matrix + // vector: 3-D rotation vector + // + // Description + // Converts rotation vector to rotation matrix. + // + // Examples + // vector = pi/4 * [1, 2, 3]; + // matrix = rotationVectorToMatrix(vector); + // + // Authors + // Tanmay Chaudhari + + out=raw_rotationVectorToMatrix(vector); + +endfunction diff --git a/macros/rotestimate.bin b/macros/rotestimate.bin new file mode 100644 index 0000000..1964ba2 Binary files /dev/null and b/macros/rotestimate.bin differ diff --git a/macros/rotestimate.sci b/macros/rotestimate.sci new file mode 100644 index 0000000..79fdc2d --- /dev/null +++ b/macros/rotestimate.sci @@ -0,0 +1,72 @@ +// Copyright (C) 2015 - IIT Bombay - FOSSEE +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// Author: Manoj Sree Harsha +// Organization: FOSSEE, IIT Bombay +// Email: toolbox@scilab.in + +function res = rotestimate(cam_index,varargin) + //Estimates camera intrinsic parameters matrix(K). + // + //Calling Sequence + //img1=imread('path of the image file') + //img2=imread('path of the image file') + //res = rotestimate(cam_index,img1,img2) + //img3=imread('path of the image file') + //res = rotestimate(cam_index,img1,img2,img3) + //img4=imread('path of the image file') + //res = rotestimate(cam_index,img1,img2,img3,img4) + //img5=imread('path of the image file') + //res = rotestimate(cam_index,img1,img2,img3,img4,img5) + //img6=imread('path of the image file') + //res = rotestimate(cam_index,img1,img2,img3,img4,img5,img6) + // + //Parameters + //cam_index : cam_index of the camera for which K is returned. + //img1 : an image + //img2 : an image + //img3 : an image + //img4 : an image + //img5 : an image + //img6 : an image + // + //Description + //The images pass through a stiching pipeline. + //Features are extracted from each image and matching is done on two consecutive images to ensure the continuity in images. + //After this camera parameters are estimated. + // + //Examples + //img1=imread('images/campus_000.jpg'); + //img2=imread('images/campus_001.jpg'); + //cam_index=1 + //res=rotestimate(1,img1,img2); + //Authors + // Manoj Sree Harsha + +[lhs rhs]=argn(0) + if lhs>1 + error(msprintf(" Too many output arguments")) + elseif rhs>7 + error(msprintf(" Too many input arguments,maximum number of arguments is 7")) + elseif rhs<3 + error(msprintf("the function needs atleast 3 arguments")) + end + for i=1:(rhs-1) + varargin(i)=mattolist(varargin(i)) + end + if rhs==3 + res=raw_rotestimate(cam_index,varargin(1),varargin(2)); + elseif rhs==4 + res=raw_rotestimate(cam_index,varargin(1),varargin(2),varargin(3)); + elseif rhs==5 + res=raw_rotestimate(cam_index,varargin(1),varargin(2),varargin(3),varargin(4)); + elseif rhs==6 + res=raw_rotestimate(cam_index,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)); + elseif rhs==7 + res=raw_rotestimate(cam_index,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6)); + end +endfunction diff --git a/macros/stereoCalibrate.bin b/macros/stereoCalibrate.bin deleted file mode 100644 index 11db6eb..0000000 Binary files a/macros/stereoCalibrate.bin and /dev/null differ diff --git a/macros/stereoCalibrate.sci b/macros/stereoCalibrate.sci deleted file mode 100644 index 502cc10..0000000 --- a/macros/stereoCalibrate.sci +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [params]=stereoCalibrate(objectpoints,imagepoints1,imagepoints2,varargin) -// this function Performs stereo calibration for the fisheye model. -// -// Calling Sequence -// -// stereo=stereoCalibrate(objectpoints,imagepoints1,imagepoints2); -// stereo=stereoCalibrate(objectpoints,imagepoints1,imagepoints2,cameraMatrix1,distCoeffs1,cameraMatrix2,distCoeffs2); -// -// Parameters -// stereo: a Struct containing all the camera Params -// objectpoints: a 2d set of actual object points. -// imagepoints1: a list of imagepoints of image1. -// imagepoints2: a list of imagepoints of image2. -// cameraMatrix1: camera matrix of first camera. -// distCoeffs1: distortion coefficients of first camera.it should be 4*1 or 1*4. -// cameraMatrix2: camera matrix of second camera. -// distCoeffs2: distortion coefficients of second camera.it should be 4*1 or 1*4. -// -// Description -// -// this function Performs stereo calibration for the fisheye model. -// -// Examples -// // A example to show calibration, using the traditional chessboard/checkerboard example. -// -// //generate checkerboardpoints for calibration -// yo=genCheckerboardPoints([7 10],8); -// //read first image -// z=imread("left1.jpg",0); -// //read second image -// image=imread("right1.jpg",0); -// //detect checkerboardpoints for image 1 -// ii=detectCheckerboardCorner(z,[7 10]); -// //detect checkerboardpoints for image 2 -// ii2=detectCheckerboardCorner(image,[7 10]); -// //convert imagepoints to list -// ii=list(ii); -// ii2=list(ii2); -// // call function -// final=stereoCalibrate(yo,ii,ii2); -// // show the struct -// final -// // use the above calibration further -// uu = undistortImage(image,final.cameraMatrix2); -// imshow(uu); -// -// -// //generate checkerboardpoints for calibration -// yo=genCheckerboardPoints([7 10],8); -// //read first image -// z=imread("left1.jpg",0); -// //read second image -// image=imread("right1.jpg",0); -// //detect checkerboardpoints for image 1 -// ii=detectCheckerboardCorner(z,[7 10]); -// //detect checkerboardpoints for image 2 -// ii2=detectCheckerboardCorner(image,[7 10]); -// //convert imagepoints to list -// ii=list(ii); -// ii2=list(ii2); -// // call function -// final=stereoCalibrate(yo,ii,ii2); -// // show the struct -// final -// // use the above calibration further -// uu = undistortImage(image,final.cameraMatrix2,'distCoeffs',final.distortionCoefficients2); -// imshow(uu); - - - - [lhs rhs]=argn(0); - - if lhs>1 - error(msprintf(" Too many [a b c d e f]put arguments\n")); - elseif rhs>7 - error(msprintf(" Too many input arguments,maximum number of arguments is 7\n")); - elseif rhs<3 - error(msprintf("the function needs atleast 3 arguments\n")); - end - - if rhs==3 - [a b c d e f] =raw_stereoCalibrate(objectpoints,imagepoints1,imagepoints2); - elseif rhs==4 - [a b c d e f]=raw_stereoCalibrate(objectpoints,imagepoints1,imagepoints2,varargin(1)); - elseif rhs==5 - [a b c d e f]=raw_stereoCalibrate(objectpoints,imagepoints1,imagepoints2,varargin(1),varargin(2)); - elseif rhs==6 - [a b c d e f]=raw_stereoCalibrate(objectpoints,imagepoints1,imagepoints2,varargin(1),varargin(2),varargin(3)); - elseif rhs==7 - [a b c d e f]=raw_stereoCalibrate(objectpoints,imagepoints1,imagepoints2,varargin(1),varargin(2),varargin(3),varargin(4)); - end - - - - params=struct('cameraMarix1',a,'distortionCoefficients1',b,'cameraMatrix2',c,'distortionCoefficients2',d,'rotationMatrix',e,'TranslationVector',f); -endfunction diff --git a/macros/trainSVMClassifier.bin b/macros/trainSVMClassifier.bin deleted file mode 100644 index 5f15907..0000000 Binary files a/macros/trainSVMClassifier.bin and /dev/null differ diff --git a/macros/trainSVMClassifier.sci b/macros/trainSVMClassifier.sci deleted file mode 100644 index a288163..0000000 --- a/macros/trainSVMClassifier.sci +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in -function [classifier]=trainSVMClassifier(imgSet,bag,classifierName,varargin) -// This function is used to train an image classifier using the SVM(Support Vector Machines) Model. -// -// Calling Sequence -// imgSet = imageSet(directory,'recursive'); -// 'or' -// imgSet = imageSet(image); -// bag = bagOfFeatures(imgSet); -// classifier = trainSVMClassifier(imgSets, bag); -// classifier = trainSVMClassifier(imgSets, bag,'nameclass') -// classifier = trainSVMClassifier(imgSets, bag,'nameclass') -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C) -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff) -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree) -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma) -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu) -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu,P) -// classifier = trainSVMClassifier(imgSets, bag,'nameclass',C,coeff,degree,gamma,kernelType,Nu,P,setType) -// -// Parameters -// classifier: Image category classifier location -// BagofFeaturesLocation : location of the xml or yml file. -// Description : features obtained after training. -// imgSets: Input imageSet to train the classifier on -// bag: The bagOfFeatures of the imageSet provided -// image: The set of images used for creating the imageset used for training -// nameclass: Name of the classifier one wants for their trained model .xml or .yml file -// C: Parameter C of a SVM optimization problem that should be used to train the model -// coef: Parameter coef0 of a kernel function that should be used to train the model -// degree: Parameter degree of a kernel function that should be used to train the model -// gamma:Parameter γ of a kernel function that should be used to train the model. -// kernelType:Type of a SVM kernel that should be used to train the model.it should be [-1,5]. -// Nu:Parameter ν of a SVM optimization problem that should be used to train the model. -// P: Parameter ϵ of a SVM optimization problem that should be used to train the model. -// type: Type of a SVM formulation that should be used to train the model.it should be [100,104]. -// -// Description -// this function is used to train an image classifier using the SVM(Support Vector Machines) Model. -// -// -// Examples -// //get imageset from 'images2' folder -// image=imageSet('images2','recursive'); -// //get bag of features -// x=bagOfFeatures(image); -// //train thew model and name the saved .yml file as "SVM" -// d=trainSVMClassifier(image,x,"SVM"); -// //read image to get prediction from mthe above trained data -// z=imread("fish.jpg"); -// //finally predict the class using SVM's prediction function for the input image -// resp=predict(d,z,"SVM"); -// -// //get imageset from 'images2' folder -// image=imageSet('images2','recursive'); -// //get bag of features -// x=bagOfFeatures(image); -// //train the model with the given parameters and name the saved .yml file as "SVM" -// d=trainSVMClassifier(image,x,"SVM",1.1,0.2); -// //read image to get prediction from mthe above trained data -// z=imread("fish.jpg"); -// //finally predict the class for the input image -// resp=predict(d,z,"SVM"); - - - - - - //convert to list - bag_list = bagStructToList(bag); - imgSets_list = imageSetToList(imgSet); - [lhs rhs]=argn(0); - - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>11 - error(msprintf(" Too many input arguments,maximum number of arguments is 11")); - elseif rhs<3 - error(msprintf("the function needs atleast 3 arguments")); - end - if rhs==3 - temp=raw_trainSVMClassifier(imgSets_list, bag_list,classifierName); - elseif rhs==4 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1)); - elseif rhs==5 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2)); - elseif rhs==6 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3)); - elseif rhs==7 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4)); - elseif rhs==8 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)); - elseif rhs==9 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6)); - elseif rhs==10 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6),varargin(7)); - elseif rhs==11 - temp=raw_trainSVMClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6),varargin(7),varargin(8)); - end - classifier = struct("ClassifierLocation", temp(2), "BagofFeaturesLocation", temp(3), "Description", temp(4)); - -endfunction diff --git a/macros/trainSVMSGDClassifier.bin b/macros/trainSVMSGDClassifier.bin deleted file mode 100644 index 1a5a9ab..0000000 Binary files a/macros/trainSVMSGDClassifier.bin and /dev/null differ diff --git a/macros/trainSVMSGDClassifier.sci b/macros/trainSVMSGDClassifier.sci deleted file mode 100644 index bb01b27..0000000 --- a/macros/trainSVMSGDClassifier.sci +++ /dev/null @@ -1,101 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [classifier]=trainSVMSGDSGDClassifier(imgSet,bag,classifierName,varargin) -// This function is used to train an image classifier using the SVMSGD(Stochastic Gradient Descent SVM) Model. -// -// Calling Sequence -// imgSet = imageSet(directory,'recursive'); -// 'or' -// imgSet = imageSet(image); -// bag = bagOfFeatures(imgSet); -// classifier = trainSVMSGDClassifier(imgSets, bag);` -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass') -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass') -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize) -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg) -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType) -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams) -// classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams,stepDecreasingPower) -//classifier = trainSVMSGDClassifier(imgSets, bag,'nameclass',initialStepSize,marginReg,marginType,optimalParams,stepDecreasingPower,svmsgdType) -// -// Parameters -// classifier: Image category classifier location -// BagofFeaturesLocation : location of the xml or yml file. -// Description : features obtained after training. -// imgSets: Input imageSet to train the classifier on -// bag: The bagOfFeatures of the imageSet provided -// image: The set of images used for creating the imageset used for training -// nameclass: Name of the classifier one wants for their trained model .xml or .yml file -// initialStepSize:Parameter initialStepSize of a SVMSGD optimization problem that should be used to train the model. -// marginReg: Parameter marginRegularization of a SVMSGD optimization problem that should be used to train the model -// marginType: Parameter marginType of a SVMSGD optimization problem that should be used to train the model.it should be either 0 or 1. -// optimalParams: sets optimal parameters values for chosen SVM SGD model. -// stepDecreasingPower: Parameter stepDecreasingPower of a SVMSGD optimization problem that should be used to train the model. -// svmsgdType: Algorithm type of SVMSGD that should be used to train the model.it should be either 0 or 1. -// -// -// Description -// This function is used to train an image classifier using the SVMSGD(Stochastic Gradient Descent SVM) Model. -// -// Examples -// //get imageset from 'images2' folder -// image=imageSet('images2','recursive'); -// //get bag of features -// x=bagOfFeatures(image); -// //train thew model and name the saved .yml file as "pbrr" using the given parameters -// r=trainSVMSGDClassifier(image,x,"pbrr",0,0,0,1,0,1); -// //read image to get prediction from the above trained data -// z=imread("fish.jpg"); -// //finally predict the class using SVMSGD's prediction function for the input image -// resp=predict(r,z,"SVMSGD"); -// -// //get imageset from 'images2' folder -// image=imageSet('images2','recursive'); -// //get bag of features -// x=bagOfFeatures(image); -// //train the model and name the saved .yml file as "pbrr" -// r=trainSVMSGDClassifier(image,x,"pbrr"); -// //read image to get prediction from the above trained data -// z=imread("fish.jpg"); -// //finally predict the class using SVMSGD's prediction function for the input image -// resp=predict(r,z,"SVMSGD"); - - //convert to list - bag_list = bagStructToList(bag); - imgSets_list = imageSetToList(imgSet); - [lhs rhs]=argn(0); - - if lhs>1 - error(msprintf(" Too many output arguments")); - elseif rhs>9 - error(msprintf(" Too many input arguments,maximum number of arguments is 9")); - elseif rhs<3 - error(msprintf("the function needs atleast 3 arguments")); - end - if rhs==3 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list, bag_list,classifierName); - elseif rhs==4 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list,bag_list,classifierName,varargin(1)); - elseif rhs==5 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2)); - elseif rhs==6 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3)); - elseif rhs==7 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4)); - elseif rhs==8 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5)); - elseif rhs==9 - temp=raw_trainSVMSGDSGDClassifier(imgSets_list,bag_list,classifierName,varargin(1),varargin(2),varargin(3),varargin(4),varargin(5),varargin(6)); - end - classifier = struct("ClassifierLocation", temp(2), "BagofFeaturesLocation", temp(3), "Description", temp(4)); - -endfunction diff --git a/macros/undistortPoints.bin b/macros/undistortPoints.bin deleted file mode 100644 index 1cf81d4..0000000 Binary files a/macros/undistortPoints.bin and /dev/null differ diff --git a/macros/undistortPoints.sci b/macros/undistortPoints.sci deleted file mode 100644 index e690f58..0000000 --- a/macros/undistortPoints.sci +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2015 - IIT Bombay - FOSSEE -// -// This file must be used under the terms of the CeCILL. -// This source file is licensed as described in the file COPYING, which -// you should have received as part of this distribution. The terms -// are also available at -// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt -// Author: Deepshika & Nihar Rao -// Organization: FOSSEE, IIT Bombay -// Email: toolbox@scilab.in - -function [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) -// Returns the ideal point coordinates from the observed point coordinates -// -// Calling Sequence -// [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) -// -// Parameters -// observedPoints: 1xN or Nx1 2-channel (CV_32FC2 or CV_64FC2). -// camMat: \vecthreethree{f_x}{0}{c_x}{0}{f_y}{c_y}{0}{0}{1} -// disCoefMat: Input vector of distortion coefficients (k_1, k_2, p_1, p_2[, k_3[, k_4, k_5, k_6]]) of 4, 5, or 8 elements. If the vector is NULL/empty, the zero distortion coefficients are assumed. -// rectMat: Rectification transformation in the object space (3x3 matrix). If the matrix is empty, the identity transformation is used. -//newCamMat: New camera matrix (3x3) or new projection matrix (3x4. If the matrix is empty, the identity new camera matrix is used. -// idealPoints: ideal point coordinates matrix. If matrix newCamMat is identity or omitted, idealPoints will contain normalized point coordinates. -// -// Description -// Returns the ideal points coordinates from the observed point coordinates after undistortion and reverse perpective transformation. -// -// Examples -// [observedPoints] = [1 2 3 4; 4 3 2 1] -// [camMat] = [450 0 231; 0 876.3 87.1; 0 0 1] -// [disCoefMat] = [3 2 0 9] -// [rectMat] = [1 0 0; 0 1 0; 0 0 1] -// [newCamMat] = [] -// [idealPoints] = undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) - - - - output = raw_undistortPoints(observedPoints, camMat, disCoefMat, rectMat, newCamMat) - - idealPoints=output; - - - -endfunction diff --git a/macros/xyz2rgb.bin b/macros/xyz2rgb.bin deleted file mode 100644 index 980d866..0000000 Binary files a/macros/xyz2rgb.bin and /dev/null differ diff --git a/macros/xyz2rgb.sci b/macros/xyz2rgb.sci deleted file mode 100644 index d557939..0000000 --- a/macros/xyz2rgb.sci +++ /dev/null @@ -1,8 +0,0 @@ -function [output] = xyz2rgb(img) - image = mattolist(img); - a = opencv_xyz2rgb(image); - d = size(a); - for i=1:d - output(:,:,i) = a(i); - end -endfunction diff --git a/sci_gateway/cpp/cleaner.sce b/sci_gateway/cleaner.sce similarity index 100% rename from sci_gateway/cpp/cleaner.sce rename to sci_gateway/cleaner.sce diff --git a/sci_gateway/cpp/PCL_pcread.cpp b/sci_gateway/cpp/PCL_pcread.cpp deleted file mode 100644 index 6c7d5e7..0000000 --- a/sci_gateway/cpp/PCL_pcread.cpp +++ /dev/null @@ -1,365 +0,0 @@ -/*Authors-Nihar Rao - Shreyash Sharma - -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - - -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - - - -bool files_exist_check( char *name) { - struct stat buffer; - return (stat (name, &buffer) == 0); - } - - int PCL_pcread(char *fname, unsigned long fname_len) - { - SciErr sciErr; - int iLen = 0; - //variable info - int iRows = 0; - int iCols = 0; - int piRows = 0; - int piCols = 0; - int *piAddr = NULL; - int *piLen = NULL; - char **pstData = NULL; - int **pstData1 = NULL; - int i,j,k=0; - int intErr; - double val; - double *points; - double *rgbValues,*intensityValues; - int n; - int width,height; - int il,z; - double num; - double *xLimit; - double *yLimit; - double *zLimit; - double *normalVectors; - bool isDense; - pcl::PointXYZRGB minLimit,maxLimit; - - - - //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) - CheckInputArgument(pvApiCtx, 1, 1); - CheckOutputArgument(pvApiCtx, 11, 11); - - - - // get Address of inputs - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls - //first call to retrieve dimensions - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - { - pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //check if file exists - if(!files_exist_check(pstData[0])) - { - - Scierror(999, "Error: the input file not found!.Please enter correct path!\n"); - return 0; - } - - //get string version of file - - string inputFile(pstData[0]); - - /*Processing*/ - - - n=inputFile.length(); - - - - pcl::PointCloud::Ptr cloud (new pcl::PointCloud ()); - //checking ending - if(inputFile.substr(n-3,n-1)=="pcd") - { - - - - if (pcl::io::loadPCDFile (pstData[0], *cloud) == -1) // load the file - { - cout<<"\n ERROR: couldn't load file\n"< (pstData[0], *cloud) < 0) - { - cout<<"\n ERROR: couldn't load file\n"<height; - width=cloud->width; - num=cloud->points.size(); - isDense=cloud->is_dense; - - //Allocate memory for cloud processing - points=(double *)malloc(sizeof(double)*height*width*3); - normalVectors=(double *)malloc(sizeof(double)*height*width*3); - rgbValues=(double *)malloc(sizeof(double)*height*width*3); - intensityValues=(double *)malloc(sizeof(double)*height*width); - xLimit=(double *)malloc(sizeof(double)*1*2); - yLimit=(double *)malloc(sizeof(double)*1*2); - zLimit=(double *)malloc(sizeof(double)*1*2); - - - il=0; - - pcl::PointCloud::iterator it; - - - - //storing values - for ( it = cloud->points.begin(); it!=cloud->points.end(); ++it) { - points[il]=(*it).x; - points[(height * width) + il]=(*it).y; - points[(2 * height * width) + il]=(*it).z; - - //RGB - rgbValues[il]=(*it).r; - rgbValues[(height * width) + il]=(*it).g; - rgbValues[(2 * height * width) + il]=(*it).b; - //intensity - intensityValues[il]=0.2989 *(*it).r + 0.5870 * (*it).g + 0.1140 * (*it).b; - - il++; - - - - } - - - - //////get Limits - getMinMax3D(*cloud,minLimit,maxLimit); - - //Allocate limits for returning to scilab - - xLimit[0]=minLimit.x; - xLimit[1]=maxLimit.x; - - yLimit[0]=minLimit.y; - yLimit[1]=maxLimit.y; - - zLimit[0]=minLimit.z; - zLimit[1]=maxLimit.z; - - ///Normal computation - - - pcl::PointCloud::Ptr normals (new pcl::PointCloud); - pcl::IntegralImageNormalEstimation ne; - ne.setNormalEstimationMethod (ne.AVERAGE_3D_GRADIENT); - ne.setMaxDepthChangeFactor(0.02f); - ne.setNormalSmoothingSize(10.0f); - ne.setInputCloud(cloud); - //ne.setRadiusSearch (0.03); - ne.compute(*normals); - - - //convert cloud to double * - - - pcl::PointCloud::iterator ir; - il=0; - for ( ir = normals->points.begin(); ir!=normals->points.end(); ++ir) { - normalVectors[il]=(*ir).x; - normalVectors[(height * width) + il]=(*ir).y; - normalVectors[(2 * height * width) + il]=(*ir).z; - - il++; - - - } - - } - catch(exception& e) - { - Scierror(999,e.what()); - return 0; - - - } - - - - - - - //Write Output to Scilab - - - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1,height*width, 3, points); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1,&num ); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = createScalarInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 3,width); - if(intErr) - { - Scierror(999,"Error creating matrix"); - return 0; - } - intErr = createScalarInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 4,height); - if(intErr) - { - Scierror(999,"Error creating matrix"); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 5,height*width, 3, rgbValues); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 6,1,2,xLimit); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 7,1,2,yLimit); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 8,1,2,zLimit); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - //processing bool for output(is_dense) - int final; - if(isDense) - final=1; - else - final=0; - - intErr=createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 9,final ); - if(intErr) - { - Scierror(999,"error creating booleean output "); - return 0; - - - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 10,width,height,intensityValues); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 11,height*width, 3, normalVectors); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - - for(int i=1;i<=11;i++) - AssignOutputVariable(pvApiCtx, i) = nbInputArgument(pvApiCtx) + i; - - - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - - return 0; - } - - - - -} - - diff --git a/sci_gateway/cpp/PCL_radsearch.cpp b/sci_gateway/cpp/PCL_radsearch.cpp new file mode 100644 index 0000000..c9ea3c7 --- /dev/null +++ b/sci_gateway/cpp/PCL_radsearch.cpp @@ -0,0 +1,180 @@ +/******************************************************** +Author: Manoj Sree Harsha +********************************************************/ +#include +#include +#include +#include +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + + int PCL_radsearch(char *fname, unsigned long fname_len) + { + + // Error management variables + SciErr sciErr; + int intErr; + + // variables required to read argument #1 + int *piAddr1 = NULL; + int rows1 = 0, cols1 = 0; + double* points = NULL; // pointCloud datapoints + + // variables required to read argument #2 + int *piAddr2 = NULL; + int rows2=0,cols2=0; + double *qpoint=NULL; // contains the query point + + // variables required to read argument #3 + int *piAddr3 = NULL; + double r=0; // radius + + //Output Matrix containing indices and distances. + double *result=NULL; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 3, 3); + CheckOutputArgument(pvApiCtx, 1, 1); + + // to get the argument #1 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Check that the first input argument is a real matrix (and not complex) + if( !isDoubleType(pvApiCtx, piAddr1) || isVarComplex(pvApiCtx, piAddr1) ) + { + Scierror(999, "point cloud should consist of real values."); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &rows1, &cols1, &points); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + // to get the argument #2 + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); + + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + // Check that the first input argument is a real vector (and not complex) + if ( !isDoubleType(pvApiCtx, piAddr2) || isVarComplex(pvApiCtx, piAddr2) ) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A real vector expected.\n"), fname, 2); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &rows2, &cols2, &qpoint); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + // to get the argument #3 + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isDoubleType(pvApiCtx, piAddr3)) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 3); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr3,&r); + if (intErr) + { + return intErr; + } + + // Check that the second argument is a vector or not + if(rows2!=1) + { + Scierror(999, _("%s: Invalid input argument #%d: A vector expected.\n"),fname,2); + return 0; + } + + //Application Code + try + { + //Creates and fills a PointCloud with the data given by user. + pcl::PointCloud::Ptr cloud (new pcl::PointCloud); + cloud->width = rows1; + cloud->height = 1; + cloud->points.resize (cloud->width*cloud->height); + for(size_t i = 0; i < cloud->points.size (); ++i) + { + cloud->points[i].x = points[i]; + cloud->points[i].y = points[i + (int)rows1*1 ]; + cloud->points[i].z = points[i + 2*(int)rows1*1]; + } + + //Creates kdtree object and sets our created cloud as the input + pcl::KdTreeFLANN kdtree; + kdtree.setInputCloud (cloud); + + //Creates a “searchPoint” which is assigned with values of querypoint. + pcl::PointXYZ searchPoint; + searchPoint.x = qpoint[0]; + searchPoint.y = qpoint[1]; + searchPoint.z = qpoint[2]; + + //Creates 2 vectors for storing information about our points. + std::vector pointIdxRadiusSearch; + std::vector pointRadiusSquaredDistance; + + //Calling Function 'radiusSearch' + kdtree.radiusSearch (searchPoint, r, pointIdxRadiusSearch, pointRadiusSquaredDistance); + + //Storing indices and distances in output matrix 'result' + int count=0; + result=(double*)malloc(sizeof(double)*2*pointIdxRadiusSearch.size ()); + for (int i=0;i<2*pointIdxRadiusSearch.size ();i++) + { + if(i%2==0) + { + result[i]=(double)pointIdxRadiusSearch[count]; + } + else + { + result[i]=(double)pointRadiusSquaredDistance[count]; + count=count+1; + } + } + + //creating the output matrix + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1,2,pointIdxRadiusSearch.size (),result); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + } +} diff --git a/sci_gateway/cpp/builder_gateway_cpp.sce b/sci_gateway/cpp/builder_gateway_cpp.sce deleted file mode 100644 index 318bf1a..0000000 --- a/sci_gateway/cpp/builder_gateway_cpp.sce +++ /dev/null @@ -1,458 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. - - -mode(-1) -lines(0) - -toolbox_title = "FOSSEE_Image_Processing_Toolbox"; - -Build_64Bits = %t; - - -path_builder = get_absolute_file_path('builder_gateway_cpp.sce'); -Names = [ -// "raw_dctmtx", "dctmtx"; -// "raw_multithresh", "multithresh"; -// "raw_applycform", "opencv_applycform"; - "raw_arrowedline", "opencv_arrowedline"; - "raw_blur", "opencv_blur"; - "raw_boundingRect", "opencv_boundingRect"; -//// "raw_bwconvhull", "opencv_bwconvhull"; -//// "raw_bwdistgeodesic", "opencv_bwdistgeodesic"; -//// "raw_bwlookup", "opencv_bwlookup"; -//// "raw_canny", "opencv_canny"; -// "raw_circle", "opencv_circle"; -//// "raw_clipline", "opencv_clipline"; -//// "raw_convexhull", "opencv_convexhull"; -//// "raw_convmtx2", "opencv_convmtx2"; -//// "raw_copymakeborder", "opencv_copymakeborder"; -//// "raw_corner", "opencv_corner"; -//// "raw_cornerEigenValsAndVecs", "opencv_cornerEigenValsAndVecs"; -//// "raw_cornerHarris", "opencv_cornerHarris"; -//// "raw_cornerMinEigenVal", "opencv_cornerMinEigenVal"; -// "raw_cvtColor", "opencv_cvtColor"; -//// "raw_demosaic", "opencv_demosaic"; -// "raw_dilate", "opencv_dilate"; -//// "raw_ellipse", "opencv_ellipse"; -//// "raw_ellipse2poly", "opencv_ellipse2poly"; -// -//// "raw_fftshift", "opencv_fftshift"; -//// "raw_fillconvexpoly", "opencv_fillconvexpoly"; -//// "raw_filter2D", "opencv_filter2D"; -//// "raw_findContours", "opencv_findContours"; -//// "raw_fsamp2", "opencv_fsamp2"; - -//// "raw_gabor", "opencv_gabor"; -//// "raw_gaussianblur", "opencv_gaussianblur"; -//// "raw_getStructuringElement", "opencv_getStructuringElement"; -//// "getTextSize", "opencv_getTextSize"; -//// "raw_getgaussiankernel", "opencv_getgaussiankernel"; -//// "raw_getrectsubpix", "opencv_getrectsubpix"; -//// "raw_getrotationmatrix2D", "opencv_getrotationmatrix2D"; -//// "raw_goodfeaturestotrack", "opencv_goodfeaturestotrack"; - -//// "raw_houghcircles", "opencv_houghcircles"; -//// "raw_houghlines", "opencv_houghlines"; -//// "raw_houghlinesp", "opencv_houghlinesp"; -//// "raw_ifftshift", "opencv_ifftshift"; -//// "raw_im2double", "opencv_im2double"; -//// "raw_imabsdiff", "opencv_imabsdiff"; -//// "raw_imadd", "opencv_imadd"; -//// "raw_imattributes", "opencv_imattributes"; -//// "raw_imboxfilt3", "opencv_imboxfilt3"; -//// "raw_imcomplement", "opencv_imcomplement"; -//// "raw_imcontour", "opencv_imcontour"; -//// "raw_imcontrast", "opencv_imcontrast"; -// "raw_imcrop", "opencv_imcrop"; -//// "raw_imdivide", "opencv_imdivide"; -//// "raw_imextendedmax", "opencv_imextendedmax"; -//// "raw_imextendedmin", "opencv_imextendedmin"; -//// "raw_imfill", "opencv_imfill"; -//// "raw_imfindcircles", "opencv_imfindcircles"; -//// "raw_imfuse", "opencv_imfuse"; -//// "raw_imgaborfilt", "opencv_imgaborfilt"; -//// "raw_imgaussfilt3", "opencv_imgaussfilt3"; -//// "raw_imguidedfilter", "opencv_imguidedfilter"; -//// "raw_imhmax", "opencv_imhmax"; -//// "raw_imhmin", "opencv_imhmin"; -//// "raw_imimposemin", "opencv_imimposemin"; -//// "raw_imlincomb", "opencv_imlincomb"; -//// "raw_immultiply", "opencv_immultiply"; -// "raw_impixel", "opencv_impixel"; -//// "raw_impyramid", "opencv_impyramid"; - "raw_imread", "opencv_imread"; -//// "raw_imrect", "opencv_imrect"; -// "raw_imresize", "opencv_imresize"; -// "raw_imsharpen", "opencv_imsharpen"; -//// "raw_imshowpair", "opencv_imshowpair"; -//// "raw_imsubtract", "opencv_imsubtract"; -//// "raw_imwarp", "opencv_imwarp"; -// "raw_imwrite", "opencv_imwrite"; -//// "raw_ind2gray", "opencv_ind2gray"; -//// "raw_ind2rgb", "opencv_ind2rgb"; -//// "raw_lab2double", "opencv_lab2double"; -//// "raw_lab2rgb", "opencv_lab2rgb"; -//// "raw_lab2uint16", "opencv_lab2uint16"; -//// "raw_lab2uint8", "opencv_lab2uint8"; -//// "raw_lab2xyz", "opencv_lab2xyz"; -//// "raw_laplacian", "opencv_laplacian"; -//// "raw_line", "opencv_line"; -// - -// "raw_medianblur", "opencv_medianblur"; -//// "raw_montage", "opencv_montage"; -//// "raw_morphologyEx", "opencv_morphologyEx"; -//// "raw_ntsc2rgb", "opencv_ntsc2rgb"; -//// "raw_puttext", "opencv_puttext"; -//// "raw_pyrDown", "opencv_pyrDown"; -//// "raw_pyrUp", "opencv_pyrUp"; -//// "raw_rectangle", "opencv_rectangle"; -//// "raw_regionfill", "opencv_regionfill"; -//// "raw_rgb2lab", "opencv_rgb2lab"; -//// "raw_rgb2ntsc", "opencv_rgb2ntsc"; - "raw_rgb2xyz", "opencv_rgb2xyz"; -//// "raw_roifill", "opencv_roifill"; -//// "raw_roipoly", "opencv_roipoly"; -//// "raw_scharr", "opencv_scharr"; -//// "raw_sepFilter2D", "opencv_sepFilter2D"; -//// "raw_sobel", "opencv_sobel"; -//// "raw_ssim", "opencv_ssim"; -//// "raw_threshold", "opencv_threshold"; -//// "raw_undistort", "opencv_undistort"; -//// "raw_viscircles", "opencv_viscircles"; -//// "raw_watershed", "opencv_watershed"; -//// "raw_whitepoint", "opencv_whitepoint"; -//// "raw_wiener2", "opencv_wiener2"; -//// "raw_xyz2double", "opencv_xyz2double"; -//// "raw_xyz2lab", "opencv_xyz2lab"; -//// "raw_xyz2rgb", "opencv_xyz2rgb"; -//// "raw_xyz2uint16", "opencv_xyz2uint16"; -// "raw_iminpaint.cpp", "opencv_iminpaint"; -// "raw_roiFreeHand.cpp","opencv_roiFreeHand.cpp" - -// "raw_deconvlucy", "opencv_deconvlucy"; -//// "imhistmatch", "opencv_imhistmatch"; -//// "graycoprops", "opencv_graycoprops"; -//// "graydiffweight", "opencv_graydiffweight"; -//// "decorrstretch", "opencv_decorrstretch"; -//// "adaptf", "opencv_adapthisteq"; -//// "affine2d", "opencv_affine2d"; - - -//// "approxpolyDP","approxpolyDP"; -//// "arclenght","arclenght"; -//// "bilateralfilter","bilateralfilter"; -//// "borderInterpolate","borderInterpolate"; -//// "boxfilter","boxfilter"; -//// "contourarea","contourarea"; -//// "boxfilter","boxfilter"; -// "raw_fitellipse","opencv_fitellipse"; -//// "getkerneltype","getkerneltype"; -//// "histeq","histeq"; -// "raw_imrotate","opencv_imrotate"; -//// "mean1","mean1"; -//// "minAreaRect","minAreaRect"; -//// "minimumenclosingcirlce","minimumenclosingcirlce"; -//// "pyrMeanShiftFiltering","pyrMeanShiftFiltering"; -// "raw_rgb2gray","opencv_rgb2gray"; -//// "warpaffine","warpaffine"; -// "raw_detectMinEigenFeatures","opencv_detectMinEigenFeatures"; -// "raw_correctMatches","opencv_correctMatches"; -// "raw_findHomography","opencv_findHomography"; -// "raw_matMulDeriv","opencv_matMulDeriv"; -// "raw_imageSet","opencv_imageSet"; -// "raw_bagOfFeatures","opencv_bagOfFeatures"; -// "raw_trainImageCategoryClassifier","opencv_trainImageCategoryClassifier"; -// "raw_trainSVMClassifier","opencv_trainSVMClassifier"; -// "raw_predictSVM","opencv_predictSVM"; -// "raw_trainSVMSGDClassifier","opencv_trainSVMSGDClassifier"; -// "raw_predictSVMSGD","opencv_predictSVMSGD"; -// "raw_getParamsSVM","opencv_getParamsSVM"; -// "raw_getParamsSVMSGD","opencv_getParamsSVMSGD"; -// "raw_trainBoostClassifier","opencv_trainBoostClassifier"; -// "raw_predictBoost","opencv_predictBoost"; -// "raw_trainEMClassifier","opencv_trainEMClassifier"; -// "raw_CascadeObjectDetector","opencv_CascadeObjectDetector"; -// "ocv_detectBRISKFeatures","opencv_detectBRISKFeatures"; -// "raw_detectMSERFeatures","opencv_detectMSERFeatures"; -// "raw_extractFeatures","opencv_extractFeatures"; -// "raw_detectSURFFeatures","opencv_detectSURFFeatures" -// "raw_drawMatch","opencv_drawMatch"; -// "raw_matchFeatures","opencv_matchFeatures"; -// "ocv_detectFASTFeatures","opencv_detectFASTFeatures"; -// "ocv_detectHarrisFeatures","opencv_detectHarrisFeatures"; -// "raw_peopleDetector","opencv_peopleDetector"; -// "raw_rectangle","opencv_rectangle"; -// "raw_detectKAZEFeatures","opencv_detectKAZEFeatures"; -// "raw_detectGFTTFeatures","opencv_detectGFTTFeatures"; -// "raw_estimateFundamentalMat","opencv_estimateFundamentalMat"; -// "raw_undistortPoints","opencv_undistortPoints"; -// "raw_rectifyStereoImages","opencv_rectifyStereoImages"; -// "raw_estimateNewCameraMatrix", "opencv_estimateNewCameraMatrix"; -// "raw_stereoCalibrate","opencv_stereoCalibrate"; -// "raw_detectCheckerboardCorner","opencv_detectCheckerboardCorner"; -// "raw_genCheckerboardPoints","opencv_genCheckerboardPoints"; -// "raw_undistortImage","opencv_undistortImage"; -// "raw_disparity","opencv_disparity"; -// "raw_indexImages","opencv_indexImages"; -// "raw_lab2double","opencv_lab2double"; -// "raw_fitellipse","opencv_fitellipse"; -// "raw_graycoprops","opencv_graycoprops"; -// "raw_integralKernel","opencv_integralKernel"; -// "raw_pcread","PCL_pcread"; - - - - ]; - -Files = [ -// "dctmtx.cpp", - -// "multithresh.cpp", -// "opencv_applycform.cpp", -// "opencv_arrowedline.cpp", -// "opencv_blur.cpp", -//// "opencv_boundingRect.cpp", -//// "opencv_bwconvhull.cpp", -//// "opencv_bwdistgeodesic.cpp", -//// "opencv_bwlookup.cpp", -//// "opencv_canny.cpp", -// "opencv_circle.cpp", -//// "opencv_clipline.cpp", -//// "opencv_convexhull.cpp", -//// "opencv_convmtx2.cpp", -//// "opencv_copymakeborder.cpp", -//// "opencv_corner.cpp", -//// "opencv_cornerEigenValsAndVecs.cpp", -//// "opencv_cornerHarris.cpp", -//// "opencv_cornerMinEigenVal.cpp", -// "opencv_cvtColor.cpp", -//// "opencv_demosaic.cpp", -// "opencv_dilate.cpp", -// "opencv_ellipse.cpp", -//// "opencv_ellipse2poly.cpp", -/// "opencv_erode.cpp", -//// "opencv_fftshift.cpp", -//// "opencv_fillconvexpoly.cpp", -//// "opencv_filter2D.cpp", -//// "opencv_findContours.cpp", -//// "opencv_fsamp2.cpp", - -//// "opencv_gabor.cpp", -//// "opencv_gaussianblur.cpp", -//// "opencv_getStructuringElement.cpp", -//// "opencv_getTextSize.cpp", -//// "opencv_getgaussiankernel.cpp", -//// "opencv_getrectsubpix.cpp", -//// "opencv_getrotationmatrix2D.cpp", -//// "opencv_goodfeaturestotrack.cpp", - -//// "opencv_houghcircles.cpp", -//// "opencv_houghlines.cpp", -//// "opencv_houghlinesp.cpp", -//// "opencv_ifftshift.cpp", -//// "opencv_im2double.cpp", -//// "opencv_imabsdiff.cpp", -//// "opencv_imadd.cpp", -//// "opencv_imattributes.cpp", -//// "opencv_imboxfilt3.cpp", -//// "opencv_imcomplement.cpp", -//// "opencv_imcontour.cpp", -//// "opencv_imcontrast.cpp", -// "opencv_imcrop.cpp", -//// "opencv_imdivide.cpp", -//// "opencv_imextendedmax.cpp", -//// "opencv_imextendedmin.cpp", -//// "opencv_imfill.cpp", -//// "opencv_imfindcircles.cpp", -//// "opencv_imfuse.cpp", -//// "opencv_imgaborfilt.cpp", -//// "opencv_imgaussfilt3.cpp", -//// "opencv_imguidedfilter.cpp", -//// "opencv_imhmax.cpp", -//// "opencv_imhmin.cpp", -//// "opencv_imimposemin.cpp", -//// "opencv_imlincomb.cpp", -//// "opencv_immultiply.cpp", -// "opencv_impixel.cpp", -//// "opencv_impyramid.cpp", - "opencv_imread.cpp", -//// "opencv_imrect.cpp", -// "opencv_imresize.cpp", -// "opencv_imsharpen.cpp", -//// "opencv_imshowpair.cpp", -//// "opencv_imsubtract.cpp", -//// "opencv_imwarp.cpp", -// "opencv_imwrite.cpp", -//// "opencv_ind2gray.cpp", -//// "opencv_ind2rgb.cpp", -//// "opencv_lab2double.cpp", -//// "opencv_lab2rgb.cpp", -//// "opencv_lab2uint16.cpp", -//// "opencv_lab2uint8.cpp", -//// "opencv_lab2xyz.cpp", -//// "opencv_laplacian.cpp", -//// "opencv_line.cpp", -// "opencv_roiFreeHand.cpp", - -// "opencv_medianblur.cpp", -//// "opencv_montage.cpp", -//// "opencv_morphologyEx.cpp", -//// "opencv_ntsc2rgb.cpp", -//// "opencv_puttext.cpp", -//// "opencv_pyrDown.cpp", -//// "opencv_pyrUp.cpp", -//// "opencv_rectangle.cpp", -//// "opencv_regionfill.cpp", -//// "opencv_rgb2lab.cpp", -//// "opencv_rgb2ntsc.cpp", - "opencv_rgb2xyz.cpp", -//// "opencv_roifill.cpp", -//// "opencv_roipoly.cpp", -//// "opencv_scharr.cpp", -//// "opencv_sepFilter2D.cpp", -//// "opencv_sobel.cpp", -//// "opencv_ssim.cpp", -//// "opencv_threshold.cpp", -//// "opencv_undistort.cpp", -//// "opencv_viscircles.cpp", -//// "opencv_watershed.cpp", -//// "opencv_whitepoint.cpp", -//// "opencv_wiener2.cpp", -//// "opencv_xyz2double.cpp", -//// "opencv_xyz2lab.cpp", -//// "opencv_xyz2rgb.cpp", -//// "opencv_xyz2uint16.cpp", - - -// "opencv_deconvlucy.cpp", -//// "opencv_integralImage.cpp", -//// "opencv_imhistmatch.cpp", -//// "opencv_graycoprops.cpp", -//// "opencv_graydiffweight.cpp", -//// "opencv_decorrstretch.cpp", -//// "opencv_adapthisteq.cpp", -//// "opencv_affine2d.cpp", - -// "rgb2gray.cpp", -//// "warpaffine.cpp", -//// "opencv_pyrMeanShiftFiltering.cpp", -//// "opencv_minimumenclosingcirlce.cpp", -//// "opencv_minAreaRect.cpp", -//// "opencv_mean1.cpp", -// "opencv_imrotate.cpp", -//// "opencv_getkerneltype.cpp", -// "opencv_fitellipse.cpp", -//// "opencv_contourarea.cpp", -//// "opencv_boxfilter.cpp", -//// "opencv_borderInterpolate.cpp", -//// "opencv_bilateralfilter.cpp", -//// "opencv_arclength.cpp", -//// "opencv_approxpolyDP.cpp", -//// "opencv_histeq.cpp", -// "opencv_detectMinEigenFeatures.cpp", - "opencv_correctMatches.cpp", - "opencv_findHomography.cpp", - "opencv_matMulDeriv.cpp", - "opencv_imageSet.cpp", - "opencv_bagOfFeatures.cpp", - "opencv_trainImageCategoryClassifier.cpp", - "opencv_trainSVMClassifier.cpp", - "opencv_predictSVM.cpp", - "opencv_trainSVMSGDClassifier.cpp", - "opencv_predictSVMSGD.cpp", - "opencv_getParamsSVM.cpp", - "opencv_getParamsSVMSGD.cpp", - "opencv_trainBoostClassifier.cpp", - "opencv_predictBoost.cpp", - "opencv_trainEMClassifier.cpp", - "opencv_CascadeObjectDetector.cpp", - "opencv_detectBRISKFeatures.cpp", - "opencv_detectMSERFeatures.cpp", - "opencv_extractFeatures.cpp", - "opencv_detectSURFFeatures.cpp", - "opencv_drawMatch.cpp", - "opencv_matchFeatures.cpp", - "opencv_detectFASTFeatures.cpp", - "opencv_detectHarrisFeatures.cpp", - "opencv_peopleDetector.cpp", - "opencv_rectangle.cpp", - "opencv_detectKAZEFeatures.cpp", - "opencv_detectGFTTFeatures.cpp", - "opencv_estimateFundamentalMatrix.cpp", - "opencv_undistortPoints.cpp", - "opencv_rectifyStereoImages.cpp", -// "opencv_estimateNewCameraMatrix.cpp", - "opencv_stereoCalibrate.cpp", - "opencv_detectCheckerboardCorner.cpp", - "opencv_genCheckerboardPoints.cpp", - "opencv_undistortImage.cpp", - "opencv_disparity.cpp", - "opencv_indexImages.cpp", - "opencv_lab2double.cpp", - "opencv_fitellipse.cpp", - "opencv_graycoprops.cpp", - "opencv_integralKernel.cpp", - "PCL_pcread.cpp" - "opencv_bundleAdjustment.cpp" - "opencv_iminpaint.cpp" - - - - ]; - - //copyfile("/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/sci_gateway/cpp/common.h",TMPDIR); - //copyfile("/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/sci_gateway/cpp/common.cpp",TMPDIR); - - //[a, opt] = getversion(); - //Version = opt(2); - - //if getos()=="Windows" then -// third_dir = path_builder+filesep()+'..'+filesep()+'..'+filesep()+'thirdparty'; -// lib_base_dir = third_dir + filesep() + 'windows' + filesep() + 'lib' + filesep() + Version + filesep(); -// inc_base_dir = third_dir + filesep() + 'windows' + filesep() + 'include' + filesep() + 'coin'; -// C_Flags=['-D__USE_DEPRECATED_STACK_FUNCTIONS__ -w -I '+path_builder+' '+ '-I '+inc_base_dir+' '] -// Linker_Flag = [lib_base_dir+"libClp.lib "+lib_base_dir+"libCgl.lib "+lib_base_dir+"libOsi.lib "+lib_base_dir+"libOsiClp.lib "+lib_base_dir+"libCoinUtils.lib "+lib_base_dir+"libSymphony.lib "+lib_base_dir+"IpOptFSS.lib "+lib_base_dir+"IpOpt-vc10.lib "] - -//else - //third_dir = path_builder+'..'+filesep()+'..'+filesep()+'thirdparty'; - //lib_base_dir = third_dir + filesep() + 'linux' + filesep() + 'lib' + filesep() + Version + filesep(); - //inc_base_dir = third_dir + filesep() + 'linux' + filesep() + 'include' + filesep() + 'opencv'; - //incl_base_dir = third_dir + filesep() + 'linux' + filesep() + 'include' + filesep() + 'opencv2'; - -// C_Flags=["-D__USE_DEPRECATED_STACK_FUNCTIONS__ -w -fpermissive -I"+path_builder+"-I"+inc_base_dir+" "+"-I"+incl_base_dir+" -Wl,-rpath= "+lib_base_dir+" "+"-L"+lib_base_dir+"libopencv_core"+" "+"-L"+lib_base_dir+"libopencv_highgui"+" "+"-L"+lib_base_dir+"libopencv_imgproc" ] - -// export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:"+lib_base_dir -// unix_s("export LD_LIBRARY_PATH="+lib_base_dir); - -// C_Flags=["-I"+inc_base_dir+" "+"-I"+incl_base_dir]; -// Linker_Flag = ["-L"+lib_base_dir+"libopencv_core"+" "+"-L"+lib_base_dir+"libopencv_highgui"+" "+"-L"+lib_base_dir+"libopencv_imgproc" ]; - -// Linker_Flag = ["-L/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/thirdparty/linux/lib/x64 -lopencv_core -L/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/thirdparty/linux/lib/x64 -lopencv_imgproc -L/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/thirdparty/linux/lib/x64 -lopencv_highgui" ] - - -//tools_path = path_builder + "../../thirdparty/linux/"; -//unix_s("export LD_LIBRARY_PATH="+tools_path+"lib/"+Version+filesep()+" "); -//C_Flags=["-w -fpermissive -I"+tools_path+"include/opencv -I"+tools_path+"include/opencv2 -Wl,-rpath="+tools_path+"lib/"+Version+filesep()+" "] - -//Linker_Flag = ["-L"+tools_path+"lib/"+Version+"-lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core "] - -//end - -//tbx_build_gateway(toolbox_title,Names,Files,get_absolute_file_path("builder_gateway_cpp.sce"), [], Linker_Flag, C_Flags,"g++"); - -//clear toolbox_title Names Files Linker_Flag C_Flags; - -function builder_gw_cpp() - WITHOUT_AUTO_PUTLHSVAR = %t; - copyfile(path_builder+"/common.h",TMPDIR); - copyfile(path_builder+"/common.cpp",TMPDIR); - tbx_build_gateway("skeleton_imageprocessing", .. - Names, .. - Files, .. - get_absolute_file_path("builder_gateway_cpp.sce"),[],["-L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_cvv -lopencv_dpm -lopencv_fuzzy -lopencv_hdf -lopencv_line_descriptor -lopencv_optflow -lopencv_reg -lopencv_saliency -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_rgbd -lopencv_viz -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_plot -lopencv_dnn -lopencv_xfeatures2d -lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml -lopencv_xphoto -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core -lpcl_common -lpcl_features -lpcl_filters -lpcl_io -lpcl_kdtree -lpcl_keypoints -lpcl_octree -lpcl_outofcore -lpcl_people -lpcl_recognition -lpcl_registration -lpcl_sample_consensus -lpcl_search -lpcl_segmentation -lpcl_surface -lpcl_tracking"],["-I/usr/include/scilab -I/usr/local/include/opencv -I/usr/local/include/opencv2 -I/usr/local/include/pcl-1.8 -I/usr/include/eigen3 "],"g++"); -endfunction - -builder_gw_cpp(); -clear builder_gw_cpp; // remove builder_gw_cpp on stack - diff --git a/sci_gateway/cpp/builder_gateway_cpp.sce~ b/sci_gateway/cpp/builder_gateway_cpp.sce~ deleted file mode 100644 index c736288..0000000 --- a/sci_gateway/cpp/builder_gateway_cpp.sce~ +++ /dev/null @@ -1,364 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. - - -mode(-1) -lines(0) - -toolbox_title = "FOSSEE_Image_Processing_Toolbox"; - -Build_64Bits = %t; - - -path_builder = get_absolute_file_path('builder_gateway_cpp.sce'); -Names = [ -// "raw_dctmtx", "dctmtx"; -// "raw_multithresh", "multithresh"; -// "raw_applycform", "opencv_applycform"; - //"raw_arrowedline", "opencv_arrowedline"; - "raw_blur", "opencv_blur"; -// "raw_boundingRect", "opencv_boundingRect"; -// "raw_bwconvhull", "opencv_bwconvhull"; -// "raw_bwdistgeodesic", "opencv_bwdistgeodesic"; -// "raw_bwlookup", "opencv_bwlookup"; -// "raw_canny", "opencv_canny"; - "raw_circle", "opencv_circle"; -// "raw_clipline", "opencv_clipline"; -// "raw_convexhull", "opencv_convexhull"; -// "raw_convmtx2", "opencv_convmtx2"; -// "raw_copymakeborder", "opencv_copymakeborder"; -// "raw_corner", "opencv_corner"; -// "raw_cornerEigenValsAndVecs", "opencv_cornerEigenValsAndVecs"; -// "raw_cornerHarris", "opencv_cornerHarris"; -// "raw_cornerMinEigenVal", "opencv_cornerMinEigenVal"; -// "raw_cvtColor", "opencv_cvtColor"; -// "raw_demosaic", "opencv_demosaic"; - "raw_dilate", "opencv_dilate"; -// "raw_ellipse", "opencv_ellipse"; -// "raw_ellipse2poly", "opencv_ellipse2poly"; - "raw_erode", "opencv_erode"; -// "raw_fftshift", "opencv_fftshift"; -// "raw_fillconvexpoly", "opencv_fillconvexpoly"; -// "raw_filter2D", "opencv_filter2D"; -// "raw_findContours", "opencv_findContours"; -// "raw_fsamp2", "opencv_fsamp2"; - -// "raw_gabor", "opencv_gabor"; -// "raw_gaussianblur", "opencv_gaussianblur"; -// "raw_getStructuringElement", "opencv_getStructuringElement"; -// "getTextSize", "opencv_getTextSize"; -// "raw_getgaussiankernel", "opencv_getgaussiankernel"; -// "raw_getrectsubpix", "opencv_getrectsubpix"; -// "raw_getrotationmatrix2D", "opencv_getrotationmatrix2D"; -// "raw_goodfeaturestotrack", "opencv_goodfeaturestotrack"; - -// "raw_houghcircles", "opencv_houghcircles"; -// "raw_houghlines", "opencv_houghlines"; -// "raw_houghlinesp", "opencv_houghlinesp"; -// "raw_ifftshift", "opencv_ifftshift"; -// "raw_im2double", "opencv_im2double"; -// "raw_imabsdiff", "opencv_imabsdiff"; -// "raw_imadd", "opencv_imadd"; -// "raw_imattributes", "opencv_imattributes"; -// "raw_imboxfilt3", "opencv_imboxfilt3"; -// "raw_imcomplement", "opencv_imcomplement"; -// "raw_imcontour", "opencv_imcontour"; -// "raw_imcontrast", "opencv_imcontrast"; - "raw_imcrop", "opencv_imcrop"; -// "raw_imdivide", "opencv_imdivide"; -// "raw_imextendedmax", "opencv_imextendedmax"; -// "raw_imextendedmin", "opencv_imextendedmin"; -// "raw_imfill", "opencv_imfill"; -// "raw_imfindcircles", "opencv_imfindcircles"; -// "raw_imfuse", "opencv_imfuse"; -// "raw_imgaborfilt", "opencv_imgaborfilt"; -// "raw_imgaussfilt3", "opencv_imgaussfilt3"; -// "raw_imguidedfilter", "opencv_imguidedfilter"; -// "raw_imhmax", "opencv_imhmax"; -// "raw_imhmin", "opencv_imhmin"; -// "raw_imimposemin", "opencv_imimposemin"; -// "raw_imlincomb", "opencv_imlincomb"; -// "raw_immultiply", "opencv_immultiply"; - "raw_impixel", "opencv_impixel"; -// "raw_impyramid", "opencv_impyramid"; - "raw_imread", "opencv_imread"; -// "raw_imrect", "opencv_imrect"; - "raw_imresize", "opencv_imresize"; - "raw_imsharpen", "opencv_imsharpen"; -// "raw_imshowpair", "opencv_imshowpair"; -// "raw_imsubtract", "opencv_imsubtract"; -// "raw_imwarp", "opencv_imwarp"; - "raw_imwrite", "opencv_imwrite"; -// "raw_ind2gray", "opencv_ind2gray"; -// "raw_ind2rgb", "opencv_ind2rgb"; -// "raw_lab2double", "opencv_lab2double"; -// "raw_lab2rgb", "opencv_lab2rgb"; -// "raw_lab2uint16", "opencv_lab2uint16"; -// "raw_lab2uint8", "opencv_lab2uint8"; -// "raw_lab2xyz", "opencv_lab2xyz"; -// "raw_laplacian", "opencv_laplacian"; -// "raw_line", "opencv_line"; - -// "raw_medianblur", "opencv_medianblur"; -// "raw_montage", "opencv_montage"; -// "raw_morphologyEx", "opencv_morphologyEx"; -// "raw_ntsc2rgb", "opencv_ntsc2rgb"; -// "raw_puttext", "opencv_puttext"; -// "raw_pyrDown", "opencv_pyrDown"; -// "raw_pyrUp", "opencv_pyrUp"; -// "raw_rectangle", "opencv_rectangle"; -// "raw_regionfill", "opencv_regionfill"; -// "raw_rgb2lab", "opencv_rgb2lab"; -// "raw_rgb2ntsc", "opencv_rgb2ntsc"; -// "raw_rgb2xyz", "opencv_rgb2xyz"; -// "raw_roifill", "opencv_roifill"; -// "raw_roipoly", "opencv_roipoly"; -// "raw_scharr", "opencv_scharr"; -// "raw_sepFilter2D", "opencv_sepFilter2D"; -// "raw_sobel", "opencv_sobel"; -// "raw_ssim", "opencv_ssim"; -// "raw_threshold", "opencv_threshold"; -// "raw_undistort", "opencv_undistort"; -// "raw_viscircles", "opencv_viscircles"; -// "raw_watershed", "opencv_watershed"; -// "raw_whitepoint", "opencv_whitepoint"; -// "raw_wiener2", "opencv_wiener2"; -// "raw_xyz2double", "opencv_xyz2double"; -// "raw_xyz2lab", "opencv_xyz2lab"; -// "raw_xyz2rgb", "opencv_xyz2rgb"; -// "raw_xyz2uint16", "opencv_xyz2uint16"; - -// "deconvlucy", "opencv_deconvlucy"; -// "imhistmatch", "opencv_imhistmatch"; -// "graycoprops", "opencv_graycoprops"; -// "graydiffweight", "opencv_graydiffweight"; -// "decorrstretch", "opencv_decorrstretch"; -// "adaptf", "opencv_adapthisteq"; -// "affine2d", "opencv_affine2d"; - - -// "approxpolyDP","approxpolyDP"; -// "arclenght","arclenght"; -// "bilateralfilter","bilateralfilter"; -// "borderInterpolate","borderInterpolate"; -// "boxfilter","boxfilter"; -// "contourarea","contourarea"; -// "boxfilter","boxfilter"; -// "fitellipse","fitellipse"; -// "getkerneltype","getkerneltype"; -// "histeq","histeq"; - "raw_imrotate","opencv_imrotate"; -// "mean1","mean1"; -// "minAreaRect","minAreaRect"; -// "minimumenclosingcirlce","minimumenclosingcirlce"; -// "pyrMeanShiftFiltering","pyrMeanShiftFiltering"; - "raw_rgb2gray","opencv_rgb2gray"; -// "warpaffine","warpaffine"; - - - - ]; - -Files = [ -// "dctmtx.cpp", - -// "multithresh.cpp", -// "opencv_applycform.cpp", - //"opencv_arrowedline.cpp", - "opencv_blur.cpp", -// "opencv_boundingRect.cpp", -// "opencv_bwconvhull.cpp", -// "opencv_bwdistgeodesic.cpp", -// "opencv_bwlookup.cpp", -// "opencv_canny.cpp", - "opencv_circle.cpp", -// "opencv_clipline.cpp", -// "opencv_convexhull.cpp", -// "opencv_convmtx2.cpp", -// "opencv_copymakeborder.cpp", -// "opencv_corner.cpp", -// "opencv_cornerEigenValsAndVecs.cpp", -// "opencv_cornerHarris.cpp", -// "opencv_cornerMinEigenVal.cpp", -// "opencv_cvtColor.cpp", -// "opencv_demosaic.cpp", - "opencv_dilate.cpp", - "opencv_ellipse.cpp", -// "opencv_ellipse2poly.cpp", - "opencv_erode.cpp", -// "opencv_fftshift.cpp", -// "opencv_fillconvexpoly.cpp", -// "opencv_filter2D.cpp", -// "opencv_findContours.cpp", -// "opencv_fsamp2.cpp", - -// "opencv_gabor.cpp", -// "opencv_gaussianblur.cpp", -// "opencv_getStructuringElement.cpp", -// "opencv_getTextSize.cpp", -// "opencv_getgaussiankernel.cpp", -// "opencv_getrectsubpix.cpp", -// "opencv_getrotationmatrix2D.cpp", -// "opencv_goodfeaturestotrack.cpp", - -// "opencv_houghcircles.cpp", -// "opencv_houghlines.cpp", -// "opencv_houghlinesp.cpp", -// "opencv_ifftshift.cpp", -// "opencv_im2double.cpp", -// "opencv_imabsdiff.cpp", -// "opencv_imadd.cpp", -// "opencv_imattributes.cpp", -// "opencv_imboxfilt3.cpp", -// "opencv_imcomplement.cpp", -// "opencv_imcontour.cpp", -// "opencv_imcontrast.cpp", - "opencv_imcrop.cpp", -// "opencv_imdivide.cpp", -// "opencv_imextendedmax.cpp", -// "opencv_imextendedmin.cpp", -// "opencv_imfill.cpp", -// "opencv_imfindcircles.cpp", -// "opencv_imfuse.cpp", -// "opencv_imgaborfilt.cpp", -// "opencv_imgaussfilt3.cpp", -// "opencv_imguidedfilter.cpp", -// "opencv_imhmax.cpp", -// "opencv_imhmin.cpp", -// "opencv_imimposemin.cpp", -// "opencv_imlincomb.cpp", -// "opencv_immultiply.cpp", - "opencv_impixel.cpp", -// "opencv_impyramid.cpp", - "opencv_imread.cpp", -// "opencv_imrect.cpp", - "opencv_imresize.cpp", - "opencv_imsharpen.cpp", -// "opencv_imshowpair.cpp", -// "opencv_imsubtract.cpp", -// "opencv_imwarp.cpp", - "opencv_imwrite.cpp", -// "opencv_ind2gray.cpp", -// "opencv_ind2rgb.cpp", -// "opencv_lab2double.cpp", -// "opencv_lab2rgb.cpp", -// "opencv_lab2uint16.cpp", -// "opencv_lab2uint8.cpp", -// "opencv_lab2xyz.cpp", -// "opencv_laplacian.cpp", -// "opencv_line.cpp", - -// "opencv_medianblur.cpp", -// "opencv_montage.cpp", -// "opencv_morphologyEx.cpp", -// "opencv_ntsc2rgb.cpp", -// "opencv_puttext.cpp", -// "opencv_pyrDown.cpp", -// "opencv_pyrUp.cpp", -// "opencv_rectangle.cpp", -// "opencv_regionfill.cpp", -// "opencv_rgb2lab.cpp", -// "opencv_rgb2ntsc.cpp", -// "opencv_rgb2xyz.cpp", -// "opencv_roifill.cpp", -// "opencv_roipoly.cpp", -// "opencv_scharr.cpp", -// "opencv_sepFilter2D.cpp", -// "opencv_sobel.cpp", -// "opencv_ssim.cpp", -// "opencv_threshold.cpp", -// "opencv_undistort.cpp", -// "opencv_viscircles.cpp", -// "opencv_watershed.cpp", -// "opencv_whitepoint.cpp", -// "opencv_wiener2.cpp", -// "opencv_xyz2double.cpp", -// "opencv_xyz2lab.cpp", -// "opencv_xyz2rgb.cpp", -// "opencv_xyz2uint16.cpp", - - -// "opencv_deconvlucy.cpp", -// "opencv_integralImage.cpp", -// "opencv_imhistmatch.cpp", -// "opencv_graycoprops.cpp", -// "opencv_graydiffweight.cpp", -// "opencv_decorrstretch.cpp", -// "opencv_adapthisteq.cpp", -// "opencv_affine2d.cpp", - - "rgb2gray.cpp", -// "warpaffine.cpp", -// "opencv_pyrMeanShiftFiltering.cpp", -// "opencv_minimumenclosingcirlce.cpp", -// "opencv_minAreaRect.cpp", -// "opencv_mean1.cpp", - "opencv_imrotate.cpp", -// "opencv_getkerneltype.cpp", -// "opencv_fitellipse.cpp", -// "opencv_contourarea.cpp", -// "opencv_boxfilter.cpp", -// "opencv_borderInterpolate.cpp", -// "opencv_bilateralfilter.cpp", -// "opencv_arclength.cpp", -// "opencv_approxpolyDP.cpp", -// "opencv_histeq.cpp", - - - - ]; - - copyfile("/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/sci_gateway/cpp/common.h",TMPDIR); - copyfile("/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/sci_gateway/cpp/common.cpp",TMPDIR); - - [a, opt] = getversion(); - Version = opt(2); - - if getos()=="Windows" then -// third_dir = path_builder+filesep()+'..'+filesep()+'..'+filesep()+'thirdparty'; -// lib_base_dir = third_dir + filesep() + 'windows' + filesep() + 'lib' + filesep() + Version + filesep(); -// inc_base_dir = third_dir + filesep() + 'windows' + filesep() + 'include' + filesep() + 'coin'; -// C_Flags=['-D__USE_DEPRECATED_STACK_FUNCTIONS__ -w -I '+path_builder+' '+ '-I '+inc_base_dir+' '] -// Linker_Flag = [lib_base_dir+"libClp.lib "+lib_base_dir+"libCgl.lib "+lib_base_dir+"libOsi.lib "+lib_base_dir+"libOsiClp.lib "+lib_base_dir+"libCoinUtils.lib "+lib_base_dir+"libSymphony.lib "+lib_base_dir+"IpOptFSS.lib "+lib_base_dir+"IpOpt-vc10.lib "] - -else - third_dir = path_builder+'..'+filesep()+'..'+filesep()+'thirdparty'; - lib_base_dir = third_dir + filesep() + 'linux' + filesep() + 'lib' + filesep() + Version + filesep(); - inc_base_dir = third_dir + filesep() + 'linux' + filesep() + 'include' + filesep() + 'opencv'; - incl_base_dir = third_dir + filesep() + 'linux' + filesep() + 'include' + filesep() + 'opencv2'; - -// C_Flags=["-D__USE_DEPRECATED_STACK_FUNCTIONS__ -w -fpermissive -I"+path_builder+"-I"+inc_base_dir+" "+"-I"+incl_base_dir+" -Wl,-rpath= "+lib_base_dir+" "+"-L"+lib_base_dir+"libopencv_core"+" "+"-L"+lib_base_dir+"libopencv_highgui"+" "+"-L"+lib_base_dir+"libopencv_imgproc" ] - -// export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:"+lib_base_dir -// unix_s("export LD_LIBRARY_PATH="+lib_base_dir); - -// C_Flags=["-I"+inc_base_dir+" "+"-I"+incl_base_dir]; -// Linker_Flag = ["-L"+lib_base_dir+"libopencv_core"+" "+"-L"+lib_base_dir+"libopencv_highgui"+" "+"-L"+lib_base_dir+"libopencv_imgproc" ]; - -// Linker_Flag = ["-L/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/thirdparty/linux/lib/x64 -lopencv_core -L/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/thirdparty/linux/lib/x64 -lopencv_imgproc -L/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/thirdparty/linux/lib/x64 -lopencv_highgui" ] - -unix_s("export LD_LIBRARY_PATH="+tools_path+"lib/"+Version+filesep()+" "); -tools_path = path_builder + "../../thirdparty/linux/"; - -C_Flags=["-w -fpermissive -I"+tools_path+"include/opencv -I"+tools_path+"include/opencv2 -Wl,-rpath="+tools_path+"lib/"+Version+filesep()+" "] - -Linker_Flag = ["-L"+tools_path+"lib/"+Version+"-lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres -lopencv_videostab -lopencv_calib3d -lopencv_features2d -lopencv_highgui -lopencv_video -lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann -lopencv_core "] - -end - -tbx_build_gateway(toolbox_title,Names,Files,get_absolute_file_path("builder_gateway_cpp.sce"), [], Linker_Flag, C_Flags,"g++"); - -clear toolbox_title Names Files Linker_Flag C_Flags; - -//function builder_gw_cpp() -// WITHOUT_AUTO_PUTLHSVAR = %t; -// copyfile("/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/sci_gateway/cpp/common.h",TMPDIR); -// copyfile("/home/fossee/Desktop/FOSSEE_Image_Processing_Toolbox/sci_gateway/cpp/common.cpp",TMPDIR); -//tbx_build_gateway("skeleton_imageprocessing", .. -// names, .. -// files, .. -// get_absolute_file_path("builder_gateway_cpp.sce"),[],["-L/usr/local/lib -lopencv_core -L/usr/local/lib -lopencv_highgui -L/usr/lib -lopencv_imgproc -L/usr/lib -lopencv_calib3d -L/usr/lib -lopencv_video -L/usr/lib -lopencv_nonfree -L/usr/lib -lopencv_ml -L/usr/lib -lopencv_objdetect"],["-I/usr/include/scilab -I/usr/include/opencv -I/usr/include/opencv2 "],"g++ "); -//endfunction - -//builder_gw_cpp(); -//clear builder_gw_cpp; // remove builder_gw_cpp on stack - diff --git a/sci_gateway/cpp/common.cpp~ b/sci_gateway/cpp/common.cpp~ deleted file mode 100644 index c19f58a..0000000 --- a/sci_gateway/cpp/common.cpp~ +++ /dev/null @@ -1,890 +0,0 @@ -/*************************************************** -Author : Sukul Bagai -***************************************************/ - -//takes the matrix type as parameter and returns a string of the type -string type2str(int type) -{ - string r; - uchar depth = type & CV_MAT_DEPTH_MASK; - switch ( depth ) - { - case CV_8U: r = "8U"; break; - case CV_8S: r = "8S"; break; - case CV_16U: r = "16U"; break; - case CV_16S: r = "16S"; break; - case CV_32S: r = "32S"; break; - case CV_32F: r = "32F"; break; - case CV_64F: r = "64F"; break; - default: r = "User"; break; - } - return r; -} - -//takes matrix type as parameter and returns no. of channels of the image matrix -int no_of_channels(int type) -{ - uchar chans = 1 + (type >> CV_CN_SHIFT); - return chans; -} - -//function used to retrieve image matrix from Scilab environment -/* - We need to retrieve image from the Scilab environment - We do this by getting a List of 2-D matrices. The size of the list, in our case is known(either 3 or 1, - 3 for a coloured image and 1 for a grayscale image), hence we do not require the dynamic capability of a list. - Incase of a 3-channel image, the first matrix will be a matrix with dimensions img.rows X img.cols, and will denote the R(red) - values of the image. Similarly, the second will have the G(green) values, and the third will have B(blue) values. - For a single-channeled image, we will have only a single matrix -*/ -int retrieveImage(Mat &image,int pos) -{ - - SciErr sciErr; - int iRows=0,iCols=0,i,j,k=0; - int *piAddr = NULL; - int *piAddrChild = NULL; - int iPrec = 0,iItem = 0; - - //retrieving number of items in the list and type of data(integer/float) - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getListItemAddress(pvApiCtx,piAddr,1,&piAddrChild); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getListItemNumber(pvApiCtx,piAddr,&iItem); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(isIntegerType(pvApiCtx, piAddrChild)) - { - //getting precision - sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddrChild, &iPrec); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - switch(iPrec) - { - case SCI_UINT8: //for unsigned integer 8 - { - if(iItem==3) - { - unsigned char *pstDataR = NULL; - unsigned char *pstDataG = NULL; - unsigned char *pstDataB = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the G values - sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, piAddr, 2, &iRows, &iCols, &pstDataG); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the B values - sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, piAddr, 3, &iRows, &iCols, &pstDataB); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_8UC3); - - /*Now that we have the 3 matrices(R,G,B), we need to assign those values to the pixels. The following code does this*/ - k=0; - for(i=0;i(i,j)[2]=pstDataR[i+iRows*j]; - image.at(i,j)[1]=pstDataG[i+iRows*j]; - image.at(i,j)[0]=pstDataB[i+iRows*j]; - } - } - } - else - { - unsigned char *pstDataR = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_8UC1); - - //Assigning matrix value to pixel - k=0; - for(i=0;i(i,j)=pstDataR[i+iRows*j]; - } - break; - } - case SCI_UINT16: //for unsigned integer 16 - { - if(iItem==3) - { - short unsigned int *pstDataR = NULL; - short unsigned int *pstDataG = NULL; - short unsigned int *pstDataB = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the G values - sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, piAddr, 2, &iRows, &iCols, &pstDataG); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the B values - sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, piAddr, 3, &iRows, &iCols, &pstDataB); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_16UC3); - - //Now that we have the 3 matrices(R,G,B), we need to assign those values to the pixels. The following code does this - k=0; - for(i=0;i(i,j)[2]=pstDataR[i+iRows*j]; - image.at(i,j)[1]=pstDataG[i+iRows*j]; - image.at(i,j)[0]=pstDataB[i+iRows*j]; - //i+iRows*j - } - } - } - else - { - short unsigned int *pstDataR = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_16UC1); - - //Assigning matrix values to pixels - k=0; - for(i=0;i(i,j)=pstDataR[i+iRows*j]; - } - break; - } - case SCI_INT16: //for signed integer 16 - { - if(iItem==3) - { - short int *pstDataR = NULL; - short int *pstDataG = NULL; - short int *pstDataB = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfInteger16InList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the G values - sciErr = getMatrixOfInteger16InList(pvApiCtx, piAddr, 2, &iRows, &iCols, &pstDataG); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the B values - sciErr = getMatrixOfInteger16InList(pvApiCtx, piAddr, 3, &iRows, &iCols, &pstDataB); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_16SC3); - - //Now that we have the 3 matrices(R,G,B), we need to assign those values to the pixels. The following code does this - k=0; - for(i=0;i(i,j)[2]=pstDataR[i+iRows*j]; - image.at(i,j)[1]=pstDataG[i+iRows*j]; - image.at(i,j)[0]=pstDataB[i+iRows*j]; - } - } - } - else - { - short int *pstDataR = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfInteger16InList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_16SC1); - - //Assigning image matrix values to pixels - k=0; - for(i=0;i(i,j)=pstDataR[i+iRows*j]; - } - break; - } - } - } - else //for floating point/ double precision values - { - if(iItem==3) - { - double *pstDataR = NULL; - double *pstDataG = NULL; - double *pstDataB = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddrChild); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the G values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 2, &iRows, &iCols, &pstDataG); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddrChild); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the B values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 3, &iRows, &iCols, &pstDataB); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_64FC3); - - //Now that we have the 3 matrices(R,G,B), we need to assign those values to the pixels. The following code does this - k=0; - for(i=0;i(i,j)[2]=pstDataR[i+iRows*j]; - image.at(i,j)[1]=pstDataG[i+iRows*j]; - image.at(i,j)[0]=pstDataB[i+iRows*j]; - } - } - } - else - { - double *pstDataR = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,pos,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //creating an image matrix with the no. of rows and columns we retrieved, and assigning it to be of the form 8-bit unsinged integers - image = Mat(iRows,iCols,CV_64FC1); - - //Assigning image matrix values to pixels - k=0; - for(i=0;i(i,j)=pstDataR[i+iRows*j]; - } - } - return 1; -} - -//function that returns an image matrix to the Scilab environment -/* - What we now need, is to pass the image matrix to the Scilab environment. - We do this by passing a List of 2-D matrices. The size of the list, in our case is known(either 3 or 1, - 3 for a coloured image and 1 for a grayscale image), hence we do not require the dynamic capability of a list. - Incase of a 3-channel image, the first matrix will be a matrix with dimensions img.rows X img.cols, and will denote the R(red) - values of the image. Similarly, the second will have the G(green) values, and the third will have B(blue) values. - For a single-channeled image, we will have only a single matrix -*/ -int returnImage(char *checker,Mat img,int pos) -{ - int i,j,k=0; - int *piAddrNew = NULL; - SciErr sciErr; - int num=no_of_channels(img.type()); //num now contains no. of channels of the image - //creating the list that will be passed to the Scilab enviroment - if(num==3) - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + pos, 3, &piAddrNew); - else - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + pos, 1, &piAddrNew); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(strcmp(checker,"8U")==0) //for Unsigned Integer 8 - { - if(num==3) - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - unsigned char *r = (unsigned char *)malloc(img.rows * img.cols * sizeof(unsigned char)); - unsigned char *g = (unsigned char *)malloc(img.rows * img.cols * sizeof(unsigned char)); - unsigned char *b = (unsigned char *)malloc(img.rows * img.cols * sizeof(unsigned char)); - - //The next block of code retrieves the RGB values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - r [i+img.rows*j]=intensity.val[2]; - g [i+img.rows*j]=intensity.val[1]; - b [i+img.rows*j]=intensity.val[0]; - } - } - - - //Adding the R value matrix to the list - sciErr = createMatrixOfUnsignedInteger8InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols, r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the G value matrix to the list - sciErr = createMatrixOfUnsignedInteger8InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 2, img.rows,img.cols,g); - free(g); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the B value matrix to the list - sciErr = createMatrixOfUnsignedInteger8InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 3, img.rows,img.cols, b); - free(b); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - else - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - unsigned char *r = (unsigned char *)malloc(img.rows * img.cols * sizeof(unsigned char)); - - //The next block of code retrieves the image colour values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - - - //Adding the image colour value matrix to the list - sciErr = createMatrixOfUnsignedInteger8InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1,img.rows,img.cols, r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - } - } - else if(strcmp(checker,"16U")==0) //for Unsigned Integer 16 - { - if(num==3) - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - short unsigned int *r = (short unsigned int *)malloc(img.rows * img.cols * sizeof(short unsigned int)); - short unsigned int *g = (short unsigned int *)malloc(img.rows * img.cols * sizeof(short unsigned int)); - short unsigned int *b = (short unsigned int *)malloc(img.rows * img.cols * sizeof(short unsigned int)); - - //The next block of code retrieves the RGB values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - r[i+img.rows*j]=intensity.val[2]; - g[i+img.rows*j]=intensity.val[1]; - b[i+img.rows*j]=intensity.val[0]; - } - } - - //Adding the R value matrix to the list - sciErr = createMatrixOfUnsignedInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the G value matrix to the list - sciErr = createMatrixOfUnsignedInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 2, img.rows,img.cols,g); - free(g); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the B value matrix to the list - sciErr = createMatrixOfUnsignedInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 3, img.rows,img.cols, b); - free(b); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - else - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - short unsigned int *r = (short unsigned int *)malloc(img.rows * img.cols * sizeof(short unsigned int)); - - //The next block of code retrieves the image colour values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - - //Adding the image colour value matrix to the list - sciErr = createMatrixOfUnsignedInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - - } - else if(strcmp(checker,"16S")==0) //for Signed Integer 16 - { - if(num==3) - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - short int *r = (short int *)malloc(img.rows * img.cols * sizeof(short int)); - short int *g = (short int *)malloc(img.rows * img.cols * sizeof(short int)); - short int *b = (short int *)malloc(img.rows * img.cols * sizeof(short int)); - //The next block of code retrieves the RGB values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - r[i+img.rows*j]=intensity.val[2]; - g[i+img.rows*j]=intensity.val[1]; - b[i+img.rows*j]=intensity.val[0]; - } - } - - //Adding the R value matrix to the list - sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols, r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the G value matrix to the list - sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 2, img.rows,img.cols, g); - free(g); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the B value matrix to the list - sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 3, img.rows,img.cols,b); - free(b); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - - else - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - short int *r = (short int *)malloc(img.rows * img.cols * sizeof(short int)); - - //The next block of code retrieves the image colour values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - - //Adding the image colour value matrix to the list - sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - } - } - else if(strcmp(checker,"32S")==0) //for Signed Integer 16 - { - if(num==3) - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - int *r = (int *)malloc(img.rows * img.cols * sizeof(int)); - int *g = (int *)malloc(img.rows * img.cols * sizeof(int)); - int *b = (int *)malloc(img.rows * img.cols * sizeof(int)); - //The next block of code retrieves the RGB values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - r[i+img.rows*j]=intensity.val[2]; - g[i+img.rows*j]=intensity.val[1]; - b[i+img.rows*j]=intensity.val[0]; - } - } - - //Adding the R value matrix to the list - sciErr = createMatrixOfInteger32InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the G value matrix to the list - sciErr = createMatrixOfInteger32InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 2, img.rows,img.cols,g); - free(g); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the B value matrix to the list - sciErr = createMatrixOfInteger32InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 3, img.rows,img.cols,b); - free(b); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - else - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - int *r = (int *)malloc(img.rows * img.cols * sizeof(int)); - - //The next block of code retrieves the image colour values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - - //Adding the image colour value matrix to the list - sciErr = createMatrixOfInteger32InList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1,img.rows,img.cols, r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - } - } - - else if(strcmp(checker,"32F")==0) //for Float 32 - { - if(num==3) - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - double *r = (double *)malloc(img.rows * img.cols * sizeof(double)); - double *g = (double *)malloc(img.rows * img.cols * sizeof(double)); - double *b = (double *)malloc(img.rows * img.cols * sizeof(double)); - //The next block of code retrieves the RGB values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - r[i+img.rows*j]=intensity.val[2]; - g[i+img.rows*j]=intensity.val[1]; - b[i+img.rows*j]=intensity.val[0]; - } - } - - //Adding the R value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the G value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 2, img.rows,img.cols,g); - free(g); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the B value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 3, img.rows,img.cols,b); - free(b); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - else - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - double *r = (double *)malloc(img.rows * img.cols * sizeof(double)); - //The next block of code retrieves the image colour values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - - //Adding the image colour value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1,img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - } - else if(strcmp(checker,"64F")==0) //For Float 64 - { - if(num==3) - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - double *r = (double *)malloc(img.rows * img.cols * sizeof(double)); - double *g = (double *)malloc(img.rows * img.cols * sizeof(double)); - double *b = (double *)malloc(img.rows * img.cols * sizeof(double)); - //The next block of code retrieves the RGB values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - r[i+img.rows*j]=intensity.val[2]; - g[i+img.rows*j]=intensity.val[1]; - b[i+img.rows*j]=intensity.val[0]; - } - } - - //Adding the R value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols,r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the G value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 2, img.rows,img.cols,g); - free(g); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //Adding the B value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 3, img.rows,img.cols, b); - free(b); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - else - { - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - double *r = (double *)malloc(img.rows * img.cols * sizeof(double)); - - //The next block of code retrieves the image colour values at a specified pixel, and assigns it to the matrices - for(i=0;i(i, j); - - //Adding the image colour value matrix to the list - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+pos , piAddrNew, 1, img.rows,img.cols, r); - free(r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - } - -} diff --git a/sci_gateway/cpp/libskeleton_imageprocessing.c b/sci_gateway/cpp/libskeleton_imageprocessing.c deleted file mode 100644 index 73a082b..0000000 --- a/sci_gateway/cpp/libskeleton_imageprocessing.c +++ /dev/null @@ -1,36 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif -#include -#include -#include -#include -static int direct_gateway(char *fname,void F(void)) { F();return 0;}; -extern Gatefunc opencv_imread; -extern Gatefunc opencv_rgb2xyz; -extern Gatefunc opencv_CascadeObjectDetector; -extern Gatefunc opencv_detectKAZEFeatures; -static GenericTable Tab[]={ - {(Myinterfun)sci_gateway_without_putlhsvar,opencv_imread,"raw_imread"}, - {(Myinterfun)sci_gateway_without_putlhsvar,opencv_rgb2xyz,"raw_rgb2xyz"}, - {(Myinterfun)sci_gateway_without_putlhsvar,opencv_CascadeObjectDetector,"raw_CascadeObjectDetector"}, - {(Myinterfun)sci_gateway_without_putlhsvar,opencv_detectKAZEFeatures,"raw_detectKAZEFeatures"}, -}; - -int C2F(libskeleton_imageprocessing)() -{ - Rhs = Max(0, Rhs); - if (*(Tab[Fin-1].f) != NULL) - { - if(pvApiCtx == NULL) - { - pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx)); - } - pvApiCtx->pstName = (char*)Tab[Fin-1].name; - (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F); - } - return 0; -} -#ifdef __cplusplus -} -#endif diff --git a/sci_gateway/cpp/libskeleton_imageprocessing.so b/sci_gateway/cpp/libskeleton_imageprocessing.so deleted file mode 100644 index 04852b0..0000000 Binary files a/sci_gateway/cpp/libskeleton_imageprocessing.so and /dev/null differ diff --git a/sci_gateway/cpp/loader.sce b/sci_gateway/cpp/loader.sce deleted file mode 100644 index 6d764aa..0000000 --- a/sci_gateway/cpp/loader.sce +++ /dev/null @@ -1,24 +0,0 @@ -// This file is released under the 3-clause BSD license. See COPYING-BSD. -// Generated by builder.sce : Please, do not edit this file -// ---------------------------------------------------------------------------- -// -libskeleton_imagepr_path = get_absolute_file_path('loader.sce'); -// -// ulink previous function with same name -[bOK, ilib] = c_link('libskeleton_imageprocessing'); -if bOK then - ulink(ilib); -end -// -list_functions = [ 'raw_imread'; - 'raw_rgb2xyz'; - 'raw_CascadeObjectDetector'; - 'raw_detectKAZEFeatures'; -]; -addinter(libskeleton_imagepr_path + filesep() + 'libskeleton_imageprocessing' + getdynlibext(), 'libskeleton_imageprocessing', list_functions); -// remove temp. variables on stack -clear libskeleton_imagepr_path; -clear bOK; -clear ilib; -clear list_functions; -// ---------------------------------------------------------------------------- diff --git a/sci_gateway/cpp/opencv_CascadeObjectDetector.cpp b/sci_gateway/cpp/opencv_CascadeObjectDetector.cpp deleted file mode 100644 index 50b1473..0000000 --- a/sci_gateway/cpp/opencv_CascadeObjectDetector.cpp +++ /dev/null @@ -1,398 +0,0 @@ -/******************************************************** -Author: Nihar Rao -********************************************************* -*/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/objdetect.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include "opencv2/videoio.hpp" -#include -using namespace cv; -using namespace std; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - double readdoublec_from_scilab(int cnt) - { - - SciErr sciErr; - int *piAddr=NULL; - double val=0; - int intErr; - - sciErr = getVarAddressFromPosition(pvApiCtx,cnt,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr ,&val); - - if(isDoubleType(pvApiCtx, piAddr)) - return val; - else - { - Scierror(999,"Error: the input argument is not of type double"); - return 0; - - - } - - - } - bool file_existsindirectory_check(const std::string& name) { - struct stat buffer; - return (stat (name.c_str(), &buffer) == 0); - } - - int opencv_CascadeObjectDetector(char *fname, unsigned long fname_len) - { - SciErr sciErr; - int intErr = 0; - int iRows=0,iCols=0; - int iRows1,iCols1; - int *piAddr = NULL; - int *piAddrNew = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piLen = NULL; - char **object = NULL; - int i; - double minX,minY,maxX,maxY; - double *bboxes = NULL; - double *minSize,*maxSize; - double scale=1.05;//all optional arguments are set to their default values - int minNeighbors=2,flags=2; - - CheckInputArgument(pvApiCtx, 2, 7); - CheckOutputArgument(pvApiCtx, 1, 2) ; - Mat image,new_image,image_gray; - //get no. of input arguments - int n=*getNbInputArgument(pvApiCtx); - retrieveImage(image, 1); - - ///resize(image,image,Size(800,600),0,0,cv::INTER_AREA); - - sciErr = getVarAddressFromPosition(pvApiCtx,2, &piAddr2); - - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - object= (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - { - object[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen,object); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - ///Reading optional arguments - int cnt=3; - switch(n) - { - case 3: - - scale=readdoublec_from_scilab(cnt); - cnt++; - break; - case 4: - - scale=readdoublec_from_scilab(cnt); - cnt++; - minNeighbors=(int)readdoublec_from_scilab(cnt); - cnt++; - break; - case 5: - - scale=readdoublec_from_scilab(cnt); - cnt++; - minNeighbors=(int)readdoublec_from_scilab(cnt); - cnt++; - flags=(int)readdoublec_from_scilab(cnt); - if(flags!=2 && flags!=1 && flags!=4 && flags!=8) - { - Scierror(999,"Error: the flag should be {1,2,4,8}\n"); - return 0; - - } - - cnt++; - break; - case 6: - - scale=readdoublec_from_scilab(cnt); - cnt++; - minNeighbors=(int)readdoublec_from_scilab(cnt); - cnt++; - flags=(int)readdoublec_from_scilab(cnt); - cnt++; - if(flags!=2 && flags!=1 && flags!=4 && flags!=8) - { - Scierror(999,"Error: the flag should be {1,2,4,8}\n"); - return 0; - - } - - sciErr = getVarAddressFromPosition(pvApiCtx,cnt,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows1, &iCols1, &minSize); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - //check dimensions - if(iCols1!=2 || iRows1!=1) - { - Scierror(999,"The minSize argument must have dimensions 1*2"); - return -1; - } - - cnt++; - - - break; - case 7: - - scale=readdoublec_from_scilab(cnt); - cnt++; - minNeighbors=(int)readdoublec_from_scilab(cnt); - cnt++; - flags=(int)readdoublec_from_scilab(cnt); - cnt++; - if(flags!=2 && flags!=1 && flags!=4 && flags!=8) - { - Scierror(999,"Error: the flag should be {1,2,4,8}\n"); - return 0; - - } - - sciErr = getVarAddressFromPosition(pvApiCtx,cnt,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows1, &iCols1, &minSize); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - //check dimensions - if(iCols1!=2 || iRows1!=1) - { - Scierror(999,"The minSize argument must have dimensions 1*2 "); - return -1; - } - cnt++; - - sciErr = getVarAddressFromPosition(pvApiCtx,cnt,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows1, &iCols1, &maxSize); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - //check dimensions - if(iCols1!=2 || iRows1!=1) - { - Scierror(999,"The maxSize argument must have dimensions 1*2 "); - return -1; - } - - break; - - } - - - /* Actual Processing*/ - try{ - if(image.channels()==1) - { - image.convertTo(image,CV_8U); - image.copyTo(image_gray); - - equalizeHist( image_gray, image_gray ); - - - - } - else - { - //Converting image from rgb to gray scale image. - image.convertTo(image,CV_8U); - cvtColor( image, image_gray, CV_BGR2GRAY ); - //equalizing the histrogram of gray scale image - equalizeHist( image_gray, image_gray ); - } - - - - vector found; - - //set minSize and maxSize if passed - if(n==6) - { - minX=minSize[0]; - minY=minSize[1]; - - } - else if(n==7) - { - minX=minSize[0]; - minY=minSize[1]; - - maxX=maxSize[0]; - maxY=maxSize[1]; - - - - } - - - - int j; - for(j=0;j +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +#include + +using namespace cv; +using namespace std; + +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "../common.h" + + int opencv_DCT(char *fname, unsigned long fname_len) + { + + /// Error management variable + SciErr sciErr; + + /// Variables + int i, j; + int flags = 0; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + // to get the argument #1 + Mat image; + retrieveImage(image, 1); + + if(image.channels() != 1) + { + Scierror(999, "Input should be single channel\n"); + return 0; + } + + /// even sized rows and columns required + if(image.rows%2 != 0){ + Scierror(999, "%s: Odd number of rows found\n"); + return 0; + } + + if(image.cols%2 != 0){ + Scierror(999, "%s: Odd number of columns found\n"); + return 0; + } + + //Application Code + try + { + Mat new_image(image.rows, image.cols, image.type()); + dct(image, new_image, flags); + + string tempstring = type2str(new_image.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker, new_image, 1); + free(checker); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +/* ==================================================================== */ +} + diff --git a/sci_gateway/cpp/opencv_FFT.cpp b/sci_gateway/cpp/opencv_FFT.cpp new file mode 100644 index 0000000..bc0beab --- /dev/null +++ b/sci_gateway/cpp/opencv_FFT.cpp @@ -0,0 +1,111 @@ +/**************************************** +Author: Sridhar Reddy +*****************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_FFT(char *fname, unsigned long fname_len) + { + // Error management variables + SciErr sciErr; + int intErr=0; + + // variables required to read arguments + int iRows=0,iCols=0,i,j; + int *piAddr1=NULL; + double *ipReal=NULL; + double *ipImg=NULL; + double *rsltReal=NULL; + double *rsltImg=NULL; + vector > vec_out; + vector vec_in; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1) ; + + // to get the argument #1 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &ipReal); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + try + { + + ipImg = (double*)malloc(sizeof(double) * iRows * iCols); + if(iRows==1) + { + for(i = 0 ; i +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include + #include "../common.h" + + int opencv_affine2d(char *fname, unsigned long fname_len) + { + + SciErr sciErr; + int intErr=0; + int iRows=0,iCols=0; + int *piLen = NULL; + int *piAddr1 = NULL; + char **ddepth = NULL; + int i,j,k; + double *inpMatrix; + + //checking input argument + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1) ; + + //for inputMatrix + sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols ,&inpMatrix); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + int n=iRows; + double inputMatrix[n][n]; + //assigning values to actual kernelMatrix + for(i=0;i(i,j) = warp_mat_t.at(i,j); + + outputMatrix.at(0,2) = 0; + outputMatrix.at(1,2) = 0; + outputMatrix.at(2,2) = 1.0; + + //returning image + string tempstring = type2str(outputMatrix.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,outputMatrix,1); + free(checker); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +/* ==================================================================== */ +} diff --git a/sci_gateway/cpp/opencv_arrowedline.cpp b/sci_gateway/cpp/opencv_arrowedline.cpp deleted file mode 100644 index 9344f87..0000000 --- a/sci_gateway/cpp/opencv_arrowedline.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************** - Author: Abhilasha Sancheti & Sukul Bagai -********************************************************* - return_image = arrowedline(image , x1 , y1 , x2,y2,r_value,g_value,b_value,thickness,linetype,shift,tiplength); -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_arrowedline(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr=0; - int iRows=0,iCols=0; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piAddr5 = NULL; - int *piAddr6 = NULL; - int *piAddr7 = NULL; - int *piAddr8 = NULL; - int *piAddr9 = NULL; - int *piAddr10 = NULL; - int *piAddr11 = NULL; - int *piAddr12 = NULL; - int i,j,k; - double thickness=1 , linetype=8,shift =0 ,tiplength=0.1; - double x1,y1,x2,y2,r_value,g_value,b_value; - - - //checking input argument - CheckInputArgument(pvApiCtx, 8, 12); - CheckOutputArgument(pvApiCtx, 1, 1) ; - int n=*getNbInputArgument(pvApiCtx); - - Mat src; - retrieveImage(src,1); - - //for value of x coordinate of first point - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr2 ,&x1); - if(intErr) - return intErr; - - //for value of y coordinate of first point - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr3,&y1); - if(intErr) - return intErr; - - //for value of x coordinate of second point - sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr4 ,&x2); - if(intErr) - return intErr; - - ///for value of y coordinate of second point - sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr5 ,&y2); - if(intErr) - return intErr; - - //for value of R value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,6,&piAddr6); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr6,&r_value); - if(intErr) - return intErr; - - // for G value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,7,&piAddr7); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr7,&g_value); - if(intErr) - return intErr; - - // for B value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,8,&piAddr8); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr8,&b_value); - if(intErr) - return intErr; - - - //Reading optional arguments - if(n>8) - { - for(int i=9;i<=n;i++) - { - - double r; - sciErr = getVarAddressFromPosition(pvApiCtx,i,&piAddr12); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - intErr = getScalarDouble(pvApiCtx, piAddr12,&r); - if(intErr) - return intErr; - //assign value - if(i==9) - thickness=r; - else if(i==10) - linetype=r; - else if(i==11) - shift=r; - else - tiplength=r; - - } - } - //temporary pt variable, to use in function as centre - Point pt1(x1,y1); - Point pt2(x2,y2); - - - /// checking the parmeters for correct values - if( r_value <0 || r_value >255) - { - r_value=0; - sciprint(" r value of colour should be between 0 and 255 , using 0 instead\n"); - } - if( g_value <0 || g_value >255) - { - g_value=0; - sciprint(" g value of colour should be between 0 and 255 , using 0 instead\n"); - } - if( b_value <0 || b_value >255) - { - b_value=0; - sciprint(" b value of colour should be between 0 and 255 , using 0 instead\n"); - } - if ((linetype!=0) && (linetype!=4)&& (linetype!=8)) - { - linetype=8; - sciprint("Only 0/4/8 allowed , using 8 instead"); - } - //calling the opencv function - try - { - arrowedLine( src, pt1, pt2, Scalar(b_value,g_value,r_value), thickness, linetype, shift, tiplength); - } - catch(cv::Exception& e) - { - - Scierror(999,e.what()); - return 0;; - - } - - - string tempstring = type2str(src.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,src,1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - - } - -} - diff --git a/sci_gateway/cpp/opencv_bboxOverlapRatio.cpp b/sci_gateway/cpp/opencv_bboxOverlapRatio.cpp new file mode 100644 index 0000000..899b960 --- /dev/null +++ b/sci_gateway/cpp/opencv_bboxOverlapRatio.cpp @@ -0,0 +1,283 @@ +/*************************************************** +Author : Tanmay Chaudhari +***************************************************/ + +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + + int opencv_bboxOverlapRatio(char *fname, unsigned long fname_len) + { + //Error management variable + SciErr sciErr; + + //Variable declaration + int i, j; + int nbInputArguments = 0; + int iComplex = 0; + int iType = 0; + int iRows = 0; + int iCols = 0; + int rowsOfBboxA = 0; + int colsOfBboxA = 0; + int rowsOfBboxB = 0; + int colsOfBboxB = 0; + int unionOrMin = 0; //if 0 then union else min + int *piAddr = NULL; + int *piLen = NULL; + char **ratioType = NULL; + double x1 = 0; + double x2 = 0; + double y1 = 0; + double y2 = 0; + double w = 0; + double h = 0; + double intersectAB = 0; + double *overlapRatio = 0; + double *bboxA = NULL; + double *bboxB = NULL; + double *x1BboxA = NULL; + double *x2BboxA = NULL; + double *y1BboxA = NULL; + double *y2BboxA = NULL; + double *x1BboxB = NULL; + double *x2BboxB = NULL; + double *y1BboxB = NULL; + double *y2BboxB = NULL; + double *areaA = NULL; + double *areaB = NULL; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + checkInputArgument(pvApiCtx, 2, 3); + checkOutputArgument(pvApiCtx, 1, 1); + + //Get number of input arguments + nbInputArguments = *getNbInputArgument(pvApiCtx); + + for( i = 1; i <= nbInputArguments; i++) + { + //Get variable address of the input arguent + sciErr = getVarAddressFromPosition(pvApiCtx, i, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(i != 3) + { + //Check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //Get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //Check complexity + if(iComplex) + { + Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); + return 0; + } + + if(i == 1) + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &rowsOfBboxA, &colsOfBboxA, &bboxA); + else + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &rowsOfBboxB, &colsOfBboxB, &bboxB); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if((i == 1) && ((rowsOfBboxA == 0) || (colsOfBboxA !=4))) + { + printError(&sciErr, 0); + return 0; + } + + if((i == 2) && ((rowsOfBboxB == 0) || (colsOfBboxB != 4))) + { + printError(&sciErr, 0); + return 0; + } + } + else + { + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + + //second call to retrieve the length of the string + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr || iRows != 1 || iCols != 1) + { + printError(&sciErr, 0); + return 0; + } + + ratioType = (char**)malloc(sizeof(char*) * iRows * iCols); + for(int i=0;i< iRows * iCols; i++) + { + ratioType[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1)); //+1 for NULL character + } + + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, ratioType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(piLen[0] != 5 && piLen[0] != 3) + { + printError(&sciErr, 0); + return 0; + } + if(piLen[0] == 5 && ratioType[0][0] == 'U' && ratioType[0][1] == 'n' && ratioType[0][2] == 'i' && ratioType[0][3] == 'o' && ratioType[0][4] == 'n') + unionOrMin = 0; + else if(piLen[0] == 3 && ratioType[0][0] == 'M' && ratioType[0][1] == 'i' && ratioType[0][2] == 'n') + unionOrMin = 1; + else + { + Scierror(999, "%s: Wrong type for input argument: Union or Min is expected.\n"); + return 0; + } + free(piLen); + free(ratioType); + } + } + + //Application Code + try + { + x1BboxA = (double*)malloc(sizeof(double) * rowsOfBboxA); + x2BboxA = (double*)malloc(sizeof(double) * rowsOfBboxA); + y1BboxA = (double*)malloc(sizeof(double) * rowsOfBboxA); + y2BboxA = (double*)malloc(sizeof(double) * rowsOfBboxA); + + x1BboxB = (double*)malloc(sizeof(double) * rowsOfBboxB); + x2BboxB = (double*)malloc(sizeof(double) * rowsOfBboxB); + y1BboxB = (double*)malloc(sizeof(double) * rowsOfBboxB); + y2BboxB = (double*)malloc(sizeof(double) * rowsOfBboxB); + + areaA = (double*)malloc(sizeof(double) * rowsOfBboxA); + areaB = (double*)malloc(sizeof(double) * rowsOfBboxB); + + overlapRatio = (double*)malloc(sizeof(double) * rowsOfBboxA * rowsOfBboxB); + + for( i = 0; i < rowsOfBboxA; i++) + { + //Left top corner + x1BboxA[i] = bboxA[i]; + y1BboxA[i] = bboxA[rowsOfBboxA + i]; + + //right bottom corner + x2BboxA[i] = x1BboxA[i] + bboxA[2 * rowsOfBboxA + i]; + y2BboxA[i] = y1BboxA[i] + bboxA[3 * rowsOfBboxA + i]; + } + + for( i = 0; i < rowsOfBboxB; i++) + { + //Left top corner + x1BboxB[i] = bboxB[i]; + y1BboxB[i] = bboxB[rowsOfBboxB + i]; + + //right bottom corner + x2BboxB[i] = x1BboxB[i] + bboxB[2 * rowsOfBboxB + i]; + y2BboxB[i] = y1BboxB[i] + bboxB[3 * rowsOfBboxB + i]; + } + + //Computing area for each rectangle in bboxA + for( i = 0; i < rowsOfBboxA; i++) + areaA[i] = bboxA[2 * rowsOfBboxA + i] * bboxA[3 * rowsOfBboxA + i]; + + //Computing area for each rectangle in bboxB + for( i = 0 ; i < rowsOfBboxB; i++) + areaB[i] = bboxB[2 * rowsOfBboxB + i] * bboxB[3 * rowsOfBboxB + i]; + + for( i = 0; i < rowsOfBboxA * rowsOfBboxB; i++) + overlapRatio[i] = 0; + + for( i = 0; i < rowsOfBboxA; i++) + { + for( j = 0; j < rowsOfBboxB; j++) + { + //Computing the corners of the intersect + x1 = (x1BboxA[i] > x1BboxB[j])?x1BboxA[i]:x1BboxB[j]; + y1 = (y1BboxA[i] > y1BboxB[j])?y1BboxA[i]:y1BboxB[j]; + x2 = (x2BboxA[i] < x2BboxB[j])?x2BboxA[i]:x2BboxB[j]; + y2 = (y2BboxA[i] < y2BboxB[j])?y2BboxA[i]:y2BboxB[j]; + + w = x2 - x1; + if(w <= 0) //Skip if no intersection + continue; + + h = y2 - y1; + if(h <= 0) //Skip if no intersection + continue; + + intersectAB = w * h; + + if(nbInputArguments == 2) + overlapRatio[j * rowsOfBboxA + i] = intersectAB/(areaA[i] + areaB[j] - intersectAB); + else + { + if(unionOrMin == 0) + overlapRatio[j * rowsOfBboxA + i] = intersectAB/(areaA[i] + areaB[j] - intersectAB); + else + overlapRatio[j * rowsOfBboxA + i] = intersectAB/((areaA[i] < areaB[j])?areaA[i]:areaB[j]); + } + } + } + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, rowsOfBboxA, rowsOfBboxB, overlapRatio); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + + return 0; + } + /* ==================================================================== */ +} diff --git a/sci_gateway/cpp/opencv_blur.cpp b/sci_gateway/cpp/opencv_blur.cpp deleted file mode 100644 index 62f5db7..0000000 --- a/sci_gateway/cpp/opencv_blur.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/*************************************************** -Author : Sukul Bagai -***************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - - - int opencv_blur(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr=0; - int iRows=0,iCols=0; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piAddr5 = NULL; - double ksize_width,ksize_height,anchorX,anchorY; - - //checking input argument - CheckInputArgument(pvApiCtx, 5, 5); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - Mat image; - retrieveImage(image,1); - - //for value of ksize_height - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr2, &ksize_height); - if(intErr) - return intErr; - - //for value of ksize_width - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr3 ,&ksize_width); - if(intErr) - return intErr; - - //for value of anchorX - sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr4, &anchorX); - if(intErr) - return intErr; - - //for value of anchorY - sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr5, &anchorY); - if(intErr) - return intErr; - - //applying checks on input parameters - Mat new_image(image.rows,image.cols,image.type()); - - //error checks - if(ksize_height<0) - { - sciprint("Positive Value Required for Height. 1 value was used instead"); - ksize_height=1; - } - if(ksize_width<0) - { - sciprint("Positive Value Required for Width. 1 value was used instead"); - ksize_width=1; - } - if(ksize_width != ksize_height) - { - sciprint("Blurring Kernel Size not equal. Value of ksize_height used for ksize_width as well"); - ksize_width = ksize_height; - } - if(anchorX >= ksize_height || anchorY >= ksize_width) - { - sciprint("Invalid anchor points. Default point (-1,-1) used instead"); - anchorY=-1; - anchorX=-1; - } - - //defining temporary size and point type variables to use in the function - Size sz(ksize_height,ksize_width); - Point pt(anchorX,anchorY); - - //void blur(InputArray src, OutputArray dst, Size ksize, Point anchor=Point(-1,-1), int borderType=BORDER_DEFAULT ) - try - { - blur(image,new_image,sz,pt); - } - catch(cv::Exception& e) - { - sciprint("%s",e.what()); - return 0; - - } - - string tempstring = type2str(new_image.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,new_image,1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - } -/* ==================================================================== */ -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_boundingRect.cpp b/sci_gateway/cpp/opencv_boundingRect.cpp deleted file mode 100644 index a016501..0000000 --- a/sci_gateway/cpp/opencv_boundingRect.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************** - Author: Sukul Bagai -********************************************************* - rectangle_dimensions_arry(height, width, x, y) = boundingRect ( vector ) -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_boundingRect(char *fname, unsigned long fname_len) - { - SciErr sciErr; - int intErr=0; - int iRows=0,iCols=0; - int *piAddr1 = NULL; - int *piAddrNew = NULL; - int i,j,k ; - double *points; - - //checking input argument - CheckInputArgument(pvApiCtx, 1, 1); - CheckOutputArgument(pvApiCtx, 1, 1); - -//retreive the points - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr1); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols,&points); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - vector actualPoints; - for(int i=0;i +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ +#include "api_scilab.h" +#include "Scierror.h" +#include "BOOL.h" +#include +#include "sciprint.h" + + int opencv_cameraMatrix(char *fname, unsigned long fname_len) + { + //Error management variable + SciErr sciErr; + + //Variable declaration + int iComplex = 0; + int iType = 0; + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + double *instrinsicMatrix = NULL; + double *rotationMatrix = NULL; + double *translationVector = NULL; + double *camMatrix = NULL; + double *tempMatrix = NULL; + + //Check input output arguments + checkInputArgument(pvApiCtx, 3, 3); + checkOutputArgument(pvApiCtx, 1, 1); + + //Get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //Get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //Check complexity + if(iComplex) + { + Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); + return 0; + } + + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &instrinsicMatrix); + if(sciErr.iErr || iCols != 3 || iRows != 3) + { + printError(&sciErr, 0); + return 0; + } + + //Get variable address of the second input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //Get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //Check complexity + if(iComplex) + { + Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); + return 0; + } + + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &rotationMatrix); + if(sciErr.iErr || iCols != 3 || iRows != 3) + { + printError(&sciErr, 0); + return 0; + } + + //Get variable address of the first third argument + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //Get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //Check complexity + if(iComplex) + { + Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); + return 0; + } + + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &translationVector); + if(sciErr.iErr || iCols != 3 || iRows != 1) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + try + { + tempMatrix = (double*)malloc(sizeof(double) * 12); + for(int i = 0; i < 4; i++) + { + for(int j = 0; j < 3; j++) + { + if(i == 3) + tempMatrix[j * 4 + i] = translationVector[j]; + else + tempMatrix[j * 4 + i] = rotationMatrix[j * 3 + i]; + } + } + camMatrix = (double*)malloc(sizeof(double) * 12); + for(int i = 0; i < 12; i++) + camMatrix[i] = 0; + + for(int i = 0; i < 4; i++) + { + for(int j = 0; j < 3; j++) + { + for(int k = 0; k < 3; k++) + { + camMatrix[j * 4 + i] += (tempMatrix[k * 4 + i] * instrinsicMatrix[j * 3 + k]); + } + } + } + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 4, 3, camMatrix); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + } +} diff --git a/sci_gateway/cpp/opencv_circle.cpp b/sci_gateway/cpp/opencv_circle.cpp deleted file mode 100644 index 96f1bc4..0000000 --- a/sci_gateway/cpp/opencv_circle.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************** - Author: Abhilasha Sancheti -********************************************************* - return_image = circle(input_image , x_coordinate_of_centre , y_coordinate_centre , radius, r_value,g_value,b_value,thickness,linetype,shift); -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_circle(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr=0; - int iRows=0,iCols=0; - int *piAddrNew = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piAddr5 = NULL; - int *piAddr6 = NULL; - int *piAddr7 = NULL; - int *piAddr8 = NULL; - int *piAddr9 = NULL; - int *piAddr10 = NULL; - int i,j,k; - double thickness=1 , linetype=8,shift =0 ,centre_x ,centre_y,radius,r_value,g_value,b_value; - - - //checking input argument - CheckInputArgument(pvApiCtx, 10, 10); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - Mat src; - retrieveImage(src,1); - int n=*getNbInputArgument(pvApiCtx); - - //for value of x coordinate of centre - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr2,¢re_x); - if(intErr) - return intErr; - - - //for value of y coordinate of centre - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr3,¢re_y); - if(intErr) - return intErr; - - //for value of radius - sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr4,&radius); - if(intErr) - return intErr; - - //for value of R value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr5 ,&r_value); - if(intErr) - return intErr; - - //for value of G value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,6,&piAddr6); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr6 ,&g_value); - if(intErr) - return intErr; - - // for B value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,7,&piAddr7); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr7,&b_value); - if(intErr) - return intErr; - - if(n==8) - { - // for thickness of circle default: 1 - sciErr = getVarAddressFromPosition(pvApiCtx,8,&piAddr8); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr8,&thickness); - if(intErr) - return intErr; - } - else if(n==9) - { - sciErr = getVarAddressFromPosition(pvApiCtx,8,&piAddr8); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr8,&thickness); - if(intErr) - return intErr; - //for line type of circle default: 8 - - sciErr = getVarAddressFromPosition(pvApiCtx,9,&piAddr9); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - intErr = getScalarDouble(pvApiCtx, piAddr9,&linetype); - if(intErr) - return intErr; - } - else if(n==10) - { sciErr = getVarAddressFromPosition(pvApiCtx,8,&piAddr8); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr8,&thickness); - if(intErr) - return intErr; - //for line type of circle default: 8 - - sciErr = getVarAddressFromPosition(pvApiCtx,9,&piAddr9); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - intErr = getScalarDouble(pvApiCtx, piAddr9,&linetype); - if(intErr) - return intErr; - - // for shift in circle default : 0 - sciErr = getVarAddressFromPosition(pvApiCtx,10,&piAddr10); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr10,&shift); - if(intErr) - return intErr; - } - - // for shift in circle defulat : 0 - - - // checking radius parameter - if (radius <0) - { - radius=3; - sciprint("Radius should be positive , 3 value was used instead\n"); - } - // checking the parmeters for correct values - if( r_value <0 || r_value >255) - { - r_value=0; - sciprint(" r value of colour should be between 0 and 255 , using 0 instead\n"); - } - if( g_value <0 || g_value >255) - { - g_value=0; - sciprint(" g value of colour should be between 0 and 255 , using 0 instead\n"); - } - if( b_value <0 || b_value >255) - { - b_value=0; - sciprint(" b value of colour should be between 0 and 255 , using 0 instead\n"); - } - if ((linetype!=0) && (linetype!=4)&& (linetype!=8)) - { - linetype=8; - sciprint("Only 0/4/8 allowed , using 8 instead\n"); - } - //temporary pt variable, to use in function as centre - Point pt(centre_x,centre_y); - /// Draw the circles detected - try - { - circle( src, pt, radius, Scalar(r_value,g_value,b_value), thickness, linetype, shift); - } - catch(cv::Exception& e) - { - Scierror(999,e.what()); - } -//// sending the image - - string tempstring = type2str(src.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,src,1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - - } - -} - diff --git a/sci_gateway/cpp/opencv_convolver.cpp b/sci_gateway/cpp/opencv_convolver.cpp new file mode 100644 index 0000000..8a5d289 --- /dev/null +++ b/sci_gateway/cpp/opencv_convolver.cpp @@ -0,0 +1,167 @@ +/****************************************************************************************** +*Author : Kevin George , Manoj Sree Harsha +* +*-> To execute, Image = convolver(I1, size, values,scalar) +* where 'I1' is image to be convoluted, +* where 'size' is size of kernel i.e size x size gives total no. of values in kernel, +* where 'values' contains the values of the kernel +* where 'scalar' is a float value +* +*******************************************************************************************/ +#include +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/features2d/features2d.hpp" +#include +#include +#include + +using namespace cv; +using namespace std; + +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_convolver(char *fname, unsigned long fname_len) + { + //-> Error Management variables + SciErr sciErr; + int intErr=0; + + //-> Mat containers for images + Mat image_1; + Mat image_2; + + //-> Address of Various Arguments + int *piAddr = NULL; + + //-> Local Variables + double *values1 = NULL; + float *values2 =NULL; + double size; + double scalar; + int iRows = 0; + int iCols = 0; + int *outList = NULL; + unsigned char *red = NULL; + unsigned char *green = NULL; + unsigned char *blue = NULL; + + //-> Checks the number of arguments + //-> pvApiCtx is a Scilab environment pointer + CheckInputArgument(pvApiCtx, 4, 4); //Check on Number of Input Arguments + CheckOutputArgument(pvApiCtx, 1, 1); //Check on Number of Output Arguments + + //-> Read Image + retrieveImage( image_1, 1); + + //-> Taking in size of kernel + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr, &size); + if(intErr) + { + return intErr; + } + if(size!=3 && size != 4 && size !=5) + { + Scierror(999," Invalid Value size. Please enter a non negative Double value\\n"); + return 0; + } + + //-> Taking the kernel values + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &values1); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + if(iRows*iCols!=9 && iRows*iCols!=16 && iRows*iCols!=25 ) + { + Scierror(999,"Invalid Argument\n"); + return 0; + } + + values2 = (float*)malloc(sizeof(float)*size*size); + for(int i=0; i Taking scalar values + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + intErr = getScalarDouble(pvApiCtx, piAddr, &scalar); + if(intErr) + { + return intErr; + } + + if( scalar == 0) + { + Scierror(999," Invalid scalar value. Please enter a non negative Double value\\n"); + return 0; + } + + //Application Code + try + { + Mat kernel(size,size,CV_32F, values2); + Mat kernel2 = kernel/ (float)(scalar); + Point anchor; + double delta; + int ddepth; + anchor = Point( -1, -1 ); + delta = 0; + ddepth = -1; + filter2D(image_1, image_2, ddepth,kernel2,anchor,delta, BORDER_DEFAULT); + + //returning final image + string tempstring = type2str(image_2.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,image_2,1); + free(checker); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + } + +} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_cornerEigenValsAndVecs.cpp b/sci_gateway/cpp/opencv_cornerEigenValsAndVecs.cpp new file mode 100644 index 0000000..1a37225 --- /dev/null +++ b/sci_gateway/cpp/opencv_cornerEigenValsAndVecs.cpp @@ -0,0 +1,148 @@ +/******************************************************** +Author: Shubheksha Jalan +********************************************************/ + +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "../common.h" + + + int opencv_cornerEigenValsAndVecs(char *fname, unsigned long fname_len) + { + //Error management variables + SciErr sciErr; + int intErr = 0; + + // variables required to read arguments + int iRows=0,iCols=0; + int *piLen = NULL; + int *piAddr = NULL; + int *piAddrNew = NULL; + int *piAddr2 = NULL; + int *piAddr3 = NULL; + int *piAddr4 = NULL; + int i,j,k; + double blockSize, ksize; + char **borderType; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 4, 4); + CheckOutputArgument(pvApiCtx, 1, 1); + + // to get the argument #1 + Mat image; + retrieveImage(image, 1); + image.convertTo(image,CV_32F); + cvtColor(image,image,CV_BGR2GRAY); + + // to get the argument #2 + //for block size + sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr2, &blockSize); + if(intErr) + { + return intErr; + } + + // to get the argument #3 + //for ksize + sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr3, &ksize); + if(intErr) + { + return intErr; + } + + // to get the argument #4 + //for border type + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr4, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + //second call to retrieve length of each string + sciErr = getMatrixOfString(pvApiCtx, piAddr4, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + borderType = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + borderType[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr4, &iRows, &iCols, piLen, borderType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + Mat new_image(image.rows, image.cols, CV_32FC1); + try + { + if(strcmp(borderType[0], "BORDER_CONSTANT") == 0){ + cornerEigenValsAndVecs(image, new_image, blockSize, ksize, BORDER_CONSTANT); + } + else if(strcmp(borderType[0], "BORDER_DEFAULT") == 0) + cornerEigenValsAndVecs(image, new_image, blockSize, ksize, BORDER_DEFAULT); + free(borderType); + + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + + //returning final Image + string tempstring = type2str(new_image.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,new_image,1); + free(checker); + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +/* ==================================================================== */ +} diff --git a/sci_gateway/cpp/opencv_cornerHarris.cpp b/sci_gateway/cpp/opencv_cornerHarris.cpp new file mode 100644 index 0000000..cda0694 --- /dev/null +++ b/sci_gateway/cpp/opencv_cornerHarris.cpp @@ -0,0 +1,158 @@ +/******************************************************** +Author: Shubheksha Jalan +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "../common.h" + + int opencv_cornerHarris(char *fname, unsigned long fname_len) + { + // Error management variables + SciErr sciErr; + int intErr = 0; + + // variables required to read arguments + int iRows=0,iCols=0; + int *piLen = NULL; + int *piAddr = NULL; + int *piAddrNew = NULL; + int *piAddr2 = NULL; + int *piAddr3 = NULL; + int *piAddr4 = NULL; + int *piAddr5 = NULL; + int i,j; + double blockSize=0, ksize=0, k=0; + char **borderType; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 5, 5); + CheckOutputArgument(pvApiCtx, 1, 1); + + // to get the argument #1 + Mat image; + retrieveImage(image, 1); + image.convertTo(image,CV_32F); + cvtColor(image,image,CV_BGR2GRAY); + + // to get the argument #2 + sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr2, &blockSize); + if(intErr) + { + return intErr; + } + + // to get the argument #3 + //for ksize + sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr3, &ksize); + if(intErr) + { + return intErr; + } + + // to get the argument #4 + //for value of k + sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr4, &k); + if(intErr) + { + return intErr; + } + + // to get the argument #5 + //for border type + sciErr = getVarAddressFromPosition(pvApiCtx, 5, &piAddr5); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr5, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + //second call to retrieve length of each string + sciErr = getMatrixOfString(pvApiCtx, piAddr5, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + borderType = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + borderType[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr5, &iRows, &iCols, piLen, borderType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + Mat new_image(image.rows, image.cols, CV_32FC1); + try + { + if(strcmp(borderType[0], "BORDER_CONSTANT") == 0){ + cornerHarris(image, new_image, blockSize, ksize, k, BORDER_CONSTANT); + } + else if(strcmp(borderType[0], "BORDER_DEFAULT") == 0) + cornerHarris(image, new_image, blockSize, ksize, k, BORDER_DEFAULT); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + //returning final Image + new_image.convertTo(new_image, CV_32FC1, 1.0/255.0); + string tempstring = type2str(new_image.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,new_image,1); + free(checker); + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +/* ==================================================================== */ +} diff --git a/sci_gateway/cpp/opencv_cornerMinEigenVal.cpp b/sci_gateway/cpp/opencv_cornerMinEigenVal.cpp new file mode 100644 index 0000000..d39e643 --- /dev/null +++ b/sci_gateway/cpp/opencv_cornerMinEigenVal.cpp @@ -0,0 +1,146 @@ +/******************************************************** +Author: Shubheksha Jalan +********************************************************/ + +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "../common.h" + + + int opencv_cornerMinEigenVal(char *fname, unsigned long fname_len) + { + // Error management variables + SciErr sciErr; + int intErr = 0; + + // variables required to read arguments + int iRows=0,iCols=0; + int *piLen = NULL; + int *piAddr = NULL; + int *piAddrNew = NULL; + int *piAddr2 = NULL; + int *piAddr3 = NULL; + int *piAddr4 = NULL; + int i,j,k; + double blockSize, ksize; + char **borderType; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 4, 4); + CheckOutputArgument(pvApiCtx, 1, 1) ; + + // to get the argument #1 + Mat image; + retrieveImage(image, 1); + image.convertTo(image,CV_32F); + cvtColor(image,image,CV_BGR2GRAY); + + // to get the argument #2 + sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr2, &blockSize); + if(intErr) + { + return intErr; + } + + // to get the argument #3 + //for ksize + sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piAddr3, &ksize); + if(intErr) + { + return intErr; + } + + // to get the argument #4 + //for border type + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr4, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + //second call to retrieve length of each string + sciErr = getMatrixOfString(pvApiCtx, piAddr4, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + borderType = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + borderType[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination + + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr4, &iRows, &iCols, piLen, borderType); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + Mat new_image; + try + { + if(strcmp(borderType[0], "BORDER_CONSTANT") == 0){ + cornerMinEigenVal(image, new_image, blockSize, ksize, BORDER_CONSTANT); + } + else if(strcmp(borderType[0], "BORDER_DEFAULT") == 0) + cornerMinEigenVal(image, new_image, blockSize, ksize, BORDER_DEFAULT); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + + //returning final Image + string tempstring = type2str(new_image.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,new_image,1); + free(checker); + + //Assigning the list as the Output Variable + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +/* ==================================================================== */ +} diff --git a/sci_gateway/cpp/opencv_correctMatches.cpp b/sci_gateway/cpp/opencv_correctMatches.cpp deleted file mode 100644 index 744815d..0000000 --- a/sci_gateway/cpp/opencv_correctMatches.cpp +++ /dev/null @@ -1,187 +0,0 @@ -//Author:- Nihar Rao - - - - -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include "opencv2/calib3d/calib3d.hpp" -#include -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - - -int opencv_correctMatches(char *fname, unsigned long fname_len) -{ - - SciErr sciErr; - int intErr = 0; - int iRows=0,iCols=0;//for fundamental matrix - int iRows1=0,iCols1=0;//for points1 array - int iRows2=0,iCols2=0;//for points2 array - int *piAddrNew = NULL; - int *piAddr1 = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - double *points1,*points2,*fundamental_matrix; - int i,j; - double *new1,*new2; - CheckInputArgument(pvApiCtx, 3,3); - CheckOutputArgument(pvApiCtx, 2, 2); - int n=*getNbInputArgument(pvApiCtx);//get number of input arguments - vector Point1,Point2; - - //for fundamental matrix - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr1); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &fundamental_matrix); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - Mat F(3, 3, CV_32FC1, &fundamental_matrix); - - if(iRows!=3 || iCols!=3) - { - - Scierror(999, "%s: The entered Fundamental matrix must have dimensions 3*3.\n", fname, 1); - return 0; - - - } - - - //for points1 - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows1, &iCols1, &points1); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - - - //for points2 - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &iRows2, &iCols2, &points2); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - if(iCols1 != iCols2) - { - Scierror(999, "There must be the same number of points in both input arrays(points)\n"); - return 0; - } - - for(i=0;i(i,j); - } - } - - - - new2 = (double*) malloc(sizeof(double) * C.cols *2); //both C and D have same dimensions - for(i = 0 ; i < C.cols ; i++) - { - - for(j = 0 ; j < 2 ; j++) - { - new2[i + C.cols * j] = D.at(i,j); - - } - } - //Creating Output Arguments - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, C.cols, 2, new1); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, C.cols,2, new2); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; - ReturnArguments(pvApiCtx); - return 0; - - - - - - - - - - - - - - - - - -} -} diff --git a/sci_gateway/cpp/opencv_cvtColor.cpp b/sci_gateway/cpp/opencv_cvtColor.cpp deleted file mode 100644 index ba26282..0000000 --- a/sci_gateway/cpp/opencv_cvtColor.cpp +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************** - Author: Shubheksha Jalan , Nihar Rao -********************************************************* - void cvtColor(InputArray src, int code, int dstCn=0 ) -********************************************************/ -// number of channels in the destination image; if the parameter is 0, the number of the channels is derived automatically from src and code - - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "sciprint.h" - #include "BOOL.h" - #include - #include "../common.h" - - int opencv_cvtColor(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr; - int iRows=0,iCols=0; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piLen = NULL; - double dstCn=0; - int code; - char **codeString = NULL; - int i, j, k,n; - - - //checking input argument - CheckInputArgument(pvApiCtx, 2, 3); - CheckOutputArgument(pvApiCtx, 1,1) ; - - n = *getNbInputArgument(pvApiCtx); - Mat src; - retrieveImage(src,1); - - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls - //first call to retrieve dimensions - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - codeString = (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - codeString[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, codeString); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(n==3) - { - sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); - if (sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr3, &dstCn); - if(intErr){ - return intErr; - } - } - - Mat dst; - if(strcmp(codeString[0], "CV_BGR2GRAY") == 0) - code = CV_BGR2GRAY; - else if(strcmp(codeString[0], "CV_RGB2GRAY") == 0) - code = CV_RGB2GRAY; - else if(strcmp(codeString[0], "CV_GRAY2BGR") == 0) - code = CV_GRAY2BGR; - else if(strcmp(codeString[0], "CV_GRAY2RGB") == 0) - code = CV_GRAY2RGB; - else if(strcmp(codeString[0], "CV_BGR2XYZ") == 0) - code = CV_BGR2XYZ; - else if(strcmp(codeString[0], "CV_RGB2XYZ") == 0) - code = CV_RGB2XYZ; - else if(strcmp(codeString[0], "CV_XYZ2BGR") == 0) - code = CV_XYZ2BGR; - else if(strcmp(codeString[0], "CV_XYZ2RGB") == 0) - code = CV_XYZ2RGB; - else if(strcmp(codeString[0], "CV_BGR2YCrCb") == 0) - code = CV_BGR2YCrCb; - else if(strcmp(codeString[0], "CV_RGB2YCrCb") == 0) - code = CV_RGB2YCrCb; - else if(strcmp(codeString[0], "CV_YCrCb2BGR") == 0) - code = CV_YCrCb2BGR; - else if(strcmp(codeString[0], "CV_YCrCb2RGB") == 0) - code = CV_YCrCb2RGB; - else if(strcmp(codeString[0], "CV_BGR2HSV") == 0) - code = CV_BGR2HSV; - else if(strcmp(codeString[0], "CV_RGB2HSV") == 0) - code = CV_RGB2HSV; - else if(strcmp(codeString[0], "CV_HSV2BGR") == 0) - code = CV_HSV2BGR; - else if(strcmp(codeString[0], "CV_HSV2RGB") == 0) - code = CV_HSV2RGB; - else if(strcmp(codeString[0], "CV_BGR2HLS") == 0) - code = CV_BGR2HLS; - else if(strcmp(codeString[0], "CV_RGB2HLS") == 0) - code = CV_RGB2HLS; - else if(strcmp(codeString[0], "CV_HLS2BGR") == 0) - code = CV_HLS2BGR; - else if(strcmp(codeString[0], "CV_HLS2RGB") == 0) - code = CV_HLS2RGB; - else if(strcmp(codeString[0], "CV_BGR2Lab") == 0) - code = CV_BGR2Lab; - else if(strcmp(codeString[0], "CV_RGB2Lab") == 0) - code = CV_RGB2Lab; - else if(strcmp(codeString[0], "CV_Lab2BGR") == 0) - code = CV_Lab2BGR; - else if(strcmp(codeString[0], "CV_Lab2RGB") == 0) - code = CV_Lab2RGB; - else if(strcmp(codeString[0], "CV_BGR2Luv") == 0) - code = CV_BGR2Luv; - else if(strcmp(codeString[0], "CV_RGB2Luv") == 0) - code = CV_RGB2Luv; - else if(strcmp(codeString[0], "CV_Luv2BGR") == 0) - code = CV_Luv2BGR; - else if(strcmp(codeString[0], "CV_Luv2RGB") == 0) - code = CV_Luv2RGB; - else{ - - sciprint("Invalid code"); - return 0; - } - - try - { - - if(src.channels()==3 || src.channels()==4) - src.convertTo(src,CV_8U); - else - src.convertTo(src,CV_8UC3); - cvtColor(src, dst, code, dstCn); - } - catch(cv::Exception& e) - { - - sciprint("%s",e.what()); - return 0; - - - - } - - // namedWindow ("window", 1); - // imshow("window", dst); - // waitKey(0); - // destroyWindow("window"); - - - string tempstring = type2str(dst.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,dst,1); - free(checker); - - - - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; -} -/* ==================================================================== */ -} diff --git a/sci_gateway/cpp/opencv_deconvlucy.cpp b/sci_gateway/cpp/opencv_deconvlucy.cpp deleted file mode 100644 index a8fcd44..0000000 --- a/sci_gateway/cpp/opencv_deconvlucy.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************** -Author: Vinay Bhat -******************************************************** -Usage: return_image = deconvlucy(input_image, PSF) - return_image = deconvlucy(input_image, PSF, no_of_iterations) -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - int opencv_deconvlucy(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr = 0; - int *piAddr = NULL; - int i; - double h; - - //checking input argument - CheckInputArgument(pvApiCtx, 2, 3); - CheckOutputArgument(pvApiCtx, 1, 1); - - // Get the input image from the Scilab environment - Mat image, psf; - retrieveImage(image, 1); - retrieveImage(psf, 2); - - - // Check if number of arguments are three, - // if so, then the number of iterations is also - // specified. - // If not, then set number of iterations as - // ten. - if (nbInputArgument(pvApiCtx) == 3) - { - // Get the address of the iterations scalar - sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - // Get the no. of iterations scalar - intErr = getScalarDouble(pvApiCtx, piAddr, &h); - if(intErr) - { - return intErr; - } - - if (h < 0) - { - sciprint("Please enter a nonnegative scalar for number of iterations.\n"); - return 0; - } - } - else - h = 10; - - - // Check if the input image is grayscale or not, - - - if (image.channels()!=1) - { - sciprint("\nthe first image must be grayscale!\n"); - return 0; - } - - if (psf.channels()!=1) - { - sciprint("\nthe second image must be grayscale!\n"); - return 0; - - } - - - // Apply the Lucy-Richardson method for deblurring - // an image. - Mat convRes, convRes2, temp; - temp = image.clone(); - - try - { - - for (i = 0; i < h; i++) - { - filter2D(temp, convRes, -1, psf); - max((temp - convRes), 0, convRes2); - min((temp + convRes2), 255, convRes); - temp = convRes.clone(); - } - - } - catch(cv::Exception& e) - { - Scierror(999,e.what()); - return 0; - - } - - image = temp.clone(); - - string tempstring = type2str(image.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker, image, 1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - } -/* ==================================================================== */ -} - diff --git a/sci_gateway/cpp/opencv_demosaic.cpp b/sci_gateway/cpp/opencv_demosaic.cpp deleted file mode 100644 index 2aa3bb2..0000000 --- a/sci_gateway/cpp/opencv_demosaic.cpp +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************** - Author: V Srinivas -********************************************************* - void cvtColor(InputArray src, int code, int dstCn=0 ) -********************************************************/ -//Demosaicing using cvt color filter - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include - -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "sciprint.h" - #include "BOOL.h" - #include - #include "../common.h" - - int opencv_demosaic(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr; - int iRows=0,iCols=0; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piLen = NULL; - double dstCn; - int code; - char **codeString = NULL; - int i, j, k; - - //checking input argument - CheckInputArgument(pvApiCtx, 2,2); - CheckOutputArgument(pvApiCtx, 1,1) ; - - - Mat src; - retrieveImage(src,1); - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return -1; - } - - //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls - //first call to retrieve dimensions - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return -1; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return -1; - } - - codeString = (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - codeString[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, codeString); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - - Mat dst; - - if(strcmp(codeString[0], "gbrg") == 0) - code = CV_BayerGR2RGB; - else if(strcmp(codeString[0], "bggr") == 0) - code = CV_BayerRG2RGB; - else if(strcmp(codeString[0], "rggb") == 0) - code = CV_BayerBG2RGB; - else if(strcmp(codeString[0], "grbg") == 0) - code = CV_BayerGB2RGB; - else{ - - sciprint("Invalid Bayer filter code"); - return 0; - } - - try - { - //convert colored image to grayscale - if(src.channels()>=3) - { - - src.convertTo(src,CV_8U); - cvtColor( src, src, CV_BGR2GRAY ); - - - - } - src.convertTo(src,CV_8U); - cvtColor(src, dst, code, 0); - } - catch(cv::Exception& e) - { - - - Scierror(999,e.what()); - return 0; - - - - - } - - // namedWindow ("window", 1); - // imshow("window", dst); - // waitKey(0); - // destroyWindow("window"); - - - string tempstring = type2str(dst.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,dst,1); - free(checker); - - - - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; -} -/* ==================================================================== */ -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_demosaic.cpp~ b/sci_gateway/cpp/opencv_demosaic.cpp~ deleted file mode 100644 index 4c2ee4b..0000000 --- a/sci_gateway/cpp/opencv_demosaic.cpp~ +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************** - Author: V Srinivas -********************************************************* - void cvtColor(InputArray src, int code, int dstCn=0 ) -********************************************************/ -//Demosaicing using cvt color filter - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include - -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "sciprint.h" - #include "BOOL.h" - #include - #include "../common.h" - - int opencv_demosaic(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr; - int iRows=0,iCols=0; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piLen = NULL; - double dstCn; - int code; - char **codeString = NULL; - int i, j, k; - - //checking input argument - CheckInputArgument(pvApiCtx, 2,2); - CheckOutputArgument(pvApiCtx, 1,1) ; - - - Mat src; - retrieveImage(src,1); - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return -1; - } - - //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls - //first call to retrieve dimensions - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return -1; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return -1; - } - - codeString = (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - codeString[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &iRows, &iCols, piLen, codeString); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - - Mat dst; - - if(strcmp(codeString[0], "gbrg") == 0) - code = CV_BayerGR2RGB; - else if(strcmp(codeString[0], "bggr") == 0) - code = CV_BayerRG2RGB; - else if(strcmp(codeString[0], "rggb") == 0) - code = CV_BayerBG2RGB; - else if(strcmp(codeString[0], "grbg") == 0) - code = CV_BayerGB2RGB; - else{ - - sciprint("Invalid Bayer filter code"); - return 0; - } - - cvtColor(src, dst, code, 0); - - // namedWindow ("window", 1); - // imshow("window", dst); - // waitKey(0); - // destroyWindow("window"); - - - string tempstring = type2str(dst.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,dst,1); - free(checker); - - - - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; -} -/* ==================================================================== */ -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_detectGFTTFeatures.cpp b/sci_gateway/cpp/opencv_detectGFTTFeatures.cpp deleted file mode 100644 index 6b8b35f..0000000 --- a/sci_gateway/cpp/opencv_detectGFTTFeatures.cpp +++ /dev/null @@ -1,509 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" - -using namespace cv; -using namespace std; -using namespace cv::xfeatures2d; - - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - int opencv_detectGFTTFeatures(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int *piAddr = NULL; - int *piAddrVal = NULL; - int argPresence[7]; - for(int i=0;i<7;i++) - argPresence[i]=0; - int val_position; - int iRows = 0; - int iCols = 0; - int *piLen = NULL; - char ** pstData = NULL; - char *currentArg = NULL; - double *ROImat = NULL; - - double MinContrast = 0.2; - double MinQuality = 0.1; - double numBits = 0; - double numFeatures = 0; - double *featureVector = NULL; - -// DECLARING INPUT ARGUMENTS with their default values - - - - bool useHarris=false; - int maxCorners=1000; - double minDistance=1; - double K = 0.04; - double qualityLevel = 0.01; - int blockSize=3; - - - - - -// DECLARING OUTPUT ARGUMENTS - - vector myPoints; - int *LocationList = NULL; - double *LocationData = NULL; - int feature_rows=0; - int feature_cols=0; - - - int size; - -// ARGUMENT CHECK - - CheckInputArgument(pvApiCtx, 1,15); - CheckOutputArgument(pvApiCtx,1,5); - -// RETRIEVING IMAGE - - Mat image; - retrieveImage(image,1); - -// GRAYSCALE VALIDATION - - if(image.channels()!=1) - { - Scierror(999," Feature is not meant for RGB images\n"); - return 0; - } - -// OBTAINING NUMBER OF ARGUMENTS - - int noOfarguments = *getNbInputArgument(pvApiCtx); - -// ARGUMENT COUNT CHECK - - if(noOfarguments%2==0) - { - Scierror(999," Invalid Number Of Arguments\n"); - return 0; - } - -// MULTIPLE ARGUMENT HANDLING - - for(int i=2;iimage.cols || ROImat[1]>image.rows || ROImat[0]+ROImat[2]>image.cols - || ROImat[1]+ROImat[3]>image.rows) - { - Scierror(999,"Please make sure the arguments are within the image range\n"); - return 0; - } - - argPresence[3]=1; - } - else if(strcmp(currentArg,"maxCorners")==0) - { - val_position=i+1; - - - if(argPresence[4]==1) - { - Scierror(999,"Do not enter the same parameter\n"); - return 0; - } - - sciErr = getVarAddressFromPosition(pvApiCtx,val_position,&piAddrVal); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!isDoubleType(pvApiCtx, piAddrVal)) - { - Scierror(999," Invalid type for maxCorners\n"); - return 0; - } - double d=0; - - getScalarDouble(pvApiCtx, piAddrVal, &d); - maxCorners=(int)d; - - - - - argPresence[4]=1; - } - else if(strcmp(currentArg,"useHarris")==0) - { - - - val_position=i+1; - - if(argPresence[5]==1) - { - Scierror(999,"Do not enter the same parameter\n"); - return 0; - } - - sciErr = getVarAddressFromPosition(pvApiCtx,val_position,&piAddrVal); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - int *r=NULL; - - sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVal, &iRows, &iCols, &r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - if(r[0]) - useHarris=true; - else - useHarris=false; - argPresence[5]=1; - - - } - else if(strcmp(currentArg,"blockSize")==0) - { - val_position=i+1; - - - if(argPresence[6]==1) - { - Scierror(999,"Do not enter the same parameter\n"); - return 0; - } - - sciErr = getVarAddressFromPosition(pvApiCtx,val_position,&piAddrVal); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!isDoubleType(pvApiCtx, piAddrVal)) - { - Scierror(999," Invalid type for blockSize\n"); - return 0; - } - double d=0; - - getScalarDouble(pvApiCtx, piAddrVal, &d); - blockSize=(int)d; - - - - - argPresence[6]=1; - } - else - { - Scierror(999, "Error: \"%s\" Invalid input argument.\n", currentArg); - return 0; - } - - } - - -// DEFAULT ARGUMENTS - - if(argPresence[3]==0) - { - ROImat=(double *)malloc(sizeof(double)*1*4); - ROImat[0]=0; - ROImat[1]=0; - ROImat[2]=image.cols; - ROImat[3]=image.rows; - } - -// CREATING REGION OF INTEREST - - Rect masker(ROImat[0], ROImat[1], ROImat[2], ROImat[3]); - - Mat mask(image.size(), CV_8UC1, Scalar::all(0)); - mask(masker).setTo(Scalar::all(255)); -//KAZE processing - Mat descriptor; - Ptr myobject = cv::GFTTDetector::create(maxCorners,qualityLevel,minDistance,blockSize,useHarris,K); - try - { - image.convertTo(image, CV_8U); - myobject->detect(image,myPoints,mask); - Ptr obj=FREAK::create( true, true, 22.0f, 4 ,std::vector< int >()); - obj->compute(image, myPoints ,descriptor); - numBits = descriptor.size[1]; - numFeatures = descriptor.size[0]; - - featureVector = (double*)malloc(sizeof(double)*descriptor.size[0]*descriptor.size[1]); - for( int i=0; i(i,j)); - } - feature_rows = descriptor.size[0]; - feature_cols = descriptor.size[1]; - } - catch(cv::Exception &e) - { - const char *err = e.what(); - sciprint("%s", err); - return 0; - } - - - - size = myPoints.size(); - - -// LOCATION ----> - - LocationData = (double *)malloc(sizeof(double) * size * 2); - for(int i = 0; i < size; i++) - { - LocationData[i] = myPoints[i].pt.x; - LocationData[i + size] = myPoints[i].pt.y; - } - - -//Creating Output Arguments - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, feature_rows, feature_cols, featureVector); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, &numBits); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 1, 1, &numFeatures); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 4, size, 2, LocationData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - createScalarInteger32(pvApiCtx,nbInputArgument(pvApiCtx) + 5, size); - -// ASSIGNING ----> - - for(int i=1;i<=5;i++) - { - AssignOutputVariable(pvApiCtx, i) = nbInputArgument(pvApiCtx) + i; - } - - ReturnArguments(pvApiCtx); - } - - -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_detectKAZEFeatures.cpp b/sci_gateway/cpp/opencv_detectKAZEFeatures.cpp deleted file mode 100644 index 1ab6100..0000000 --- a/sci_gateway/cpp/opencv_detectKAZEFeatures.cpp +++ /dev/null @@ -1,510 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - int opencv_detectKAZEFeatures(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int *piAddr = NULL; - int *piAddrVal = NULL; - int argPresence[7]; - for(int i=0;i<7;i++) - argPresence[i]=0; - int val_position; - int iRows = 0; - int iCols = 0; - int *piLen = NULL; - char ** pstData = NULL; - char *currentArg = NULL; - double *ROImat = NULL; - - double MinContrast = 0.2; - double MinQuality = 0.1; - double numBits = 0; - double numFeatures = 0; - double *featureVector = NULL; - -// DECLARING INPUT ARGUMENTS with their default values - - - bool extended=false; - bool upright=false; - double Threshold=0.001; - double NumOctaves = 4; - double NumLayers = 4; - double diff=0; - int diffusivity=1; - - - -// DECLARING OUTPUT ARGUMENTS - - vector myPoints; - int *LocationList = NULL; - double *LocationData = NULL; - int feature_rows=0; - int feature_cols=0; - - - int size; - -// ARGUMENT CHECK - - CheckInputArgument(pvApiCtx, 1,15); - CheckOutputArgument(pvApiCtx,1,5); - -// RETRIEVING IMAGE - - Mat image; - retrieveImage(image,1); - -// GRAYSCALE VALIDATION - - if(image.channels()!=1) - { - Scierror(999," Feature is not meant for RGB images\n"); - return 0; - } - -// OBTAINING NUMBER OF ARGUMENTS - - int noOfarguments = *getNbInputArgument(pvApiCtx); - -// ARGUMENT COUNT CHECK - - if(noOfarguments%2==0) - { - Scierror(999," Invalid Number Of Arguments\n"); - return 0; - } - -// MULTIPLE ARGUMENT HANDLING - - for(int i=2;iimage.cols || ROImat[1]>image.rows || ROImat[0]+ROImat[2]>image.cols - || ROImat[1]+ROImat[3]>image.rows) - { - Scierror(999,"Please make sure the arguments are within the image range\n"); - return 0; - } - - argPresence[3]=1; - } - else if(strcmp(currentArg,"upright")==0) - { - - sciprint("hey"); - val_position=i+1; - - if(argPresence[4]==1) - { - Scierror(999,"Do not enter the same parameter\n"); - return 0; - } - - sciErr = getVarAddressFromPosition(pvApiCtx,val_position,&piAddrVal); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - int *r=NULL; - - sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVal, &iRows, &iCols, &r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(r[0]) - upright=true; - else - upright=false; - argPresence[4]=1; - - - } - else if(strcmp(currentArg,"extended")==0) - { - - - val_position=i+1; - - if(argPresence[5]==1) - { - Scierror(999,"Do not enter the same parameter\n"); - return 0; - } - - sciErr = getVarAddressFromPosition(pvApiCtx,val_position,&piAddrVal); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - int *r=NULL; - - sciErr = getMatrixOfBoolean(pvApiCtx, piAddrVal, &iRows, &iCols, &r); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - if(r[0]) - extended=true; - else - extended=false; - argPresence[5]=1; - - - } - else if(strcmp(currentArg,"diffusivity")==0) - { - val_position=i+1; - - - if(argPresence[6]==1) - { - Scierror(999,"Do not enter the same parameter\n"); - return 0; - } - - sciErr = getVarAddressFromPosition(pvApiCtx,val_position,&piAddrVal); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!isDoubleType(pvApiCtx, piAddrVal)) - { - Scierror(999," Invalid type for diffusivity\n"); - return 0; - } - - getScalarDouble(pvApiCtx, piAddrVal, &diff); - diffusivity=(int)diff; - - if(diffusivity>3 || diffusivity<0) - { - Scierror(999," diffusivity must be [0,3] \n"); - return 0; - - - } - - - argPresence[6]=1; - } - else - { - Scierror(999, "Error: \"%s\" Invalid input argument.\n", currentArg); - return 0; - } - - } - - -// DEFAULT ARGUMENTS - - if(argPresence[3]==0) - { - ROImat=(double *)malloc(sizeof(double)*1*4); - ROImat[0]=0; - ROImat[1]=0; - ROImat[2]=image.cols; - ROImat[3]=image.rows; - } - -// CREATING REGION OF INTEREST - - Rect masker(ROImat[0], ROImat[1], ROImat[2], ROImat[3]); - - Mat mask(image.size(), CV_8UC1, Scalar::all(0)); - mask(masker).setTo(Scalar::all(255)); -//KAZE processing - Mat descriptor; - Ptr myobject = KAZE::create(extended,upright,Threshold,NumOctaves,NumLayers,diffusivity); - try - { - image.convertTo(image, CV_8U); - myobject->detectAndCompute(image,mask,myPoints,descriptor,false); - - - numBits = descriptor.size[1]; - numFeatures = descriptor.size[0]; - - featureVector = (double*)malloc(sizeof(double)*descriptor.size[0]*descriptor.size[1]); - for( int i=0; i(i,j)); - } - feature_rows = descriptor.size[0]; - feature_cols = descriptor.size[1]; - } - catch(cv::Exception &e) - { - const char *err = e.what(); - sciprint("%s", err); - return 0; - } - - - - size = myPoints.size(); - - -// LOCATION ----> - - LocationData = (double *)malloc(sizeof(double) * size * 2); - for(int i = 0; i < size; i++) - { - LocationData[i] = myPoints[i].pt.x; - LocationData[i + size] = myPoints[i].pt.y; - } - - -//Creating Output Arguments - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, feature_rows, feature_cols, featureVector); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, &numBits); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 1, 1, &numFeatures); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 4, size, 2, LocationData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - createScalarInteger32(pvApiCtx,nbInputArgument(pvApiCtx) + 5, size); - -// ASSIGNING ----> - - for(int i=1;i<=5;i++) - { - AssignOutputVariable(pvApiCtx, i) = nbInputArgument(pvApiCtx) + i; - } - - ReturnArguments(pvApiCtx); - } - - -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_detectMSERFeatures.cpp b/sci_gateway/cpp/opencv_detectMSERFeatures.cpp deleted file mode 100644 index 38a240e..0000000 --- a/sci_gateway/cpp/opencv_detectMSERFeatures.cpp +++ /dev/null @@ -1,465 +0,0 @@ -/******************************************************************************************************************************************************************************************************** -* Author: Umang Agrawal and nihar rao * -* Code: detectMSERFeatures.cpp * -* Function Format: [ list_pixels, ......] = detectMSERFeatures( image, Optional Arguments........) * -* Input Arguments: 1. Image (Grayscale or RGB) * -* 2. ThresholdDelta Value: (0:100] Expressed in Percentage * -* 3. RegionAreaRange Value: [ Min_Area , Max_Area ] * -* 4. MaxAreaVariation Value: Scalar Double typical range from 0.25 - 4 * -* 5. ROI Value: [ x_cord , y_cord , width , height ] * -* * -* Output Argument: 1. List Of Pixels stating the Locus of all features detected * -* 2. Count * -* 3. Location: Centroid of each Locus * -* 4. Axes: Major and Minor axis length of ellipse * -* 5. Orientation: Tilt of the elliptical fit * -* * -********************************************************************************************************************************************************************************************************/ - - -#include -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/features2d/features2d.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" - -using namespace cv; -using namespace std; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - int opencv_detectMSERFeatures(char *fname, unsigned long fname_len) - { - //Various Declarations - //Error Variables - SciErr sciErr; - int sca_read; - - //Mat containers for image - Mat image; - Mat cropped; - - //Address of Various Arguments - int *piAddr = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - - int inp_params, out_params; //Count of Parameters - double arg_val; //Memory for Scalar Argument Value - int Rows, Cols; //Rows and Columns for Matrix Argument Value - double *roi_arg = NULL; //Memory for Matrix Argument Value - int *pilen = NULL; //For String Matrix Reading: Length of String - char **arg = NULL; //For String Matrix Reading: String - int count_area = 0, count_tres = 0, count_var = 0, count_roi = 0; //Count of all the optional Arguments - double x = 0, y = 0, width = 0, height = 0; //Initials of all Cropped Varaibles - - int i,j; //Iterator - - int delta = 5, min_area = 60, max_area = 14400, max_evolution = 200, edge_blur_size = 5; //Arguments of MSER function with default values - double max_variation = 0.25, min_diversity = 0.2, area_threshold = 1.01, min_margin = 0.003; //Arguments of MSER function with default values - - double *pixellist = NULL; //Output Argument Pixellist - int count[1] ; //Output Argument Count - double *location = NULL; //Output Argument Location - double *axes = NULL; //Output Argument Axes - double *orientation = NULL; //Output Argument Orientation - - vector< vector > mser_points; //3D vector for storing the locus of each detected feature - vector< RotatedRect > regions; - vector bboxes; //RotatedRect vector for storing each region associated with a feature - - CheckInputArgument(pvApiCtx, 1, 9); //Check on Number of Input Arguments - CheckOutputArgument(pvApiCtx, 1, 5); //Check on Number of Output Arguments - - //Read Image - retrieveImage(image, 1); - - - //Getting Number of Input Arguments - inp_params = *getNbInputArgument(pvApiCtx); - - //Based on the number of Input Arguments, alter the arguments of the MSER funtion. - for(i=2; i<=inp_params; i++) - { - if( inp_params == 2 || inp_params == 4 || inp_params == 6 || inp_params == 8) - { - Scierror(999,"Either Argument Name or its Value missing\n"); - return 0; - } - //Reading the Name of the Argument - sciErr = getVarAddressFromPosition(pvApiCtx, i, &piAddr2); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isStringType(pvApiCtx, piAddr2)) - { - Scierror(999, "%s: Wrong type of argument #%d. A string is expected.\n", fname, 1); - return 0; - } - //Matrix of Stings - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &Rows, &Cols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pilen = (int*)malloc(sizeof(int) * Rows * Cols); - //second call to retrieve the length of the string - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &Rows, &Cols, pilen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - return 0; - } - arg = (char**)malloc(sizeof(char*) * Rows * Cols); - for(int j=0;j< Rows * Cols; j++) - { - arg[j] = (char*)malloc(sizeof(char) * (pilen[j] + 1)); - } - - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr2, &Rows, &Cols, pilen, arg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - free(arg); - return 0; - } - - if(strcmp(arg[0],"ThresholdDelta") == 0) - { - if(count_tres == 0) - { - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Checking the type of value - if( !isDoubleType(pvApiCtx, piAddr3)) - { - Scierror(999,"Not a valid type of value.\n"); - return 0; - } - //Reading the Value of the argument - sca_read = getScalarDouble(pvApiCtx, piAddr3, &arg_val); - if(sca_read) - { - Scierror(999,"Not a valid value.\n"); - return 0; - } - //Check for valid range - if(arg_val <= 0 && arg_val > 100) - { - Scierror(999,"Not a valid range.Should be between 0 and 100.\n"); - return 0; - } - delta = arg_val; - i++; - count_tres += 1; - } - else - { - Scierror(999,"ThresholdDelta has been specified twice.Check the Arguments\n"); - return 0; - } - } - else if(strcmp(arg[0],"RegionAreaRange") == 0) - { - if(count_area == 0) - { - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Checking the type of argument - if( !(isDoubleType(pvApiCtx, piAddr3) || isIntegerType(pvApiCtx, piAddr3)) ) - { - Scierror(999,"Not a valid type of value.\n"); - return 0; - } - //Reading the Value of the argument - sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &Rows, &Cols, &roi_arg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( Rows*Cols != 2 ) - { - Scierror(999,"Only 2 values are expected.Neither less nor more\n"); - return 0; - } - if( roi_arg[0] >= roi_arg[1] ) - { - Scierror(999,"Max Area should be greater than Min Area\n"); - return 0; - } - //Assigning the elements of the list to their proper function - min_area = roi_arg[0]; - max_area = roi_arg[1]; - i++; - count_area += 1; - } - else - { - Scierror(999,"RegionAreaRange has been specified twice.Check the Arguments\n"); - return 0; - } - } - else if(strcmp(arg[0],"MaxAreaVariation") == 0) - { - if(count_var == 0) - { - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Checking the type of value - if( !isDoubleType(pvApiCtx, piAddr3)) - { - Scierror(999,"Not a valid type of value.\n"); - return 0; - } - //Reading the Value of the argument - sca_read = getScalarDouble(pvApiCtx, piAddr3, &arg_val); - if(sca_read) - { - Scierror(999,"Not a valid value.\n"); - return 0; - } - max_variation = arg_val; - i++; - count_var += 1; - } - else - { - Scierror(999,"MaxAreaVariation has been specified twice.Check the Arguments\n"); - return 0; - } - } - else if(strcmp(arg[0],"ROI") == 0) - { - if(count_roi == 0) - { - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Checking the type of argument - if( !(isDoubleType(pvApiCtx, piAddr3) || isIntegerType(pvApiCtx, piAddr3)) ) - { - Scierror(999,"Not a valid type of value.\n"); - return 0; - } - //Reading the Value of the argument - sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &Rows, &Cols, &roi_arg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( Rows*Cols != 4 ) - { - Scierror(999,"Expected 4 arguments in format [x,y,width,height]\n"); - return 0; - } - //Assigning the elements of the list to their proper function - x = roi_arg[0]; - y = roi_arg[1]; - width = roi_arg[2]; - height = roi_arg[3]; - if(x>=image.cols || y>=image.rows || x<0 || y<0) - { - sciprint("Invalid x or y value\n"); - return 0; - } - if(width<=0 || height<=0 || x+width > image.cols || y+height > image.rows) - { - sciprint("Invalid width or height value\n"); - return 0; - } - Rect myROI(x, y, width, height); - Mat croppedRef(image, myROI); - croppedRef.copyTo(cropped); - i++; //Incrementing iterator to count for the value argument read - count_roi += 1; //Indicating ROI has been called once - } - else - { - Scierror(999,"ROI has been specified twice.Check the Arguments\n"); - return 0; - } - } - else - { - Scierror(999,"Invalid Argument\n"); - return 0; - } - } - try - { - image.convertTo(image,CV_8UC3); - //Creating an MSER class Object with specified conditions - - Ptr img_ms = cv:: - MSER::create(delta, min_area, max_area, max_variation, min_diversity, max_evolution, area_threshold, min_margin, edge_blur_size); - - //Checking if have to operate on original image or cropped one - // 1st Argument: Image on which MSER features has to be detected - // 2nd Argument: Locus of all the points detected - // 3rd Argument: Mask of empty Mat container - if(count_roi == 0) - img_ms->detectRegions( image, mser_points,bboxes); - else - img_ms->detectRegions( cropped, mser_points,bboxes); - - // Extracting Regions from the mser_points locus and approximating them to an elliptic fit - for(i=0; i= regions[i].size.height ) - { - axes[i] = regions[i].size.width; //Axis: Major Axis of Ellipse - axes[mser_points.size() + i] = regions[i].size.height; //Axis: Minor Axis of Ellipse - } - else - { - axes[i] = regions[i].size.height; //Axis: Major Axis of Ellipse - axes[mser_points.size() + i] = regions[i].size.width; //Axis: Minor Axis of Ellipse - } - orientation[i] = regions[i].angle; //Orientation - } - - //Reading the number of output Arguments user demands - - //Assigning Pixel_List - - out_params = *getNbOutputArgument(pvApiCtx); - if( out_params >= 1 ) - { - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, mser_points.size(), &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - for(i = 0; i= 2 ) - { - sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 1, count); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; - } - - //Assigning Location - if( out_params >= 3 ) - { - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 3, mser_points.size(), 2, location); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; - } - - //Assigning Axes - if( out_params >= 4 ) - { - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 4, mser_points.size(), 2, axes); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; - } - - //Assigning Orientation - if( out_params == 5 ) - { - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 5, mser_points.size(), 1, orientation); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5; - } - - //Releasing all the memory Captured - free(location); - free(axes); - free(orientation); - - //Returning the Output Arguments - ReturnArguments(pvApiCtx); - return 0; - } -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_detectMinEigenFeatures.cpp b/sci_gateway/cpp/opencv_detectMinEigenFeatures.cpp deleted file mode 100644 index a1de682..0000000 --- a/sci_gateway/cpp/opencv_detectMinEigenFeatures.cpp +++ /dev/null @@ -1,367 +0,0 @@ -/*************************************************** -Author : Rohit Suri -***************************************************/ -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - - int opencv_detectMinEigenFeatures(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - int intErr; - - //------Local variables------// - int *location = NULL; - double *metric = NULL; - int *piAddr = NULL; - int *piLen = NULL; - int nbInputArguments; - char **pstData = NULL; - char *currentArg = NULL; - bool *providedArgs = NULL; - double *matrixOfRoi; // ROI[xStart, yStart, width, height] - int iRows, iCols; - Mat sourceImage, dst, dstThresholded, ucharDstThresholded, extended; - vector > contours; - double filterSize = 5, minQuality = 0.01, blockSize = 2, maxDst, localMax; - bool *included = NULL; - int pointCount = 0, localMaxPos; - double tempForSwapping; - int coordinateMin, coordinatePos; - - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 1, 7); - CheckOutputArgument(pvApiCtx, 1, 3); - - //------Get input arguments------// - retrieveImage(sourceImage, 1); - sourceImage.convertTo(sourceImage,CV_8U); - if(sourceImage.channels() != 1) - { - Scierror(999, "The input image is not a grayscale image."); - return 0; - } - matrixOfRoi = (double*) malloc(sizeof(double) * 4); - providedArgs = (bool*) malloc(sizeof(bool) * 3); - memset(providedArgs, 0, 3); - matrixOfRoi[0] = 0; - matrixOfRoi[1] = 0; - matrixOfRoi[2] = sourceImage.cols; - matrixOfRoi[3] = sourceImage.rows; - nbInputArguments = *getNbInputArgument(pvApiCtx); - - // The following loop is for checking if optional arguments have been provided - for(int iter=2; iter <= nbInputArguments; iter++) - { - // Getting address of next argument - sciErr = getVarAddressFromPosition(pvApiCtx, iter, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - // Extracting name of next argument takes three calls to getMatrixOfString - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - currentArg = pstData[0]; - // providedArgs[] makes sure that no optional argument is provided more than once - if(strcmp(currentArg, "MinQuality")==0) - { - if(iter+1<=nbInputArguments && !providedArgs[0]) - { - sciErr = getVarAddressFromPosition(pvApiCtx, ++iter, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr, &minQuality); - if(intErr) - { - return intErr; - } - // Checking if values are in proper range. Same for all optional arguments - if(minQuality < 0 || minQuality > 1) - { - Scierror(999, "Error: Please provide proper value for \"%s\". Permissible range is [0, 1].\n", currentArg); - return 0; - } - providedArgs[0] = 1; - } - else if(providedArgs[0]) // Send an error message if an argument is provided more than once. Same for all optional arguments. - { - Scierror(999, "Please provide optional arguments only once.\n"); - return 0; - } - else // Send an error message if name of argument is given but type is incorrect. Same for all optional arguments. - { - Scierror(999, "Incorrect number of arguments provided. Please check the documentation for more information.\n"); - return 0; - } - } - else if(strcmp(currentArg, "FilterSize")==0) - { - if(iter+1 <= nbInputArguments && !providedArgs[1]) - { - sciErr = getVarAddressFromPosition(pvApiCtx, ++iter, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr, &filterSize); - if(intErr) - { - return intErr; - } - providedArgs[1] = 1; - if(filterSize!=1 && filterSize!=3 && filterSize!=5 && filterSize!=7) - { - Scierror(999, "Error: Please provide proper value for \"%s\". Permissible values are {1, 3, 5, 7}.\n", currentArg); - return 0; - } - } - else if(providedArgs[1]) - { - Scierror(999, "Please provide optional arguments only once.\n"); - return 0; - } - else - { - Scierror(999, "Incorrect number of arguments provided. Please check the documentation for more information.\n"); - return 0; - } - } - else if(strcmp(currentArg, "ROI")==0) - { - if(iter+1 <= nbInputArguments && !providedArgs[2]) - { - sciErr = getVarAddressFromPosition(pvApiCtx, ++iter, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isDoubleType(pvApiCtx, piAddr) || isVarComplex(pvApiCtx, piAddr)) - { - Scierror(999, "%s: Wrong type for input argument #%d: A real matrix expected.\n", fname, iter); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &matrixOfRoi); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(iRows!=1 || iCols!=4) - { - Scierror(999, "Incorrect dimension of matrix for argument ROI.\n"); - return 0; - } - providedArgs[2] = 1; - if(matrixOfRoi[0] < 0 || matrixOfRoi[0] > sourceImage.cols || matrixOfRoi[1] < 0 || - matrixOfRoi[1] > sourceImage.cols || matrixOfRoi[2] < 0 || matrixOfRoi[0] + matrixOfRoi[2] > sourceImage.cols - || matrixOfRoi[3] < 0 || matrixOfRoi[1] + matrixOfRoi[3] > sourceImage.rows) - { - Scierror(999, "Error: Please provide proper values for \"%s\".\n", currentArg); - return 0; - } - } - else if(providedArgs[2]) - { - Scierror(999, "Please provide optional arguments only once.\n"); - return 0; - } - else - { - Scierror(999, "Incorrect number of arguments provided. Please check the documentation for more information.\n"); - return 0; - } - } - else - { - Scierror(999, "Error: \"%s\" name for input argument is not valid.\n", currentArg); - return 0; - } - } - try - { - //------Actual processing------// - cornerMinEigenVal(sourceImage(Rect(matrixOfRoi[0], matrixOfRoi[1], matrixOfRoi[2], matrixOfRoi[3])), dst, blockSize, filterSize, BORDER_DEFAULT); - - // Finding the maximum value at a pixel in dst - maxDst = 0; - for(int rowIter=0; rowIter < dst.rows; rowIter++) - { - for(int colIter=0; colIter < dst.cols; colIter++) - { - if(dst.at(rowIter, colIter) > maxDst) - { - maxDst = dst.at(rowIter, colIter); - } - } - } - - /* First, we threshold dst according to the minQuality expected by the user. - We then find contours in the thresholded image and check each pixel's value - to compute the local maxima. A extended mat is created because contours - having edges on the boundaries of the images are not considered by - findContours */ - threshold(dst, dstThresholded, maxDst*minQuality, 255, THRESH_BINARY); - dstThresholded.convertTo(ucharDstThresholded, CV_8UC1); - extended = Mat(dst.rows+2, dst.cols+2, CV_8UC1); - for(int rowIter = 0; rowIter < extended.rows; rowIter++) - { - for(int colIter = 0; colIter < extended.cols; colIter++) - { - if(rowIter == 0 || rowIter == extended.rows - 1 - || colIter == 0 || colIter == extended.cols - 1) - { - extended.at(rowIter, colIter) = 0; - } - else - { - extended.at(rowIter, colIter) = ucharDstThresholded.at(rowIter-1, colIter-1); - } - } - } - - findContours(extended, contours, CV_RETR_TREE, CV_CHAIN_APPROX_NONE); - pointCount = contours.size(); - location = (int*) malloc(sizeof(int) * pointCount * 2); - metric = (double*) malloc(sizeof(double)*pointCount); - for(int rowIter = 0; rowIter < contours.size(); rowIter++) - { - localMax = 0; - localMaxPos = 0; - for(int colIter=0; colIter(contours[rowIter][colIter].y-1, contours[rowIter][colIter].x-1)>localMax) - { - localMax = dst.at(contours[rowIter][colIter].y-1, contours[rowIter][colIter].x-1); - localMaxPos = colIter; - } - } - if(localMax > maxDst*minQuality) - { - location[rowIter] = contours[rowIter][localMaxPos].x-1 + matrixOfRoi[0]; - location[pointCount + rowIter] = contours[rowIter][localMaxPos].y-1 + matrixOfRoi[1]; - metric[rowIter] = dst.at(location[pointCount + rowIter], location[rowIter]); - } - } - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("\n%s\n",err); - - - } - // To return coordinates in order - for(int iter1 = 0; iter1 < pointCount - 1; iter1++) - { - coordinateMin = location[iter1]; - coordinatePos = iter1; - for(int iter2 = iter1 + 1; iter2 < pointCount; iter2++) - { - if(location[iter2] < coordinateMin) - { - coordinateMin = location[iter2]; - coordinatePos = iter2; - } - else if(location[iter2] == coordinateMin) - { - if(location[pointCount + iter2] < location[pointCount + coordinatePos]) - { - coordinateMin = location[iter2]; - coordinatePos = iter2; - } - } - } - // Swapping x coordinate - tempForSwapping = location[coordinatePos]; - location[coordinatePos] = location[iter1]; - location[iter1] = tempForSwapping; - // Swapping y coordinate - tempForSwapping = location[pointCount + coordinatePos]; - location[pointCount + coordinatePos] = location[pointCount + iter1]; - location[pointCount + iter1] = tempForSwapping; - // Swapping metric - tempForSwapping = metric[coordinatePos]; - metric[coordinatePos] = metric[iter1]; - metric[iter1] = tempForSwapping; - } - //------Create output arguments------// - sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx)+1, pointCount, 2, location); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx)+2, pointCount, 1, metric); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx)+3, 1, 1, &pointCount); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx)+2; - AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx)+3; - ReturnArguments(pvApiCtx); - return 0; - } -/* ==================================================================== */ -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_ellipse.cpp b/sci_gateway/cpp/opencv_ellipse.cpp deleted file mode 100644 index db9a284..0000000 --- a/sci_gateway/cpp/opencv_ellipse.cpp +++ /dev/null @@ -1,324 +0,0 @@ -/******************************************************** - Author: Sukul Bagai -********************************************************* - return_image = ellipse(input_image , x_coordinate_of_centre , y_coordinate_centre , first_axis, second_axis, angle, startAngle, endAngle, r_value,g_value,b_value,thickness,linetype,shift); -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_ellipse(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr=0; - int iRows=0,iCols=0; - int *piAddrNew = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piAddr5 = NULL; - int *piAddr6 = NULL; - int *piAddr7 = NULL; - int *piAddr8 = NULL; - int *piAddr9 = NULL; - int *piAddr10 = NULL; - int *piAddr11 = NULL; - int *piAddr12 = NULL; - int *piAddr13 = NULL; - int *piAddr14 = NULL; - int i,j,k; - double thickness=1 , linetype=8, shift=0 ,centre_x ,centre_y,first_axis,second_axis,angle,startAngle,endAngle,r_value,g_value,b_value; - - //checking input argument - CheckInputArgument(pvApiCtx, 11, 14); - CheckOutputArgument(pvApiCtx, 1, 1) ; - //get number of input arguments - int n=*getNbInputArgument(pvApiCtx); - Mat src; - retrieveImage(src,1); - - //for value of x coordinate of centre - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr2,¢re_x); - if(intErr) - return intErr; - - - //for value of y coordinate of centre - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr3,¢re_y); - if(intErr) - return intErr; - - //for value of first_axis - sciErr = getVarAddressFromPosition(pvApiCtx,4,&piAddr4); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr4,&first_axis); - if(intErr) - return intErr; - - //for value of second_axis - sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr5,&first_axis); - if(intErr) - return intErr; - - //for value of angle - sciErr = getVarAddressFromPosition(pvApiCtx,6,&piAddr6); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr6,&angle); - if(intErr) - return intErr; - - //for value of startAngle - sciErr = getVarAddressFromPosition(pvApiCtx,7,&piAddr7); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr7,&startAngle); - if(intErr) - return intErr; - - //for value of endAngle - sciErr = getVarAddressFromPosition(pvApiCtx,8,&piAddr8); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr8,&endAngle); - if(intErr) - return intErr; - - //for value of R value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,9,&piAddr9); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr9 ,&r_value); - if(intErr) - return intErr; - - //for value of G value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,10,&piAddr10); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr10 ,&g_value); - if(intErr) - return intErr; - - // for B value of colour - sciErr = getVarAddressFromPosition(pvApiCtx,11,&piAddr11); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr11,&b_value); - if(intErr) - return intErr; - if(n==12) - { - // for thickness of circle default: 1 - sciErr = getVarAddressFromPosition(pvApiCtx,12,&piAddr12); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr12,&thickness); - if(intErr) - return intErr; - } - else if(n==13) - { - sciErr = getVarAddressFromPosition(pvApiCtx,12,&piAddr12); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr12,&thickness); - if(intErr) - return intErr; - //for line type of circle default: 8 - - sciErr = getVarAddressFromPosition(pvApiCtx,13,&piAddr13); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - intErr = getScalarDouble(pvApiCtx, piAddr13,&linetype); - if(intErr) - return intErr; - } - else if(n==14) - { sciErr = getVarAddressFromPosition(pvApiCtx,12,&piAddr12); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr12,&thickness); - if(intErr) - return intErr; - //for line type of circle default: 8 - - sciErr = getVarAddressFromPosition(pvApiCtx,13,&piAddr13); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - intErr = getScalarDouble(pvApiCtx, piAddr13,&linetype); - if(intErr) - return intErr; - - // for shift in circle default : 0 - sciErr = getVarAddressFromPosition(pvApiCtx,14,&piAddr14); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr14,&shift); - if(intErr) - return intErr; - } - // checking radius parameter - if (first_axis < 0) - { - first_axis=3; - sciprint("first_axis should be positive , 3 value was used instead\n"); - } - if (second_axis < 0) - { - second_axis=3; - sciprint("second_axis should be positive , 3 value was used instead\n"); - } - if (first_axis < second_axis) - { - double temp; - temp=first_axis; - first_axis=second_axis; - second_axis=temp; - sciprint("first_axis should be greater than second_axis. Values swapped.\n"); - } - if(angle < 0 || angle > 360) - { - angle=45; - sciprint("Imvalid angle value used. Using 45 instead"); - } - if(startAngle < 0 || startAngle > 360) - { - startAngle=45; - sciprint("Imvalid startAngle value used. Using 120 instead"); - } - if(endAngle < 0 || endAngle > 360) - { - endAngle=45; - sciprint("Imvalid endAngle value used. Using 120 instead"); - } - // checking the parmeters for correct values - if( r_value <0 || r_value >255) - { - r_value=0; - sciprint(" r value of colour should be between 0 and 255 , using 0 instead\n"); - } - if( g_value <0 || g_value >255) - { - g_value=0; - sciprint(" g value of colour should be between 0 and 255 , using 0 instead\n"); - } - if( b_value <0 || b_value >255) - { - b_value=0; - sciprint(" b value of colour should be between 0 and 255 , using 0 instead\n"); - } - if ((linetype!=0) && (linetype!=4)&& (linetype!=8)) - { - linetype=8; - sciprint("Only 0/4/8 allowed , using 8 instead\n"); - } - //temporary pt variable, to use in function as centre - Point pt(centre_x,centre_y); - Size sz(first_axis,second_axis); - /// Draw the circles detected - try - { - ellipse( src, pt, sz, angle, startAngle, endAngle, Scalar(r_value,g_value,b_value), thickness, linetype, shift); - } - catch(cv::Exception& e) - { - - Scierror(999,e.what()); - - - - } -//// sending the image - string tempstring = type2str(src.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,src,1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - - } - -} - diff --git a/sci_gateway/cpp/opencv_erode.cpp b/sci_gateway/cpp/opencv_erode.cpp deleted file mode 100644 index 2876c3b..0000000 --- a/sci_gateway/cpp/opencv_erode.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_erode(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr = 0; - int iRows=0,iCols=0; - int *piLen = NULL; - int *piAddr = NULL; - int *piAddrNew = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piAddr5 = NULL; - char **type = NULL; - int i,j,k; - double anchorX,anchorY,iterations; - double *kernel; - - //checking input argument - CheckInputArgument(pvApiCtx, 5, 5); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - Mat image; - retrieveImage(image,1); - - //for kernel - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows, &iCols, &kernel); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - double actualkernel[iRows][iCols]; - for(i=0;i -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/calib3d/calib3d.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_estimateFundamentalMat(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr=0; - int iComplex = 0; - int iType = 0; - int *piAddr = NULL; - int *piLen = NULL; - int iRows,iCols; - int iA1Rows=0,iA1Cols=0,iA2Rows=0,iA2Cols=0; - int method=FM_RANSAC; - int nbInputArguments,iter,i,j; - char **pstData = NULL; - char *currentArg = NULL; - bool *providedArgs = NULL; - double* pdblReal = NULL; - double *iArray1=NULL,*iArray2=NULL; - double param1=3,param2=0.99; - - vector point1,point2; - - CheckInputArgument(pvApiCtx, 2, 8); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - nbInputArguments = *getNbInputArgument(pvApiCtx); - providedArgs = (bool*) malloc(sizeof(bool) * 3); - - - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getVarType(pvApiCtx, piAddr, &iType); - if(sciErr.iErr || iType != sci_matrix) - { - printError(&sciErr, 0); - return 0; - } - //Get complexity - iComplex = isVarComplex(pvApiCtx, piAddr); - //Check complexity - if(iComplex) - { - Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); - return 0; - } - - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iA1Rows, &iA1Cols, &iArray1); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getVarType(pvApiCtx, piAddr, &iType); - if(sciErr.iErr || iType != sci_matrix) - { - printError(&sciErr, 0); - return 0; - } - //Get complexity - iComplex = isVarComplex(pvApiCtx, piAddr); - //Check complexity - if(iComplex) - { - Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); - return 0; - } - - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iA2Rows, &iA2Cols, &iArray2); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(iA1Rows != iA2Rows) - { - Scierror(999, "There must be the same number of points in both input arrays\n"); - return 0; - } - - for(i=0;i(i,j); - } - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, fm.rows , 3, pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - ReturnArguments(pvApiCtx); - return 0; - } -} diff --git a/sci_gateway/cpp/opencv_exposure.cpp b/sci_gateway/cpp/opencv_exposure.cpp new file mode 100644 index 0000000..6d956b3 --- /dev/null +++ b/sci_gateway/cpp/opencv_exposure.cpp @@ -0,0 +1,148 @@ +/******************************************************** +Author: Manoj Sree Harsha +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/stitching/detail/exposure_compensate.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/core/utility.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_exposure(char *fname,unsigned long fname_len) + { + + // Error management variables + SciErr sciErr; + int intErr=0; + + //variable declarations + int *piaddrvar1=NULL; + int *piaddrvar2=NULL; + double index=0; + double choice=0; + int i,num; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 4, 8); + CheckOutputArgument(pvApiCtx, 1, 1); + + //number of input arguments + num=*getNbInputArgument(pvApiCtx); + + //for argument #1 + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piaddrvar1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isDoubleType(pvApiCtx, piaddrvar1)) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 1); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piaddrvar1,&choice); + if (intErr) + { + return intErr; + } + + //for argument #2 + sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piaddrvar2); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isDoubleType(pvApiCtx, piaddrvar2)) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname,2); + return 0; + } + intErr = getScalarDouble(pvApiCtx, piaddrvar2,&index); + if (intErr) + { + return intErr; + } + + //for images + vector images; + vector masks; + vector points; + for(i=3;i<=num;i++) + { + Mat image1; + retrieveImage(image1, i); + image1.convertTo(image1,CV_8U); + Mat mask1(image1.size(), CV_8U); + mask1(Rect(0, 0, mask1.cols, mask1.rows)).setTo(255); + UMat img1 = image1.getUMat( ACCESS_READ ); + UMat m1 = mask1.getUMat( ACCESS_READ ); + images.push_back(img1); + masks.push_back(m1); + points.push_back(Point(0,0)); + } + + //Application Code + try + { + if(choice==1) + { + Ptr compensator = detail::ExposureCompensator::createDefault(detail::ExposureCompensator::GAIN); + compensator->feed(points,images,masks); + compensator->apply(index-1,points[index-1],images[index-1],masks[index-1]); + } + else if(choice==2) + { + Ptr compensator = detail::ExposureCompensator::createDefault(detail::ExposureCompensator::GAIN_BLOCKS); + compensator->feed(points,images,masks); + compensator->apply(index-1,points[index-1],images[index-1],masks[index-1]); + } + else if(choice==3) + { + Ptr compensator = detail::ExposureCompensator::createDefault(detail::ExposureCompensator::NO); + compensator->feed(points,images,masks); + compensator->apply(index-1,points[index-1],images[index-1],masks[index-1]); + } + else + { + Scierror(999,("%s: Wrong value for input argument #%d: A value b/w [1,3] is expected.\n"), fname,2); + return 0; + } + + //returning final image for which exposure is compensated + Mat result=images[index-1].getMat(ACCESS_RW); + string tempstring = type2str(result.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,result,1); + free(checker); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s",err)); + } + + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +} diff --git a/sci_gateway/cpp/opencv_extractFeatures.cpp b/sci_gateway/cpp/opencv_extractFeatures.cpp deleted file mode 100644 index d47cf88..0000000 --- a/sci_gateway/cpp/opencv_extractFeatures.cpp +++ /dev/null @@ -1,1775 +0,0 @@ -#include -#include -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" - -using namespace cv; -using namespace std; -using namespace cv::xfeatures2d; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - /*string type2str(int type) - { - string r; - uchar depth = type & CV_MAT_DEPTH_MASK; - uchar chans = 1 + (type >> CV_CN_SHIFT); - switch ( depth ) - { - case CV_8U: r = "8U"; break; - case CV_8S: r = "8S"; break; - case CV_16U: r = "16U"; break; - case CV_16S: r = "16S"; break; - case CV_32S: r = "32S"; break; - case CV_32F: r = "32F"; break; - case CV_64F: r = "64F"; break; - default: r = "User"; break; - } - r += "C"; - r += (chans+'0'); - return r; - }*/ - - int opencv_extractFeatures(char *fname, unsigned long fname_len) - { - //...................................................................................................................................................................................... - //Declarations - // Error Handling - SciErr sciErr; - - // Address of Various Scilab API - int *piAddr1 = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - - // Number of input and output Arguments - int inputArguments = 0; - int out_params; - - // Matrix Reading Argument - int iPrec = 0; - int noItemInList = 0; - int iRows,iCols; - int Rows, Cols; - int *pilen = NULL; - char **arg = NULL; - char **method = NULL; - char **clas = NULL; - int length_M = 0; - - // Necessary Output Arguments - double *valid_points = NULL; - double numBits = 0; - double numFeatures = 0; - double *featureVector = NULL; - - // Count of various Arguments - int count_method=0, count_block=0, count_surf=0, count_upright=0 ,count_metric=0; - int count_orient=0, count_scale=0, count_axes=0, count_sign=0, count_class=0; - - // Iterator - int i; - - //Input Arguments Parameters - double *metric = NULL; - double *orient = NULL; - double *axes = NULL; - double *scale = NULL; - double *sign = NULL; - double block_size = 0; - double upright = 0; - double surf_size = 64; - - // Keypoint Vector - vector keypoints; - vector copy_k; - - //Image Container - Mat image; - - //Output Argument - int feature_rows, feature_cols; - int valid_rows; - double count; - double *metric_o = NULL; - double *scale_o = NULL; - double *orientation_o = NULL; - double *axes_o = NULL; - double *sign_o = NULL; - - - // Checks on Number of Input and Output Arguments - CheckInputArgument(pvApiCtx, 4, 22); - CheckOutputArgument(pvApiCtx, 2, 9); - - - inputArguments = *getNbInputArgument(pvApiCtx); - - //....................................................................................................................................................................................... - //Checking for the Presence of Valid Number of Arguments - if( inputArguments%2 == 0) - { - - //Argument 1 - Image - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(isListType(pvApiCtx, piAddr1)) - { - sciErr = getListItemNumber(pvApiCtx, piAddr1, &noItemInList); - if( noItemInList != 1) - { - Scierror(999,"Expecting a grayscale image as first Argument\n"); - return 0; - } - retrieveImage(image, 1); - } - else - { - if( !isDoubleType(pvApiCtx, piAddr1)) - { - Scierror(999,"Expecting a grayscale Image as first Argument\n"); - return 0; - } - retrieveImage(image, 1); - } - - - //.............................................................................................................................................................................. - //Argument 2 - Location Co-ordinates - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( !isVarMatrixType(pvApiCtx, piAddr2)) - { - Scierror(999,"Expecting a Matrix of Mx2 order depicting the Location Coordinates as 2nd Argument.\n"); - return 0; - } - //Checking the type of location coordinates - if(isDoubleType(pvApiCtx, piAddr2)) - { - //for double location co-ordinates - double *points = NULL; - sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows, &iCols, &points); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - length_M = iRows; - KeyPoint *X = new KeyPoint; - for(int i=0; ipt = Point2f(points[i],points[iRows+i]); - X->size = 7; - keypoints.push_back(*X); - copy_k.push_back(*X); - } - } - else if(isIntegerType(pvApiCtx, piAddr2)) - { - sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr2, &iPrec); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - switch(iPrec) - { - case SCI_UINT8: //for unsigned integer 8 location co-ordinates - { - unsigned char *points = NULL; - sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, piAddr2, &iRows, &iCols, &points); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - length_M = iRows; - KeyPoint *X = new KeyPoint; - for(int i=0; ipt = Point2f(points[i],points[iRows+i]); - X->size = 7; - keypoints.push_back(*X); - copy_k.push_back(*X); - } - break; - } - case SCI_UINT16: //for unsigned integer 16 location co-ordinates - { - unsigned short *points = NULL; - sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, piAddr2, &iRows, &iCols, &points); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - length_M = iRows; - KeyPoint *X = new KeyPoint; - for(int i=0; ipt = Point2f(points[i],points[iRows+i]); - X->size = 7; - keypoints.push_back(*X); - copy_k.push_back(*X); - } - break; - } - case SCI_INT32: - { - int *points = NULL; - sciErr = getMatrixOfInteger32(pvApiCtx, piAddr2, &iRows, &iCols, &points); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - length_M = iRows; - KeyPoint *X = new KeyPoint; - for(int i=0; ipt = Point2f(points[i],points[iRows+i]); - X->size = 7; - keypoints.push_back(*X); - copy_k.push_back(*X); - } - break; - } - } - } - else - { - Scierror(999,"Expecting a Double or an Integer Matrix as Location Coordinates in 2nd Argument.\n"); - return 0; - } - - - //............................................................................................................................................................................. - //Argument 3 - Class - sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isStringType(pvApiCtx, piAddr3)) - { - Scierror(999,"Expecting String Argument \"Class\" as Argument 3.\n"); - return 0; - } - //Matrix of Stings - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &Rows, &Cols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pilen = (int*)malloc(sizeof(int) * Rows * Cols); - //second call to retrieve the length of the string - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &Rows, &Cols, pilen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - return 0; - } - arg = (char**)malloc(sizeof(char*) * Rows * Cols); - for(int j=0;j< Rows * Cols; j++) - { - arg[j] = (char*)malloc(sizeof(char) * (pilen[j] + 1)); - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &Rows, &Cols, pilen, arg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - free(arg); - return 0; - } - - //Checking Whether Argument 3 is Method or not - if(strcmp(arg[0],"Class") == 0) - { - //If method extracting the Value of the Argument - if(count_class != 0) - { - Scierror(999,"Class Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isStringType(pvApiCtx, piAddr4)) - { - Scierror(999, "%s: Wrong type of 2nd argument #%d. A string is expected.\n", fname, 1); - return 0; - } - //Matrix of Stings - sciErr = getMatrixOfString(pvApiCtx, piAddr4, &Rows, &Cols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pilen = (int*)malloc(sizeof(int) * Rows * Cols); - //second call to retrieve the length of the string - sciErr = getMatrixOfString(pvApiCtx, piAddr4, &Rows, &Cols, pilen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - return 0; - } - clas = (char**)malloc(sizeof(char*) * Rows * Cols); - for(int j=0;j< Rows*Cols; j++) - { - clas[j] = (char*)malloc(sizeof(char) * (pilen[j] + 1)); - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr4, &Rows, &Cols, pilen, clas); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - free(clas); - return 0; - } - count_class += 1; - } - else - { - Scierror(999,"Expecting \"Class\" as the 3rd Argument\n"); - return 0; - } - } - else - { - Scierror(999,"Required Arguments are Missing\n"); - return 0; - } - - //.......................................................................................................................................................................................... - //Getting Optional Input Arguments - for( i=5; i<= inputArguments; i++) - { - - - - - - sciErr = getVarAddressFromPosition(pvApiCtx, i, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isStringType(pvApiCtx, piAddr3)) - { - Scierror(999, "%s: Wrong type of argument #%d. A string is expected.\n", fname, 1); - return 0; - } - //Matrix of Stings - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &Rows, &Cols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pilen = (int*)malloc(sizeof(int) * Rows * Cols); - //second call to retrieve the length of the string - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &Rows, &Cols, pilen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - return 0; - } - arg = (char**)malloc(sizeof(char*) * Rows * Cols); - for(int j=0;j< Rows * Cols; j++) - { - arg[j] = (char*)malloc(sizeof(char) * (pilen[j] + 1)); - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &Rows, &Cols, pilen, arg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - free(arg); - return 0; - } - - - - //................................................................................................................................................................................. - //Reading the Value of Optional Arguments - //If Optional Argument is Method - if(strcmp(arg[0],"Method") == 0) - { - if(count_method!= 0) - { - Scierror(999,"Method Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isStringType(pvApiCtx, piAddr4)) - { - Scierror(999, "%s: Wrong type of 2nd argument #%d. A string is expected.\n", fname, 1); - return 0; - } - //Matrix of Stings - sciErr = getMatrixOfString(pvApiCtx, piAddr4, &Rows, &Cols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pilen = (int*)malloc(sizeof(int) * Rows * Cols); - //second call to retrieve the length of the string - sciErr = getMatrixOfString(pvApiCtx, piAddr4, &Rows, &Cols, pilen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - return 0; - } - method = (char**)malloc(sizeof(char*) * Rows * Cols); - for(int j=0;j< Rows*Cols; j++) - { - method[j] = (char*)malloc(sizeof(char) * (pilen[j] + 1)); - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr4, &Rows, &Cols, pilen, method); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(pilen); - free(method); - return 0; - } - - i++; - - count_method += 1; - } - //................................................................................................................................................................................. - //If Optional Argument is Metric - else if(strcmp(arg[0],"Metric") == 0) - { - if(count_metric != 0) - { - Scierror(999,"Metric Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isVarMatrixType(pvApiCtx, piAddr4)) - { - Scierror(999,"Expecting a Matrix of Mx1 order depicting the Metric Values as Value of Metric Argument.\n"); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &iRows, &iCols, &metric); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( iCols != 1) - { - Scierror(999,"Expecting a single Column Metric Matrix\n"); - return 0; - } - if( iRows != length_M) - { - Scierror(999,"Expecting a M Row matrix having M number of elements corresponding to M rows of location coordinates\n"); - return 0; - } - i++; - count_metric += 1; - } - //................................................................................................................................................................................. - //If Optional Argument is BlockSize - else if(strcmp(arg[0],"blockSize") == 0) - { - if(count_block != 0) - { - Scierror(999,"BlockSize has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !(isDoubleType(pvApiCtx, piAddr4)) ) - { - Scierror(999,"BlockSize Value should be an odd Integer\n"); - return 0; - } - if(getScalarDouble(pvApiCtx, piAddr4, &block_size)) - { - Scierror(999,"Cannot Read Block Size Value"); - return 0; - } - if(int(block_size)%2 == 0) - { - Scierror(999,"Expecting a odd value for Block Size"); - return 0; - } - - i++; - count_block += 1; - } - //................................................................................................................................................................................. - //If Optional Argument is Upright - else if(strcmp(arg[0],"upright") == 0) - { - if(count_upright != 0) - { - Scierror(999,"Upright Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !(isDoubleType(pvApiCtx, piAddr4)) ) - { - Scierror(999,"Upright Value must be a logic scalar\n"); - return 0; - } - if(getScalarDouble(pvApiCtx, piAddr4, &upright)) - { - Scierror(999,"Cannot Read Upright Value\n"); - return 0; - } - i++; - count_upright += 1; - } - //................................................................................................................................................................................. - //If Optional Argument is SURFSize - else if(strcmp(arg[0],"surfSize") == 0) - { - - if(count_surf != 0) - { - Scierror(999,"SURFSize Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !(isDoubleType(pvApiCtx, piAddr4)) ) - { - Scierror(999,"Surf Size Value should be an Integer\n"); - return 0; - } - if(getScalarDouble(pvApiCtx, piAddr4, &surf_size)) - { - Scierror(999,"Cannot Read Surf Size Value"); - return 0; - } - if( int(surf_size) != 64 && int(surf_size) !=128 ) - { - Scierror(999,"Expecting value 64 or 128 for Surf Size\n"); - return 0; - } - - i++; - count_surf += 1; - } - //................................................................................................................................................................................. - //If Optional Argument is Orientation - else if(strcmp(arg[0],"Orientation") == 0) - { - if(count_orient != 0) - { - Scierror(999,"Orientation Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isVarMatrixType(pvApiCtx, piAddr4)) - { - Scierror(999,"Expecting a Matrix of Mx1 order depicting the Orientation Values as Value of Orientation Argument.\n"); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &iRows, &iCols, &orient); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( iCols != 1) - { - Scierror(999,"Expecting a single Column Orientation Matrix\n"); - return 0; - } - if( iRows != length_M) - { - Scierror(999,"Expecting a M Row matrix having M number of elements corresponding to M rows of location coordinates\n"); - return 0; - } - i++; - count_orient += 1; - } - //................................................................................................................................................................................. - //If Optional Argument is Axes - else if(strcmp(arg[0],"Axes") == 0) - { - if(count_axes != 0) - { - Scierror(999,"Axes Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isVarMatrixType(pvApiCtx, piAddr4)) - { - Scierror(999,"Expecting a Matrix of Mx2 order depicting the Axes as Value of Axes Argument.\n"); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &iRows, &iCols, &axes); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( iCols != 2) - { - Scierror(999,"Expecting a 2 Column Axes Matrix\n"); - return 0; - } - if( iRows != length_M) - { - Scierror(999,"Expecting a M Row matrix having M number of elements corresponding to M rows of location coordinates\n"); - return 0; - } - i++; - count_axes += 1; - } - //................................................................................................................................................................................ - //If Optional Argument is Scale - else if(strcmp(arg[0],"Scale") == 0) - { - if(count_scale != 0) - { - Scierror(999,"Scale Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isVarMatrixType(pvApiCtx, piAddr4)) - { - Scierror(999,"Expecting a Matrix of Mx1 order depicting the Scale as Value of Scale Argument.\n"); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &iRows, &iCols, &scale); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( iCols != 1) - { - Scierror(999,"Expecting a single Column Scale Matrix\n"); - return 0; - } - if( iRows != length_M) - { - Scierror(999,"Expecting a M Row matrix having M number of elements corresponding to M rows of location coordinates\n"); - return 0; - } - i++; - count_scale += 1; - } - //................................................................................................................................................................................ - //If Optional Argument is SignOfLaplacian - else if(strcmp(arg[0],"SignOfLaplacian") == 0) - { - - if(count_sign != 0) - { - Scierror(999,"SignOfLaplacian Argument has been called twice\n"); - return 0; - } - free(arg); - free(pilen); - - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - - if( !isVarMatrixType(pvApiCtx, piAddr4)) - { - Scierror(999,"Expecting a Matrix of Mx1 order depicting the Sign Of Laplacian as Value of SignOfLaplacian Argument.\n"); - return 0; - } - - sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &iRows, &iCols, &sign); - - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if( iCols != 1) - { - Scierror(999,"Expecting a single Column Axes Matrix\n"); - return 0; - } - - if( iRows != length_M) - { - Scierror(999,"Expecting a M Row matrix having M number of elements corresponding to M rows of location coordinates\n"); - return 0; - } - i++; - count_sign += 1; - - //Check for Validity of Laplacian Matrix - for(int i=0; i obj=FREAK::create( true, true, 22.0f, 4 ,std::vector< int >()); - image.convertTo(image,CV_8U); - obj->compute(image, keypoints, descriptor); - numBits = descriptor.size[1]; - numFeatures = descriptor.size[0]; - - valid_points = (double *)malloc(sizeof(double) * keypoints.size() * 2); - - for( int i=0; i(i,j)); - } - feature_rows = descriptor.size[0]; - feature_cols = descriptor.size[1]; - valid_rows = descriptor.size[0]; - count = descriptor.size[0]; - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("\n%s\n",err); - } - if( strcmp(clas[0],"cornerPoints") == 0) - { - try - { - metric_o = (double*)malloc(sizeof(double) * valid_rows); - int iterator = 0; - for(int i=0; i obj; - if( int(upright) == 1) - { - if( int(surf_size) == 64) - obj = SURF::create(100, 4, 3, 0, 1); - else if ( int(surf_size) == 128) - obj = SURF::create(100, 4, 3, 1, 1); - } - else if( int(upright) == 0) - { - if( int(surf_size) == 64) - obj = SURF::create(100, 4, 3, 0, 0); - else if ( int(surf_size) == 128) - obj = SURF::create(100, 4, 3, 1, 0); - } - - image.convertTo(image,CV_8U); - obj->compute(image, keypoints, descriptor); - - numBits = descriptor.size[1]; - numFeatures = descriptor.size[0]; - - valid_points = (double *)malloc(sizeof(double) * keypoints.size() * 2); - - for( int i=0; i(i,j)); - } - feature_rows = descriptor.size[0]; - feature_cols = descriptor.size[1]; - valid_rows = descriptor.size[0]; - count = descriptor.size[0]; - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("\n%s\n",err); - - - } - if( strcmp(clas[0],"cornerPoints") == 0) - { - metric_o = (double*)malloc(sizeof(double) * valid_rows); - int iterator = 0; - for(int i=0; i(i,j)); - } - feature_rows = descriptor.size[0]; - feature_cols = descriptor.size[1]; - valid_rows = descriptor.size[0]; - count = descriptor.size[0]; - - if( strcmp(clas[0],"cornerPoints") == 0) - { - metric_o = (double*)malloc(sizeof(double) * valid_rows); - int iterator = 0; - for(int i=0; i valid; - for( i=0; i image.cols || keypoints[i].pt.y + (block_size-1)/2 > image.rows) - continue; - valid.push_back(keypoints[i]); - } - valid_points = (double *)malloc(sizeof(double)*valid.size()*2); - featureVector = (double *)malloc(sizeof(double)*valid.size()*int(block_size)*int(block_size)); - for( int i=0; i(j,k); - iterator = iterator+1; - } - } - feature_rows = valid.size(); - feature_cols = int(block_size)*int(block_size); - valid_rows = valid.size(); - numFeatures = valid.size(); - numBits = int(block_size)*int(block_size); - count = valid.size(); - - if( strcmp(clas[0],"cornerPoints") == 0) - { - metric_o = (double*)malloc(sizeof(double) * valid_rows); - int iterator = 0; - for(int i=0; i -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include -#include -using namespace cv; -using namespace std; - extern "C" - { - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "../common.h" - int opencv_fitellipse(char *fname, unsigned long fname_len) - { - // Error management variable - SciErr sciErr; - //variable info - int iRows = 0; - int iCols = 0; - int piRows = 0; - int piCols = 0; - int* piAddr = NULL; - int* piAddr2 = NULL; - int* piAddr3 = NULL; - int* piAddr4 = NULL; - int* piAddr5 = NULL; - int* piAddr6 = NULL; - int* piAddrNew = NULL; - int* piLen = NULL; - double* pstData = NULL; - int* pstData2 = NULL; - double *rrows; - double *rcols; - double sigmaSpace; - int error; - vector contours; - ////checking input argument - CheckInputArgument(pvApiCtx,1,1); - //checking output argument - CheckOutputArgument(pvApiCtx,5,5); - //for first argument - // get Address of first input - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - //check for any error - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrieve input array - //SciErr getMatrixOfDouble(void* _pvCtx, int* _piAddress, int* _piRows, int* _piCols, double** _pdblReal) - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols,&pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - int k=0; - - //The input array can be N*2 or 2*N - int temp=max(iCols,iRows); - contours.resize(temp); - for(int i=0;i +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/stitching/detail/blenders.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace cv; +using namespace cv::detail; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_focals(char *fname,unsigned long fname_len) + { + // Error management variables + SciErr sciErr; + int intErr = 0; + + //variable declarations + int i,k,j,num; + double scale = 1; + double *result=NULL; + float conf_thresh = 1.f; + float match_conf = 0.3f; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx,2,6); + CheckOutputArgument(pvApiCtx,1,1); + + //number of input arguments + num=*getNbInputArgument(pvApiCtx); + + //Application Code + try + { + + //PHASE-1 REGISTRATION + //Feature matching + vector full_img_sizes(num); + vector images(num); + vector imagescopy(num); + + Ptr finder; + finder = makePtr(); + + vector features(num); + Mat image1,img; + for(i=0;icollectGarbage(); + image1.release(); + img.release(); + vector pairwise_matches; + BestOf2NearestMatcher matcher(false, match_conf); + matcher(features, pairwise_matches); + matcher.collectGarbage(); + vector indices = leaveBiggestComponent(features, pairwise_matches, conf_thresh); + vector img_subset; + vector full_img_sizes_subset; + for (i = 0; i < indices.size(); ++i) + { + img_subset.push_back(images[indices[i]]); + full_img_sizes_subset.push_back(full_img_sizes[indices[i]]); + } + images = img_subset; + full_img_sizes = full_img_sizes_subset; + + //PHASE-2 CALIBRARION + //Estimating Camera Parameters + HomographyBasedEstimator estimator; + vector cameras; + if (!estimator(features, pairwise_matches, cameras)) + { + sciprint("Homography estimation failed.\n"); + return 0; + } + for (i = 0; i < cameras.size(); ++i) + { + Mat R; + cameras[i].R.convertTo(R, CV_32F); + cameras[i].R = R; + } + Ptr adjuster; + adjuster = makePtr(); + adjuster->setConfThresh(conf_thresh); + if (!(*adjuster)(features, pairwise_matches, cameras)) + { + sciprint("Camera parameters adjusting failed.\n"); + return 0; + } + result=(double*)malloc(sizeof(double)*1*num); + for(i=0;i -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/ml.hpp" -#include "opencv2/opencv.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; -using namespace cv::ml; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - int opencv_getParamsSVM(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - - //------Local variables------// - int upright = 1; - Ptr matcher = DescriptorMatcher::create("FlannBased"); - Ptr detector = SURF::create(400, 4, 2, 1, int(upright)); - Ptr extractor=detector; - Ptr bowDE=makePtr(extractor,matcher); - //SurfFeatureDetector detector(1, 4, 2, 1, int(upright)); - // char *classifierLocation = NULL; - Mat dictionary,features; - double response; - vector keyPoints; - int dictionarySize; - int *piAddr = NULL; - int *piChild = NULL; - int iRows, iCols; - char **pstData = NULL; - int *piLen = NULL; - char **classifierDescription = NULL; - int classifierDescriptionCount; - char *bagOfFeaturesLocation = NULL; - int descriptionCount; - double C=0,gamma=1,coef=0,degree=0,P=0,Nu=0,kernelType=2,setType=100; - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 1, 1); - CheckOutputArgument(pvApiCtx, 1, 1); - - //------Get input arguments------// - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - - // Extracting object type and checking if type is classifier - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"classifier")==0)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for classifier argument."); - return 0; - } - string classifierLocation = string(pstData[0]); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for bagOfFeatures argument."); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - classifierDescription = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - classifierDescription[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, classifierDescription); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciprint("getting the parameters of trained SVM Model...\n"); -//------Actual processing------// - try{ - Ptr svm = Algorithm::load(classifierLocation); - if(!svm->isTrained()) - { - Scierror(999,"\nthe given model is not trained!,please try again!\n"); - return 0; - - } - C=svm->getC(); - degree=svm->getDegree(); - gamma=svm->getGamma(); - kernelType=svm->getKernelType(); - Nu=svm->getNu(); - P=svm->getP(); - setType=svm->getType(); - - sciprint("\ndone"); - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("%s",err); - - } - //------Create output arguments------// - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 1, 1, 1, &C); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 2, 1, 1, &coef); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 3, 1, 1, °ree); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 4, 1, 1, &gamma); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 5, 1, 1, &kernelType); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 6, 1, 1, &Nu); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 7, 1, 1, &P); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 8, 1, 1, &setType); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - ReturnArguments(pvApiCtx); - return 0; - } - /* ==================================================================== */ -} - diff --git a/sci_gateway/cpp/opencv_getParamsSVMSGD.cpp b/sci_gateway/cpp/opencv_getParamsSVMSGD.cpp deleted file mode 100644 index 34cf794..0000000 --- a/sci_gateway/cpp/opencv_getParamsSVMSGD.cpp +++ /dev/null @@ -1,275 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/ml.hpp" -#include "opencv2/opencv.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; -using namespace cv::ml; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - int opencv_getParamsSVMSGD(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - - //------Local variables------// - int upright = 1; - Ptr matcher = DescriptorMatcher::create("FlannBased"); - Ptr detector = SURF::create(400, 4, 2, 1, int(upright)); - Ptr extractor=detector; - Ptr bowDE=makePtr(extractor,matcher); - //SurfFeatureDetector detector(1, 4, 2, 1, int(upright)); - // char *classifierLocation = NULL; - Mat dictionary,features; - double response; - vector keyPoints; - int dictionarySize; - int *piAddr = NULL; - int *piChild = NULL; - int iRows, iCols; - char **pstData = NULL; - int *piLen = NULL; - char **classifierDescription = NULL; - int classifierDescriptionCount; - char *bagOfFeaturesLocation = NULL; - int descriptionCount; - double initStepSize=0.1,marginreg=0,optimalParam=0,stepDecreasingPower=0.1;//all model paramenter set to their default values - double marginType=0,svmsgdsgdType=0; - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 1, 1); - CheckOutputArgument(pvApiCtx, 1, 1); - - //------Get input arguments------// - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - - // Extracting object type and checking if type is classifier - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"classifier")==0)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for classifier argument."); - return 0; - } - string classifierLocation = string(pstData[0]); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for bagOfFeatures argument."); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - classifierDescription = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - classifierDescription[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, classifierDescription); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciprint("getting the parameters of trained SVMSGD Model...\n"); -//------Actual processing------// - try{ - Ptr svmsgd = Algorithm::load(classifierLocation); - if(!svmsgd->isTrained()) - { - Scierror(999,"\nthe given model is not trained!,please try again!\n"); - return 0; - - } - initStepSize=svmsgd->getInitialStepSize(); - marginreg=svmsgd->getMarginRegularization(); - stepDecreasingPower=svmsgd->getStepDecreasingPower(); - svmsgdsgdType=svmsgd->getSvmsgdType(); - marginType=svmsgd->getMarginType(); - - sciprint("\ndone\n"); - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("%s",err); - - } - //------Create output arguments------// - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 6, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 1, 1, 1, &initStepSize); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 2, 1, 1, &marginreg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 3, 1, 1, &stepDecreasingPower); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 4, 1, 1, &svmsgdsgdType); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 5, 1, 1, &marginType); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - ReturnArguments(pvApiCtx); - return 0; - } - /* ==================================================================== */ -} - diff --git a/sci_gateway/cpp/opencv_graycoprops.cpp b/sci_gateway/cpp/opencv_graycoprops.cpp deleted file mode 100644 index cf6daa4..0000000 --- a/sci_gateway/cpp/opencv_graycoprops.cpp +++ /dev/null @@ -1,674 +0,0 @@ -/* Author: Nihar rao & Samiran Roy - -/* Usage of the function is exactly similar to matlab function */ -/* - * graycoprops - * - * graycoprops in scilab - * Please refer to : - * http://www.cse.unsw.edu.au/~icml2002/workshops/MLCV02/MLCV02-Bevk.pdf, p.3. - */ - -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" { -#include "api_scilab.h" -#include "Scierror.h" -#include "BOOL.h" -#include -#include "sciprint.h" -#include "../common.h" - -double return_contrast(Mat image) - -{ - double contrast = 0; - - for (int i = 0; i < image.rows; i++) { - for (int j = 0; j < image.cols; j++) { - contrast = contrast + (pow((i - j), 2) * image.at(i, j)); - } - } - return contrast; -} - -double return_correlation(Mat image) - -{ - double correlation = 0; - - std::vector mg_rows; - std::vector mg_cols; - - // Meshgrid of row and column indices - for (int i = 0; i < image.rows; i++) { - for (int j = 0; j < image.cols; j++) { - mg_rows.push_back(j); - mg_cols.push_back(i); - } - } - - // for (int i=0; i(i); - - for (int i = 0; i < mg_cols.size(); i++) - mean_col = mean_col + mg_cols[i] * flat_image.at(i); - - for (int i = 0; i < mg_rows.size(); i++) - std_row = - std_row + (pow(mg_rows[i] - mean_row, 2) * flat_image.at(i)); - - std_row = sqrt(std_row); - - for (int i = 0; i < mg_cols.size(); i++) - std_col = - std_col + (pow(mg_cols[i] - mean_col, 2) * flat_image.at(i)); - - std_col = sqrt(std_col); - - for (int i = 0; i < mg_rows.size(); i++) - correlation = - correlation + ((mg_rows[i] - mean_row) * (mg_cols[i] - mean_col) * - flat_image.at(i)); - - double denom = std_col * std_row; - if (denom != 0) { - correlation = correlation / denom; - } - - // sciprint("\n"); - - // sciprint("MR: %f",mean_row); - // sciprint("MC: %f",mean_col); - - // sciprint("SR: %f",std_row); - // sciprint("SC: %f",std_col); - return correlation; -} - -double return_energy(Mat image) - -{ - double energy = 0; - - for (int i = 0; i < image.rows; i++) { - for (int j = 0; j < image.cols; j++) { - energy = energy + pow(image.at(i, j), 2); - } - } - return energy; -} - -double return_homogeneity(Mat image) - -{ - double homogeneity = 0; - - for (int i = 0; i < image.rows; i++) { - for (int j = 0; j < image.cols; j++) { - homogeneity = homogeneity + (image.at(i, j) / (1 + abs(i - j))); - } - } - return homogeneity; -} - -int opencv_graycoprops(char *fname, unsigned long fname_len) { - SciErr sciErr; - int intErr = 0; - - int *piAddr1 = NULL; - int *piLen = NULL; - int i,j; - int argPresence[4]={0}; - - int error; - int iRows,iCols; - // String holding the second argument - int iRet = 0; - char **pstData = NULL; - vector rgb; - double s; - - // Checking input argument - CheckInputArgument(pvApiCtx, 1, 2); - CheckOutputArgument(pvApiCtx, 1, 4); - - //get number of input arguments - int n=*getNbInputArgument(pvApiCtx); - // Get input image - Mat image; - retrieveImage(image, 1); - - // converting image to float - - image.convertTo(image, CV_64FC1, 1, 0); - //if only one input argument - if(n==1) - { - if (image.channels() == 1) { - // Normalizing image - - double s = cv::sum(image)[0]; - image = image / s; - - - double contrast = return_contrast(image); - intErr = - createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, contrast); - if (intErr) return intErr; - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - // Returning the Output Variables as arguments to the Scilab environment - - - - - - double correlation = return_correlation(image); - - intErr = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, - correlation); - if (intErr) return intErr; - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; - // Returning the Output Variables as arguments to the Scilab environment - - - double energy = return_energy(image); - - intErr = - createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 3, energy); - if (intErr) return intErr; - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3; - - - double homogeneity = return_homogeneity(image); - - intErr = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 4, - homogeneity); - if (intErr) return intErr; - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4; - // Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - } - - else if (image.channels() == 3) { - - - split(image, rgb); - - double *contrast = (double *)malloc(sizeof(double) * 3); - - - for (int i = 0; i < 3; i++) { - s = cv::sum(rgb[i])[0]; - rgb[i] = rgb[i] / s; - contrast[2-i] = return_contrast(rgb[i]); - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx)+1, 1, 3, - contrast); - - free(contrast); - - if (sciErr.iErr) { - printError(&sciErr, 0); - return 0; - } - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - // Returning the Output Variables as arguments to the Scilab environment - - - - split(image, rgb); - - double *correlation = (double *)malloc(sizeof(double) * 3); - - - for (int i = 0; i < 3; i++) { - s = cv::sum(rgb[i])[0]; - rgb[i] = rgb[i] / s; - correlation[2-i] = return_correlation(rgb[i]); - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx)+2, 1, 3, - correlation); - - free(correlation); - - if (sciErr.iErr) { - printError(&sciErr, 0); - return 0; - } - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx)+2; - // Returning the Output Variables as arguments to the Scilab environment - - - - - split(image, rgb); - - double *energy = (double *)malloc(sizeof(double) * 3); - - - for (int i = 0; i < 3; i++) { - s = cv::sum(rgb[i])[0]; - rgb[i] = rgb[i] / s; - energy[2-i] = return_energy(rgb[i]); - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx)+3, 1, 3, - energy); - - free(energy); - - if (sciErr.iErr) { - printError(&sciErr, 0); - return 0; - } - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx)+3; - - - - split(image, rgb); - - double *homogeneity = (double *)malloc(sizeof(double) * 3); - - for (int i = 0; i < 3; i++) { - s = cv::sum(rgb[i])[0]; - rgb[i] = rgb[i] / s; - homogeneity[2-i] = return_homogeneity(rgb[i]); - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx)+4, 1, 3, - homogeneity); - - free(homogeneity); - - if (sciErr.iErr) { - printError(&sciErr, 0); - return 0; - } - - // Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx)+4; - // Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - - } else { - sciprint("Invalid number of channels in the image(must be 1 or 3)\n"); - return 0; - } - - - - } - - //2 input arguments - - else - { - - if (image.channels() == 1) { - // Normalizing image - - s = cv::sum(image)[0]; - image = image / s; - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr1); - - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - sciErr = getMatrixOfString(pvApiCtx, piAddr1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pstData= (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - { - pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr1, &iRows, &iCols, piLen,pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //iterate througt the matrix - - for(j=0;j +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "sciprint.h" + #include "BOOL.h" + #include + #include "../common.h" + + int opencv_imattributes(char *fname, unsigned long fname_len) + { + + //Checking number of input arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 1, 1); + + // to get the argument #1 + Mat image; + retrieveImage(image,1); + + //Application Code + try + { + int row = image.rows; + int column = image.cols; + int type = image.type(); + string r; + uchar depth = type & CV_MAT_DEPTH_MASK; + uchar chans = 1 + (type >> CV_CN_SHIFT); + switch ( depth ) + { + case CV_8U: r = "8U"; break; + case CV_8S: r = "8S"; break; + case CV_16U: r = "16U"; break; + case CV_16S: r = "16S"; break; + case CV_32S: r = "32S"; break; + case CV_32F: r = "32F"; break; + case CV_64F: r = "64F"; break; + default: r = "User"; break; + } + r += "C"; + r += (chans+'0'); + int flag_binary=1; + for(int i =0; i(i,j)!=0 || image.at(i,j)!=255) + { + flag_binary=0; + break; + } + } + if (flag_binary==0) + break; + } + string image_type; + if (flag_binary==1) + image_type = "Binary"; + else if (chans==1) + image_type= "Intensity"; + else if (chans==3) + image_type= "Truecolor"; + char image_type1[100]; + strcpy(image_type1, image_type.c_str()); + char image_class[100]; + strcpy(image_class, r.c_str()); + sciprint("Width (columns) \t%d\n",column); + sciprint("Height (rows) \t%d\n",row); + sciprint("Class \t%s\n",image_class); + sciprint("Image Type \t%s\n",image_type1); + if(flag_binary!=1 && chans==1) + { + int min_intensity=255,max_intensity=0; + for(int i=0; i(i,j)(i,j); + if (image.at(i,j)>max_intensity) + max_intensity=image.at(i,j); + } + } + sciprint("Min intensity \t%d\n",min_intensity); + sciprint("Max intensity \t%d\n",max_intensity); + } + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + return 0; + } +/* ==================================================================== */ +} diff --git a/sci_gateway/cpp/opencv_imfindcircles.cpp~ b/sci_gateway/cpp/opencv_imfindcircles.cpp~ deleted file mode 100644 index 7201e7d..0000000 --- a/sci_gateway/cpp/opencv_imfindcircles.cpp~ +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************** -Function :imfindcircles -Syntax :B=imfindcircles(A) -Author: Tess Zacharias - -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - int opencv_imfindcircles(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr = 0; - int *piAddrNew = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - Mat src_gray,image; - double Rmin,Rmax; - //checking input argument - CheckInputArgument(pvApiCtx, 1, 1); - CheckOutputArgument(pvApiCtx, 1, 2) ; - sciprint("here1"); - retrieveImage(image, 1); -// sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); -// if (sciErr.iErr) -// { -// printError(&sciErr, 0); -// return 0; -// } -// intErr = getScalarDouble(pvApiCtx, piAddr2, &Rmin); -// if(intErr) -// { -// return intErr; -// } -// if(Rmin!= round(Rmin) || Rmin<=0) -// { -// sciprint("The value of minium Radius must be an integer\n"); -// return 0; -// } -// if(Rmin<5) -// { -// sciprint("The value of minium Radius too small\n"); -// return 0; -// } -// sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); -// if (sciErr.iErr) -// { -// printError(&sciErr, 0); -// return 0; -// } -// intErr = getScalarDouble(pvApiCtx, piAddr3, &Rmax); -// if(intErr) -// { -// return intErr; -// } -// if(Rmax!= round(Rmax) || Rmax<=0) -// { -// sciprint("The value of maximum Radius must be an integer\n"); -// return 0; -// } - sciprint("here2"); - cvtColor(image,src_gray,CV_BGR2GRAY); - GaussianBlur( src_gray, src_gray, Size(9, 9), 2, 2 ); - vector circles; - HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100,0,0); - sciprint("here3"); - int k=circles.size(); - if (k==0) - {sciprint("zero");} - else if (k==1) - {sciprint("one");} - else if (k==2) - {sciprint("two");} - else if (k==3) - {sciprint("three");} - else - {sciprint(">3");} - double *radius=NULL; - radius=( double *)malloc(sizeof(double)*k); - double *c1=NULL; - c1=( double *)malloc(sizeof(double)*k); - double *c2=NULL; - c2=( double *)malloc(sizeof(double)*k); - sciprint("here4"); - for( size_t i= 0; i < circles.size(); i++ ) - { - c1[i]=cvRound(circles[i][0]); - cout< -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - #include "../common.cpp" - - bool file_exists_check( char *name) { - struct stat buffer; - return (stat (name, &buffer) == 0); - } - -int opencv_imread(char *fname, unsigned long fname_len) -{ - - SciErr sciErr; - int iLen = 0; - //variable info - int iRows = 0; - int iCols = 0; - int piRows = 0; - int piCols = 0; - int *piAddr = NULL; - int *piLen = NULL; - char **pstData = NULL; - int **pstData1 = NULL; - int i,j,k=0; - int intErr; - double val; - Mat img; - - - //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) - CheckInputArgument(pvApiCtx, 1, 2); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - //get number of input arguments - int n=*getNbInputArgument(pvApiCtx); - - // get Address of inputs - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls - //first call to retrieve dimensions - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve length of each string - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - for(i = 0 ; i < iRows * iCols ; i++) - { - pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination - } - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //read 2nd argument if user has passed 2 arguments - if(n==2) - { - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr ,&val); - if(intErr) - { - Scierror(999,"Error: there was an error while reading the second argument \n"); - return 0; - - } - } - int d=(int)val; - - if(!file_exists_check(pstData[0])) - { - - Scierror(999, "Error: the input image not found!.Please enter correct path!\n"); - return 0; - } - - - - try{ - - - - if(n==2) - { - switch(d) - { - - case -1: - img = imread(pstData[0],CV_LOAD_IMAGE_UNCHANGED); - break; - case 0: - img = imread(pstData[0],CV_LOAD_IMAGE_GRAYSCALE); - break; - case 1: - img = imread(pstData[0],CV_LOAD_IMAGE_COLOR); - break; - case 2: - img = imread(pstData[0],2); - break; - case 4: - img = imread(pstData[0],4); - break; - case 8: - img = imread(pstData[0],8); - break; - case 16: - img = imread(pstData[0],16); - break; - case 17: - img = imread(pstData[0],16); - break; - case 32: - img = imread(pstData[0],32); - break; - case 33: - img = imread(pstData[0],33); - break; - case 64: - img = imread(pstData[0],64); - break; - case 65: - img = imread(pstData[0],65); - break; - case 128: - img = imread(pstData[0],128); - break; - - } - - } - //one argument - else - { - - img = imread(pstData[0],CV_LOAD_IMAGE_UNCHANGED); - } - } - catch(cv::Exception& e) - { - - const char* err=e.what(); - Scierror(999,err); - - } - - - //wrong argument check - if(n==2 && img.empty()) - { - Scierror(999,"Error: the second argument is invalid or the image path is wrong!! \n"); - return 0; - - - } - - - - string tempstring = type2str(img.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,img,1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; -} -/* ==================================================================== */ -} diff --git a/sci_gateway/cpp/opencv_imresize.cpp b/sci_gateway/cpp/opencv_imresize.cpp deleted file mode 100644 index 190ab5e..0000000 --- a/sci_gateway/cpp/opencv_imresize.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************** -Author: Sukul Bagai -********************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - int opencv_imresize(char *fname, unsigned long fname_len) - { - SciErr sciErr; - int intErr = 0; - int iRows=0,iCols=0; - int *piAddr = NULL; - int *piAddrNew = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int i,j,k; - double alpha, beta; - - //checking input argument - CheckInputArgument(pvApiCtx, 3, 3); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - Mat image; - retrieveImage(image, 1); - - //for new no. of rows - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr2, &alpha); - if(sciErr.iErr) - { - return intErr; - } - - //for new no. of columns - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr3, &beta); - if(sciErr.iErr) - { - return intErr; - } - - - Mat new_image; - Size size(alpha, beta); - - if(alpha<=0 || beta<=0) - { - sciprint("Invalid new size\n"); - return 0; - } - //resizes the image to new_image to the size given by the user - resize(image,new_image,size); - - int temp = nbInputArgument(pvApiCtx) + 1; - string tempstring = type2str(new_image.type()); - char *checker; - checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,new_image,1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - } -/* ==================================================================== */ -} diff --git a/sci_gateway/cpp/opencv_imrotate.cpp~ b/sci_gateway/cpp/opencv_imrotate.cpp~ deleted file mode 100644 index a2b0e54..0000000 --- a/sci_gateway/cpp/opencv_imrotate.cpp~ +++ /dev/null @@ -1,81 +0,0 @@ -/* ==================================================================== */ -/* Author :Priyanka Hiranandani NIT Surat */ -/* ==================================================================== */ -/* Syntax : rotated_image=imrotate(sourcrimage,angle); */ -/* ==================================================================== */ -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include -using namespace cv; -using namespace std; - extern "C" - { - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "../common.h" - int imrotate(char *fname, unsigned long fname_len) - { - // Error management variable - SciErr sciErr; - //variable info - int iRows = 0; - int iCols = 0; - int piRows = 0; - int piCols = 0; - int* piAddr = NULL; - int* piAddr2 = NULL; - int* piAddr3 = NULL; - int* piAddrNew = NULL; - int* piLen = NULL; - double pstData; - int* pstData2 = NULL; - double *rrows; - double *rcols; - int error; - //function to check number of input variable - CheckInputArgument(pvApiCtx, 2, 2); - //function to check number of output variable - CheckOutputArgument(pvApiCtx, 1, 1); - // get Address of first input - Mat img; - retrieveImage(img,1); - //second argument - //fetching address of second argument - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - //checking for error if any - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //this function will fetch second argument i.e angle - error=getScalarDouble(pvApiCtx,piAddr2,&pstData); - if(error!=0) - { - sciprint("error in retrieving second argument"); - } - //creating distination matrix - Mat dst; - //following set of functions for image rotation - Point2f pt((img.cols)/2., (img.rows)/2.); - Mat r1 = getRotationMatrix2D(pt, pstData, 1.0); - warpAffine(img, dst, r1, Size(dst.cols, dst.rows)); - //Since we need to pass a single pointer as an arguement, for a 2-D matrix, we define it in this manner - string tempstring = type2str(dst.type()); - char* checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,dst,1); - //returning output arguments - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - ReturnArguments(pvApiCtx); - return 0; - - - - } -} diff --git a/sci_gateway/cpp/opencv_indexImages.cpp b/sci_gateway/cpp/opencv_indexImages.cpp deleted file mode 100644 index 28ce9b7..0000000 --- a/sci_gateway/cpp/opencv_indexImages.cpp +++ /dev/null @@ -1,669 +0,0 @@ -/**************************************************************************************** -* Author: Umang Agrawal * -* Code: indexImages.cpp * -* Function Call: indexImage = indexImages( Image_Set, Bag, Optional Arguments) * -* Optional Argument: Name Value * -* Verbose Bool(1 or 0) * -* SaveFeatureLocations Bool(1 or 0) * -****************************************************************************************/ -#include -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - bool response(const KeyPoint& p1, const KeyPoint& p2) { - return p1.response > p2.response; - } - - int opencv_indexImages(char *fname, unsigned long fname_len) - { - SciErr sciErr; - - int *piAddr = NULL; - int *piAddr1 = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piChild = NULL; - int *piGrandChild = NULL; - int iRows, iCols; - int *piLen = NULL; - char **pstData = NULL; - char *objectType = "invertedImageIndex"; - char **description = NULL; - char ***location = NULL; - int *count = NULL; - int descriptionCount; - char **arg = NULL; - char **filePath = NULL; - - int inp_params = 0; - char *bagOfFeaturesLocation = NULL; - double *upright_bag = NULL; - double *strength_bag = NULL; - double *vocab_size_bag = NULL; - int count_ver = 0, count_save = 0; - double save = 1; - double verbose = 1; - int upright = 1; - int vocab_size = 500; - double strength = 0.8; - - vector key_size_vector; - double *wordFrequency = NULL; - double ***ImageWords = NULL; - int indx; - - Mat image; - Mat dictionary; - Mat featuresUnclustered; - Mat feature_des; - Mat des_matched; - Mat hist; - vector keypoints; - vector valid_key; - vector< vector > clusterID; - int key_size; - int v_key_size; - - CheckInputArgument(pvApiCtx, 1, 6); //Check on Number of Input Arguments - CheckOutputArgument(pvApiCtx, 1, 1); //Check on Number of Output Arguments - - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr1)) - { - Scierror(999, "Error: Invalid first argument. List Expected.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr1, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr1, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr1, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"imageSet")==0)) - { - Scierror(999, "Error: The input argument 1 is not of type imageSet.\n"); - return 0; - } - - // Extracting Description attribute of input argument - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr1, 2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( iRows!= 1 ) - { - Scierror(999,"Expecting an image Set with single type of Images.\n"); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr1, 2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - description = (char**)malloc(sizeof(char*) * iRows * iCols); - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - description[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr1, 2, &iRows, &iCols, piLen, description); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - descriptionCount = iRows; - - // Extracting Count attribute of input argument - sciErr = getMatrixOfInteger32InList(pvApiCtx, piAddr1, 3, &iRows, &iCols, &count); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( iRows!= 1 ) - { - Scierror(999,"Expecting an image Set with single type of Images.\n"); - return 0; - } - location = (char***) malloc(sizeof(char**) * descriptionCount); - sciErr = getListItemAddress(pvApiCtx, piAddr1, 4, &piChild); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - for(int iter = 1; iter<=descriptionCount; iter++) - { - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - location[iter-1] = (char**)malloc(sizeof(char*) * iRows * iCols); - for(int colIter = 0 ; colIter < iRows * iCols ; colIter++) - { - location[iter-1][colIter] = (char*)malloc(sizeof(char) * (piLen[colIter] + 1));//+ 1 for null termination - } - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, piLen, location[iter-1]); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - -//.............................................................................................................. - inp_params = *getNbInputArgument(pvApiCtx); - if( inp_params>=2 ) - { - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr2)) - { - Scierror(999, "Error: Invalid first argument. List Expected.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr2, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr2, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr2, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!(strcmp(pstData[0],"bagOfFeatures")==0)) - { - Scierror(999, "Error: The input argument 2 is not of type bagOfFeatures.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr2, 2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr2, 2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr2, 2, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr2, 3, &iRows, &iCols, &vocab_size_bag); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr2, 4, &iRows, &iCols, &strength_bag); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr2, 5, &iRows, &iCols, &upright_bag); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - upright = int(upright_bag[0]); - vocab_size = int(vocab_size_bag[0]); - strength = strength_bag[0]; - FileStorage fs(bagOfFeaturesLocation, FileStorage::READ); - fs["dictionary"] >> dictionary; - fs.release(); - -//................................................................................................................ - for( int i=3; i<=inp_params; i++) - { - if( inp_params%2 != 0) - { - Scierror(999,"Either Argument Name or its Value missing\n"); - return 0; - } - sciErr = getVarAddressFromPosition(pvApiCtx, i, &piAddr3); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //Check for Argument type - if( !isStringType(pvApiCtx, piAddr3)) - { - Scierror(999, "%s: Wrong type of argument for Name of Optional Argument. A string is expected.\n", fname); - return 0; - } - //Matrix of Stings - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - //second call to retrieve the length of the string - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(piLen); - return 0; - } - arg = (char**)malloc(sizeof(char*) * iRows * iCols); - for(int j=0;j< iRows * iCols; j++) - { - arg[j] = (char*)malloc(sizeof(char) * (piLen[j] + 1)); - } - - //third call to retrieve data - sciErr = getMatrixOfString(pvApiCtx, piAddr3, &iRows, &iCols, piLen, arg); - if(sciErr.iErr) - { - printError(&sciErr, 0); - free(piLen); - free(arg); - return 0; - } - - if(strcmp(arg[0],"Verbose") == 0) - { - if( count_ver != 0) - { - Scierror(999,"Verbose has been called twice.\n"); - return 0; - } - free(arg); - free(piLen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( !(isDoubleType(pvApiCtx, piAddr4)||isIntegerType(pvApiCtx, piAddr4))) - { - Scierror(999,"Not a valid type of value for Verbose.\n"); - return 0; - } - //Reading the Value of the argument - if(getScalarDouble(pvApiCtx, piAddr4, &verbose)) - { - Scierror(999,"Not a valid type of value for Verbose.\n"); - return 0; - } - if( !(verbose == 1|| verbose == 0) ) - { - Scierror(999,"Enter a valid value for Verbose (Either 0 or 1)\n"); - return 0; - } - i++; - count_ver += 1; - } - else if(strcmp(arg[0],"SaveFeatureLocations") == 0) - { - if( count_save != 0) - { - Scierror(999,"SaveFeatureLoactions has been called twice.\n"); - return 0; - } - free(arg); - free(piLen); - sciErr = getVarAddressFromPosition(pvApiCtx, i+1, &piAddr4); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if( !(isDoubleType(pvApiCtx, piAddr4)||isIntegerType(pvApiCtx, piAddr4))) - { - Scierror(999,"Not a valid type of value for SaveFeatureLoactions.\n"); - return 0; - } - //Reading the Value of the argument - if(getScalarDouble(pvApiCtx, piAddr4, &save)) - { - Scierror(999,"Not a valid type of value for SaveFeatureLoactions.\n"); - return 0; - } - if( !(save == 1|| save == 0) ) - { - Scierror(999,"Enter a valid value for SaveFeatureLoactions (Either 0 or 1)\n"); - return 0; - } - i++; - count_save += 1; - } - else - { - Scierror(999,"Invalid Argument Name\n"); - return 0; - } - } - } - - if(int(verbose)) - { - sciprint("Creating an Inverted image Index Using Bag-Of-Features.\n"); - sciprint("--------------------------------------------------------\n"); - } - - if( inp_params == 1) - { - bagOfFeaturesLocation = "Bag-Of-Features.yml"; - Ptr detector = SURF::create( 400, 4, 2, 1, int(upright) ); - Ptr extractor = SURF::create(400, 4, 2, 1, int(upright)); - - if(int(verbose)) - { - sciprint("Creating Bag-Of-Features from %d image sets.\n\n",descriptionCount); - for(int i=0; idetect(image, keypoints); - sort(keypoints.begin(), keypoints.end(), response); - for( int k=0; k<(keypoints.size()*strength); k++) - { - valid_key.push_back(keypoints[k]); - } - extractor->compute(image, valid_key, feature_des); - featuresUnclustered.push_back(feature_des); - key_size += keypoints.size(); - v_key_size += valid_key.size(); - } - if(int(verbose)) - { - sciprint("done. Extracted %d features.\n",key_size); - sciprint("Keeping %f percent of the strongest features.\n",(strength)*100); - sciprint("Net Extracted features : %d\n\n",v_key_size); - } - } - - vocab_size = featuresUnclustered.rows; - TermCriteria tc(CV_TERMCRIT_ITER, 100, 0.001); - int retries = 3; - BOWKMeansTrainer bowTrainer(int(vocab_size), tc, retries, KMEANS_PP_CENTERS); - - if(int(verbose)) - { - sciprint("Using K-Means Clustering to create a %d word visual vocabulary.\n",int(vocab_size)); - sciprint("Number of Features : %d\n",featuresUnclustered.rows); - sciprint("Number of Clusters : %d\n\n",int(vocab_size)); - } - - dictionary = bowTrainer.cluster(featuresUnclustered); - - if(int(verbose)) - sciprint("Finished creating Bag-Of-Features\n"); - - FileStorage fs(bagOfFeaturesLocation, FileStorage::WRITE); - fs<<"dictionary"< detector = SURF::create( 400, 4, 2, 1, int(upright) ); - Ptr extractor = SURF::create(400, 4, 2, 1, int(upright)); - for( int i=0; idetect(image, keypoints); - extractor->compute(image, keypoints,feature_des); - - key_size_vector.push_back(keypoints.size()); - ImageWords[i] = (double**)malloc(sizeof(double*)*4*1); - ImageWords[i][0] = (double*)malloc(sizeof(double)*keypoints.size()*1); - ImageWords[i][1] = (double*)malloc(sizeof(double)*keypoints.size()*2); - ImageWords[i][2] = (double*)malloc(sizeof(double)*1); - ImageWords[i][3] = (double*)malloc(sizeof(double)*1); - - ImageWords[i][2][0] = vocab_size; - ImageWords[i][3][0] = keypoints.size(); - - for( int j=0; j -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" { -#include "api_scilab.h" -#include "Scierror.h" -#include "BOOL.h" -#include -#include "sciprint.h" -#include "../common.h" - -int opencv_integralImage(char *fname, unsigned long fname_len) { - SciErr sciErr; - int intErr = 0; - - - int *piAddr1 = NULL; - - int error; - -// String holding the second argument - int iRet = 0; - char* pstData = NULL; - -// Checking input argument - CheckInputArgument(pvApiCtx, 1, 2); - CheckOutputArgument(pvApiCtx, 1, 1); - -// Get input image - - Mat image; - retrieveImage(image, 1); - - - - for (int i = 0; i < image.rows; i++) { - for (int j = 0; j < image.cols; j++) { - sciprint("%f ", image.at(i,j)); - - } - - sciprint("\n"); - } - -// Error Checks - - if (image.channels() > 1) { - sciprint("The image must be grayscale."); - return 0; - } - -// Output variables holding integralImage, squared integralImage, integralImage over rectangle rotated by 45 degrees - Mat new_image, integralimage, squaredimage, rotatedimage; - - integral(image, integralimage, squaredimage, rotatedimage, -1); - -// Get the number of input arguments - int inputarg = *getNbInputArgument(pvApiCtx); - - if (inputarg == 1) - integralimage.copyTo(new_image); - - if (inputarg == 2) - - { - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr1); - - if (sciErr.iErr) { - printError(&sciErr, 0); - return 0; - } - - if (isStringType(pvApiCtx, piAddr1)) { - if (isScalar(pvApiCtx, piAddr1)) { - - iRet = getAllocatedSingleString(pvApiCtx, piAddr1, &pstData); - } - } - if (strcmp(pstData, "rotated") == 0) { - rotatedimage.copyTo(new_image); - } else if (strcmp(pstData, "upright") == 0) { - integralimage.copyTo(new_image); - } else { - sciprint("Unknown Parameter Name:%s\n", pstData); - - } - - } - - // sciprint("\n"); - - // for (int i = 0; i < new_image.rows; i++) { - // for (int j = 0; j < new_image.cols; j++) { - // sciprint("%f ", new_image.at(i,j)); - - // } - - // sciprint("\n"); - // } - - // new_image is sent to scilab as output - - int temp = nbInputArgument(pvApiCtx) + 1; - string tempstring = type2str(new_image.type()); - char *checker; - checker = (char *) malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker, new_image, 1); - free(checker); - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments (pvApiCtx); - return 0; - -} -/* ==================================================================== */ -} - diff --git a/sci_gateway/cpp/opencv_lab2double.cpp b/sci_gateway/cpp/opencv_lab2double.cpp deleted file mode 100644 index 1597d04..0000000 --- a/sci_gateway/cpp/opencv_lab2double.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/*-------------------------------------- - function-lab2double - Author :Tess Zacharias -------------------------------------- */ -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include -#include -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "../common.h" - #define REF_X .95047; // Observer= 2°, Illuminant= D65 - #define REF_Y 1.00000; - #define REF_Z 1.08883; - int opencv_lab2double(char *fname, unsigned long fname_len) - { - SciErr sciErr; - int iRows = 0; - int iCols = 0; - int* piAddr=NULL; - int* piAddr1=NULL; - int* piAddr3=NULL; - int i,j; - int error; - float L,a,b; - int *piAddrNew = NULL; - CheckOutputArgument(pvApiCtx,1,1); - int k=0; - double *pstDataR = NULL; - double *pstDataG = NULL; - double *pstDataB = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999,"the input should be a list \n"); - return 0; - - - - } - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 2, &iRows, &iCols, &pstDataG); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 3, &iRows, &iCols, &pstDataB); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - int m=0; - double *r1,*g1,*b1; - r1=(double *)malloc(sizeof(double)*iRows*iCols); - g1=(double *)malloc(sizeof(double)*iRows*iCols); - b1=(double *)malloc(sizeof(double)*iRows*iCols); - for(int i=0;i -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include "opencv2/calib3d/calib3d.hpp" -#include -#include -using namespace cv; -using namespace std; -extern "C" -{ - - - - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - - int opencv_matMulDeriv(char *fname, unsigned long fname_len) - { - - SciErr sciErr; - int intErr = 0; - int iRows1=0,iCols1=0;//for matrix1 array - int iRows2=0,iCols2=0;//for matrix2 array - int *piAddrNew = NULL; - int *piAddr1 = NULL; - int *piAddr2 = NULL; - double *matrix1,*matrix2; - int i,j; - - CheckInputArgument(pvApiCtx, 2, 2); - CheckOutputArgument(pvApiCtx, 2, 2); - - int n=*getNbInputArgument(pvApiCtx);//get number of input arguments - -//for matrix1 - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr1); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows1, &iCols1, &matrix1); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - - - Mat A(iRows1,iCols1,CV_64F,&matrix1);//get Mat - - - //for matrix2 - sciErr = getVarAddressFromPosition(pvApiCtx,2,&piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows2, &iCols2, &matrix2); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - - Mat B(iRows2,iCols2,CV_64F,&matrix2);//get Mat - - - //final call - Mat C,D; - - sciprint("yama"); - try{ - cv::matMulDeriv(A,B,C,D); - } - catch(cv::Exception& e) - { - sciprint("%s",e.what()); - - - } - - - - - //return the Mat to scilab memory - - double *partial1;//[iRows1*iCols2][iRows1*iCols1]; - partial1=(double*)malloc(sizeof(double)*iRows1*iCols2*iRows1*iCols1); - for(i=0;i(i,j)); - - double *partial2;//[iRows1*iCols2][iRows2*iCols2]; - partial2=(double*)malloc(sizeof(double)*iRows1*iCols2*iRows2*iCols2); - for(i=0;i(i,j));; - - //Creating Output Arguments - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1*iCols2, iRows1*iCols1, partial1); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows1*iCols2, iRows2*iCols2, partial2); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - - - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2; - ReturnArguments(pvApiCtx); - return 0; - - - - - - -} - - - - - - -} diff --git a/sci_gateway/cpp/opencv_match.cpp b/sci_gateway/cpp/opencv_match.cpp new file mode 100644 index 0000000..76267cc --- /dev/null +++ b/sci_gateway/cpp/opencv_match.cpp @@ -0,0 +1,83 @@ +/******************************************************** +Author: Manoj Sree Harsha +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/imgcodecs.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/features2d/features2d.hpp" +#include "opencv2/stitching/detail/matchers.hpp" +#include "opencv2/xfeatures2d.hpp" +#include + +using namespace cv; +using namespace std; +using namespace cv::xfeatures2d; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_match(char *fname, unsigned long fname_len) + { + + // Error management variables + SciErr sciErr; + + //variable declarations + int *piAddr1 = NULL; + int *piAddr2 = NULL; + double *result=NULL; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 2, 2); + CheckOutputArgument(pvApiCtx, 1, 1); + + Mat image1; + retrieveImage(image1, 1); + Mat image2; + retrieveImage(image2, 2); + + //Application Code + try + { + Ptr surf = SURF::create(5000); + vector keypoints1, keypoints2; + Mat descriptors1, descriptors2; + Mat img1,img2; + image1.convertTo(img1,CV_8U); + image2.convertTo(img2,CV_8U); + surf->detectAndCompute(img1, Mat(), keypoints1, descriptors1); + surf->detectAndCompute(img2, Mat(), keypoints2, descriptors2); + BFMatcher matcher(surf->defaultNorm()); + cv::detail::MatchesInfo m1; + matcher.match(descriptors1, descriptors2, m1.matches); + Mat img_matches; + drawMatches(img1, keypoints1, img2, keypoints2,m1.matches, img_matches); + string tempstring = type2str(img_matches.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker, img_matches, 1); + free(checker); + + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + } + catch(Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s",err)); + } + + } +} diff --git a/sci_gateway/cpp/opencv_opticalflow.cpp b/sci_gateway/cpp/opencv_opticalflow.cpp new file mode 100644 index 0000000..be1eb1c --- /dev/null +++ b/sci_gateway/cpp/opencv_opticalflow.cpp @@ -0,0 +1,149 @@ +/******************************************************** +Author: Avinash Reddy , Manoj Sree Harsha +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/video/tracking.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include "opencv2/videoio/videoio.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + +int opencv_opticalflow(char *fname, unsigned long fname_len) +{ + + //Error management variables + SciErr sciErr; + + //variable info + int intErr = 0; + int iLen = 0; + int iRows = 0; + int iCols = 0; + int piRows = 0; + int piCols = 0; + int *piAddr = NULL; + int *piLen = NULL; + char **pstData = NULL; + int **pstData1 = NULL; + int i,j,k = 0; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 1, 1); + CheckOutputArgument(pvApiCtx, 1, 1); + + //get Address of inputs + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + //Now, we will retrieve the string from the input parameter. For this, we will require 3 calls + //first call to retrieve dimensions + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, NULL, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + piLen = (int*)malloc(sizeof(int) * iRows * iCols); + //second call to retrieve length of each string + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, NULL); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + pstData = (char**)malloc(sizeof(char*) * iRows * iCols); + for(i = 0 ; i < iRows * iCols ; i++) + { + pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1)); + } + //third call to retrieve data + sciErr = getMatrixOfString(pvApiCtx, piAddr, &iRows, &iCols, piLen, pstData); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + try + { + string filename=pstData[0]; + VideoCapture cap(filename); + if( !cap.isOpened() ) + { + return 0; + } + Mat flow,frame; + UMat flowUmat, prevgray; + VideoWriter video("out.avi",CV_FOURCC('M','J','P','G'),10,Size(640,480),true); + for (;;) + { + bool Is = cap.grab(); + if (Is == false) + { + cout << "Video Capture Fail" << endl; + break; + } + else + { + Mat img; + Mat original; + cap.retrieve(img, CV_CAP_OPENNI_BGR_IMAGE); + resize(img, img, Size(640, 480)); + img.copyTo(original); + cvtColor(img, img, COLOR_BGR2GRAY); + if (prevgray.empty() == false ) + { + // calculate optical flow + calcOpticalFlowFarneback(prevgray, img, flowUmat, 0.4, 1, 12, 2, 8, 1.2, 0); + // copy Umat container to standard Mat + flowUmat.copyTo(flow); + // By y += 5, x += 5 you can specify the grid + for (int y = 0; y < original.rows; y += 5) + { + for (int x = 0; x < original.cols; x += 5) + { + const Point2f flowatxy = flow.at(y, x) * 10; + line(original, Point(x, y), Point(cvRound(x + flowatxy.x), cvRound(y + flowatxy.y)), Scalar(0,255,0));// draw initial point + circle(original, Point(x, y), 1, Scalar(0, 0, 0), -1); + } + } + //writing video + video.write(original); + img.copyTo(prevgray); + } + + // fill previous image in case prevgray.empty() == true + else + { + img.copyTo(prevgray); + } + } + + } + cap.release(); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s",err)); + } + return 0; + } +} + diff --git a/sci_gateway/cpp/opencv_panorama.cpp b/sci_gateway/cpp/opencv_panorama.cpp new file mode 100644 index 0000000..9abeb44 --- /dev/null +++ b/sci_gateway/cpp/opencv_panorama.cpp @@ -0,0 +1,297 @@ +/******************************************************** +Author: Avinash Reddy , Manoj Sree Harsha , Ebey Abraham +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/stitching/detail/blenders.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +using namespace cv; +using namespace cv::detail; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + +int opencv_panorama(char *fname,unsigned long fname_len) +{ + + // Error management variables + SciErr sciErr; + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx, 2, 6); + CheckOutputArgument(pvApiCtx, 1, 1); + + //variable declarations + int num,i; + double scale = 1; + bool do_wave_correct = true; + int expos_comp_type = ExposureCompensator::GAIN_BLOCKS; + string seam_find_type = "gc_color"; + float blend_strength = 5; + float match_conf = 0.3f; + float conf_thresh = 1.f; + WaveCorrectKind wave_correct_type = WAVE_CORRECT_HORIZ; + int blend_type = Blender::MULTI_BAND; + + //number of input arguments + num=*getNbInputArgument(pvApiCtx); + + //Application Code + try + { + + //PHASE-1 REGISTRATION + //Feature matching + vector full_img_sizes(num); + vector images(num); + vector imagescopy(num); + + Ptr finder; + finder = makePtr(); + + vector features(num); + Mat image1,img; + for(i=0;icollectGarbage(); + image1.release(); + img.release(); + + + vector pairwise_matches; + BestOf2NearestMatcher matcher(false, match_conf); + matcher(features, pairwise_matches); + matcher.collectGarbage(); + + vector indices = leaveBiggestComponent(features, pairwise_matches, conf_thresh); + + vector img_subset; + + vector full_img_sizes_subset; + for (i = 0; i < indices.size(); ++i) + { + + img_subset.push_back(images[indices[i]]); + full_img_sizes_subset.push_back(full_img_sizes[indices[i]]); + } + + images = img_subset; + full_img_sizes = full_img_sizes_subset; + + //PHASE-2 CALIBRARION + //Estimating Camera Parameters + HomographyBasedEstimator estimator; + vector cameras; + + if (!estimator(features, pairwise_matches, cameras)){ + Scierror(999,("Homography estimation failed.\n")); + return 0; + } + + for (i = 0; i < cameras.size(); ++i) + { + Mat R; + cameras[i].R.convertTo(R, CV_32F); + cameras[i].R = R; + + } + + Ptr adjuster; + adjuster = makePtr(); + + adjuster->setConfThresh(conf_thresh); + if (!(*adjuster)(features, pairwise_matches, cameras)) { + Scierror(1000,("Camera parameters adjusting failed.\n")); + return 0; + } + + + vector focals; + for ( i = 0; i < cameras.size(); ++i) + { + focals.push_back(cameras[i].focal); + } + + sort(focals.begin(), focals.end()); + float warped_image_scale; + if (focals.size() % 2 == 1){ + warped_image_scale = static_cast(focals[focals.size() /2]); + } + else{ + warped_image_scale = static_cast(focals[focals.size() /2 - 1] + focals[focals.size() / 2]) * 0.5f; + } + + + if (do_wave_correct) + { + vector rmats; + for (size_t i = 0; i < cameras.size(); ++i) + rmats.push_back(cameras[i].R.clone()); + waveCorrect(rmats, wave_correct_type); + for (size_t i = 0; i < cameras.size(); ++i) + cameras[i].R = rmats[i]; + } + + //PHASE-3 COMPOSITION + //Warping + vector corners(num); + vector masks_warped(num); + vector images_warped(num); + vector sizes(num); + vector masks(num); + + for ( i = 0; i < num; ++i) + { + masks[i].create(images[i].size(), CV_8U); + masks[i].setTo(Scalar::all(255)); + } + + Ptr warper_creator; + warper_creator = makePtr(); + if (!warper_creator){ + Scierror(1001,("Can't create the following warper")); return 0; + } + + Ptr warper = warper_creator->create(static_cast(warped_image_scale * scale)); + for (i = 0; i < num; ++i) + { + Mat_ K; + cameras[i].K().convertTo(K, CV_32F); + float swa = (float)scale; + K(0,0) *= swa; K(0,2) *= swa; + K(1,1) *= swa; K(1,2) *= swa; + corners[i] = warper->warp(images[i], K, cameras[i].R, INTER_LINEAR, BORDER_REFLECT, images_warped[i]); + sizes[i] = images_warped[i].size(); + warper->warp(masks[i], K, cameras[i].R, INTER_NEAREST, BORDER_CONSTANT, masks_warped[i]); + } + + vector images_warped_f(num); + for (i = 0; i < num; ++i) + images_warped[i].convertTo(images_warped_f[i], CV_32F); + + //Exposure Compensation + Ptr compensator = ExposureCompensator::createDefault(expos_comp_type); + compensator->feed(corners, images_warped, masks_warped); + + //Seam Finding + Ptr seam_finder; + seam_finder = makePtr(GraphCutSeamFinderBase::COST_COLOR); + + seam_finder->find(images_warped_f, corners, masks_warped); + + + images_warped.clear(); + images_warped_f.clear(); + masks.clear(); + + //Blending + Ptr blender = Blender::createDefault(blend_type, false); + Size dst_sz = resultRoi(corners, sizes).size(); + float blend_width = sqrt(static_cast(dst_sz.area())) *blend_strength / 100.f; + + if (blend_width < 1.f){ + blender = Blender::createDefault(Blender::NO, false); + } + + else{ + MultiBandBlender* mb = dynamic_cast(blender.get()); + mb->setNumBands(static_cast(ceil(log(blend_width)/log(2.)) - 1.)); + } + + blender->prepare(corners, sizes); + + Mat img_warped, img_warped_s,full_img; + Mat dilated_mask, seam_mask, mask, mask_warped; + + for (int img_idx = 0; img_idx < num; ++img_idx) + { + // Read image and resize it if necessary + full_img = imagescopy[img_idx]; + if (abs(scale - 1) > 1e-1) + resize(full_img, img, Size(), scale, scale); + else + img = full_img; + full_img.release(); + Size img_size = img.size(); + Mat K; + cameras[img_idx].K().convertTo(K, CV_32F); + // Warp the current image + + warper->warp(img, K, cameras[img_idx].R, INTER_LINEAR, BORDER_REFLECT,img_warped); + + // Warp the current image mask + mask.create(img_size, CV_8U); + mask.setTo(Scalar::all(255)); + warper->warp(mask, K, cameras[img_idx].R, INTER_NEAREST,BORDER_CONSTANT, mask_warped); + // Compensate exposure error step + compensator->apply(img_idx, corners[img_idx], img_warped, mask_warped); + img_warped.convertTo(img_warped_s, CV_16S); + img_warped.release(); + img.release(); + mask.release(); + dilate(masks_warped[img_idx], dilated_mask, Mat()); + resize(dilated_mask, seam_mask, mask_warped.size()); + mask_warped = seam_mask & mask_warped; + // Blending images step + blender->feed(img_warped_s, mask_warped, corners[img_idx]); + } + + Mat result, result_mask; + blender->blend(result, result_mask); + + + //returning panoramic Image + string tempstring = type2str(result.type()); + char *checker; + checker = (char *)malloc(tempstring.size() + 1); + memcpy(checker, tempstring.c_str(), tempstring.size() + 1); + returnImage(checker,result,1); + free(checker); + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s",err)); + } + + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + + } +} diff --git a/sci_gateway/cpp/opencv_predictSVM.cpp b/sci_gateway/cpp/opencv_predictSVM.cpp deleted file mode 100644 index 1a76076..0000000 --- a/sci_gateway/cpp/opencv_predictSVM.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/ml.hpp" -#include "opencv2/opencv.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; -using namespace cv::ml; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - inline bool file_exists_check(const std::string& name) { - struct stat buffer; - return (stat (name.c_str(), &buffer) == 0); - } - int opencv_predictSVM(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - - //------Local variables------// - int upright = 1; - Ptr matcher = DescriptorMatcher::create("FlannBased"); - Ptr detector = SURF::create(400, 4, 2, 1, int(upright)); - Ptr extractor=detector; - Ptr bowDE=makePtr(extractor,matcher); - //SurfFeatureDetector detector(1, 4, 2, 1, int(upright)); - // char *classifierLocation = NULL; - Mat dictionary,features; - double response; - vector keyPoints; - int dictionarySize; - int *piAddr = NULL; - int *piChild = NULL; - int iRows, iCols; - char **pstData = NULL; - int *piLen = NULL; - char **classifierDescription = NULL; - int classifierDescriptionCount; - char *bagOfFeaturesLocation = NULL; - int descriptionCount; - Mat input; - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 2, 2); - CheckOutputArgument(pvApiCtx, 1, 1); - - //------Get input arguments------// - retrieveImage(input,2); - //cvtColor(input, input, cv::COLOR_RGBA2GRAY); - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - - // Extracting object type and checking if type is classifier - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"classifier")==0)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for classifier argument."); - return 0; - } - string classifierLocation = string(pstData[0]); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for bagOfFeatures argument."); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - classifierDescription = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - classifierDescription[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, classifierDescription); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //------Actual processing------// - FileStorage fs(bagOfFeaturesLocation, FileStorage::READ); - fs["dictionary"] >> dictionary; - fs.release(); - try{ - - input.convertTo(input,CV_8U); - dictionarySize = dictionary.rows; - - bowDE->setVocabulary(dictionary); - if(!file_exists_check(classifierLocation)) - { - - Scierror(999, "Error: the input File not found!.Please enter correct path!\n"); - return 0; - - } - Ptr svm = Algorithm::load(classifierLocation); - if(!svm->isTrained()) - { - Scierror(999, "Error: the model is not trained!.\n"); - return 0; - - - - - } - detector->detect(input, keyPoints); - bowDE->compute(input, keyPoints, features); - features.convertTo(features,CV_32F); - response = svm->predict(features); - sciprint("\ndone"); - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("%s",err); - - } - //------Create output arguments------// - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1,piAddr,1,1,1,&classifierDescription[(int)response]); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - ReturnArguments(pvApiCtx); - return 0; - } - /* ==================================================================== */ -} diff --git a/sci_gateway/cpp/opencv_predictSVMSGD.cpp b/sci_gateway/cpp/opencv_predictSVMSGD.cpp deleted file mode 100644 index 77ad6e7..0000000 --- a/sci_gateway/cpp/opencv_predictSVMSGD.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/ml.hpp" -#include "opencv2/opencv.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; -using namespace cv::ml; - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - #include "../common.h" - - inline bool file_exists_check(const std::string& name) { - struct stat buffer; - return (stat (name.c_str(), &buffer) == 0); - } - int opencv_predictSVMSGD(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - - //------Local variables------// - int upright = 1; - Ptr matcher = DescriptorMatcher::create("FlannBased"); - Ptr detector = SURF::create(400, 4, 2, 1, int(upright)); - Ptr extractor=detector; - Ptr bowDE=makePtr(extractor,matcher); - //SurfFeatureDetector detector(1, 4, 2, 1, int(upright)); - // char *classifierLocation = NULL; - Mat dictionary,features; - double response; - vector keyPoints; - int dictionarySize; - int *piAddr = NULL; - int *piChild = NULL; - int iRows, iCols; - char **pstData = NULL; - int *piLen = NULL; - char **classifierDescription = NULL; - int classifierDescriptionCount; - char *bagOfFeaturesLocation = NULL; - int descriptionCount; - Mat input; - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 2, 2); - CheckOutputArgument(pvApiCtx, 1, 1); - - //------Get input arguments------// - retrieveImage(input,2); - //cvtColor(input, input, cv::COLOR_RGBA2GRAY); - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - - // Extracting object type and checking if type is classifier - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"classifier")==0)) - { - Scierror(999, "Error: The input argument #1 is not of type classifier.\n"); - return 0; - } - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for classifier argument."); - return 0; - } - string classifierLocation = string(pstData[0]); - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 3, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for bagOfFeatures argument."); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - classifierDescription = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - classifierDescription[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 4, &iRows, &iCols, piLen, classifierDescription); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //------Actual processing------// - FileStorage fs(bagOfFeaturesLocation, FileStorage::READ); - fs["dictionary"] >> dictionary; - fs.release(); - try{ - - input.convertTo(input,CV_8U); - dictionarySize = dictionary.rows; - - bowDE->setVocabulary(dictionary); - if(!file_exists_check(classifierLocation)) - { - - Scierror(999, "Error: the input File not found!.Please enter correct path!\n"); - return 0; - - } - - Ptr svmsgd = Algorithm::load(classifierLocation); - if(!svmsgd->isTrained()) - { - Scierror(999, "Error: the model is not trained!.\n"); - return 0; - - } - detector->detect(input, keyPoints); - bowDE->compute(input, keyPoints, features); - features.convertTo(features,CV_32F); - response = svmsgd->predict(features); - sciprint("\ndone"); - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("%s",err); - - } - //------Create output arguments------// - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1,piAddr,1,1,1,&classifierDescription[(int)response]); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - ReturnArguments(pvApiCtx); - return 0; - } - /* ==================================================================== */ -} - diff --git a/sci_gateway/cpp/opencv_radius.cpp b/sci_gateway/cpp/opencv_radius.cpp new file mode 100644 index 0000000..1e7d793 --- /dev/null +++ b/sci_gateway/cpp/opencv_radius.cpp @@ -0,0 +1,212 @@ +/******************************************************** +Author: Manoj Sree Harsha +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/flann/flann.hpp" +#include +using namespace cv; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + +int opencv_radius(char *fname, unsigned long fname_len) +{ + + // Error management variables + SciErr sciErr; + int intErr=0; + + //variable declarations + int *piaddrvar1=NULL; + int *piaddrvar2=NULL; + int *piaddrvar3=NULL; + int *piaddrvar4=NULL; + + + double *qpoint=NULL;//contains the query point + double r=0; //radius + double choice; + int r1=0,c1=0; + int i,j,l,count,n; + double*result = NULL;//output matrix containing the indices and corresponding distances. + + //Checking the number of input and output arguments + CheckInputArgument(pvApiCtx, 3, 4); + CheckOutputArgument(pvApiCtx, 1, 1); + n=*getNbInputArgument(pvApiCtx); + /* get Address of inputs */ + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piaddrvar1); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + /* Check that the first input argument is a real matrix (and not complex) */ + if ( !isDoubleType(pvApiCtx, piaddrvar1) || isVarComplex(pvApiCtx, piaddrvar1) ) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A real vector expected.\n"), fname, 1); + return 0; + } + sciErr = getMatrixOfDouble(pvApiCtx, piaddrvar1, &r1, &c1, &qpoint); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if(r1!=1) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A vector is expected\n"), fname,1); + return 0; + } + + //Application Code + try + { + + Mat image,img,imgray,image1; + retrieveImage(image, 2); //the input image given by the user is loaded into image(Mat container) + //converting image to cvtColor compatible type + if(image.channels()>1) + { + image.convertTo(img,CV_32F); + cvtColor(img,imgray,COLOR_BGR2GRAY); + imgray.convertTo(image1,CV_64F); + } + else + { + image.convertTo(image1,CV_64F); + } + if(c1!=image1.cols) //Checking whether cols in querypoint are equal to no. of dimensions of datapoints + { + Scierror(999, _("%s: Wrong value for input argument #%d: cols. in query should match with no. of columns in matrix\n"), fname,1); + return 0; + } + //the vector querypoint is loaded into qpoi(Mat container) + Mat qpoi=Mat(1,image1.cols,CV_64F); + for(i=0;i(0,i)=qpoint[i]; + } + sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piaddrvar3); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isDoubleType(pvApiCtx, piaddrvar3)) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 3); + return 0; + } + + intErr = getScalarDouble(pvApiCtx, piaddrvar3,&r); + if (intErr) + { + return intErr; + } + if(n==4) + { + sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piaddrvar4); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isDoubleType(pvApiCtx, piaddrvar4)) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname, 4); + return 0; + } + + intErr = getScalarDouble(pvApiCtx, piaddrvar4,&choice); + if (intErr) + { + return intErr; + } + } + else{ + choice=1; + } + if(choice<1 || choice >4) + { + Scierror(999, _("%s: Wrong value for input argument #%d: A value between 1 and 4(inclusively) is expected\n"), fname,4); + return 0; + } + if(r<0) + { + Scierror(999, _("%s: Wrong value for input argument #%d: A positive value is expected\n"), fname,3); + return 0; + } + //Creating a new object of GenericIndex + //the index will perform a linear,brute-force search. + //the distance type used here is euclidean distance(L2) + Mat indices=Mat(1,image1.rows,CV_32S);//contains the indices of points within 'r' radius + Mat dists=Mat(1,image1.rows,CV_64F);//contains corresponding distances + int retval; + + if(choice==1) + { + cv::flann::GenericIndex< cvflann::L2 > index(image1,cvflann::LinearIndexParams(),cvflann::L2()); + retval = index.radiusSearch(qpoi,indices,dists,r,cvflann::SearchParams());//OpenCv function radiusSearch is called. + } + + if(choice==2) + { + cv::flann::GenericIndex< cvflann::L2 > index(image1,cvflann::KDTreeIndexParams(),cvflann::L2()); + retval = index.radiusSearch(qpoi,indices,dists,r,cvflann::SearchParams());//OpenCv function radiusSearch is called. + } + if(choice==3) + { + cv::flann::GenericIndex< cvflann::L2 > index(image1,cvflann::KMeansIndexParams(),cvflann::L2()); + retval = index.radiusSearch(qpoi,indices,dists,r,cvflann::SearchParams());//OpenCv function radiusSearch is called. + } + if(choice==4) + { + cv::flann::GenericIndex< cvflann::L2 > index(image1,cvflann::CompositeIndexParams(),cvflann::L2()); + retval = index.radiusSearch(qpoi,indices,dists,r,cvflann::SearchParams());//OpenCv function radiusSearch is called. + } + sciprint("Number of points : %d",retval); + result = (double*)malloc(sizeof(double)*2*retval); + int count=0; + for(j=0;j<2*retval;j++) + { + if(j%2==0) + { + result[j]=(double)indices.at(0,count); + } + else + { + result[j]=dists.at(0,count); + count++; + } + } + //creating the output matrix + sciErr = createMatrixOfDouble(pvApiCtx,nbInputArgument(pvApiCtx)+1,2,retval,result); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + } + catch(cv::Exception& e) + { + const char* err=e.what(); + sciprint("%s",err); + } + + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + } +} diff --git a/sci_gateway/cpp/opencv_rotationVectorToMatrix.cpp b/sci_gateway/cpp/opencv_rotationVectorToMatrix.cpp new file mode 100644 index 0000000..40186e2 --- /dev/null +++ b/sci_gateway/cpp/opencv_rotationVectorToMatrix.cpp @@ -0,0 +1,209 @@ +/*************************************************** +Author : Tanmay Chaudhari + **************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include +#include +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + + int opencv_rotationVectorToMatrix(char *fname, unsigned long fname_len) + { + + //Error management variable + SciErr sciErr; + + //Variable declaration + int iComplex = 0; + int iType = 0; + int iRows = 0; + int iCols = 0; + int *piAddr = NULL; + double sinOfangle = 0; + double cosOfangle = 0; + double t=0, x=0, y=0, z=0; + double theta=0; + double *pdbl = NULL; + double *matrix=NULL; + double *identity=NULL; + double *A=NULL; + double *B=NULL; + + //Check input output arguments + checkInputArgument(pvApiCtx, 1, 1); + checkOutputArgument(pvApiCtx, 1, 1); + + //Get variable address of the first input argument + sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + + //Check type + sciErr = getVarType(pvApiCtx, piAddr, &iType); + if(sciErr.iErr || iType != sci_matrix) + { + printError(&sciErr, 0); + return 0; + } + + //Get complexity + iComplex = isVarComplex(pvApiCtx, piAddr); + + //Check complexity + if(iComplex) + { + Scierror(999, "%s: Wrong type for input argument: A complex number is not expected.\n"); + return 0; + } + + sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdbl); + if(sciErr.iErr || iCols != 3 || iRows != 1) + { + printError(&sciErr, 0); + return 0; + } + + //Application Code + try + { + x = pdbl[0]; + y = pdbl[1]; + z = pdbl[2]; + theta = sqrt(x * x + y * y + z * z); + sinOfangle = sin(theta); + cosOfangle = cos(theta); + t = 1 - cosOfangle; + x = pdbl[0] / theta; + y = pdbl[1] / theta; + z = pdbl[2] / theta; + + matrix = (double*)malloc(sizeof(double) * 9); + A = (double*)malloc(sizeof(double) * 9); + B = (double*)malloc(sizeof(double) * 9); + identity = (double*)malloc(sizeof(double) * 9); + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 3; j++) + { + if(i == 0) + { + if(j == 0) + A[j * 3 + i] = x * x; + else if(j == 1) + A[j * 3 + i] = x * y; + else if(j == 2) + A[j * 3 + i] = x * z; + + } + else if(i == 1) + { + if(j == 0) + A[j * 3 + i] = x * y; + else if(j == 1) + A[j * 3 + i] = y * y; + else if(j == 2) + A[j * 3 + i] = y * z; + } + else + { + if(j == 0) + A[j * 3 + i] = x * z; + else if(j == 1) + A[j * 3 + i] = y * z; + else if(j == 2) + A[j * 3 + i] = z * z; + } + + } + } + + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 3; j++) + { + if(i == 0) + { + if(j == 0) + B[j * 3 + i] = 0; + else if(j == 1) + B[j * 3 + i] = -z; + else if(j == 2) + B[j * 3 + i] = y; + + } + else if(i == 1) + { + if(j == 0) + B[j * 3 + i] = z; + else if(j == 1) + B[j * 3 + i] = 0; + else if(j == 2) + B[j * 3 + i] = -x; + } + else + { + if(j == 0) + B[j * 3 + i] = -y; + else if(j == 1) + B[j * 3 + i] = x; + else if(j == 2) + B[j * 3 + i] = 0; + } + + } + } + for(int i = 0; i < 3; i++) + { + for(int j = 0;j < 3; j++) + { + if(i == j) + identity[j * 3 + i] = 1; + else + identity[j * 3 + i] = 0; + } + } + for(int i = 0; i < 3; i++) + { + for(int j = 0; j < 3; j++) + { + matrix[i * 3 + j] = identity[j * 3 + i] * cosOfangle + t * A[j * 3 + i] + sinOfangle * B[j * 3 + i]; + } + } + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1,3, 3, matrix); + if(sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + } + catch(cv::Exception& e) + { + const char* err=e.what(); + Scierror(999,("%s"),err); + } + + //Return output arguments + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + return 0; + } +} + + + diff --git a/sci_gateway/cpp/opencv_rotestimate.cpp b/sci_gateway/cpp/opencv_rotestimate.cpp new file mode 100644 index 0000000..2dbf97c --- /dev/null +++ b/sci_gateway/cpp/opencv_rotestimate.cpp @@ -0,0 +1,175 @@ +/******************************************************** +Author: Manoj Sree Harsha +********************************************************/ +#include +#include "opencv2/core/core.hpp" +#include "opencv2/highgui/highgui.hpp" +#include "opencv2/opencv.hpp" +#include "opencv2/stitching/detail/blenders.hpp" +#include "opencv2/imgproc/imgproc.hpp" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace cv; +using namespace cv::detail; +using namespace std; +extern "C" +{ + #include "api_scilab.h" + #include "Scierror.h" + #include "BOOL.h" + #include + #include "sciprint.h" + #include "../common.h" + + int opencv_rotestimate(char *fname,unsigned long fname_len) + { + + // Error management variables + SciErr sciErr; + int intErr = 0; + + //variable declarations + int i,k,j,num; + double scale = 1; + double index=0; + int *piaddrvar=NULL; + double *result=NULL; + float conf_thresh = 1.f; + float match_conf = 0.3f; + + + //Checking number of input and output arguments (enviromnet variable, min arguments, max arguments) + CheckInputArgument(pvApiCtx,3,7); + CheckOutputArgument(pvApiCtx,1,1); + + //number of input arguments + num = *getNbInputArgument(pvApiCtx); + num = num-1; + + //argument #1 + sciErr = getVarAddressFromPosition(pvApiCtx,1,&piaddrvar); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return 0; + } + if ( !isDoubleType(pvApiCtx, piaddrvar)) + { + Scierror(999, _("%s: Wrong type for input argument #%d: A scalar expected.\n"), fname,1); + return 0; + } + + intErr = getScalarDouble(pvApiCtx, piaddrvar,&index); + if (intErr) + { + return intErr; + } + + if(index<1 || index>num){ + Scierror(999, _("%s: Invalid input argument #%d. The value is expected to be between 1 and %d\n"), fname,1,num); + return 0; + } + + //Application Code + try + { + //PHASE-1 REGISTRATION + //Feature matching + vector full_img_sizes(num); + vector images(num); + vector imagescopy(num); + Ptr finder; + finder = makePtr(); + vector features(num); + for(i=1;i<=num;i++) + { + Mat image1,img; + retrieveImage(image1, i+1); + image1.convertTo(image1,CV_8U); + resize(image1, img, Size(), scale, scale); + images[i-1]=img.clone(); + imagescopy[i-1]=img.clone(); + + full_img_sizes.push_back(image1.size()); + (*finder)(img, features[i-1]); + features[i-1].img_idx = i-1; + img.release(); + } + finder->collectGarbage(); + vector pairwise_matches; + BestOf2NearestMatcher matcher(false, match_conf); + matcher(features, pairwise_matches); + matcher.collectGarbage(); + vector indices = leaveBiggestComponent(features, pairwise_matches, conf_thresh); + vector img_subset; + vector full_img_sizes_subset; + for (i = 0; i < indices.size(); ++i) + { + img_subset.push_back(images[indices[i]]); + full_img_sizes_subset.push_back(full_img_sizes[indices[i]]); + } + images = img_subset; + full_img_sizes = full_img_sizes_subset; + + //PHASE-2 CALIBRARION + //Estimating Camera Parameters + HomographyBasedEstimator estimator; + vector cameras; + if (!estimator(features, pairwise_matches, cameras)) + { + sciprint("Homography estimation failed.\n"); + return 0; + } + for (i = 0; i < cameras.size(); ++i) + { + Mat R; + cameras[i].R.convertTo(R, CV_32F); + cameras[i].R = R; + } + Ptr adjuster; + adjuster = makePtr(); + adjuster->setConfThresh(conf_thresh); + if (!(*adjuster)(features, pairwise_matches, cameras)) + { + sciprint("Camera parameters adjusting failed.\n"); + return 0; + } + result=(double*)malloc(sizeof(double)*3*3); + for(i=0;i<3;i++) + { + for(j=0;j<3;j++) + { + result[i+3*j]=cameras[index-1].K().at(i,j); + } + } + + //creating the output matrix + sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1,3,3,result); + if (sciErr.iErr) + { + printError(&sciErr, 0); + return sciErr.iErr; + } + //Assigning output variables + AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; + + //Returning the Output Variables as arguments to the Scilab environment + ReturnArguments(pvApiCtx); + + } + catch(cv::Exception& e) + { + const char* err=e.what(); + sciprint("%s",err); + } + return 0; + } +} diff --git a/sci_gateway/cpp/opencv_stereoCalibrate.cpp b/sci_gateway/cpp/opencv_stereoCalibrate.cpp deleted file mode 100644 index 7409c75..0000000 --- a/sci_gateway/cpp/opencv_stereoCalibrate.cpp +++ /dev/null @@ -1,347 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include "opencv2/core/types_c.h" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - -int opencv_stereoCalibrate(char *fname, unsigned long fname_len) - { - //variables - - int i,j,k,n,m; - int iRows=0,iCols=0; - int *piAddr=NULL; - double *pdblReal = NULL; - double x,y,rms; - int p; - - - SciErr sciErr; - vector >imagepoints1(1),imagepoints2(1); - vector >objectPoints(1); - - - - Mat cameraMatrix1; - Mat cameraMatrix2; - Mat distCoeffsActual1,distCoeffsActual2; - Mat rotationMatrix; - Mat translationVector; - int num; - - ////////parsing input - - n=*getNbInputArgument(pvApiCtx); - //first - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //stores - - //objectPoints = (CvPoint3D64f*)cvAlloc( iRows *1* sizeof(CvPoint3D64f)); - for(i = 0; i < iRows; ++i) - objectPoints[0].push_back(Point3d(double(pdblReal[(0 * iRows) + i]), double(pdblReal[(1 * iRows) + i]),0.0)); - - -int pointCount=iRows; - //2nd Input - - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!isListType(pvApiCtx, piAddr)) - { - - Scierror(999,"\nthe imagepoints1 Argument must be a list of points \n"); - return 0; - } - sciErr = getListItemNumber(pvApiCtx, piAddr, &num); - if(sciErr.iErr) - { - printError(&sciErr, 0); - - return 0; - } - imagepoints1.resize(num); - - //get items from list - - for(int i=1;i<=num;i++) - { - - sciErr=getMatrixOfDoubleInList(pvApiCtx, piAddr,i,&iRows, &iCols, &pdblReal); - - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - for(j = 0; j < iRows; ++j) - imagepoints1[i-1].push_back( Point2d(double(pdblReal[(0 * iRows) + j]), double(pdblReal[(1 * iRows) + j]))); - - - - } - - //3rd input - sciprint("\n"); - sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!isListType(pvApiCtx, piAddr)) - { - - Scierror(999,"\nthe imagepoints2 Argument must be a list of points \n"); - return 0; - } - sciErr = getListItemNumber(pvApiCtx, piAddr, &num); - if(sciErr.iErr) - { - printError(&sciErr, 0); - - return 0; - } - imagepoints2.resize(num); - //get items from list - - for(int i=1;i<=num;i++) - { - sciErr=getMatrixOfDoubleInList(pvApiCtx, piAddr,i,&iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - for(j = 0; j < iRows; ++j) - imagepoints2[i-1].push_back( Point2d(double(pdblReal[(0 * iRows) + j]), double(pdblReal[(1 * iRows) + j]))); - - - } - - ///Getting optional arguments - - for(i=4;i<=n;i++) - { - sciErr = getVarAddressFromPosition(pvApiCtx,i,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!isDoubleType(pvApiCtx, piAddr)) - { - - Scierror(999,"\nthe input should be of type double\n"); - return 0; - - - } - if(i==4 || i==6) - { - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - - Mat C(3,3,CV_8U,&pdblReal); - if(i==4) - C.copyTo(cameraMatrix1); - else - C.copyTo(cameraMatrix2); - } - - if(i==5 || i==7) - { - sciErr = getMatrixOfDouble(pvApiCtx, piAddr, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr,0); - return 0; - } - if(iRows== 1) - p = iCols; - else if (iCols == 1) - p = iRows; - else{ - Scierror(1,"Distortion Points matrix must be a 4 X 1 or 1 X 4 matrix"); - return 0; - } - if(p==4); - else{ - Scierror(1," N must be 4"); - return 0; - } - Mat A(1,p,CV_8U,&pdblReal); - if(i==5) - A.copyTo(distCoeffsActual1); - else - A.copyTo(distCoeffsActual2); - - } - - } - - - - try - { - Size imageSize (600,960); - - rms = fisheye::stereoCalibrate(objectPoints,imagepoints1,imagepoints2, - cameraMatrix1, distCoeffsActual1, - cameraMatrix2, distCoeffsActual2, - imageSize, rotationMatrix, translationVector,fisheye::CALIB_FIX_SKEW | fisheye::CALIB_RECOMPUTE_EXTRINSIC | fisheye::CALIB_FIX_K4, - TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, DBL_EPSILON)); - - } - catch(cv::Exception& e) - { - - Scierror(999,e.what()); - return 0; - - - - } - sciprint("Calibration done with RMS error=%f\n",rms); - - - - ///Return Arguments to Scilab - - double *pstdata1 = NULL,*pstdata2 = NULL,*pstdata3 = NULL,*pstdata4 = NULL,*pstdata5 = NULL,*pstdata6 = NULL; - pstdata1 = (double*)malloc(sizeof(double) *3* 3); - - for(i=0;i<3;i++) - for(j=0;j<3;j++) - pstdata1[(j * 3) + i]=cameraMatrix1.at(i,j); - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 3, 3, pstdata1); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - pstdata2 = (double*)malloc(sizeof(double) *4*1); - - for(i=0;i<4;i++) - pstdata2[i]=distCoeffsActual1.at(0,i); - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, 1, 4, pstdata2); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - pstdata3 = (double*)malloc(sizeof(double) *3* 3); - - for(i=0;i<3;i++) - for(j=0;j<3;j++) - pstdata3[(j * 3) + i]=cameraMatrix2.at(i,j); - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 3, 3, 3, pstdata3); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - pstdata4 = (double*)malloc(sizeof(double) *4*1); - for(i=0;i<4;i++) - pstdata4[i]=distCoeffsActual2.at(0,i); - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 4, 1, 4, pstdata4); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - pstdata5=(double*)malloc(sizeof(double) *rotationMatrix.rows*rotationMatrix.cols); - - for(i=0;i(i,j); - - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 5, rotationMatrix.rows, rotationMatrix.cols, pstdata5); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - pstdata6=(double*)malloc(sizeof(double) *translationVector.rows*translationVector.cols); - - for(i=0;i(i,j); - - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 6, translationVector.rows, translationVector.cols, pstdata6); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - - - for(int i=1;i<=6;i++) - AssignOutputVariable(pvApiCtx, i) = nbInputArgument(pvApiCtx) + i; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - - - } -} - - - - - - - - - diff --git a/sci_gateway/cpp/opencv_trainSVMClassifier.cpp b/sci_gateway/cpp/opencv_trainSVMClassifier.cpp deleted file mode 100644 index 9659abf..0000000 --- a/sci_gateway/cpp/opencv_trainSVMClassifier.cpp +++ /dev/null @@ -1,614 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/ml.hpp" -#include "opencv2/opencv.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; -using namespace cv::ml; - - - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - - double readdouble_from_scilab(int cnt) - { - - SciErr sciErr; - int *piAddr=NULL; - double val=0; - int intErr; - - sciErr = getVarAddressFromPosition(pvApiCtx,cnt,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr ,&val); - - if(isDoubleType(pvApiCtx, piAddr)) - return val; - else - { - Scierror(999,"Error: the input argument is not of type double"); - return 0; - - - } - - - } - - - - int opencv_trainSVMClassifier(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - - //------Local variables------// - int upright = 1; - Ptr matcher = DescriptorMatcher::create("FlannBased"); - Ptr detector = SURF::create(400, 4, 2, 1, int(upright)); - Ptr extractor=detector; - Ptr bowDE=makePtr(extractor,matcher); - //SurfFeatureDetector detector(1, 4, 2, 1, int(upright)); - char *fileName = NULL; - Mat dictionary,inp,features; - vector keyPoints; - - - int *piAddr = NULL; - int *piChild = NULL; - int iRows, iCols; - char **pstData = NULL; - int *piLen = NULL; - int *count = NULL; - char **description = NULL; - char ***location = NULL; - char *bagOfFeaturesLocation = NULL; - int descriptionCount; - char *classifierLocation = "classifier.yml"; - char *objectType = "classifier"; - int intErr = 0; - char* stringData = NULL; - char* classifierName; - int iRet; - - double C=0,gamma=1,coef=0,degree=0,P=0,Nu=0,kernelType=2,setType=100;//all model paramenter set to their default values - - //default value is false - - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 3,11); - CheckOutputArgument(pvApiCtx, 1, 1); - - //------Get input arguments------// - int n=*getNbInputArgument(pvApiCtx); - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #1 is not of type imageSet.\n"); - return 0; - } - - // Extracting object type and checking if type is imageSet - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"imageSet")==0)) - { - Scierror(999, "Error: The input argument #1 is not of type imageSet.\n"); - return 0; - } - - // Extracting Description attribute of input argument - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - description = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - description[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, description); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - descriptionCount = iRows; - int i=0; - // Extracting Count attribute of input argument - sciErr = getMatrixOfInteger32InList(pvApiCtx, piAddr, 3, &iRows, &iCols, &count); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - location = (char***) malloc(sizeof(char**) * descriptionCount); - sciErr = getListItemAddress(pvApiCtx, piAddr, 4, &piChild); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - for(int iter = 1; iter<=descriptionCount; iter++) - { - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - location[iter-1] = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int colIter = 0 ; colIter < iRows * iCols ; colIter++) - { - location[iter-1][colIter] = (char*)malloc(sizeof(char) * (piLen[colIter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, piLen, location[iter-1]); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - // Second argument - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #2 is not of type bagOfFeatures.\n"); - return 0; - } - - // Extracting object type and checking if type is bagOfFeatures - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"bagOfFeatures")==0)) - { - Scierror(999, "Error: The input argument #2 is not of type bagOfFeatures.\n"); - return 0; - } - // Extracting name of next argument takes three calls to getMatrixOfString - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for bagOfFeatures argument."); - return 0; - } - // Handling 3rd argument. - sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(isStringType(pvApiCtx, piAddr)) - { - if(isScalar(pvApiCtx, piAddr)) - { - iRet = getAllocatedSingleString(pvApiCtx, piAddr, &stringData); - if(!iRet) - { - classifierName = stringData; - } - else - { - Scierror(999, "Error: Could not assign input arg #3 to local var.\n"); - return 0; - } - } - else - { - Scierror(999, "Error: The input argument #3 is not scalar type.\n"); - return 0; - } - } - else - { - Scierror(999, "Error: The input argument #3 is not a string.\n"); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - - classifierLocation = classifierName; - strcat(classifierLocation, ".yml"); - //------Actual processing------// - FileStorage fs(bagOfFeaturesLocation, FileStorage::READ); - fs["dictionary"] >> dictionary; - fs.release(); - if(dictionary.rows==0 || dictionary.cols==0) - { - sciprint("Error: The provided file for bagOfFeatures may be invalid.\n"); - } - sciprint("Training an image category classifier for %d categories.\n",descriptionCount); - sciprint("-------------------------------------------------------\n\n"); - for(int i=0;isetVocabulary(dictionary); - for(int i=0; idetect(inp,keyPoints); - bowDE->compute(inp,keyPoints,features); - trainingData.push_back(features); - labels.push_back((int)i); - } - sciprint("done.\n"); - } - int cnt=4; - switch(n-1) - { - case 3: - - C=readdouble_from_scilab(cnt); - cnt++; - break; - case 4: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - break; - case 5: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - degree=readdouble_from_scilab(cnt); - cnt++; - break; - case 6: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - degree=readdouble_from_scilab(cnt); - cnt++; - gamma=readdouble_from_scilab(cnt); - cnt++; - break; - case 7: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - degree=readdouble_from_scilab(cnt); - cnt++; - gamma=readdouble_from_scilab(cnt); - cnt++; - kernelType=readdouble_from_scilab(cnt); - cnt++; - if(kernelType>5 || kernelType<-1) - { - Scierror(999,"Error: the kernel should be [-1,5]"); - return 0; - - } - break; - case 8: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - degree=readdouble_from_scilab(cnt); - cnt++; - gamma=readdouble_from_scilab(cnt); - cnt++; - kernelType=readdouble_from_scilab(cnt); - cnt++; - if(kernelType>5 || kernelType<-1) - { - Scierror(999,"Error: the kernel should be [-1,5]"); - return 0; - - } - Nu=readdouble_from_scilab(cnt); - cnt++; - break; - - case 9: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - degree=readdouble_from_scilab(cnt); - cnt++; - gamma=readdouble_from_scilab(cnt); - cnt++; - kernelType=readdouble_from_scilab(cnt); - cnt++; - if(kernelType>5 || kernelType<-1) - { - Scierror(999,"Error: the kernel should be between -1 and 5 \n"); - return 0; - - } - Nu=readdouble_from_scilab(cnt); - cnt++; - P=readdouble_from_scilab(cnt); - cnt++; - break; - case 10: - - C=readdouble_from_scilab(cnt); - cnt++; - coef=readdouble_from_scilab(cnt); - cnt++; - degree=readdouble_from_scilab(cnt); - cnt++; - gamma=readdouble_from_scilab(cnt); - cnt++; - kernelType=readdouble_from_scilab(cnt); - cnt++; - if(kernelType>5 || kernelType<-1) - { - Scierror(999,"Error: the kernel should be between -1 and 5 \n"); - return 0; - - } - Nu=readdouble_from_scilab(cnt); - cnt++; - P=readdouble_from_scilab(cnt); - cnt++; - setType=(int)readdouble_from_scilab(cnt); - cnt++; - if(setType<100 || setType>104) - { - Scierror(999,"Error: the type should be 100-104"); - return 0; - - - } - break; - } - - - - - - - - - - - sciprint("\n# Training the category classifier..."); - - - - - try{ - - Ptr svm = ml::SVM::create(); - svm->setType(setType); - svm->setGamma(gamma); - svm->setTermCriteria(cvTermCriteria(CV_TERMCRIT_ITER,100,0.000001)); - svm->setDegree(degree); - svm->setP(P); - svm->setCoef0(coef); - svm->train( trainingData , ml::ROW_SAMPLE , labels ); - transpose(trainingData,trainingData); - if(!svm->isTrained()) - { - Scierror(999,"\nthere was an error while training the model,please try again!\n"); - return 0; - - } - if(svm->isTrained()) - svm->save(classifierLocation); - sciprint("\ndone"); - - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("%s",err); - - } - - - - - - - - - - - //------Create output arguments------// - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 4, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 1, 1, 1, &objectType); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 2, 1, 1, &classifierLocation); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 3, 1, 1, &bagOfFeaturesLocation); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 4, descriptionCount, 1, description); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - ReturnArguments(pvApiCtx); - return 0; - } - /* ==================================================================== */ -} - - diff --git a/sci_gateway/cpp/opencv_trainSVMSGDClassifier.cpp b/sci_gateway/cpp/opencv_trainSVMSGDClassifier.cpp deleted file mode 100644 index 46e5fd8..0000000 --- a/sci_gateway/cpp/opencv_trainSVMSGDClassifier.cpp +++ /dev/null @@ -1,569 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ -#include -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/imgproc/imgproc.hpp" -#include "opencv2/features2d.hpp" -#include "opencv2/xfeatures2d.hpp" -#include "opencv2/ml.hpp" -#include "opencv2/opencv.hpp" - - -using namespace cv; -using namespace cv::xfeatures2d; -using namespace std; -using namespace cv::ml; - - - -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include "sciprint.h" - - double readdoubles_from_scilab(int cnt) - { - - SciErr sciErr; - int *piAddr=NULL; - double val=0; - int intErr; - - sciErr = getVarAddressFromPosition(pvApiCtx,cnt,&piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - intErr = getScalarDouble(pvApiCtx, piAddr ,&val); - - if(isDoubleType(pvApiCtx, piAddr)) - return val; - else - { - Scierror(999,"Error: the input argument is not of type double"); - return 0; - - - } - - - } - - - - int opencv_trainSVMSGDClassifier(char *fname, unsigned long fname_len) - { - // Error management variables - SciErr sciErr; - - //------Local variables------// - int upright = 1; - Ptr matcher = DescriptorMatcher::create("FlannBased"); - Ptr detector = SURF::create(400, 4, 2, 1, int(upright)); - Ptr extractor=detector; - Ptr bowDE=makePtr(extractor,matcher); - //SurfFeatureDetector detector(1, 4, 2, 1, int(upright)); - char *fileName = NULL; - Mat dictionary,inp,features; - vector keyPoints; - - - int *piAddr = NULL; - int *piChild = NULL; - int iRows, iCols; - char **pstData = NULL; - int *piLen = NULL; - int *count = NULL; - char **description = NULL; - char ***location = NULL; - char *bagOfFeaturesLocation = NULL; - int descriptionCount; - char *classifierLocation = "classifier.yml"; - char *objectType = "classifier"; - int intErr = 0; - char* stringData = NULL; - char* classifierName; - int iRet; - - double initStepSize=0.2,marginreg=0,optimalParam=0,stepDecreasingPower=0.1;//all model paramenter set to their default values - int marginType=0,svmsgdType=0; - - - //------Check number of parameters------// - CheckInputArgument(pvApiCtx, 3,9); - CheckOutputArgument(pvApiCtx, 1, 1); - - //------Get input arguments------// - int n=*getNbInputArgument(pvApiCtx); - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #1 is not of type imageSet.\n"); - return 0; - } - - // Extracting object type and checking if type is imageSet - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"imageSet")==0)) - { - Scierror(999, "Error: The input argument #1 is not of type imageSet.\n"); - return 0; - } - - // Extracting Description attribute of input argument - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - description = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - description[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, description); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - descriptionCount = iRows; - - // Extracting Count attribute of input argument - sciErr = getMatrixOfInteger32InList(pvApiCtx, piAddr, 3, &iRows, &iCols, &count); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - location = (char***) malloc(sizeof(char**) * descriptionCount); - sciErr = getListItemAddress(pvApiCtx, piAddr, 4, &piChild); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - for(int iter = 1; iter<=descriptionCount; iter++) - { - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - location[iter-1] = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int colIter = 0 ; colIter < iRows * iCols ; colIter++) - { - location[iter-1][colIter] = (char*)malloc(sizeof(char) * (piLen[colIter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piChild, iter, &iRows, &iCols, piLen, location[iter-1]); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - } - // Second argument - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(!isListType(pvApiCtx, piAddr)) - { - Scierror(999, "Error: The input argument #2 is not of type bagOfFeatures.\n"); - return 0; - } - - // Extracting object type and checking if type is bagOfFeatures - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, NULL, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*)malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, NULL); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**)malloc(sizeof(char*) * iRows * iCols); - - for(int iter = 0 ; iter < iRows * iCols ; iter++) - { - pstData[iter] = (char*)malloc(sizeof(char) * (piLen[iter] + 1));//+ 1 for null termination - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 1, &iRows, &iCols, piLen, pstData); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(!(strcmp(pstData[0],"bagOfFeatures")==0)) - { - Scierror(999, "Error: The input argument #2 is not of type bagOfFeatures.\n"); - return 0; - } - // Extracting name of next argument takes three calls to getMatrixOfString - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, NULL, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - piLen = (int*) malloc(sizeof(int) * iRows * iCols); - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, NULL); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - pstData = (char**) malloc(sizeof(char*) * iRows * iCols); - for(int iterPstData = 0; iterPstData < iRows * iCols; iterPstData++) - { - pstData[iterPstData] = (char*) malloc(sizeof(char) * piLen[iterPstData] + 1); - } - - sciErr = getMatrixOfStringInList(pvApiCtx, piAddr, 2, &iRows, &iCols, piLen, pstData); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows!=1 || iCols!=1) - { - Scierror(999, "1x1 Matrix expected for bagOfFeatures argument."); - return 0; - } - // Handling 3rd argument. - sciErr = getVarAddressFromPosition(pvApiCtx, 3, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - if(isStringType(pvApiCtx, piAddr)) - { - if(isScalar(pvApiCtx, piAddr)) - { - char* stringData = NULL; - - iRet = getAllocatedSingleString(pvApiCtx, piAddr, &stringData); - if(!iRet) - { - classifierName = stringData; - } - else - { - Scierror(999, "Error: Could not assign input arg #3 to local var.\n"); - return 0; - } - } - else - { - Scierror(999, "Error: The input argument #3 is not scalar type.\n"); - return 0; - } - } - else - { - Scierror(999, "Error: The input argument #3 is not a string.\n"); - return 0; - } - bagOfFeaturesLocation = pstData[0]; - classifierLocation = classifierName; - strcat(classifierLocation, ".yml"); - //------Actual processing------// - FileStorage fs(bagOfFeaturesLocation, FileStorage::READ); - fs["dictionary"] >> dictionary; - fs.release(); - if(dictionary.rows==0 || dictionary.cols==0) - { - sciprint("Error: The provided file for bagOfFeatures may be invalid.\n"); - } - sciprint("Training an image category classifier for %d categories.\n",descriptionCount); - sciprint("-------------------------------------------------------\n\n"); - for(int i=0;isetVocabulary(dictionary); - for(int i=0; idetect(inp,keyPoints); - bowDE->compute(inp,keyPoints,features); - trainingData.push_back(features); - labels.push_back((int)i); - } - sciprint("done.\n"); - } - int cnt=4; - switch(n-1) - { - case 3: - - initStepSize=readdoubles_from_scilab(cnt); - cnt++; - break; - case 4: - - initStepSize=readdoubles_from_scilab(cnt); - cnt++; - marginreg=readdoubles_from_scilab(cnt); - cnt++; - break; - case 5: - - initStepSize=readdoubles_from_scilab(cnt); - cnt++; - marginreg=readdoubles_from_scilab(cnt); - cnt++; - marginType=(int)readdoubles_from_scilab(cnt);//default type of scalar is double in scilab.so typecasting is needed - if(marginType>1 || marginType<0) - { - Scierror(999,"Error: the marginType should be either 0 or 1"); - return 0; - - } - cnt++; - break; - case 6: - - initStepSize=readdoubles_from_scilab(cnt); - cnt++; - marginreg=readdoubles_from_scilab(cnt); - cnt++; - marginType=(int)readdoubles_from_scilab(cnt);//default type of scalar is double in scilab.so typecasting is needed - if(marginType>1 || marginType<0) - { - Scierror(999,"Error: the marginType should be either 0 or 1"); - return 0; - - } - cnt++; - optimalParam=readdoubles_from_scilab(cnt); - cnt++; - break; - case 7: - - initStepSize=readdoubles_from_scilab(cnt); - cnt++; - marginreg=readdoubles_from_scilab(cnt); - cnt++; - marginType=(int)readdoubles_from_scilab(cnt);//default type of scalar is double in scilab.so typecasting is needed - if(marginType>1 || marginType<0) - { - Scierror(999,"Error: the marginType should be either 0 or 1"); - return 0; - - } - cnt++; - optimalParam=readdoubles_from_scilab(cnt); - cnt++; - stepDecreasingPower=readdoubles_from_scilab(cnt); - cnt++; - break; - case 8: - - initStepSize=readdoubles_from_scilab(cnt); - cnt++; - marginreg=readdoubles_from_scilab(cnt); - cnt++; - marginType=(int)readdoubles_from_scilab(cnt);//default type of scalar is double in scilab.so typecasting is needed - if(marginType>1 || marginType<0) - { - Scierror(999,"Error: the marginType should be either 0 or 1"); - return 0; - - } - cnt++; - optimalParam=readdoubles_from_scilab(cnt); - cnt++; - stepDecreasingPower=readdoubles_from_scilab(cnt); - cnt++; - svmsgdType=(int)readdoubles_from_scilab(cnt);//default type of scalar is double in scilab.so typecasting is needed - if(svmsgdType>1 || svmsgdType<0) - { - Scierror(999,"Error: the marginType should be either 0 or 1"); - return 0; - - } - - break; - - - } - sciprint("\n# Training the category classifier..."); - - - - - try{ - - cv::Ptr svmsgd = SVMSGD::create(); - svmsgd->setInitialStepSize(initStepSize); - svmsgd->setMarginRegularization(marginreg); - svmsgd->setMarginType(marginType); - svmsgd->setOptimalParameters(svmsgdType,marginType); - svmsgd->setStepDecreasingPower(stepDecreasingPower); - svmsgd->setSvmsgdType(svmsgdType); - svmsgd->setTermCriteria(cvTermCriteria(CV_TERMCRIT_ITER,100,0.000001)); - svmsgd->train( trainingData , ml::ROW_SAMPLE , labels ); - transpose(trainingData,trainingData); - if(!svmsgd->isTrained()) - { - Scierror(999,"\nthere was an error while training the model,please try again!\n"); - return 0; - - } - if(svmsgd->isTrained()) - svmsgd->save(classifierLocation); - sciprint("\ndone"); - - } - catch(cv::Exception& e) - { - const char* err=e.what(); - sciprint("%s",err); - - } - - - - - - - - - - - //------Create output arguments------// - sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 4, &piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 1, 1, 1, &objectType); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 2, 1, 1, &classifierLocation); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 3, 1, 1, &bagOfFeaturesLocation); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx)+1, piAddr, 4, descriptionCount, 1, description); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - //------Return Arguments------// - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx)+1; - ReturnArguments(pvApiCtx); - return 0; - } - /* ==================================================================== */ -} - diff --git a/sci_gateway/cpp/opencv_undistortPoints.cpp b/sci_gateway/cpp/opencv_undistortPoints.cpp deleted file mode 100644 index 5e7ef58..0000000 --- a/sci_gateway/cpp/opencv_undistortPoints.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/*************************************************** -Author : Nihar Rao -***************************************************/ - -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -using namespace cv; -using namespace std; -extern "C" -{ - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - #include - #include "../common.h" - - int opencv_undistortPoints(char *fname, unsigned long fname_len) - { - //variables - - int i,j,k,n,m; - int iRows=0,iCols=0; - int *piAddr1 = NULL; - int *piAddr2 = NULL; - int *piAddr3 = NULL; - int *piAddr4 = NULL; - int *piAddr5 = NULL; - - double *pdblReal = NULL; - - SciErr sciErr; - - //function varible - std::vector< Point2d > Src; - std::vector< Point2d > dst; - double cameraMatrix [3][3]; - double newCameraMatrix [3][3]; - double *distCoeffs = NULL; - double RectificationMatrix[3][3]; - - /*------------------------------------------- Checking Input Argument ----------------------------------------------------*/ - - CheckInputArgument(pvApiCtx, 5, 5); - CheckOutputArgument(pvApiCtx, 1, 1) ; - - /*------------------------------------- Source matrix :- First argument of the input -------------------------------------*/ - - sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr1, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - // For 1 X N single channel - for(i = 0; i < iRows; ++i) - Src.push_back( Point2d(pdblReal[(0 * iRows) + i], pdblReal[(1 * iRows) + i])); - - /* ------------------------------------ Camera matrix :- Second argument of the input -------------------------------------*/ - - sciErr = getVarAddressFromPosition(pvApiCtx, 2, &piAddr2); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr2, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - Mat cameraMat(3, 3, CV_64F); - for(i=0;i<3;i++) - for(j=0;j<3;j++) - cameraMat.at(i,j) = pdblReal[(j * 3) + i]; - - - /* ------------------------------------ Distortion Coefficient matrix :- Third argument of the input -------------------------------------*/ - - sciErr = getVarAddressFromPosition(pvApiCtx,3,&piAddr3); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr3, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - if(iRows== 1) - n = iCols; - else if (iCols == 1) - n = iRows; - else{ - Scierror(1,"Points matrix (arg 4) must be a 2 X N matrix"); - return 0; - } - if(n==4 or n==5 or n==8); - else{ - Scierror(1," n must be 4 or 5 or 8"); - return 0; - } - - - - Mat distCoeffsActual(1,n,CV_64F); - for(i=0;i(0,i) = pdblReal[i]; - - - /* ------------------------------------ Rectification matrix :- Fourth argument of the input -------------------------------------*/ - - sciErr = getVarAddressFromPosition(pvApiCtx, 4, &piAddr4); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr4, &iRows, &iCols, &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - Mat RectMat(3, 3, CV_64F); - for(i=0;i<3;i++) - for(j=0;j<3;j++) - RectMat.at(i,j) =pdblReal[(j*3)+i]; - - - /* ------------------------------------ New Camera matrix :- Fifth argument of the input -------------------------------------*/ - - sciErr = getVarAddressFromPosition(pvApiCtx,5,&piAddr5); - if (sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - sciErr = getMatrixOfDouble(pvApiCtx, piAddr5, &iRows, &iCols , &pdblReal); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - - Mat newCameraMat(3,3,CV_64F); - for(i=0;i<3;i++) - for(j=0;j<3;j++) - newCameraMat.at(i, j) =pdblReal[(j*3)+i]; - - - - /* opencv function for undistortPoints */ - try - { - fisheye::undistortPoints(Src, dst, cameraMat, distCoeffsActual, RectMat, newCameraMat); - } - catch(cv::Exception& e) - { - - sciprint("%s",e.what()); - - - } - /* Writing to Scilab */ - double *pstdata = NULL; - pstdata = (double*)malloc(sizeof(double) * dst.size() * 2); - - for(i = 0; i < dst.size(); i++) - { - pstdata[i + 0 * dst.size()] = dst[i].x; - pstdata[i + 1 * dst.size()] = dst[i].y; - } - - sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dst.size(), 2, pstdata); - if(sciErr.iErr){ - printError(&sciErr, 0); - return 0; - } - - //Assigning the list as the Output Variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - //Returning the Output Variables as arguments to the Scilab environment - ReturnArguments(pvApiCtx); - return 0; - - } -/* ==================================================================== */ -} \ No newline at end of file diff --git a/sci_gateway/cpp/opencv_xyz2rgb.cpp b/sci_gateway/cpp/opencv_xyz2rgb.cpp deleted file mode 100644 index cafe54a..0000000 --- a/sci_gateway/cpp/opencv_xyz2rgb.cpp +++ /dev/null @@ -1,280 +0,0 @@ -/* ==================================================================== */ -/* Author :Tess Zacharias */ -/* ==================================================================== */ -/* overloaded function */ -/* Syntax : return_matrix_3_xyz_values=lab2xyz(matrix_of_3_labvalues a) */ -/* Syntax : return_matrix_3_xyz_values=lab2xyz(matrix_of_3_labvalues a,String1 Name,String2 value) */ -/* ==================================================================== */ -/* ==================================================================== */ -#include -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include -#include -#include -#include -using namespace cv; -using namespace std; - extern "C" - { - #include "api_scilab.h" - #include "Scierror.h" - #include "BOOL.h" - #include - // #include "../common.h" - #define REF_X .95047; // Observer= 2°, Illuminant= D65 -#define REF_Y 1.00000; -#define REF_Z 1.08883; - -struct Color -{ - float X,Y,Z,R,G,B; -}; - -Color xyz2rgb1(float X, float Y, float Z) -{ - - float x = X; - float y = Y; - float z = Z; - float R1 = 3.2404542*x-1.5371385*y-0.4985314*z; - float G1 =-0.9692660*x+1.8760108*y+0.0415560 *z; - float B1 = 0.0556434*x-0.2040259*y+1.0572252*z; - if( R1 > 0.0031308 ) - R1 = 1.055 * ( pow( R1, 1./2.4 ) ) - 0.055; - else - R1 = 12.92 * R1; - if( G1 > 0.0031308 ) - G1 = 1.055 * ( pow( G1, 1./2.4 ) ) - 0.055; - else - G1 = 12.92 * G1; - if( B1 > 0.0031308 ) - B1 = 1.055 * ( pow( B1, 1./2.4 ) ) - 0.055; - else - B1= 12.92 * B1; - - /*R1 = R1*REF_X; - G1 = G1*REF_Y; - B1 = B1*REF_Z; */ - /* R1 = R1 * 255; - G1 = G1 * 255; - B1 = B1 * 255;*/ - Color rgb; - rgb.R= R1; - rgb.G= G1; - rgb.B= B1; - return rgb; - -} - Color xyz2rgb2(float X, float Y, float Z,char *s) -{ - double REF_X1; - double REF_Y1; - double REF_Z1; - if(!strcmp(s,"a")) - { - REF_X1=1.0985; - REF_Y1= 1.0000; - REF_Z1=0.3558; - } - else if(!strcmp(s,"c")) - { - REF_X1=0.9807; - REF_Y1= 1.0000; - REF_Z1=1.1822; - } - else if(!strcmp(s,"d50")) - { - REF_X1=0.9642; - REF_Y1= 1.0000; - REF_Z1=0.8251; - } - else if(!strcmp(s,"d65")) - { - REF_X1=0.9504; - REF_Y1= 1.0000; - REF_Z1= 1.0888; - } - else if(!strcmp(s,"icc")) - { - REF_X1=0.962; - REF_Y1=1.000; - REF_Z1= 0.8249; - } - else if(!strcmp(s,"e")) - { - REF_X1=1.000; - REF_Y1=1.000; - REF_Z1=1.000; - } - float x = X; - float y = Y; - float z = Z; - float R1 = 3.2406*x-1.5372*y-0.4986*z; - float G1 =-0.9689*x+1.8758*y+0.0415 *z; - float B1 = 0.0557*x-0.2040*y+1.0570*z; - if( R1 > 0.0031308 ) - R1 = 1.055 * ( pow( R1, 1./2.4 ) ) - 0.055; - else - R1 = 12.92 * R1; - if( G1 > 0.0031308 ) - G1 = 1.055 * ( pow( G1, 1./2.4 ) ) - 0.055; - else - G1 = 12.92 * G1; - if( B1 > 0.0031308 ) - B1 = 1.055 * ( pow( B1, 1./2.4 ) ) - 0.055; - else - B1= 12.92 * B1; - - /*R1 = R1*REF_X; - G1 = G1*REF_Y; - B1 = B1*REF_Z;*/ - /* R1 = R1 * 255; - G1 = G1 * 255; - B1 = B1 * 255; */ - Color rgb; - rgb.R= R1; - rgb.G= G1; - rgb.B= B1; - return rgb; - - -} - int opencv_xyz2rgb(char *fname, unsigned long fname_len) - { - // Error management variable - SciErr sciErr; - //variable info - int iRows = 0; - int iCols = 0; - int piRows = 0; - int piCols = 0; - int* piAddr=NULL; - int* piAddr1=NULL; - int* piAddr3=NULL; - double *value=NULL; - int* piLen = NULL; - char **val; - int i,j; - int error; - Color out; - double check; - Mat img,dst; - float X,Y,Z; - int *piAddrNew = NULL; - //checking output argument - CheckOutputArgument(pvApiCtx,1,1); - //checking if number of input arguments are 3 - - int k=0; - // SciErr getMatrixOfDoubleInList(void* _pvCtx, int* _piParent, int _iItemPos, int* _piRows, int* _piCols, double** _pdblReal) - double *pstDataR = NULL; - double *pstDataG = NULL; - double *pstDataB = NULL; - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the R values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 1, &iRows, &iCols, &pstDataR); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the G values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 2, &iRows, &iCols, &pstDataG); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive address of the list - sciErr = getVarAddressFromPosition(pvApiCtx,1,&piAddr); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - //retrive the matrix of the B values - sciErr = getMatrixOfDoubleInList(pvApiCtx, piAddr, 3, &iRows, &iCols, &pstDataB); - if(sciErr.iErr) - { - printError(&sciErr, 0); - return 0; - } - int m=0; - double *r,*g,*b; - r=(double *)malloc(sizeof(double)*iRows*iCols); - g=(double *)malloc(sizeof(double)*iRows*iCols); - b=(double *)malloc(sizeof(double)*iRows*iCols); - for(int i=0;i(i,j); - X= (pstDataR[k]); - Y= (pstDataG[k]); - Z= (pstDataB[k++]); - out=xyz2rgb1(X,Y,Z); - //cout< -#include "opencv2/core/core.hpp" -#include "opencv2/highgui/highgui.hpp" -#include "opencv2/opencv.hpp" -#include "opencv2/imgproc/imgproc.hpp" //new header file for cvtColor function of opencv -#include -using namespace cv; -using namespace std; -extern "C" -{ -#include "api_scilab.h" -#include "Scierror.h" -#include "BOOL.h" -#include -#include -#include "../common.h" -int rgb2gray(char *fname, unsigned long fname_len) -{ - - // Error management variable - SciErr sciErr; - //checking input argument - CheckInputArgument(pvApiCtx,1,1); - //checking output argument - CheckOutputArgument(pvApiCtx, 1, 1) - Mat img,grayimg; - //calling function - retrieveImage(img,1); - cvtColor(img, grayimg, CV_BGR2GRAY ); - string tempstring = type2str(grayimg.type()); - char* checker = (char *)malloc(tempstring.size() + 1); - memcpy(checker, tempstring.c_str(), tempstring.size() + 1); - returnImage(checker,grayimg,1); - //returning output variable - AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1; - ReturnArguments(pvApiCtx); - return 0; -} - -/* ==================================================================== */ -} diff --git a/sci_gateway/libskeleton_imageprocessing.c b/sci_gateway/libskeleton_imageprocessing.c new file mode 100644 index 0000000..c17faca --- /dev/null +++ b/sci_gateway/libskeleton_imageprocessing.c @@ -0,0 +1,70 @@ +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include +#include +static int direct_gateway(char *fname,void F(void)) { F();return 0;}; +extern Gatefunc opencv_DCT; +extern Gatefunc opencv_FFT; +extern Gatefunc opencv_match; +extern Gatefunc opencv_cameraMatrix; +extern Gatefunc PCL_radsearch; +extern Gatefunc opencv_cornerEigenValsAndVecs; +extern Gatefunc opencv_cornerHarris; +extern Gatefunc opencv_cornerMinEigenVal; +extern Gatefunc opencv_imattributes; +extern Gatefunc opencv_imcrop; +extern Gatefunc opencv_imread; +extern Gatefunc opencv_bboxOverlapRatio; +extern Gatefunc opencv_convolver; +extern Gatefunc opencv_rotationVectorToMatrix; +extern Gatefunc opencv_affine2d; +extern Gatefunc opencv_radius; +extern Gatefunc opencv_panorama; +extern Gatefunc opencv_exposure; +extern Gatefunc opencv_rotestimate; +extern Gatefunc opencv_focals; +extern Gatefunc opencv_opticalflow; +static GenericTable Tab[]={ + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_DCT,"raw_DCT"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_FFT,"raw_FFT"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_match,"raw_match"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_cameraMatrix,"raw_cameraMatrix"}, + {(Myinterfun)sci_gateway_without_putlhsvar,PCL_radsearch,"raw_radsearch"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_cornerEigenValsAndVecs,"raw_cornerEigenValsAndVecs"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_cornerHarris,"raw_cornerHarris"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_cornerMinEigenVal,"raw_cornerMinEigenVal"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_imattributes,"raw_imattributes"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_imcrop,"raw_imcrop"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_imread,"raw_imread"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_bboxOverlapRatio,"raw_bboxOverlapRatio"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_convolver,"raw_convolver"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_rotationVectorToMatrix,"raw_rotationVectorToMatrix"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_affine2d,"raw_affine2d"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_radius,"raw_radius"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_panorama,"raw_panorama"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_exposure,"raw_exposure"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_rotestimate,"raw_rotestimate"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_focals,"raw_focals"}, + {(Myinterfun)sci_gateway_without_putlhsvar,opencv_opticalflow,"raw_opticalflow"}, +}; + +int C2F(libskeleton_imageprocessing)() +{ + Rhs = Max(0, Rhs); + if (*(Tab[Fin-1].f) != NULL) + { + if(pvApiCtx == NULL) + { + pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx)); + } + pvApiCtx->pstName = (char*)Tab[Fin-1].name; + (*(Tab[Fin-1].f))(Tab[Fin-1].name,Tab[Fin-1].F); + } + return 0; +} +#ifdef __cplusplus +} +#endif diff --git a/sci_gateway/libskeleton_imageprocessing.so b/sci_gateway/libskeleton_imageprocessing.so new file mode 100755 index 0000000..c3e5587 Binary files /dev/null and b/sci_gateway/libskeleton_imageprocessing.so differ diff --git a/sci_gateway/loader.sce b/sci_gateway/loader.sce new file mode 100644 index 0000000..96f402d --- /dev/null +++ b/sci_gateway/loader.sce @@ -0,0 +1,41 @@ +// This file is released under the 3-clause BSD license. See COPYING-BSD. +// Generated by builder.sce : Please, do not edit this file +// ---------------------------------------------------------------------------- +// +libskeleton_imagepr_path = get_absolute_file_path('loader.sce'); +// +// ulink previous function with same name +[bOK, ilib] = c_link('libskeleton_imageprocessing'); +if bOK then + ulink(ilib); +end +// +list_functions = [ 'raw_DCT'; + 'raw_FFT'; + 'raw_match'; + 'raw_cameraMatrix'; + 'raw_radsearch'; + 'raw_cornerEigenValsAndVecs'; + 'raw_cornerHarris'; + 'raw_cornerMinEigenVal'; + 'raw_imattributes'; + 'raw_imcrop'; + 'raw_imread'; + 'raw_bboxOverlapRatio'; + 'raw_convolver'; + 'raw_rotationVectorToMatrix'; + 'raw_affine2d'; + 'raw_radius'; + 'raw_panorama'; + 'raw_exposure'; + 'raw_rotestimate'; + 'raw_focals'; + 'raw_opticalflow'; +]; +addinter(libskeleton_imagepr_path + filesep() + 'libskeleton_imageprocessing' + getdynlibext(), 'libskeleton_imageprocessing', list_functions); +// remove temp. variables on stack +clear libskeleton_imagepr_path; +clear bOK; +clear ilib; +clear list_functions; +// ----------------------------------------------------------------------------