0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【画像処理100本ノックに挑戦】Q.1. チャネル入れ替え

Posted at

使用したライブラリ

【画像処理100本ノック】独自の画像入出力クラスを作る

Q.1. チャネル入れ替え

画像を読み込み、RGBをBGRの順に入れ替えよ。

まだチュートリアルって感じですね。

int main()
{
	PPM ppm("imori.pnm");
	int width = ppm.Get_width();
	int height = ppm.Get_height();
	PPM ppm2(width, height);

	for(int j=0; j<height; j++)
		for (int i = 0; i < width; i++)
		{
			ppm2(i, j, 'b') = ppm(i, j, 'r');
			ppm2(i, j, 'g') = ppm(i, j, 'g');
			ppm2(i, j, 'r') = ppm(i, j, 'b');
		}

	ppm2.Flush("out.ppm");
	return 0;
}

左からそれぞれ入出力です。
imori.png out.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?