は、私は現在の例外を取得しています:私の現在の画像形式を受け入れていない、私のblobCounterによって引き起こされるBlobCounterサポートされていないピクセルフォーマット
UnsupportedImageFormatException: Unsupported pixel format of the source image.
AForge.Imaging.BlobCounter.BuildObjectsMap (AForge.Imaging.UnmanagedImage image)
AForge.Imaging.BlobCounterBase.ProcessImage (AForge.Imaging.UnmanagedImage image)
AForge.Imaging.BlobCounterBase.ProcessImage (System.Drawing.Imaging.BitmapData imageData)
AForge.Imaging.BlobCounterBase.ProcessImage (System.Drawing.Bitmap image)
cam.blobCounter (System.Drawing.Bitmap videoOutput, AForge.Imaging.BlobCounter bc) (at Assets/Scripts/cam.cs:127)
cam.Update() (at Assets/Scripts/cam.cs:69)
。これを修正するには、変換方法を使用しました:Bitmap yellowClone = AForge.Imaging.Image.Clone(originalBm, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
しかし、私はまだエラーが発生します(すべてのフォーマットを試していますが)。
byte[] bytes = originalFeedTexture.EncodeToJPG();
using (var ms = new MemoryStream(bytes))
{
originalBm = new Bitmap(ms);
}
Bitmap yellowClone = AForge.Imaging.Image.Clone(originalBm, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
yellow = new Bitmap(yellowClone);
yellowFilter(yellow);
BlobCounter bc = new BlobCounter();
blobCounter(yellowClone, bc);
Rectangle[] rects = bc.GetObjectsRectangles();
if (bc.ObjectsCount >= 1)
{
Debug.Log("Swedes");
}
マイyellowFilter機能:
void yellowFilter(Bitmap videoOutput)
{
HSLFiltering yellowHslFilter = new HSLFiltering();
yellowHslFilter.Hue = new IntRange(40, 70);
yellowHslFilter.Saturation = new DoubleRange(0.3f, 0.9f);
yellowHslFilter.Luminance = new DoubleRange(0.3f, 0.8f);
yellowHslFilter.ApplyInPlace(videoOutput);
}
そして、私のblobCounter機能:
void blobCounter(Bitmap videoOutput, BlobCounter bc)
{
bc.ObjectsOrder = ObjectsOrder.Size;
bc.ProcessImage(videoOutput);
}
EDIT状況については
は、ここoriginalFeedTextureがこのウェブカムの飼料であることで、私のコードです:私は言及を忘れて、次の行にエラーがあります:blobCounter(yellowClone, bc);
私はあなたがあなたの質問でエラーが発生するコード行を指すべきだと思います – Programmer