Write some Software
- Állapot: Closed
- Díj: $30
- Beérkezett pályamű: 1
- Nyertes: L8G8S
A verseny összegzése
I need to speed up this function using parallel programming and GPU with c#
public void Fai(string foto,string sfondo)
{
int heigth = 0;
int width = 0;
Bitmap myBitmap = new Bitmap(foto);
heigth = myBitmap.Height ;
width = myBitmap.Width;
Bitmap myBitmap2 = new Bitmap(sfondo);
for (y = 0; y < heigth; y++)
{
for (x = 0; x < width; x++)
{
Color camColor = myBitmap.GetPixel(x, y);
byte max = Math.Max(Math.Max(camColor.R, camColor.G), camColor.B);
byte min = Math.Min(Math.Min(camColor.R, camColor.G), camColor.B);
bool replace =
camColor.G != min // green is not the smallest value
&& (camColor.G == max // green is the biggest value
|| max - camColor.G < 8) // or at least almost the biggest value
&& (max - min) > 32; // minimum difference between smallest/biggest value (avoid grays)
if (replace)
{
camColor = myBitmap2.GetPixel(x, y);
}
myBitmap.SetPixel(x, y, camColor);
Color pixelColor = myBitmap.GetPixel(x, y);
Color pixelColor2 = myBitmap2.GetPixel(x, y);
// ((Bitmap)pictureBox1.Image).SetPixel(x, y, Color.FromArgb(0, 255, 0));
if (pixelColor.A < 100)
{
((Bitmap)pictureBox1.Image).SetPixel(x, y, pixelColor2);
}
}
}
Ajánlott készségek
Munkaadói értékelés
“Very professional. Excellent worker. I recommend it”
nicolaantonica, Italy.
Nyilvános pontosítófelület
Így vágjon bele a versenyekbe
-
Indítson egy versenyt! Gyors és könnyű
-
Kapjon akár több száz pályaművet A világ minden szegletéből
-
Díjazza a legjobb pályázatot Töltse le a fájlokat - csak egy kattintás!