Archivo:Mandrill-yuv.png

Contenido de la página no disponible en otros idiomas.
De Wikipedia, la enciclopedia libre

Ver la imagen en su resolución original(512 × 2048 píxeles; tamaño de archivo: 1,35 MB; tipo MIME: image/png)

Resumen

Descripción YUV colorspace
Fecha
Fuente Adapted from public domain Mandrill.png
Autor Brian Szymanski
Permiso
(Reutilización de este archivo)
Public domain
Otras versiones File:Barn-yuv.png

Raison d'être

This file is designed to replace en:Image:YUV_components.jpg. The improvements are:

  • Use a lossless compression algorithm, PNG removing jpeg artifacts
  • Use a more permissive license (public domain)
  • Use a standard test image from the public domain
  • Don't scale U, V to extreme values - use the raw value, which more closely approximates the chroma component
  • Fix the inverted polarity of U, V components

If you want to see the same method applied to the original picture, see Image:Barn-yuv.png, but note the licensing is necessarily a little different.

Generation

To generate this map from mandrill.png, I used this perl script, and then ran optipng with a full search to shrink the filesize. If you want to understand the below code, you should probably use perltidy - the code is mostly here for my reference.

perl -e '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("mandrill.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));
   }
};
print $yuv_img->png' >mandrill-yuv.png

Licencia

Public domain Yo, el titular de los derechos de autor de esta obra, lo libero al dominio público. Esto aplica en todo el mundo.
En algunos países esto puede no ser legalmente factible; si ello ocurriese:
Concedo a cualquier persona el derecho de usar este trabajo para cualquier propósito, sin ningún tipo de condición al menos que éstas sean requeridas por la ley.

Leyendas

Añade una explicación corta acerca de lo que representa este archivo

Elementos representados en este archivo

representa a

Historial del archivo

Haz clic sobre una fecha y hora para ver el archivo tal como apareció en ese momento.

Fecha y horaMiniaturaDimensionesUsuarioComentario
actual04:39 22 sep 2007Miniatura de la versión del 04:39 22 sep 2007512 × 2048 (1,35 MB)Brianski== Summary == {{Information |Description=YUV colorspace |Source=Adapted from public domain Mandrill.png |Date=2007/09/22 |Author=Brian Szymanski |Permission=Public domain |other_versions= }} == Raison d'être == This file is designed to replace [[:en:Ima

La siguiente página usa este archivo: