0

Nokia Imaging SDK で赤目軽減アルゴリズムを実装しようとしています。私は目の円を選ぶためのコントロールを書いたので、セグメンテーション/顔検出フェーズは必要ありません(円内にポイントリストがあります)-私はそれを次のように実装しました:

 protected override void OnProcess(PixelRegion sourcePixelRegion, PixelRegion targetPixelRegion)
    {
        int currentRow = 0;

        targetPixelRegion.ForEachRow((index, width, position) =>
        {
            for (int x = 0; x < width; ++x)
            {
                uint currentPixelColor = sourcePixelRegion.ImagePixels[index + x];

                if (_selectedRegionProvider.IsPointInSelectedRegion(position.X + x, position.Y + currentRow))
                {
                    uint alphaChannel = (currentPixelColor & AlphaBitMask) >> 24;
                    uint redChannel = (currentPixelColor & RedBitMask) >> 16;
                    uint greenChannel = (currentPixelColor & GreenBitMask) >> 8;
                    uint blueChannel = (currentPixelColor & BlueBitMask);

                    float greenBlueChannelAvg = (greenChannel + blueChannel)/2.0f;

                    float redIntensity = (float) (redChannel/greenBlueChannelAvg);
                    if (redIntensity > 0.5)
                        redChannel = Math.Min(255, (uint)((greenChannel+blueChannel)/2.0));

                    currentPixelColor = (alphaChannel << 24) | (redChannel << 16) | (greenChannel << 8) | blueChannel;
                }

                targetPixelRegion.ImagePixels[index + x] = currentPixelColor;
            }

            currentRow++;
        });
    }

ここ AlphaBitMask = 0xFF000000RedBitMask = 0x00FF0000、、、 GreenBitMask = 0x0000FF00_ BlueBitMask = 0x000000FF

しかし、私は奇妙な結果を得ます:

左の円の結果

問題は、Nokia Imaging SDK がアルファ ブレンディングを使用するかどうかです。アルファチャンネルはどうすればいいですか? もう 1 つの重要な質問 - 対処した人はいCustomFilterBaseますか? ポイントのリストのみを処理するにはどうすればよいですか (_selectedRegionProvider.GetAllSelectedPoints()ポイントの IEnumerable を返すものを使用できOnProcessます)。

4

2 に答える 2

2

朗報です!新しくリリースされた Lumia Imaging SDK 2.0 には RedEyeRemovalFilter があります。NuGet を介してアップグレードできます。詳細については、http: //dev.windows.com/en-us/featured/lumia にアクセスしてください。

MSDN のドキュメントは現在かなり壊れており、完全に最新ではないことに注意してください。うまくいけば、これはすぐに修正されます。

リファレンス ドキュメントについては、NuGet パッケージの chm ファイルが最新でクリーンです。

于 2014-12-31T16:50:16.070 に答える