Skip to content

Instantly share code, notes, and snippets.

@ImagingSolution
Created November 7, 2019 14:58
Show Gist options
  • Save ImagingSolution/e9fed2638ecc3873e8440504f37bab1e to your computer and use it in GitHub Desktop.
Save ImagingSolution/e9fed2638ecc3873e8440504f37bab1e to your computer and use it in GitHub Desktop.
【C#】画像の輝度値の取得設定速度の比較
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
var bmp = new Bitmap(@"C:\Temp\syurijou.JPG"); // 6000 x 4000 x 24bit
pictureBox1.Image = bmp;
var sw = new System.Diagnostics.Stopwatch();
MessageBox.Show("開始");
sw.Start();
// GetPixel、SetPixel
NegativeImage1(bmp);
sw.Stop();
pictureBox1.Refresh();
MessageBox.Show($"NegativeImage1: {sw.ElapsedMilliseconds} msec");
sw.Reset();
sw.Start();
// 配列を介す方法
NegativeImage2(bmp);
sw.Stop();
pictureBox1.Refresh();
MessageBox.Show($"NegativeImage2: {sw.ElapsedMilliseconds} msec");
sw.Reset();
sw.Start();
// MershalのReadByte、WriteByte
NegativeImage3(bmp);
sw.Stop();
pictureBox1.Refresh();
MessageBox.Show($"NegativeImage3: {sw.ElapsedMilliseconds} msec");
sw.Reset();
sw.Start();
// usafeのポインタ
NegativeImage4(bmp);
sw.Stop();
pictureBox1.Refresh();
MessageBox.Show($"NegativeImage4: {sw.ElapsedMilliseconds} msec");
sw.Reset();
sw.Start();
// usafeのポインタの並列処理
NegativeImage5(bmp);
sw.Stop();
pictureBox1.Refresh();
MessageBox.Show($"NegativeImage5: {sw.ElapsedMilliseconds} msec");
@ImagingSolution
Copy link
Author

【C#】画像の輝度値の取得設定速度の比較
https://imagingsolution.net/program/set_get_bright_speed/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment