位相画像をアンラッピングする演算方法について
3 ビュー (過去 30 日間)
古いコメントを表示
位相画像を読み込み,画像と二次元hanningフィルタを周波数領域で演算し,位相画像とフィルタ処理された画像を差分することで位相ラップを除去する方法をコード化しました.
しかし,自作フィルタの演算法やフィルタ処理後のcomplexの扱いが悪いのか元画像と変化がなく,位相のアンラッピングができません.
とくに周波数空間におけるlow-pass filteringが違うのではないかと考えています.
圧縮されたデータを貼り付けていますので非常に見苦しいかと存じますが,何卒ご教示頂ければ幸いです.
%% 位相画像読み込み
alldata = [1873.64410130912 1865.93992430856 2208.83269309555 2057.51596378675 1951.28294238425 2099.44363787095 2084.39148913720 1953.94096542220 2285.07323054387 2047.44834039337 2059.54361761687 1987.24054109538 2146.69649394252 1925.82645291626 1967.50488277175 2067.48268153076 2171.23137325561 2172.68657101411 2025.93531589769 1982.15469706687 2018.05538080377 2120.15302861645 1914.51474931953 2033.60053707939 2105.31453914451 2023.84213304939 1929.23291371251 2157.57644186169 2323.88268906530 2223.85763375368 2263.56682629511 2120.68825564021
2184.47474625660 2225.55239404459 2034.04355617031 2397.08006207435 2158.41706879088 2128.34704943304 2306.49579628790 2128.01713267551 1847.99168673414 2038.02661024663 2159.83586038067 2310.87295896420 1864.90902679437 1946.21208147216 2048.19626478921 2004.94417954725 1970.22025424358 1983.54178491631 1788.89387514931 1884.89822204295 2077.52126829349 2018.12825990724 1843.54527698527 2015.09613323864 2048.24818225577 2045.61443576519 2192.14367519529 1992.82078133640 2025.21448385483 2148.27603452373 2077.30342654279 1934.86702672951
2191.60582533898 1839.37054163078 1671.79256676044 2199.47058402677 2386.21138478373 2455.47373409220 2268.09856011788 2193.64773139264 1828.32308551902 2120.07349346532 2101.91108232550 2091.80190404737 1969.65233776439 2131.02717393986 2048.34128648625 2329.09871210554 2113.33668779163 1945.26124405372 2302.21940582641 1978.08940531476 1976.96123222075 1710.42938189348 1961.02912797662 2303.49816174363 2039.91063394560 1704.30031379452 2094.17557872529 2345.29240928241 2105.73249350046 1654.50190769113 1874.40976378764 2099.13916119188
2276.34623284149 2186.13952865498 2205.32137746154 2182.31892635813 2090.94242366334 2100.04656832502 2250.19682447519 1836.73912391253 2228.46030954015 2296.37860127119 2264.30766900815 2051.18981571822 2108.77831212711 2182.97083618864 2122.59929808951 2189.41896117129 2095.37382354261 1968.59496711800 2085.32311383891 2100.08398477733 2100.40935313911 2237.10278508510 2483.04703466338 1978.15852764924 2126.80036723800 2100.43538083928 1753.45324451127 1866.39696818707 2380.56955650868 1750.15566778206 2255.21916754218 2259.62223258172
1980.17949517607 2090.47133461665 2220.56446556444 2025.27788397740 2125.04514438240 2267.99051814177 2164.85199146508 2202.63286216860 2007.48906376073 1977.30766912829 1749.85400593211 1870.45194917033 2118.12768200762 2055.31409197697 1908.74603032065 1991.26819778164 1737.79848311702 2203.90256428462 2098.85057862033 1900.70812221151 1818.85225021630 2106.57219945989 2331.61550684110 2122.17415495473 2251.89534805133 1838.05373905925 1821.75284629827 1711.35171210486 1975.68532734597 1836.99387534708 2194.66099926224 2203.11500674207
1855.99130486720 2087.03518641763 1953.74610278523 1968.57912052749 2143.53080489044 2016.43221863033 1993.42359309108 1857.70135662099 2072.97244891920 1898.44921240280 2239.64439832070 1702.80121855135 1845.10407800763 2055.09171372699 2372.00148879970 2353.77696307097 1555.16521102190 1589.66442736262 2229.17240184709 2053.95183192426 1680.06750241923 1715.06806581398 1762.57233392983 2134.21092730667 2496.15717687947 2238.84180876636 1910.71851838683 2159.49218482524 2499.53618206526 2398.76493687253 2145.18799218466 1869.10207697237
2037.49167823745 1974.16195191420 2006.31538025616 2033.98690661602 1907.48366641742 1870.39438421000 2349.68854187406 2412.30584669765 2490.19049357832 2283.10077777505 2715.91183227277 2463.23984750849 2449.85672193370 1912.54880683916 2081.97969416203 2440.27709835325 2479.42749374313 1943.70685178204 2765.56701924442 2394.03145826003 1589.39771618997 2057.26938407472 2310.31916386890 2172.66226536478 1878.26678541675 2260.20945833670 2303.96768782125 2268.53764617373 2639.31670604693 2541.41551676369 1656.73284834879 1924.44966218527
2502.56949164742 2610.45443284558 2277.57663275395 2034.91940257419 1973.12891806848 2088.82836817531 1939.68117596186 2171.70215887344 2120.49035930890 2543.86937906849 3017.33277584054 3502.65609119833 3478.53960440285 3121.24918764527 2632.52065626998 2254.91153422208 1632.95584463095 1809.66748522455 2447.61815756536 1950.17262139684 1761.93424128089 1414.39227626054 1558.14766441798 1773.62515986967 2001.83019162714 2299.52952020685 2096.30583439302 1979.50945012597 2429.88586568018 2300.94042910775 1867.18272923608 2309.47136486508
2039.45372880134 2566.40417014924 2528.76936997031 2082.57916571014 2058.36257885792 2152.50820320053 1664.89068970154 1755.67546885763 2071.61720173457 2665.50293299695 3161.99747075490 3511.56157358782 3550.70172074181 3286.41085072723 2859.89324882277 2180.99114315026 1573.15373009723 1219.31158380630 2043.42666405812 1946.79975678446 2170.93373050541 2373.96946836845 1482.12813558499 1660.93541407306 2170.15367849194 1619.26330919284 1850.53691174346 2089.91203605686 1435.83950868971 1768.84119093209 2398.09744932828 2208.36090287939
2093.66822776571 2311.88928255742 2780.31922735809 2232.02723935852 2366.90512842685 1743.82597897900 1235.41154291271 1427.86783331912 2166.26026635128 2712.70406913455 3038.67316249083 3323.15898200241 3348.49444919662 3038.67327882140 2781.28654499585 2220.45386954187 1889.74227506761 1358.41701488383 1203.53473502491 1813.35578258638 2062.69307795353 2231.80234968197 2307.84303278965 2399.62046196754 1651.81906785839 1605.80583557929 2209.70787134324 2322.75501688221 1786.20142540173 1942.00039138412 2191.17012308235 2000.81788323377
2325.07116082171 2741.36424383800 2400.51461042347 1555.45092116157 2387.44408750488 1618.35214522737 1273.04455080722 1783.63920667279 2270.16303424956 2472.04816155415 2512.30946483067 2596.26166948769 2659.01014169282 2576.18980097328 2295.08310393011 2139.74690224533 2217.85741083813 2638.25718292687 2683.88644304685 2346.17365397606 2057.12729221699 1987.90691577410 2078.15531286504 2203.57628098666 2149.35567184235 2037.04444836173 1866.29701675638 1938.88345943997 2214.23852162599 2401.19242005213 2347.53541886387 2357.68044424942
2291.77681003674 2643.36476963968 2017.06661653821 2107.09989992715 2339.19595853915 1718.30392773147 1950.46586571122 2105.83793215919 2070.40102931159 1942.16589786788 1993.08102647844 2026.36160811572 2010.44794874475 1862.13182376395 2048.67769760382 2269.94099005428 2843.23864692030 2269.83058294933 1656.47510335688 1869.65420865896 2036.43723653839 2127.81898748758 1956.44993983512 1843.08327898686 2020.17631019070 2048.52721379930 1972.98970268178 1987.85317218676 2000.10284115793 2205.78479183652 2370.39965094673 2633.09155865549
2229.21223584050 2313.62231780030 1899.76072342717 2180.91901680222 1864.61588607798 1625.40989223076 2135.45578693831 2072.13773601200 1988.72499811673 1731.82130379044 1492.01438143617 1677.32267778437 1807.49634101312 1496.05045183725 1773.78840471315 2926.07727309293 2003.76960145496 1849.54975807131 2232.28950472572 1949.47343100305 2094.45384791773 2057.80900994409 2111.88517438062 2403.69535170821 2271.02060325281 1921.86354246060 2039.75398116722 2379.68281138479 1738.81895496440 1800.77991715446 2791.32165588136 2207.14736796869
2100.34566474450 1515.85566809215 2025.45341335423 1665.91728765704 1638.46195857576 1697.20835133293 2058.26953329635 1948.81921510259 2193.01226334367 1986.54646722716 1597.01370876888 1521.98017562460 1775.23583423276 1907.93238373986 2256.28352178494 2536.65800872888 1666.93240231881 2088.62526956480 2021.35684871092 2321.57234329218 2226.50149602676 2000.80531031615 2038.82856075489 1746.48221954936 2016.85086403298 2140.02546834643 1812.02391932905 1647.27546834736 2183.59943594947 2038.63657184201 2625.00938942796 2246.69261980359
1830.97001720150 1865.95719250664 2148.75560188177 1632.40853554336 1854.08860890660 1735.82159681735 2014.61559972004 1980.50335849100 2054.23680852749 1997.19766415400 1484.43945285375 959.432745994767 1403.88544068276 2067.47464420693 2765.22744566924 1372.61321370583 1960.47549834824 1918.90912225447 2286.12660773029 1590.73143886193 1390.72376838955 2187.74787292210 1999.04094827781 2454.68590397597 2123.29555696272 1607.23660526169 2139.70031556347 2103.99543333147 1670.60954329860 2045.67441519676 2713.84958229563 1859.31856210507
2068.57214183849 2447.67088120757 1915.30581247876 2127.63670682441 1583.19890737347 1423.62138893944 1963.64637607289 2011.29995927704 1802.87642059731 1549.16008853447 1397.38157870807 1845.49755682377 1522.71538101533 1875.45242883428 2754.95094142482 1475.67916001962 2160.24456015811 2032.09681252297 2200.31412770390 1742.56219820166 1552.38772162446 1773.88015885488 1737.74808386038 2614.02676994842 2551.97717835801 2122.53968470846 2288.98327275319 2339.55305406661 1862.65053338115 1961.16328508477 2910.01439012215 2309.31981714489
1907.84613202768 2621.26831579930 1896.14710739977 1911.52664932329 1762.83214695891 1489.91106320685 1829.02357391967 2032.05293874582 1973.90302915568 1476.51324501657 1264.28714372031 2176.11545172147 1361.39499461814 1718.87887977576 2842.77282428509 1129.80229638936 2091.15925682965 1983.80565151200 2359.96915853210 1830.92809560639 1441.63096632948 2132.31356757949 1758.80632305332 2722.47378055495 2423.00493360357 2212.00819969480 2394.21818590676 2039.58034738316 1562.35248943046 1958.80970527255 2111.63559355540 1840.94499296346
2090.39256256004 2232.35985124484 2100.14031930920 2311.57703147782 1881.22876802599 1191.81913376530 1753.43112641829 2029.91759278695 1810.28321894957 1558.98501408589 1427.25318833697 1023.20443187840 1156.15751692140 1681.72065134766 2716.72598091490 2184.29875270207 1596.61688977527 2020.83784169541 1938.33646374452 2276.32049473585 2265.92391990800 1991.36834722292 2168.22556744912 1827.44220488169 1919.82290647319 1938.19571578479 2108.82040923857 2080.01446049195 2218.36044417322 2014.43341720640 2389.91027228558 2262.25257940358
2184.68445703760 2613.50924533047 2183.61557460437 2084.38745436911 2019.03494696016 1259.78260494163 1686.18340237997 1988.41361468681 1918.89856807026 1793.08291119267 1529.12335002795 1180.30078293686 1283.77251497237 1665.82567937532 1748.84686720767 2359.75737628387 2300.86865734984 1823.49678284186 2146.65997852501 2026.40232357569 1994.05224454007 1933.77934540412 2081.08097667899 2400.29058753280 1557.37956604501 1573.63691422553 2042.58829253982 1913.88469753624 2085.50793343713 1941.53754852363 2276.65021603974 2351.69817781448
2072.43203099188 2548.95542242611 2559.08360664407 1853.37141064275 2160.33847430605 1068.63699257630 1774.68768967805 1962.98978642072 2061.08892540773 1969.19364162255 1629.63791490486 1603.28180506569 1531.37886915286 1452.47445909702 1348.99585136771 2100.26821330772 2665.68985651177 2354.47508919961 1715.85586271575 1781.36621787469 1896.29293525801 2032.96252420940 1833.72990473942 1497.41038970533 1632.44124892354 1947.32735791989 2089.46403430891 2281.54065027880 2290.06468761130 2347.97409594292 2017.56275141682 1854.47356213140
1833.94336017780 2446.66401595017 2981.87890657084 2007.63909171382 1652.02355268830 1711.74413557444 2122.03860312793 2435.43992228434 2077.48420759174 1941.15023475094 1822.83194786264 1673.39658363326 1573.51631869469 1746.88780658343 1650.23105951329 1845.37818082701 1939.67659903388 2513.41380997002 2818.52371502086 2686.76575143263 2446.88602711912 1798.66830583615 1608.75023548305 1599.59314767551 2111.52956319787 2453.28518163762 2419.03329889895 2051.43116203719 2180.02289069165 2635.18952539191 2353.95278341323 1815.45435578236
1596.45580827445 2030.37611007458 2571.22519016173 2029.00347369467 1531.99302430428 1722.64868456940 2254.26261593215 2626.93928721221 2217.19815262780 2215.05273101525 2035.70755913388 1950.98042873526 2092.06256358163 2272.24671580875 2218.43254060322 2068.85368944332 1816.87307124771 1727.04451787588 1743.14271740126 1684.10186493164 1740.34376769187 2314.59671819769 2898.56825570017 2462.83353328635 2301.17403921997 1901.37304018647 1695.11133274343 1964.05724185426 2081.84624754079 2335.69667088706 1692.71191790490 1653.15197697328
1818.92474199319 1922.64001930831 1929.22103547445 1921.01332844771 1722.83559781336 2071.74170419923 2002.66233658278 1488.76658289763 1647.28359320969 2207.67305696127 2385.83113018819 2656.96609898191 2987.39955157368 3221.15183643671 2972.33772874461 2397.88495847979 1812.54996015900 1428.56690904382 984.849076218670 925.025693674572 1823.20561777661 1962.09074550960 2066.28169971937 2064.80257150834 1677.76744245738 1563.67921756301 2089.82242600503 2616.00639100513 2443.17700584629 1637.66978916223 1015.40036626440 1615.08052550256
1937.87203091057 2193.43097988144 1772.53182226047 1595.09837372974 2112.90913294349 2173.64921567380 2113.52402861882 1848.59902464459 1400.88446849212 1915.58980870829 2267.70346523402 2890.95954974275 3464.90982399462 3835.67411989928 3689.63769107545 2820.19368225895 1906.97898733453 1413.87901578797 1296.23977607931 1275.99449550291 2311.74941014405 1931.51551412744 1361.51814861898 1967.28248278447 1662.16003042040 1656.60602394049 2406.66352668009 2562.66640472948 1721.74356365949 1492.80305158952 1748.81356383138 1888.78499840153
2313.42016000021 1953.17889589514 1558.77072710055 1834.88384072739 2175.26510136481 2201.68987589073 2141.58216391504 1971.98062967625 1773.83399416180 1954.33698221226 1942.68691382254 2508.64910673071 3127.95074235834 3671.66350095510 3638.50439650379 2811.13301108731 2208.67990680551 2114.25360476947 1729.46452523884 2491.41865962581 1940.70962699526 1523.90107436781 2068.36286201468 2391.56022873498 1725.79392563831 2319.29112803843 2540.68100513262 1917.96721875807 2096.87831752421 2325.64462020248 2164.52667185059 2120.77880831086
1847.44522852730 1430.64092221018 2129.89885422005 2270.59169809311 2220.39344001142 2037.98649693560 2157.27863330138 1845.06256307196 2099.15464895451 2062.09713749983 1941.76185258548 2189.63686074223 2263.47594779427 2780.55961403972 2115.41482571024 1906.89514090098 1852.96261002542 1734.61230935389 2431.04890895053 2265.16241105041 1689.18132757861 2133.42266982980 2521.90351309627 2365.14181093499 2113.59299966437 2263.36204144196 2142.79430788709 1676.47661474091 2096.18340940541 2150.54876403161 2226.64634087333 2183.19007572415
2136.44035641151 1791.53159773583 2297.08425015234 2037.42173297773 2214.15725596761 2434.03249603300 1743.61409547273 1920.88871070603 2370.21837537573 2169.63838179759 1963.45797645627 1891.68427668349 1587.59868832584 2016.42981936526 1842.69135100511 1774.01711044111 1383.70822845143 1724.51137978514 2478.40452622878 2006.00412396574 2099.62908338546 2044.10959328711 1985.39877351816 1575.00639162678 2063.22321215714 2241.78700107639 1924.06566794962 2150.74891603435 2368.61987813283 1878.85114592197 2334.93112365855 2300.48346459353
1976.22381761135 1832.29610207398 1970.47435460170 1616.17068488151 2021.99550648313 2314.33217585855 2404.04824849288 2031.36467377935 2105.26517204405 1918.25242411066 1944.82851216081 2276.25281220675 1987.74961517681 2126.57075115084 2171.73553270148 2051.94527700846 2048.66623487417 1999.37599748489 2150.28053613915 2154.46485771169 2270.57486338704 2046.62661496643 1932.76976136724 2120.74486675719 1853.69327576878 1892.91250244179 1885.94896982005 1951.37623607437 2057.07509271917 1915.89778559236 2107.23578726407 2165.05417956412
2086.92488231161 2038.39852967719 2070.18266761303 2103.62745633442 2117.77597345645 2228.10090434365 2453.26313408208 2032.66444997210 1946.27781428234 1978.75323565025 2179.83192529460 2080.03834765055 2045.00657330197 1971.74012829992 1964.71289027971 2141.49537931010 1942.45201648213 1905.27842542762 2073.13160484750 2028.66437734384 2045.00118817366 2042.53948644293 1883.85850681271 2014.65182892955 1705.00558162807 1866.82040124410 2299.80203413637 2274.03895657510 2154.85557320621 1872.03569256887 1939.01058712183 1975.26514902757
2143.66053446056 2119.70706982375 2032.13596199220 2061.85839957860 2082.97556978394 1731.51603099005 1971.19686211715 1827.09842562652 1880.47137196525 1746.77843925706 2224.57711489662 2404.44159123115 2230.14448891813 2005.67727961135 2096.16907624411 2168.89368991856 1916.19376205537 2138.02510660654 2138.77195362025 2150.18739582528 2142.84228211758 2025.39213126851 1994.82911183732 1937.67910182825 1967.75276387669 2103.79887788557 2072.57383003691 2137.20913951239 2475.44192200922 2017.97272202699 2000.23416839051 2209.28832961619
2259.41731300345 2226.41211387515 2057.46468793415 2029.90569895622 1993.38533538044 1902.73270221497 1880.66354905465 1904.81218179432 1961.45506991469 2072.92615882005 2134.10040313471 2062.49442561623 1812.77019264945 2013.29696995742 2149.61403194256 1993.07226951211 2083.47110658488 1958.35236779461 2068.67143268022 2007.56813853700 1907.04689169652 1898.26721556648 2088.24910703208 2221.31249723141 2246.43140036007 1944.07421036577 2013.16830767901 1849.90287380619 2091.01673012343 2255.40797127178 2391.30139583838 2346.25237003295
2075.11398960697 2028.39866739418 1918.24972839886 2058.40821895096 2145.78621219471 1990.90643301769 1728.21392210689 1662.39256574702 2076.77757680649 1930.35288065020 1855.55498265987 1985.09305413882 2155.59249142627 2067.76219189609 2166.27423231956 2112.11246161512 2368.80745871807 1872.61927052937 1876.57291903743 2086.92660861323 2098.06682548509 2065.24936405616 2213.20263636811 2133.50936253974 2081.52312289435 2180.53818268701 1959.58826556127 2141.91900807573 2024.79218514636 1943.02340265317 1975.17132842401 2041.21894278913]
[km, kn] = size(alldata);
%% 位相画像を周波数空間へ格納
J = fft2(alldata); %画像に対して 2次元FFT (周波数領域 0 ~ 2*pi)
J = fftshift(J); % 周波数領域を-pi~piとする (中央に)
figure(1), imagesc(20*log10(abs(J))) % パワースペクトル表示
%% フィルタの作成
Kernelsize = 8;
w0 = hanning(Kernelsize)*hanning(Kernelsize)'; % Hanningフィルタ:任意サイズ作成
w = zeros(km, kn);
w((km-Kernelsize)/2:(km+Kernelsize)/2-1, (km-Kernelsize)/2:(km+Kernelsize)/2-1) = w0;
% フィルタ処理
filtered_J = J.*w; % フィルタ処理 (周波数空間フィルタリング)
filtered_J = ifftshift(ifft2(filtered_J)); % 周波数領域を 0 ~ 2*pi に戻す,IFFT処理で空間領域へ変換
figure(2), imagesc(abs(filtered_J))
%% フィルタ処理された演算画像出力
Phase = alldata-filtered_J;
figure(4),imagesc(abs(Phase)) % フィルタ後の画像表示
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で イメージのフィルター処理 についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!