File:Barn-yuv.png

Une page de Wikimedia Commons, la médiathèque libre.
Aller à la navigation Aller à la recherche

Fichier d’origine(400 × 1 196 pixels, taille du fichier : 425 kio, type MIME : image/png)

Légendes

Légendes

Ajoutez en une ligne la description de ce que représente ce fichier

Description

[modifier]
Description YUV colorspace
Date
Source Concept from en:Image:YUV_components.jpg, original public domain image at en:Image:Barns_grand_tetons.jpg
Auteur User:Brianski
Autorisation
(Réutilisation de ce fichier)
Public Domain

The picture is of the John Moulton Barn at the base of the Teton Range.

Raison d'être

[modifier]

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

  • Use a lossless compression algorithm, PNG removing jpeg artifacts
  • 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

Generation

[modifier]

To generate this map Brian Szymanski 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, 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. I will fix it soon and update the image.

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

Conditions d’utilisation

[modifier]
Public domain Moi, propriétaire des droits d’auteur sur cette œuvre, la place dans le domaine public. Ceci s'applique dans le monde entier.
Dans certains pays, ceci peut ne pas être possible ; dans ce cas :
J’accorde à toute personne le droit d’utiliser cette œuvre dans n’importe quel but, sans aucune condition, sauf celles requises par la loi.

Historique du fichier

Cliquer sur une date et heure pour voir le fichier tel qu'il était à ce moment-là.

Date et heureVignetteDimensionsUtilisateurCommentaire
actuel22 septembre 2007 à 05:11Vignette pour la version du 22 septembre 2007 à 05:11400 × 1 196 (425 kio)Brianski (d | contributions)== 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

La page suivante utilise ce fichier :

Utilisations du fichier sur d’autres wikis

Les autres wikis suivants utilisent ce fichier :

  • Utilisation sur az.wikipedia.org
  • Utilisation sur be.wikipedia.org
  • Utilisation sur cs.wikipedia.org
  • Utilisation sur da.wikipedia.org
  • Utilisation sur de.wikipedia.org
  • Utilisation sur en.wikipedia.org
  • Utilisation sur es.wikipedia.org
  • Utilisation sur fr.wikipedia.org
  • Utilisation sur it.wikipedia.org
  • Utilisation sur ja.wikipedia.org
  • Utilisation sur ko.wikipedia.org
  • Utilisation sur nl.wikipedia.org
  • Utilisation sur pl.wikipedia.org
  • Utilisation sur ru.wikipedia.org
  • Utilisation sur tr.wikipedia.org
  • Utilisation sur uk.wikipedia.org
  • Utilisation sur zh.wikipedia.org