Note that there are some explanatory texts on larger screens.

plurals
  1. POAccelerating bitmap grayscale conversion, is OpenMP an option in C#?
    primarykey
    data
    text
    <p>please help me to make this code parallel using openmp this code is run on button click and the text box is 128</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace IMG { public partial class Form1 : Form { public Form1() { InitializeComponent(); } string path = ""; public void openimage() { if (openFileDialog1.ShowDialog() == DialogResult.OK) { path = openFileDialog1.FileName; Graphics g = this.CreateGraphics(); g.Clear(this.BackColor); Bitmap curBitmap = new Bitmap(path); g.DrawImage(curBitmap, 200, 220, 200, 200); } } Bitmap bm; Bitmap gs; private void button1_Click(object sender, EventArgs e) { if (path == "") { openimage(); } //mack image gray scale Graphics g = this.CreateGraphics(); g.Clear(this.BackColor); // Create a Bitmap object bm = new Bitmap(path); // Draw image with no effects g.DrawImage(bm, 200, 220, 200, 200); gs = new Bitmap(bm.Width, bm.Height); for (int i = 0; i &lt; bm.Width; i++) { for (int j = 0; j &lt; bm.Height; j++) { Color c = bm.GetPixel(i, j); int y = (int)(0.3 * c.R + 0.59 * c.G + 0.11 * c.B); gs.SetPixel(i, j, Color.FromArgb(y, y, y)); } } // Draw image with no effects g.DrawImage(gs, 405, 220, 200, 200); for (int i = 0; i &lt; gs.Width; i++) { for (int j = 0; j &lt; gs.Height; j++) { Color c = gs.GetPixel(i, j); int y1 = 0; if (c.R &gt;= Convert.ToInt16(textBox19.Text)) y1 = 255; bm.SetPixel(i, j, Color.FromArgb(y1, y1, y1)); } } g.DrawImage(bm, new Rectangle(610, 220, 200, 200), 0, 0, bm.Width, bm.Height, GraphicsUnit.Pixel); // Dispose of objects gs.Dispose(); g.Dispose(); } } } </code></pre> <p>please help me as soon as u can i believe in this site and all programmers here...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload