2018年3月17日土曜日

写真加工 縮小の落とし穴 参考:引用のみ

写真加工 縮小の落とし穴 を書きながら、 Internet を彷徨って見付けた 貴重な 情報を引用します。
個人用の 備忘録 と言った位置付けですが、
縮小で頭を抱えたら、 これをご覧になると 参考になるかも。
原文は英語なので、Google さまの 翻訳 を併記しますね。


では。
写真加工 縮小の落とし穴 に絡んで、 縮小時の留意点です。
Internet 上にあった 情報 を 引用 して置きます。

リンク 原文 翻訳 原文 翻訳 ... の 順で列記します。  翻訳は translate.google.co.jp .
尚、 質疑応答形式からの抜粋なので、不要箇所も一部含まれます。
有益な画像もありましたが、著作権の絡みから、掲載は出来ませんので、
リンク先を参照下さい。

 尚、その画像の一部は、古い GIMP 2.9 系 で作成された様で、
 現行の GIMP 2.9.8 で処理を行うと 多少の 違い が見られます。
 進化している! と言う事で。
 更に、現行の Stable 2.8.22 と Unstable の 2.9.8 とを比較すると、
 より、Unstable の方が 綺麗に 画像を縮小しますね。

     良い画像サンプルが無いので、例示出来ないのが残念です。.



https://www.gimp-forum.net/Thread-Scaling-layers-and-loosing-resolution
2018/02

When you scale down, pixels are interpolated so you lose definition, even if this is not as visible as when scaling up. In some bad cases you can be hit by aliasing and get moirés and jagged edges, in which cas the solution is to pre-blur the picture before scaling down. In 2.8 the rule is to apply a gaussian blur of N pixels when you downscale by N.

Pixels are also interpolated when you rotate. This isn't very visible on the first rotation, but if you rotate things several times blur shows up around th the third rotation. If you want several copied of an object with varying angles, always produce them from the initial object and do not obtain copy N+1 from copy N.

Last, all geometric transforms (except the flips and the rotations of multiple of 90°) interpolate pixels, so the fewer you do, the better it is. Gimp 2.9 introduced a combined transform tool that has the big advantage that you can apply scaling, rotation and shear in one single operation (so you interpolate pixels only once and avoid the blurring caused by repeated interpolations.

縮小すると、拡大縮小のように表示されなくても、定義を失うようにピクセルが補間されます。いくつかの悪いケースでは、エイリアシングによってヒットし、モアレやギザギザのエッジが発生することがあります。その解決策は、縮小する前に画像をあらかじめぼかしておくことです。 2.8では、Nで縮小したときに、Nピクセルのガウスぼかしを適用するというルールがあります。

回転するとピクセルも補間されます。これは最初の回転ではあまり見えませんが、回転させると3回目の回転の周りに数回のぼかしが表示されます。角を変えてオブジェクトを複数コピーする場合は、常に初期オブジェクトからそれらを生成し、コピーNからコピーN + 1を取得しないでください。

最後に、すべての幾何学的変換(フリップと90°の倍数の回転を除く)がピクセルを補間するので、少ないほど効果があります。 Gimp 2.9では、スケーリング、回転、剪断を1回の操作で適用できるという大きな利点があります(ピクセルを1回だけ補間し、繰り返される補間によって生じるぼやけを避けることができる)。


Obviously depends on the image sizes and amount of scaling/rotating.

There is a difference between 2.8 and 2.9 - I think less of a bug, more a decision by the developers.

The Gimp 2.8 sinc(Lanczos3) algorithm replaced by 2 new methods.

LoHalo method: when you downscale an image thats less than a half of the original size
NoHalo method: when you do not reduce the size much (rotate, shear or something)

This does mean that for small images there is a less sharp 'feel' - edge artifacts are not there. You need to zoom in for this comparison, but differences are there.
 

You might need to sharpen, depending on requirements. Gimp 2.9 does now come with wavelet sharpen. Usual advice remains, leave any sharpening to the very final procedure.

明らかに、画像サイズとスケーリング/回転量に依存します。

2.8と2.9の間には違いがあります - 私はバグが少なく、開発者の決定は多いと思います。

Gimp 2.8 sinc(Lanczos3)アルゴリズムは2つの新しいメソッドに置き換えられました。

LoHaloの方法:元のサイズの半分以下の画像を縮小するとき
NoHaloの方法:サイズを大きく(回転、せん断など)減らさない場合、

これは、小さな画像では、よりシャープな「感じ」があることを意味します。エッジアーティファクトはありません。 この比較のためにズームインする必要がありますが、違いがあります。

  

要件に応じて、シャープにする必要があるかもしれません。 Gimp 2.9にはウェーブレットシャープが付属しています。 通常のアドバイスが残っています。


http://www.gimpusers.com/forums/gimp-developer/18084-cubic-interpolation-vs-no-halo
2016/05

I've pushed code to GEGL master that makes the resamplers called "linear" and "cubic" do a tiny bit more than just interpolation. These operations now do a (possibly sparse) box-filtering when scaling down instead of scaling up. Doing point sampling with interpolated values is probably not what a user expect "cubic" or "linear" scaling down to be anyways,. even if this is what it currently is. GEGL now does a 2x2 averaging of values for bilinear and a 4x4 sparse box filter averaging for cubic. Due to how this code uses whole pixels for averaging it might yield slightly sharper result than nohalo in many cases.

私はGEGLマスターにコードをプッシュして、 "リニア"と "キュービック"と呼ばれるリサンプラをちょうど補間以上のものにしました。 これらの操作では、スケールアップする代わりに縮小するときに、(おそらくスパースな)ボックスフィルタリングを行うようになりました。 補間された値を使ったポイントサンプリングは、おそらくユーザーが「3次」または「線形」のスケーリングを期待しているとは限りません。 これが現在のものであっても。 GEGLでは、バイリニアの値を2x2で平均化し、3x4のスパースボックスフィルタを平均してキュービックにします。 このコードが平均化のためにピクセル全体をどのように使用するかによって、多くの場合、nohaloよりもわずかにシャープな結果が得られる可能性があります。


This was a fix for the 2.9 series - any releases of 2.9 thus far have been development snapshots and you shouldn't be establishing unchangable workflows based on the behavior of development snapshots. The new behavior you will get from cubic and linear *resamplers* in GIMP master + GEGL master resembles what the stable releases of GIMP have been doing for at least the last half decade, whereas GIMP 2.9 for a while has produced the equivalent of slightly randomized nearest neighbor when scaling down with cubic and linear. Other things that might happen for 2.10 is lanczos being reinstated if *you (or someone you convince)* implement lanczos as a GeglSampler, and the nohalo sampler being dropped unless it starts having performance of similar magnitude to nearest/linear/cubic/lohalo.

 Quote:    I would ask you to reinstate the old code and have the new selectable under a new name - then at least an existing workflow could remain intact and the user would be made aware (a little bit at least) that there may be something better available...

Nope - won't happen. Linear and cubic resamplers should provide reasonable results - instead of a random broken thing, which is why I also implemented similar fixes to GIMP itself early in the 2.x series. If you've been blurring your photos before scaling them down with cubic to compensate for cubic being broken in 2.9, you should no longer be doing so.

これは2.9シリーズの修正版であり、これまでの2.9のリリースは開発スナップショットであり、開発スナップショットの動作に基づいて変更できないワークフローを確立するべきではありません。 GIMPマスター+ GEGLマスターの立方体とリニア*リサンプラ*から得られる新しい動作は、GIMPの安定版リリースが少なくとも過去半年間行っていたものに似ていますが、GIMP 2.9ではしばらくの間、わずかにランダム化された立方体と線形で縮尺を変えたときに最も近い隣人。 2.10で起こる可能性のある他の事柄は、*あなた(またはあなたが納得した人)がGeglSamplerとしてlanczosを実装し、最も近い/線形/立方体/ lohaloと同様の大きさのパフォーマンスを開始しない限り、nohaloサンプラーを落とした場合にlanczosが復活することです。

 引用。古いコードを元に戻し、新しい名前で新しい選択可能なものを持ってくるようにお願いします。少なくとも、既存のワークフローはそのまま残っている可能性があります。 ..

いいえ - 起こりません。リニアとキュービックのリサンプラは、ランダムな壊れたものの代わりに妥当な結果を提供する必要があります。そのため、2.xシリーズの早い段階でGIMP自体に同様の修正を実装しました。 2.9で立方体が壊れたことを補うために立方体で縮尺を変更する前に写真をぼかしていた場合は、もはやそうしてはいけません。



[2018/03/17] 自投稿への外部リンクを追加

0 件のコメント:

コメントを投稿