跳转到内容

File:Barn-yuv.png

页面内容不支持其他语言。
這個文件來自維基共享資源
维基百科,自由的百科全书
    原始文件 (400 × 1,196像素,文件大小:425 KB,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.

    说明

    添加一行文字以描述该文件所表现的内容

    此文件中描述的项目

    描繪內容

    22 9 2007

    d3127a1d2ae6d38c684681282a72fe7b47e4f8a8

    435,380 字节

    1,196 像素

    400 像素

    文件历史

    点击某个日期/时间查看对应时刻的文件。

    日期/时间缩⁠略⁠图大小用户备注
    当前2007年9月22日 (六) 05:112007年9月22日 (六) 05:11版本的缩略图400 × 1,196​(425 KB)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

    以下页面使用本文件:

    全域文件用途

    以下其他wiki使用此文件: