ファイル:Barn-yuv.png

提供: testwiki
ナビゲーションに移動 検索に移動
元のファイル (400 × 1,196 ピクセル、ファイルサイズ: 425キロバイト、MIME タイプ: image/png)

このファイルはウィキメディア・コモンズのものであり、他のプロジェクトで使用されている可能性があります。 ウィキメディア・コモンズでのファイル解説ページにある説明を以下に示します。

概要

解説
English: YUV colour space example using a photograph of the John Moulton Barn at the base of the Teton Range.
日付
原典 Concept from Image:YUV_components.jpg, original public domain image at Barns grand tetons.jpg.
作者 Brian Szymanski
許可
(ファイルの再利用)
Public domain この作品の著作権者である私は、この作品についての権利を放棄しパブリックドメインとします。これは全世界で適用されます。
一部の国では、これが法的に可能ではない場合があります。その場合は、次のように宣言します。
私は、あらゆる人に対して、法により必要とされている条件を除き、如何なる条件も課すことなく、あらゆる目的のためにこの著作物を使用する権利を与えます。
Generation
InfoField
To generate this map, Brian Szymanski used this Perl script, and then ran optipng with a full search to shrink the filesize. The code is mostly here for reference, but it is wrong. The first channel of the blue/yellow map has to be set to U as well and the third channel of the red/green map has to be set to 0.5.
#!/usr/bin/env perl
use strict;
use warnings;
use GD;
GD::Image->trueColor(1);
my %color_cache;
sub cached_allocate {
	my $img = shift;
	my @rgb = @_;
	my $rgb = join(",", @rgb);
	$color_cache{$rgb} = $img->colorAllocate(@rgb) unless($color_cache{$rgb});
	return $color_cache{$rgb};
}

my $img = GD::Image->new("barn.png");
my ($height, $width) = ($img->height, $img->width);
my $yuv_img = GD::Image->new($width, $height*4);
foreach my $y (0..$height-1) {
	foreach my $x (0..$width-1) {
		my ($r, $g, $b) = map { $_ / 256 } my @rgb = $img->rgb($img->getPixel($x, $y));
		my $Y = 0.299 * $r + 0.587 * $g + 0.114 * $b;
		my $U = 0.436 * ($b - $Y) / (1 - 0.114);
		my $V = 0.615 * ($r - $Y) / (1 - 0.299);
		$Y *= 256;
		$U += .436; $U *= (256/.872);
		$V += .615; $V *= (256/1.23);
		($Y, $U, $V) = map { int(0.5+$_) } ($Y, $U, $V);
		die "YUV: $Y,$U,$V" if (($Y > 255) or ($U > 255) or ($V > 255));
		$yuv_img->setPixel($x, $y, cached_allocate($yuv_img, @rgb));
		$yuv_img->setPixel($x, $height+$y, cached_allocate($yuv_img, $Y, $Y, $Y));
		$yuv_img->setPixel($x, 2*$height+$y, cached_allocate($yuv_img, 0, 255-$U, $U));
		$yuv_img->setPixel($x, 3*$height+$y, cached_allocate($yuv_img, $V, 255-$V, 0));
	}
};
$yuv_img->_file("barn-yuv.png");
Running this script requires the GD Graphics Library and GD CPAN module.

Raison d'être

This is a cleaner/more accurate version of Image:YUV_components.jpg. The improvements are:

  • Using a lossless image format, PNG, to avoid JPEG artefacts.
  • Not scaling U and V to extreme values; instead, raw values are used to better approximate the chroma component.
  • Fixing the inverted polarity of U and V components.

キャプション

このファイルの内容を1行で記述してください

このファイルに描写されている項目

題材

22 9 2007

d3127a1d2ae6d38c684681282a72fe7b47e4f8a8

435,380 バイト

1,196 ピクセル

400 ピクセル

ファイルの履歴

過去の版のファイルを表示するには、その版の日時をクリックしてください。

日時サムネイル寸法利用者コメント
現在の版2007年9月22日 (土) 06:112007年9月22日 (土) 06:11時点における版のサムネイル400 × 1,196 (425キロバイト)wikimediacommons>Brianski== Summary == {{Information |Description=YUV colorspace |Source=Adapted from en:Image:YUV_components.jpg |Date=2007/09/22 |Author=en:User:(3ucky(3all, updated by User:Brianski |Permission=Creative Commons Attribution or GFDL |see_also=[[barn

以下のページがこのファイルを使用しています: