public WriteableBitmap Process(WriteableBitmap input) { var p = input.Pixels; var result = new WriteableBitmap(input.PixelWidth, input.PixelHeight); var rp = result.Pixels; var r = this.ResultColor; YCbCrColor ycbcr; // Threshold every pixel for (int i = 0; i < p.Length; i++) { ycbcr = YCbCrColor.FromArgbColori(p[i]); if (ycbcr.Y >= LowerThreshold.Y && ycbcr.Y <= UpperThreshold.Y && ycbcr.Cb >= LowerThreshold.Cb && ycbcr.Cb <= UpperThreshold.Cb && ycbcr.Cr >= LowerThreshold.Cr && ycbcr.Cr <= UpperThreshold.Cr) { rp[i] = r; } } return(result); }
public YCbCrColor Interpolate(YCbCrColor c2, float amount) { return(new YCbCrColor(Y + (c2.Y - Y) * amount, Cb + (c2.Cb - Cb) * amount, Cr + (c2.Cr - Cr) * amount)); }