GREYCstoration は3つの機能を備えたコンソール アプリケーションです。ノイズ除去、画像修復、スムーズなリサイズ機能を提供します。
Gimp に Plugin で一部の機能が実装されています。
GREYCstoration はイメージ操作フレームワーク CImg のサンプルアプリケーションとしてソースアーカイブに収録されています。
各種バイナリは GREYCstoration 作者のページで配布されています。過去には CImg のダウンロード ページで Windows バイナリが配布されていました。歴史的にダウンロードトラブルが多く、サーバのパーミッション関係のトラブル、 Sourceforge におけるバイナリ アーカイブの登録カテゴリが分からない、最新版が用意されない、などありました。
GREYCstoration の情報はまだ少なく、作者による Demo ページは情報が古くそのままでは利用できません。
このページは Windows バイナリの入手方法、使用方法などの情報提供を目的としています。
用意するもの
- 高速な CPU
- GREYCstoration はとても重いです。遅い CPU でも実行できますが、時間がかかります。
- 大容量メモリ
- GREYCstoration はメモリ喰らいです。 1024 x 768 ピクセルの画像の場合、52MBほど消費しています。
- greycstoration.exe
- インストールを参考に用意してください。
- 画像
- BMP 形式で保存した画像を用意してください。また、プレビュー用に 100 x 100 ピクセル程度に切り取ったサムネイルも用意します。以下の説明では、適用対象画像を original.bmp 、サムネイルを thumb.bmp で表します。
- 環境変数 gs
- 以下の説明では簡便のために環境変数 gs を使用します。環境変数はコマンドプロンプトから次のように設定します。<インストール フォルダ>は実際のフォルダ名に変更してください。
set gs=<インストール フォルダ>\greycstoration.exe
バイナリの取得
GREYCstoration 作者のページ
GREYCstoration は次のページで各種バイナリが配布されています。確認したバージョンは次のとおりです。アーカイブにはソースも含まれています。
GREYCstoration
http://www.greyc.ensicaen.fr/~dtschump/greycstorat...
- GREYCstoration-2.6.zip
-- GREYCstoration_mac_intel
-- GREYCstoration_mac_ppc
-- GREYCstoration_pc_freebsd
-- GREYCstoration_pc_linux
-- GREYCstoration_pc_win32.exe
-- GREYCstoration_gimp_pc_linux
-- GREYCstoration_gimp_pc_win32.exe
CImg のダウンロードページ
過去、CImg のダウンロードページにいくつか Windows バイナリが配布されていました。
http://sourceforge.net/project/showfiles.php?group...
- CImg_win32exe.zip ( Dec 07, 2005 05:53 )
- CImg_win32_exe.zip ( Sep 27, 2005 02:33 )
- CImg_execWin32.zip ( Feb 26, 2004 05:17 )
筆者がコンパイルした物
僕がコンパイルした、 SSE2 最適化版を含む Windows バイナリはこちらからダウンロードできます。通常は blend フォルダの greycstoration.exe を使用します。 Pentium 4 以降の SSE2 命令を実装した CPU では、 SSE2 最適化した sse2 フォルダの greycstoration.exe が使えます。
http://www.geocities.jp/bitcase0312/index.html
インストール
保存場所を決め、ダウンロードした zip ファイルを解凍してください。
アンインストール
保存フォルダごと削除してください。レジストリは(おそらく)使用してません。
GREYCstoration にはバージョン1系と2系があり、アルゴリズムが異なります。同系であっても GREYCstoration および CImg フレームワークのバージョンにより出力が異なる場合があります。
基礎となる知識
コマンドプロンプトの使い方
コマンドプロンプトの使い方は Windows のヘルプを参照してください。ヘルプはウインドウズ キーを押しながらF1キーを押すと呼び出せます。簡単な説明は次のページにあります。
サイト内リンク:コマンドプロンプトを使う
pc-unix 環境はこちら。
サイト内リンク:基本的なコマンドとシェルの使い方
greycstoration.exe の使い方
コマンドプロンプトを起動し、適用対象の画像のあるフォルダに移動します。
サムネイルを使いパラメータを調節します。 -h オプションで全てのパラメータが表示されます。
%gs% -h -restore thumb.bmp -sigma 1.4 -p 0.9 -a 0.3
パラメータが決まったら、 thumb.bmp を original.bmp に変更し、 -o after.bmp を指定して適用画像をファイルに保存します。 -visu false を指定するとダイアログを表示しなくなります。
GREYCstoration 1系
以下、断りのない限り CImg 1.1.0 の GREYCstoration を使用しています。
1系列の特徴
1系列はパラメータの設定値によっては Gimp におけるヴァン・ゴッホ効果のような筆触があらわれます。エッジをはっきりさせる p 値を大きくすると強くあらわれます。
restore の適用例
| 元絵 | 適用後 |
![]() |
![]() |
パラメータは次のとおり。
%gs% -h -restore before.bmp -o after.bmp -sigma 1.4 -p 0.9 -a 0.3 -prec 1
-restore = before.bmp : Restore the image specified after '-restore' -inpaint = NULL : Inpaint the image specified after '-inpaint' -resize = NULL : Resize the image specified after '-resize' -dt = 20 : Smoothing strength -p = 0.9 : Contour preservation -a = 0.3 : Smoothing anisotropy -alpha = 0.3 : Noise scale -sigma = 1.4 : Geometry regularity -iter = 1 : Number of iterations -scheme = true : Curvature-preserving scheme (0=false, 1=true) -ng = 0 : Add gaussian noise before denoising -nu = 0 : Add uniform noise before denoising -ns = 0 : Add Salt&Pepper noise before denoising -improve = true : Improve structure tensor computation -save = 0 : Iteration saving step -visu = true : Enable/Disable visualization -o = after.bmp : Output image -dl = 0.8 : Spatial integration step -da = 45 : Angular integration step (in degrees) -prec = 1 : Precision of the gaussian function -linear = false : Use linear interpolation for integration
inpaint の適用例
| 元絵 | 適用後 |
![]() |
![]() |
![]() |
![]() |
| マスク | |
![]() |
|
パラメータは次のとおり。この版はバグってるような...
%gs% -h -inpaint before.bmp -m mask.bmp -o after.bmp
-restore = NULL : Restore the image specified after '-restore' -inpaint = before.bmp : Inpaint the image specified after '-inpaint' -resize = NULL : Resize the image specified after '-resize' -dt = 30 : Smoothing strength -p = 0.01 : Contour preservation -a = 0.9 : Smoothing anisotropy -alpha = 0.1 : Noise scale -sigma = 2 : Geometry regularity -iter = 100 : Number of iterations -scheme = false : Curvature-preserving scheme (0=false, 1=true) -m = mask.bmp : Input inpainting mask -dilate = 0 : Inpainting mask dilatation -init = 2 : Inpainting init (0=black, 1=white, 2=noise, 3=unchanged, 4=interpol) -improve = true : Improve structure tensor computation -save = 0 : Iteration saving step -visu = true : Enable/Disable visualization -o = after.bmp : Output image
resize の適用例
| 元絵 | ViX で拡大 | GREYCstoration で拡大 |
![]() |
![]() |
![]() |
パラメータは次のとおり。
%gs% -h -resize before.bmp -o after.bmp -g 128x128 -anchor false -prec 7 -sigma 5 -dt 2.5
-restore = NULL : Restore the image specified after '-restore' -inpaint = NULL : Inpaint the image specified after '-inpaint' -resize = before.bmp : Resize the image specified after '-resize' -dt = 2.5 : Smoothing strength -p = 0.01 : Contour preservation -a = 1 : Smoothing anisotropy -alpha = 0.1 : Noise scale -sigma = 5 : Geometry regularity -iter = 3 : Number of iterations -scheme = true : Curvature-preserving scheme (0=false, 1=true) -g = 128x128 : Output image geometry -anchor = false : Anchor original pixels -interp = 3 : Initial interpolation (0=black, 1=block, 2=mosaic, 3=linear, 4=grid, 5=bicubic -improve = true : Improve structure tensor computation -save = 0 : Iteration saving step -visu = true : Enable/Disable visualization -o = after.bmp : Output image -dl = 0.8 : Spatial integration step -da = 45 : Angular integration step (in degrees) -prec = 7 : Precision of the gaussian function -linear = false : Use linear interpolation for integration
CImg 1.1.0 へのパッチ
CImg 1-10 の greycstoration が vc でコンパイルできなかったので、パッチ。 cvs では直ってる。
--- greycstoration.cpp.orig Fri Nov 18 16:10:04 2005
+++ greycstoration.cpp Fri Dec 9 20:39:46 2005
@@ -337,13 +337,13 @@
const bool append_result = cimg_option("-append",false,NULL);
const float p2 = (float)((1+anisotropy)/(1e-10+1-anisotropy)*p1);
switch(scheme) {
- case 0:
+ case false: // Trace-based PDE
+ break;
+ default: // Curvature-preserving PDE
dl = (float)cimg_option("-dl",0.8f,"Spatial integration step");
da = (float)cimg_option("-da",45.0f,"Angular integration step (in degrees)");
gauss_prec = (float)cimg_option("-prec",2.0f,"Precision of the gaussian function");
linear = cimg_option("-linear",false,"Use linear interpolation for integration");
- break;
- default:
break;
}
GREYCstoration 2系
CImg 1.1.1 から GREYCstoration はバージョン2となり restore アルゴリズムが変わりました。筆触があらわれることが無くなり、ぼかしを強くしたような印象になりました。
restore の適用例
GREYCstoration 2.0 は品質が落ちます。確認した 2.4.1 では改善されています。それ以前のバージョンは未確認です。 2.5.2 で -a 1 -p 0 にすると1系ぽくなるようです。
| 元絵 | |
![]() |
|
| 1.1.0 | 2.0 ( CImg 1.1.1 ) |
![]() |
![]() |
| 2.5.2 ( CImg 1.2.0.1 ) | 2.4.1 ( CImg 1.1.7 ) |
![]() |
![]() |
パラメータは次のとおり。
%gs% -h -restore before.bmp -o after.bmp -sigma 1.1 -da 30 -a 0.3 -p 1.1
gs110
-dt = 20 : Smoothing strength -p = 1.1 : Contour preservation -a = 0.3 : Smoothing anisotropy -alpha = 0.3 : Noise scale -sigma = 1.1 : Geometry regularity -iter = 1 : Number of iterations -scheme = true : Curvature-preserving scheme (0=false, 1=true) -ng = 0 : Add gaussian noise before denoising -nu = 0 : Add uniform noise before denoising -ns = 0 : Add Salt&Pepper noise before denoising -improve = true : Improve structure tensor computation -save = 0 : Iteration saving step -visu = false : Enable/Disable visualization -dl = 0.8 : Spatial integration step -da = 30 : Angular integration step (in degrees) -prec = 2 : Precision of the gaussian function -linear = false : Use linear interpolation for integration
gs20 と gs241 はパラメータを指定せず初期値のまま適用しました。
gs20
-dt = 50 : Smoothing strength (>=0) -p = 1.1 : Contour preservation (>=0) -a = 0.3 : Smoothing anisotropy (0<=a<=1) -alpha = 0.5 : Noise scale (>=0) -sigma = 1.1 : Geometry regularity (>=0) -iter = 1 : Number of iterations (>0) -scheme = true : Curvature-preserving scheme (0=false, 1=true) -ng = 0 : Add gaussian noise before denoising (>=0) -nu = 0 : Add uniform noise before denoising (>=0) -ns = 0 : Add Salt&Pepper noise before denoising (>=0) -save = 0 : Iteration saving step (>=0) -visu = false : Enable/Disable visualization (0 or 1) -prenormalize = false : Apply pre-normalization in [0,255] -postnormalize = false : Apply post-normalization in [0,255] -dl = 0.8 : Spatial integration step (0<=dl<=1) -da = 30 : Angular integration step (0<=da<=90) -prec = 2 : Precision of the gaussian function (>0) -interp = 0 : Interpolation type (0=Nearest-neighbor, 1=Linear,2=Runge-Kutta)
gs241
+ Global algorithm parameters
---------------------------
-dt = 40 : Regularization strength for one iteration (>=0)
-iter = 1 : Number of regularization iterations (>0)
-p = 0.9 : Contour preservation for regularization (>=0)
-a = 0.2 : Regularization anisotropy (0<=a<=1)
-alpha = 0.6 : Noise scale (>=0)
-sigma = 1.1 : Geometry regularity (>=0)
-fast = true : Use fast approximation for regularization (true or false)
-prec = 2 : Precision of the gaussian function for regularization (>0)
-dl = 0.8 : Spatial integration step for regularization (0<=dl<=1)
-da = 30 : Angular integration step for regulatization (0<=da<=90)
-interp = 0 : Interpolation type (0=Nearest-neighbor, 1=Linear,2=Runge-Kutta)
-sdt = 0 : Sharpening strength for one iteration (>=0)
-sp = 0.5 : Sharpening edge threshold (>=0)
1系ぽい効果。
%gs% -h -restore before.bmp -o after.bmp -a 1 -p 0
gs252
+ Global algorithm parameters
---------------------------
-dt = 40 : Regularization strength per iteration (>=0)
-iter = 1 : Number of iterations (>0)
-p = 0 : Contour preservation (>=0)
-a = 1 : Smoothing anisotropy (0<=a<=1)
-alpha = 0.6 : Noise scale (>=0)
-sigma = 1.1 : Geometry regularity (>=0)
-fast = true : Enable fast approximation (true or false)
-prec = 2 : Computation precision (>0)
-dl = 0.8 : Spatial integration step (0<=dl<=1)
-da = 30 : Angular integration step (0<=da<=90)
-interp = 0 : Interpolation type (0=Nearest-neighbor, 1=Linear,2=Runge-Kutta)
-tile = 512 : Activate tiled mode and set tile size (>=0)
-btile = 4 : Size of tile borders (>=0)
-threads = 2 : Number of threads used (tile mode only)
-sdt = 0 : Activate sharpening filter, set sharpening strength (>=0)
-sp = 0.5 : Sharpening edge threshold (>=0)
相違点
| アプリケーション名 | restore v1 | restore v2 | restore v2 fast | inpaint | resize |
| <= 1.1.0 ( CImg 1.1.0 ) | x | - | - | x | x |
| >= 2.0 ( CImg 1.1.1 ) | - | x | - | x | x |
| <= 2.3 ( CImg 1.1.3 ) | - | x | x | x | x |
| GREYCstoration for Integration | - | x | x | - | - |
| Gimp Plugin 0.2.0 | x | - | - | - | - |
| Gimp Plugin 1.1 | - | - | x | - | - |
| Paint.NET Wrapper Plugin | - | - | x? | x? | - |
記号 x は実装を表しています。記号 - は未実装です。
GREYCstoration for Integration は CImg に同梱されています。 Gimp Plugin は他の手により実装され提供されています。
Gimp Plugin 1.1 は CImg 1.2.0.2 から CImg の examples に収録されるようになりました。
Paint.NET Wrapper Pluginなるものがあるらしい。調査してません。
各バージョンにおける大きな変更
GREYCstoration 2.0
CImg 1.1.1 同梱の GREYCstoration 2.0 から restore アルゴリズムが変わりました。
GREYCstoration 2.3
GREYCstoration 2.4.1
CImg 1.1.7 同梱の GREYCstoration 2.4.1 でオプションが追加されました。
| -append = false | Append original image to output file |
| -quality = 100 | JPEG output quality |
GREYCstoration 2.5
CImg 1.1.9 同梱の GREYCstoration 2.5 でオプションが追加されました。ただしこの CImg アーカイブには不備がありコンパイルできませんでした。 GREYCstoration 作者のページで 2.5.1 を取得するか cvs から取得しコンパイルしてください。
| -bits = 8 | Define image pixel type (8='uchar', 16='ushort', 32='float') |
| -tile = 512 | Activate tiled mode and set tile size (>=0) |
| -btile = 4 | Size of tile borders (>=0) |
| -threads = 2 | Number of threads used (tile mode only) |
GREYCstoration 2.5.2 ( CImg 1.2.5 )
CImg 1.2.5 同梱の GREYCstoration 2.5.2 でオプションが追加されました。
| -fact = 0 | Define intensity factor (0=auto) |
GREYCstoration 2.6 ( CImg 1.2.6 )
CImg 1.2.6 同梱の GREYCstoration 2.6 でオプションが追加されました。
| -cbase = 0 | Color base processed (0=RGB, 1=YCbCr) |
| -crange = 0 | Channels processed (ex: '0-2') |
| -verbose = true | Verbose mode |
また Output image (-o) オプションで処理結果をファイルに出力する場合、 GraphicsMagic ( gm.exe ) を呼び出し jpeg で保存するようになりました。旧来どおり bmp で保存するには -quality オプションに 0 を渡します。
GREYCstoration 2.6 ( CImg 1.2.7 )
オプション -threads が experimental (実験的) になりました。これにより既定値が 2 から 1 に変更されています。
GREYCstoration 2.8 ( CImg 1.2.8pre )
オプション名が変更されました。
| old | new |
| -reference | -ref |
| -sdt | -sharp |
| -sp | -se |
新モードが追加されました。オプションは次の通り。
| -clean | Clean image specified after '-clean' |
| -p = 0 | Patch size (>0) |
| -ss = 15 | Spatial sigma (>0) |
| -sp = 10 | Patch sigma (>0) |
| -r = 7 | Size of the lookup region (>0) |
CImg 1.3.1
この版から GREYCstoration が削除されました。かわりに G'MIC の -smooth を使ってほしいとのことです。
gs129ex
-restore
G'MIC -smooth を使うようです。todo
| -smooth | amplitude>=0,_sharpness>=0,_anisotropy=[0,1],_alpha,_sigma,_dl>0,_da>=0,_precision>0,_interpolation_type={0,1,2},_fast_approximation={0,1} |
| or nb_iters>=0,_sharpness>=0,_anisotropy=[0,1],_alpha,_sigma,_dt>0,0 | |
| or [ind],_amplitude>=0,_dl>0,_da>=0,_precision>0,_interpolation_type={0,1,2},_fast_approximation={0,1} | |
| or [ind],_nb_iters>=0,_dt>0,0 |
GREYCstoration -restore との対応。
| GREYCstoration -restore | G'MIC -smooth |
| -dt | amplitude>=0 |
| -p | sharpness>=0 |
| -a | anisotropy=[0,1] |
| -alpha | alpha |
| -sigma | sigma |
| -dl | dl>0 |
| -da | da>=0 |
| -prec | precision>0 |
| -interp | interpolation_type={0,1,2} |
| -fast | fast_approximation={0,1} |
inpaint
大きく変わってしまった...
ソースの当該箇所を読むと、ファイルから読み込んだイメージの一つをマスクに使用するようだ。 todo
| -inpaint | [ind] |
resize
todo
| -resize | [indice],_interpolation={-1,0,1,2,3,4,5},_borders={-1,0,1,2},_center={0,1} |
| or {[indice],width[%]},_{[indice],height[%]},_{[indice],depth[%]},_{[indice],dim[%]},_interpolation,_borders,_center | |
| or (noargs) |
Greycstoration : Fast Anisotropic Smoothing of Multi-Valued Images using Curvature-Preserving PDE's.
http://cimg.sourceforge.net/greycstoration/
The CImg Library - C++ Template Image Processing Library
http://cimg.sourceforge.net/
GIMP Plug-In: GREYCstoration 0.2.0
http://registry.gimp.org/plugin?id=6233
GIMP Plug-In: GREYCstoration 1.1
http://registry.gimp.org/plugin?id=9304
リンク切れのときは Internet Archive で探してみてください。ただし registry.gimp.org のファイルは保存されてないようです。
2009/6/1mon G'MIC 関係を記述。 G'MIC の sse2 最適化はそのうち上げます。
2008/12/31wed gs129ex を記述。
2008/4/12sat 各バージョンにおける大きな変更点に追記。 greycstoration 2.8 windows バイナリ追加。
2008/2/23sat GREYCstoration 2.6 ( CImg 1.2.6 ) に追記。
2008/1/27sun 各バージョンにおける大きな変更点に追記。 CImg 1.2.7 の greycstoration 2.6 windows バイナリ追加(予定)。
2008/1/21mon CImg 1.2.6 の greycstoration 2.6 windows バイナリ追加。
2007/10/5fri CImg 1.2.4 の greycstoration 2.5.2 windows バイナリ追加。
2007/8/27mon CImg 1.2.3 の greycstoration 2.5.2 windows バイナリ追加。 gimp プラグインもアーカイブに収録するようにしました。
2007/7/14sat CImg 1.2.2.1 の greycstoration 2.5.2 windows バイナリ追加。アプリケーションによる違い/相違点に追記。
2007/6/16sat CImg 1.2.1 の greycstoration 2.5.2 windows バイナリ追加。
2007/6/9sat 2.5.2 で1系ぽい適用例追記。
2007/4/19thu CImg 1.2.0.1 の greycstoration 2.5.2 windows バイナリ追加。
2006/3/31sat アプリケーションによる違い-相違点に greycstoration4gimp 2.5.2 を追記。
2006/3/10sat ページの構成を見直し、記述を改めた。 CImg 1.1.9 (ではなく cvs ...) の greycstoration 2.5.1 windows バイナリ追加。
2007/1/28sun CImg 1.1.8 の greycstoration 2.4.2 windows バイナリ追加。
2006/11/25sat CImg 1.1.7 の greycstoration 2.4.1 windows バイナリ追加。「 CImg 1.1.1 」に追記。
2006/9/25mon CImg 1.1.6 の greycstoration 2.4b windows バイナリ追加。
2006/7/22sat CImg 1.1.5 の greycstoration 2.4a windows バイナリ追加。
2006/5/21sun CImg 1.1.4 の greycstoration 2.4 windows バイナリ追加。
2006/4/1sat CImg 1.1.3 の greycstoration 2.3 windows バイナリ追加。 GREYCstoration 2.3 の注意点を追記。
2006/3/16thu CImg 1.1.3beta1 と CImg 1.0.8 の greycstoration windows バイナリ追加。
2006/2/21tue CImg 1.1.2 の greycstoration 2.2 windows バイナリ追加。アーカイブ名を greycstoration のバージョン番号に変更。
2006/2/5sun 本家 windows バイナリの情報を書き換えた。
2006/2/3fri CImg 1.1.1 の restore 効果の参考例追加。
2006/1/29sun CImg 1.1.1 の restore 効果の記述追加。
2006/1/25wed CImg 1.1.1 の greycstoration 2.0 windows バイナリ追加。
2005/12/29thu コマンドプロンプトを使うへのリンクを追加。
2005/12/11sun CImg 1.10 をCImg 1.1.0 に訂正。
2005/12/10sat resize の記述追加。
2005/12/9fri パッチ修正。バイナリ差し替え。 inpaint の記述追加。
2005/12/4sun バイナリ配布。
2005/12/3sat ページ作成。


















最新コメント