Last active
November 8, 2019 13:09
-
-
Save ImagingSolution/968436fde06cd5f71485192e0261bc5d to your computer and use it in GitHub Desktop.
【C#】画像の輝度値の取得設定速度の比較
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// GetPixel、SetPixelで輝度値の取得設定 | |
/// </summary> | |
/// <param name="bmp"></param> | |
private void NegativeImage1(Bitmap bmp) | |
{ | |
var width = bmp.Width; | |
var height = bmp.Height; | |
Color col; | |
int r, g, b; | |
for (int y = 0; y < height; y++) | |
{ | |
for (int x = 0; x < width; x++) | |
{ | |
// 輝度値の取得 | |
col = bmp.GetPixel(x, y); | |
r = col.R; | |
g = col.G; | |
b = col.B; | |
// 色を反転 | |
col = Color.FromArgb(255 - r, 255 - g, 255 - b); | |
// 輝度値の設定 | |
bmp.SetPixel(x, y, col); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
【C#】画像の輝度値の取得設定速度の比較
https://imagingsolution.net/program/set_get_bright_speed/