Write some Software

  • Tila: Closed
  • Palkinto: $30
  • Vastaanotetut työt: 1
  • Voittaja: L8G8S

Kilpailun tehtävänanto

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);

}

}
}

Suositellut taidot

Työnantajan palaute

“Very professional. Excellent worker. I recommend it”

Profiilikuva nicolaantonica, Italy.

Julkinen selvennystaulu

  • nicolaantonica
    Kilpailun järjestäjä
    • 5 vuotta sitten

    I can delete the reference to picturebox1 if this allows me to use the GPU

    • 5 vuotta sitten

Kuinka päästä alkuun kilpailuiden kanssa

  • Ilmoita kilpailusi

    Ilmoita kilpailusi Nopeaa ja helppoa

  • Saat valtavasti töitä

    Vastaanota tonnikaupalla osallistumisia Ympäri maailmaa

  • Myönnä palkinto parhaalle työlle

    Myönnä palkinto parhaalle työlle Lataa tiedostot - Helppoa!

Ilmoita kilpailu nyt tai liity tänään!