とらりもん - PolSARpro Diff
- Added parts are displayed like this.
- Deleted parts are displayed
like this.
2017/05/14 JIn Katagi (一部修正)
{{toc}}
! PolSARproとは
* [[公式ページ|https://earth.esa.int/web/polsarpro/home]]
ESAがリリースしているPolSARの解析ツール。
オープンソースであり、頑張ればLinuxでも動く。
ツールの使い方に限らず、PolSARの基礎までカバーしている充実した[[ドキュメント|https://earth.esa.int/web/polsarpro/documentation]]が特徴。
! インストール
PolSARproは現在v5.1が最新です(2017/05/14).
以下は古いバージョン(v5.0.4)のインストール方法です.
[[Sentinel-1 Toolbox]]が必要なので、必要に合わせて参照してください。
!! Ubuntu
wget https://earth.esa.int/documents/653194/1960708/PolSARpro_v5.0.4_Linux_20150607
unar PolSARpro_v5.0.4_Linux_20150607
sudo apt-get install tcl-dev
sudo apt-get install tk-dev
sudo apt-get install bwidget iwidgets4
sudo apt-get install itcl3 itk3 libtk-img
cd PolSARpro_v5.0/Soft/
chmod +x Compil_PolSARpro_v5_Linux.bat
ここで
vi ./Compil_PolSARpro_v5_Linux.bat
で, パスが変になっているところを修正(\が使われているところを/に修正)。その後,
./Compil_PolSARpro_v5_Linux.bat
古いバージョンでよければ...
sudo add-apt-repository ppa:a.valentino/eotools
sudo apt-get update
sudo apt-get install polsarpro
!! Fedora
「Ubuntuへのインストール」のapt-getの箇所を以下に変更。
sudo dnf install tcl-devel tk-devel bwidget iwidgets itk-devel itcl-devel tkimg
PolSARpro_v5.0/GUI/bmp_process/ViewBMPFile.tcl の28行名を以下のように書き換える
package require itk
! インストール後
GUIの実行ファイルは ./PolSARpro_V5.0/PolSARpro.tcl
これを立ち上げるとPdf reader周りで怒られるので、
OK -> Yes -> (Selection:) /usr/bin/evince -> OK -> Save & Exit
以下、同様にpathを指定していく。
(Google Earth) (Selection:) /usr/bin/google-earth
(gimp) (Selection:) /usr/bin/gimp
(ImageMagick) (Selection:) /usr/bin/convert
(Asf mapready) /usr/local/bin/asf_mapready
(s1tbx) /home/hoge/snap/bin/snap # 不安
上記の手順でインストール後、[[RESTECが提供しているPALSARのポラメトリデータ(L1.1)|http://www.alos-restec.jp/staticpages/index.php/service-sampledata-04]]に対してYamaguchi 4 components decompositionまで出来ることを確認。
GUIの挙動やエラーメッセージがおかしいが、とりあえずLinuxでも動く模様。
プログラムの詳細は付録しているヘルプのpdfを参照するか、Soft/ 以下に内蔵されているCプログラム(Soft/data_process_sngl/yamaguchi_4components_decomposition.c)を読めばいい。
! 実行
!! Level 1.1
!!! データのダウンロード
[[RESTECが公開しているPALSAR/ポラメトリック L1.1|http://www.alos-restec.jp/staticpages/index.php/service-sampledata-04]]をダウンロードする。
(仕様書は[[こちら|http://www.eorc.jaxa.jp/ALOS/doc/fdata/PALSAR_x_Format_JL.pdf]])
unzip psr_plr11.zip
!!! Yamaguchi 4 components
(メモ)コヒーレンスの計算の前に、大気補正が必要?[[参考(2.2 Terrain correction processing flow)|https://media.asf.alaska.edu/uploads/RTC/rtc_product_guide_v1.2.pdf]]
↑ SARにRadiometric calibrationはそもそも必要ない気がする。
./PolSARpro_v5.0.tcl
#ENTER -> ALOSのロゴをクリック -> Data Processing Level 1.1 -> Quad-Pol
#Environment -> (Main Input Directory) /home/jin/workspace/SAR/PSR_PLR15 -> OK -> Save & Exit -> (WARNINGが出るが無視して)No
#Import -> Input Data File -> (SAR Leader File) -> LED* を選択 -> OK -> Check Fiels -> OK -> Read Header -> OK -> OK
#Import -> Extract -> Full Resolution -> Run
#左上のPolsar Pro v5.0のロゴをクリック -> Single Data Set
#Process -> Polametric Decompositions -> YAM4 -> TgtG TgtG TgtG -> BMP -> Run
!!! GeoTiffへの変換(幾何補正、推奨)
PolSARProには大気・幾何補正の機能がない。幾何補正の機能を補うためにMapReadyを用いる。([[引用|https://media.asf.alaska.edu/asfmainsite/documents/mapready_3.1.22_how_to_guide.pdf]])
Why do I need MapReady for PolSARPro products?
MapReady provides the functionality that PolSARPro is missing. It can
geometrically and radiometrically
terrain correct and geocode PolSARPro products. After exporting the data to a
GeoTIFF format, the results can be used in a GIS environment.
補正を行うとどうなるかは[[こちら|https://www.asf.alaska.edu/sar-data/palsar/terrain-corrected-rtc/]]を参照。
以下にMapReady(asf_geocode, asf_terrcorr)とDEMを用いた補正の仕方を示す。
# DEMを準備する([[国土地理院が提供しているデータからDEMを作成する]])。
# xmlをtifに変換。
python2 fggdem.py *\.xml
# tifを結合。空間解像度はPALSARに合わせる。
gdal_merge.py -o Hiroshima_DEM.tif -ps 0.000118947688640 0.000118947688640 FG-GML-5132-02-dem10b-20161001.tif FG-GML-5132-03-DEM10B-20161001.tif \
FG-GML-5132-04-dem10b-20161001.tif FG-GML-5132-12-dem10b-20161001.tif FG-GML-5132-13-dem10b-20161001.tif \
FG-GML-5132-14-dem10b-20161001.tif FG-GML-5132-22-dem10b-20161001.tif FG-GML-5132-23-dem10b-20161001.tif \
FG-GML-5132-24-dem10b-20161001.tif FG-GML-5132-32-dem10b-20161001.tif FG-GML-5132-33-dem10b-20161001.tif \
FG-GML-5132-34-dem10b-20161001.tif FG-GML-5132-42-dem10b-20161001.tif FG-GML-5132-43-dem10b-20161001.tif \
FG-GML-5132-44-dem10b-20161001.tif FG-GML-5132-52-dem10b-20161001.tif FG-GML-5132-53-dem10b-20161001.tif \
FG-GML-5132-54-dem10b-20161001.tif FG-GML-5132-62-dem10b-20161001.tif FG-GML-5132-63-dem10b-20161001.tif \
FG-GML-5132-64-dem10b-20161001.tif FG-GML-5132-72-dem10b-20161001.tif FG-GML-5132-73-dem10b-20161001.tif \
FG-GML-5132-74-dem10b-20161001.tif
#GeoConding, GCP
MapReadyでも行えるようだが、とりあえずgdalとPALSAR/Level1.5のGCPを元に試してみる。
# Level1.5を参考に、サイズを変更
gdal_translate -of GTiff -outsize 1900 5600 Yamaguchi4_Y4O_Dbl.bin dummy.tif
# GCPを与える
# 上下反転するために、(5600 - gcp_y)している
gdal_translate \
-gcp 0.5 5599.5 132.181645 34.635271 \
-gcp 950 5599.5 132.308356 34.656714 \
-gcp 1899.5 5599.5 132.435276 34.678051 \
-gcp 0.5 4200.5 132.219924 34.48091 \
-of "GTiff" dummy.tif dummy2.tif
# 座標系を変換
gdalwarp -t_srs EPSG:4326 dummy2.tif out.tif
#
(メモ1)
# asf_import (asf_polsarpro_impor?)で ASF Internal format に変換
asf_polsarpro_import LED-ALPSRP149880680-P1.1__A CEOS Yamaguchi4_Y4O_Dbl.bin dummy1
# asf_geocode でUTM座標系に変換(要:中心座標)
asf_geocode -p utm --central-meridian 132.3837176 dummy1 dummy2
エラー
**** ERROR! Cannot Open File! *******
*
* This program tried to open the file named
* '@TMPDIR@/.float_image_tile_file_1760_0' for writing.
* This file does not exist or cannot be opened.
* Please check the file name and try again.
** Program terminating... Cannot open file.
(メモ2)
asf_import -format geotiff Yamaguchi4_Y40_Dbl.tif dummy1
# asf_terrcorrで幾何補正
(メモ3)
Snap Software
File -> import -> SAR Sensors -> ALOS PALSAR CEOS
java.lang.nullpointerexception!!!
!! Level 1.5
!!! データのダウンロード
[[RESTECが公開しているPALSAR/ポラメトリック L1.5|http://www.alos-restec.jp/staticpages/index.php/service-sampledata-04]]をダウンロードする。
unzip psr_plr15.zip
QGISなどで見たい場合は、以下のスクリプトで変換する。
#!/bin/sh
# 2016/11/08 Jin Katagi
# RESTECからダウンロードしたPALSAR full pola L1.5 のデータをtifに変換する
for file in IMG-HH-ALPSRP149880680-P1.5_UA IMG-HV-ALPSRP149880680-P1.5_UA IMG-VH-ALPSRP149880680-P1.5_UA IMG-VV-ALPSRP149880680-P1.5_UA; do
# GCPを用いて座標を計算し、tifに変換
gdal_translate \
-gcp 0.5 0.5 132.181645 34.635271 \
-gcp 950 0.5 132.308356 34.656714 \
-gcp 1899.5 0.5 132.435276 34.678051 \
-gcp 0.5 1399.5 132.219924 34.48091 \
-of "GTiff" ${file} hoge.tif
# 座標系を変換
gdalwarp -t_srs EPSG:4326 hoge.tif ${file}.tif
rm hoge.tif
done
!! リンク集
*[[Polarimetry Tutorial |https://earth.esa.int/web/polsarpro/polarimetry-tutorial;jsessionid=64046B4BC97002673E0888440696A2DC.jvm1]] ... ESAがPolSARの基礎からPolSAR Proの使い方までまとめている。
** [[Four-Component Scattering Model for Polarimetric SAR Image Decomposition|https://pdfs.semanticscholar.org/12c2/cd93a3a1fa67e03e89bf4bd2206565a5dc90.pdf]] ... Yamaguchi 4 components decomposition の論文1。
** [[A Four-Component Decomposition of POLSAR Images Based on the Coherency Matrix|http://dspace.lib.niigata-u.ac.jp/dspace/bitstream/10191/4983/1/]] ... 論文2。
** [[Modifying the Yamaguchi Four-Component Decomposition Scattering Powers Using a Stochastic Distance|https://arxiv.org/pdf/1504.01000.pdf]] ... ↑の改良版?
*[[Analysis of PolSAR maritime data|http://cradpdf.drdc-rddc.gc.ca/PDFS/unc71/p529331.pdf]] ... PolSARProとMATLABで解析。Pythonで書き換え可能か。
*[[NL-SAR|https://www.math.u-bordeaux.fr/~cdeledal/nlsar.php]] ... PolSAR PROに入っているスペックルノイズを取り除くやつ?
**[[NL-SAR Toolbox Manual|https://www.math.u-bordeaux.fr/~cdeledal/files/nlsartoolbox_v06_doc.pdf]] ... ↑の説明。Pythonでも動く。
→ [[PolSAR入門]]に戻る。
{{toc}}
! PolSARproとは
* [[公式ページ|https://earth.esa.int/web/polsarpro/home]]
ESAがリリースしているPolSARの解析ツール。
オープンソースであり、頑張ればLinuxでも動く。
ツールの使い方に限らず、PolSARの基礎までカバーしている充実した[[ドキュメント|https://earth.esa.int/web/polsarpro/documentation]]が特徴。
! インストール
PolSARproは現在v5.1が最新です(2017/05/14).
以下は古いバージョン(v5.0.4)のインストール方法です.
[[Sentinel-1 Toolbox]]が必要なので、必要に合わせて参照してください。
!! Ubuntu
wget https://earth.esa.int/documents/653194/1960708/PolSARpro_v5.0.4_Linux_20150607
unar PolSARpro_v5.0.4_Linux_20150607
sudo apt-get install tcl-dev
sudo apt-get install tk-dev
sudo apt-get install bwidget iwidgets4
sudo apt-get install itcl3 itk3 libtk-img
cd PolSARpro_v5.0/Soft/
chmod +x Compil_PolSARpro_v5_Linux.bat
ここで
vi ./Compil_PolSARpro_v5_Linux.bat
で, パスが変になっているところを修正(\が使われているところを/に修正)。その後,
./Compil_PolSARpro_v5_Linux.bat
古いバージョンでよければ...
sudo add-apt-repository ppa:a.valentino/eotools
sudo apt-get update
sudo apt-get install polsarpro
!! Fedora
「Ubuntuへのインストール」のapt-getの箇所を以下に変更。
sudo dnf install tcl-devel tk-devel bwidget iwidgets itk-devel itcl-devel tkimg
PolSARpro_v5.0/GUI/bmp_process/ViewBMPFile.tcl の28行名を以下のように書き換える
package require itk
! インストール後
GUIの実行ファイルは ./PolSARpro_V5.0/PolSARpro.tcl
これを立ち上げるとPdf reader周りで怒られるので、
OK -> Yes -> (Selection:) /usr/bin/evince -> OK -> Save & Exit
以下、同様にpathを指定していく。
(Google Earth) (Selection:) /usr/bin/google-earth
(gimp) (Selection:) /usr/bin/gimp
(ImageMagick) (Selection:) /usr/bin/convert
(Asf mapready) /usr/local/bin/asf_mapready
(s1tbx) /home/hoge/snap/bin/snap # 不安
上記の手順でインストール後、[[RESTECが提供しているPALSARのポラメトリデータ(L1.1)|http://www.alos-restec.jp/staticpages/index.php/service-sampledata-04]]に対してYamaguchi 4 components decompositionまで出来ることを確認。
GUIの挙動やエラーメッセージがおかしいが、とりあえずLinuxでも動く模様。
プログラムの詳細は付録しているヘルプのpdfを参照するか、Soft/ 以下に内蔵されているCプログラム(Soft/data_process_sngl/yamaguchi_4components_decomposition.c)を読めばいい。
! 実行
!! Level 1.1
!!! データのダウンロード
[[RESTECが公開しているPALSAR/ポラメトリック L1.1|http://www.alos-restec.jp/staticpages/index.php/service-sampledata-04]]をダウンロードする。
(仕様書は[[こちら|http://www.eorc.jaxa.jp/ALOS/doc/fdata/PALSAR_x_Format_JL.pdf]])
unzip psr_plr11.zip
!!! Yamaguchi 4 components
(メモ)コヒーレンスの計算の前に、大気補正が必要?[[参考(2.2 Terrain correction processing flow)|https://media.asf.alaska.edu/uploads/RTC/rtc_product_guide_v1.2.pdf]]
↑ SARにRadiometric calibrationはそもそも必要ない気がする。
./PolSARpro_v5.0.tcl
#ENTER -> ALOSのロゴをクリック -> Data Processing Level 1.1 -> Quad-Pol
#Environment -> (Main Input Directory) /home/jin/workspace/SAR/PSR_PLR15 -> OK -> Save & Exit -> (WARNINGが出るが無視して)No
#Import -> Input Data File -> (SAR Leader File) -> LED* を選択 -> OK -> Check Fiels -> OK -> Read Header -> OK -> OK
#Import -> Extract -> Full Resolution -> Run
#左上のPolsar Pro v5.0のロゴをクリック -> Single Data Set
#Process -> Polametric Decompositions -> YAM4 -> TgtG TgtG TgtG -> BMP -> Run
!!! GeoTiffへの変換(幾何補正、推奨)
PolSARProには大気・幾何補正の機能がない。幾何補正の機能を補うためにMapReadyを用いる。([[引用|https://media.asf.alaska.edu/asfmainsite/documents/mapready_3.1.22_how_to_guide.pdf]])
Why do I need MapReady for PolSARPro products?
MapReady provides the functionality that PolSARPro is missing. It can
geometrically and radiometrically
terrain correct and geocode PolSARPro products. After exporting the data to a
GeoTIFF format, the results can be used in a GIS environment.
補正を行うとどうなるかは[[こちら|https://www.asf.alaska.edu/sar-data/palsar/terrain-corrected-rtc/]]を参照。
以下にMapReady(asf_geocode, asf_terrcorr)とDEMを用いた補正の仕方を示す。
# DEMを準備する([[国土地理院が提供しているデータからDEMを作成する]])。
# xmlをtifに変換。
python2 fggdem.py *\.xml
# tifを結合。空間解像度はPALSARに合わせる。
gdal_merge.py -o Hiroshima_DEM.tif -ps 0.000118947688640 0.000118947688640 FG-GML-5132-02-dem10b-20161001.tif FG-GML-5132-03-DEM10B-20161001.tif \
FG-GML-5132-04-dem10b-20161001.tif FG-GML-5132-12-dem10b-20161001.tif FG-GML-5132-13-dem10b-20161001.tif \
FG-GML-5132-14-dem10b-20161001.tif FG-GML-5132-22-dem10b-20161001.tif FG-GML-5132-23-dem10b-20161001.tif \
FG-GML-5132-24-dem10b-20161001.tif FG-GML-5132-32-dem10b-20161001.tif FG-GML-5132-33-dem10b-20161001.tif \
FG-GML-5132-34-dem10b-20161001.tif FG-GML-5132-42-dem10b-20161001.tif FG-GML-5132-43-dem10b-20161001.tif \
FG-GML-5132-44-dem10b-20161001.tif FG-GML-5132-52-dem10b-20161001.tif FG-GML-5132-53-dem10b-20161001.tif \
FG-GML-5132-54-dem10b-20161001.tif FG-GML-5132-62-dem10b-20161001.tif FG-GML-5132-63-dem10b-20161001.tif \
FG-GML-5132-64-dem10b-20161001.tif FG-GML-5132-72-dem10b-20161001.tif FG-GML-5132-73-dem10b-20161001.tif \
FG-GML-5132-74-dem10b-20161001.tif
#GeoConding, GCP
MapReadyでも行えるようだが、とりあえずgdalとPALSAR/Level1.5のGCPを元に試してみる。
# Level1.5を参考に、サイズを変更
gdal_translate -of GTiff -outsize 1900 5600 Yamaguchi4_Y4O_Dbl.bin dummy.tif
# GCPを与える
# 上下反転するために、(5600 - gcp_y)している
gdal_translate \
-gcp 0.5 5599.5 132.181645 34.635271 \
-gcp 950 5599.5 132.308356 34.656714 \
-gcp 1899.5 5599.5 132.435276 34.678051 \
-gcp 0.5 4200.5 132.219924 34.48091 \
-of "GTiff" dummy.tif dummy2.tif
# 座標系を変換
gdalwarp -t_srs EPSG:4326 dummy2.tif out.tif
#
(メモ1)
# asf_import (asf_polsarpro_impor?)で ASF Internal format に変換
asf_polsarpro_import LED-ALPSRP149880680-P1.1__A CEOS Yamaguchi4_Y4O_Dbl.bin dummy1
# asf_geocode でUTM座標系に変換(要:中心座標)
asf_geocode -p utm --central-meridian 132.3837176 dummy1 dummy2
エラー
**** ERROR! Cannot Open File! *******
*
* This program tried to open the file named
* '@TMPDIR@/.float_image_tile_file_1760_0' for writing.
* This file does not exist or cannot be opened.
* Please check the file name and try again.
** Program terminating... Cannot open file.
(メモ2)
asf_import -format geotiff Yamaguchi4_Y40_Dbl.tif dummy1
# asf_terrcorrで幾何補正
(メモ3)
Snap Software
File -> import -> SAR Sensors -> ALOS PALSAR CEOS
java.lang.nullpointerexception!!!
!! Level 1.5
!!! データのダウンロード
[[RESTECが公開しているPALSAR/ポラメトリック L1.5|http://www.alos-restec.jp/staticpages/index.php/service-sampledata-04]]をダウンロードする。
unzip psr_plr15.zip
QGISなどで見たい場合は、以下のスクリプトで変換する。
#!/bin/sh
# 2016/11/08 Jin Katagi
# RESTECからダウンロードしたPALSAR full pola L1.5 のデータをtifに変換する
for file in IMG-HH-ALPSRP149880680-P1.5_UA IMG-HV-ALPSRP149880680-P1.5_UA IMG-VH-ALPSRP149880680-P1.5_UA IMG-VV-ALPSRP149880680-P1.5_UA; do
# GCPを用いて座標を計算し、tifに変換
gdal_translate \
-gcp 0.5 0.5 132.181645 34.635271 \
-gcp 950 0.5 132.308356 34.656714 \
-gcp 1899.5 0.5 132.435276 34.678051 \
-gcp 0.5 1399.5 132.219924 34.48091 \
-of "GTiff" ${file} hoge.tif
# 座標系を変換
gdalwarp -t_srs EPSG:4326 hoge.tif ${file}.tif
rm hoge.tif
done
!! リンク集
*[[Polarimetry Tutorial |https://earth.esa.int/web/polsarpro/polarimetry-tutorial;jsessionid=64046B4BC97002673E0888440696A2DC.jvm1]] ... ESAがPolSARの基礎からPolSAR Proの使い方までまとめている。
** [[Four-Component Scattering Model for Polarimetric SAR Image Decomposition|https://pdfs.semanticscholar.org/12c2/cd93a3a1fa67e03e89bf4bd2206565a5dc90.pdf]] ... Yamaguchi 4 components decomposition の論文1。
** [[A Four-Component Decomposition of POLSAR Images Based on the Coherency Matrix|http://dspace.lib.niigata-u.ac.jp/dspace/bitstream/10191/4983/1/]] ... 論文2。
** [[Modifying the Yamaguchi Four-Component Decomposition Scattering Powers Using a Stochastic Distance|https://arxiv.org/pdf/1504.01000.pdf]] ... ↑の改良版?
*[[Analysis of PolSAR maritime data|http://cradpdf.drdc-rddc.gc.ca/PDFS/unc71/p529331.pdf]] ... PolSARProとMATLABで解析。Pythonで書き換え可能か。
*[[NL-SAR|https://www.math.u-bordeaux.fr/~cdeledal/nlsar.php]] ... PolSAR PROに入っているスペックルノイズを取り除くやつ?
**[[NL-SAR Toolbox Manual|https://www.math.u-bordeaux.fr/~cdeledal/files/nlsartoolbox_v06_doc.pdf]] ... ↑の説明。Pythonでも動く。
→ [[PolSAR入門]]に戻る。