From: zlf lf on 5 Apr 2010 20:45 It works pretty! Thank you very much:) superZZ "Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <hpd86f$jgk$1(a)fred.mathworks.com>... > Maybe try this: > % Demo to median filter an image. > > % Change the current folder to the folder of this m-file. > % (The line of code below is from Brett Shoelson of The Mathworks.) > if(~isdeployed) > cd(fileparts(which(mfilename))); > end > clc; > clear all; > close all; > workspace; > p = [ > 95 95.0052630121090 96.0468635614927 96.1301201497221 96.1873172512884 97.3293378175358 98.5088828481980 98.7319603775799 98.8584847142621 99.1413132856328 100.448992030781 100.806745806022 102.181211580212 102.610915598683 103.077640640442 103.324730824716 106.042444332446 106.606754007427 106.254411673116 106.569226327303 107.224064463161 109.201648339208 108.632407687577 107.540689973610 81.0246875958186 109.165012710117 110.022724925353 110.018180315801 112.294256309038 117.720006795786 115.602768132947 114.389684849640 114.057003292213 115.663304466023 116.764720699362 118.460964034571 118.224362971428 118.600168633944 119.016805536025 119.473846510439 121.379569944863 121.918005233025 122.494897852931 123.109707172099 122.347864713692 123.036579926459 123.761868117769 124.523090228279 128.144449743249 128.316016147635 127.781062759706 128.689548915209 133.225372958757 133.600149700 > ... > 515 134.617977996997 139.269522868429 141.173651932646 143.122325302519 145.113748487178 145.773797371133 146.485494162391 129.375422704623 129.294238077340 150.266430050095 151.168779845575 153.447059274526 155.347996446687 156.387339641034 158.398232313369 161.755989069957 163.865798750075 164.757397406004 187.211110781385 169.248338248858 168.404275480167 170.765921658860 171.959297509614 172.244012958361 173.769962881966 179.254009718053 178.709261091864 180.188789884388 181.727818453862 183.324848288496 183.983694929741 193.662076824555 191.441897190766 190.213038459513 191.094217599591 196.022957839127 198.002525236422 198.040399918804 198.123698733897 203.297811104793 203.553432788543 203.796467094010 203.194488114220 204.533615819014 124.310096130604 205.664775788174 208.312265601428 208.865985742054 208.691159371929 209.570990358876 210.523157871052 209.353767580142 215.52030066 > ... > 7942 214.462117867002 211.558502547168 210.622885746065 208.806130178211 208.925824157762 208.542561603141 216.393160705231 194.092761328186 192.314846020790 50.1198563445667 49.7393204617835 50.2493781056045 49.3963561409139 49.9299509312797 176.954796487691 177.789201021884 176.465294038233 176.011363269534 174.805606317418 78.2432105680742 78.1024967590665 78.7464284904401 172.904597972408 123.166553901617 174.040225235432 170.425936993170 170.414201286160 170.449405983125 171.265875176580 169.994117545284 168.772035598318 167.600715988924 167.107749670684 173.219513912261 173.600115207335 174.025860147278 175.316856006489 175.285481429581 175.025712396779 174.264167286336 171.327172392473 171.540082779507 206.305598566786 170.417135288679 169.047330650324 169.056203672033 195.071781659983 203.273215156351 170.308543532026 169.168554997671 172.168522093907 172.069753297900 172.0290673 > ... > 11312 275.136329843952 170.205757834452 164.283291907607 163.487002541486 165.656270632898 201.099477871028 162.388423232692 157.689568456509 156.348968656656 155.858910556952 171.548826868621 153.062078909180 150.748134316813 150.562279472649 146.342065039414 145.168867185771 144.086779407411 144.013888219158 157.003184681076 157.028659804508 136.091880727691 137.233377864133 139.359247988786 142.593828758470 134.836938559135 134.082064423248 132.370691620162 107.354552767919 132.018938035420 130.418556961807 64.5368112010502 63.7887137352682 64.0312423743285 64.2884126417817 118.680242669115 118.296238317201 123.016259087976 121.757956618859 121.490740387900 115.879247494968 114.389684849640 114.236596587959 113.718951806636 112.729765368336 111.359777298628 111.364267159624 110.941425986869 111.018016555873 109.772492000501 107.703296142690 106.531685427388 106.230880632705 106.508215 > ... > 645555 106.254411673116 106.606754007427 106.400187969759 106.826962888589 106.667708328247 105.759160359753 104.890419009555 104.804580052591 104.004807581188 101.833196944808 100.409162928490 99.0050503762308 98.3514107677160 97 96.4261375354214 95.1314879522022 95.2680429105164 95.4253635046784 95 95.2102935611481 94.8683298050514 95.6922149393565 94.5780101292050 94.3398113205660 93.2952303175248 93.6482781475452 94.0212741883453 93.9414711402797 93.4772699644143 92.5742944882649 91.7060521448830 92.1954445729289 81.5414005275848 91.9238815542512 92.1140597303148 92.6984358012583 92.0271699010678 91.7060521448830 91.0933587041339 90.5207158610668 91.2140340079310 90.7083237635885 90.4709898254684 90.0277734924062 88.6453608487212 88.4590300647707 88.1192374002408 87.9659024849970 88.6848352312840 88.5663593019381 86.3712915267567 85.2115015710907 85.1469318296320 85.0529246998597 .... > 85.0235261559999 84 85.0058821494136 85.0235261559999 86.0929730001235 86.1452262171271 85.2877482408816 85.3756405539660 84.5931439302264 84.7171765346320 85 85.1586754241751 84.5281018360166 84.7230783199005 83.9523674472614 83.4326075344646 83.6779540858881 84.2021377400835 83.5224520712844 82.8613299434664 82.2192191643779 81.5965685553014 81.3449445263810 81.7067928632620 81.1541742610939 81.9390017024860 81.4370922860093 80.0562302385017 80.4984471899924 50.5371150739731 50.1198563445667 50.1198563445667 49.7393204617835 50.2493781056045 79.6115569499806 79.3221280602078 79.0569415042095 78.2368199762746 78.0064099930256 78.4091831356506 78.2432105680742 78.1024967590665 77.3369252039412 77.2334124585985 77.1556867638413 77.1038261048049 77.0778826901725 78.4920378127616 78.5175139698144 77.8331548891602 77.8973683766018 77.9871784333810 78.8733161468440 79.0253124005214 > 79.2022726946 ... > 645 80 79.6303962064738 79.8811617341661 80.7093550959243 82.6801064343775 83.0060238777885 83.8629834909300 82.8552955459094 81.8840643837371 82.2982381342395 82.7345151674922 83.1925477431723 83.6719785830358 85.0881895447306 85.6154191720160 84.8645980371085 85.4400374531753 85.7029754442633 85.3814968245462 86.0232526704263 87.6413144584219 88.3232698670062 88.7693640846886 88.5268320906153 89.0505474435727 89.8220462915425 89.4427190999916 89.2692556258872 89.9444272870754 90.7964757025293 91.5478017212866 91.4439719172346 93.2630687893123 95.1892851112981 94.0850678907126 94.0212741883453 > ] > > plot(p, 'r'); > p_MedianFiltered = medfilt1(p, 19); > > % [B,idx,outliers] = deleteoutliers(p, 3) > > hold on; > plot(p_MedianFiltered, 'b', 'LineWidth', 2); > ylim([0 300]); > set(gcf, 'Position', get(0,'Screensize')); % Maximize figure.
From: Image Analyst on 10 Apr 2010 10:27 You could also try RANSAC: http://en.wikipedia.org/wiki/RANSAC RANSAC is an abbreviation for "RANdom SAmple Consensus". It is an iterative method to estimate parameters of a mathematical model from a set of observed data which contains outliers. It is a non-deterministic algorithm in the sense that it produces a reasonable result only with a certain probability, with this probability increasing as more iterations are allowed. The algorithm was first published by Fischler and Bolles in 1981......
From: Image Analyst on 10 Apr 2010 10:37 To use RANSAC though, you'd have to have an assumed model for your data.
From: Mark Shore on 10 Apr 2010 13:31
"Image Analyst" <imageanalyst(a)mailinator.com> wrote in message <hpq1rq$328$1(a)fred.mathworks.com>... > You could also try RANSAC: > http://en.wikipedia.org/wiki/RANSAC > > RANSAC is an abbreviation for "RANdom SAmple Consensus". It is an iterative method to estimate parameters of a mathematical model from a set of observed data which contains outliers. It is a non-deterministic algorithm in the sense that it produces a reasonable result only with a certain probability, with this probability increasing as more iterations are allowed. The algorithm was first published by Fischler and Bolles in 1981...... Thanks, that's interesting reference to a method that never made it over to my fields of study. The name of the author of the RANSAC toolbox ( http://vision.ece.ucsb.edu/~zuliani/Code/Code.html ) could be a bit offsetting to CSSM veterans though ;-) |