Operácie

MEMS Cvičenie 5: Rozdiel medzi revíziami

Z SensorWiki

(Doplnkové informácie)
(Doplnkové informácie)
Riadok 63: Riadok 63:
 
ToDo: preveriť, či je to naozaj tak.
 
ToDo: preveriť, či je to naozaj tak.
  
Pre konverziu z jedného farebného modelu do iného sa používajú štandardizované CIE vzťahy
+
Pre konverziu z jedného farebného modelu do iného sa používajú štandardizované CIE vzťahy. Neexistuje jednoduchý prevod medzi RGB a Lab priestormi, pretože ten prvý je závislý od zariadenia, ten druhý je ''device independent''. Preto sa používa medziprevod RGB -> sRGB -> XYZ -> Lab
 
 
  
 
<math>
 
<math>
Riadok 83: Riadok 82:
 
B_\mathrm{linear}\end{bmatrix}
 
B_\mathrm{linear}\end{bmatrix}
 
</math>
 
</math>
 +
 +
 +
===Forward transformation===
 +
 +
:<math>\begin{align}
 +
  L^\star &= 116 \  f\!\left(\frac{Y}{Y_{\mathrm{n}}}\right) - 16\\
 +
  a^\star &= 500 \left(f\!\left(\frac{X}{X_{\mathrm{n}}}\right) - f\!\left(\frac{Y}{Y_{\mathrm{n}}}\right)\right)\\
 +
  b^\star &= 200 \left(f\!\left(\frac{Y}{Y_{\mathrm{n}}}\right) - f\!\left(\frac{Z}{Z_{\mathrm{n}}}\right)\right)
 +
\end{align}</math>
 +
 +
where
 +
:<math>\begin{align}
 +
  f(t) &= \begin{cases}
 +
    \sqrt[3]{t} & \text{if } t > \delta^3 \\
 +
    \frac{t}{3 \delta^2} + \frac{4}{29} & \text{otherwise}
 +
  \end{cases} \\
 +
  \delta &= \frac{6}{29}
 +
\end{align}</math>
 +
 +
Here, {{math|''X''<sub>n</sub>}}, {{math|''Y''<sub>n</sub>}} and {{math|''Z''<sub>n</sub>}} are the [[CIE XYZ]] tristimulus values of the reference [[white point]] (the subscript n suggests "normalized").
 +
 +
Under [[Illuminant D65]] with normalization {{math|1=''Y'' = 100}}, the values are
 +
:<math>\begin{align}
 +
X_{\mathrm{n}}&=95.0489,\\
 +
Y_{\mathrm{n}}&=100,\\
 +
Z_{\mathrm{n}}&=108.8840
 +
\end{align}</math>
 +
 +
Values for illuminant D50 are
 +
:<math>\begin{align}
 +
X_{\mathrm{n}}&=96.4212,\\
 +
Y_{\mathrm{n}}&=100,\\
 +
Z_{\mathrm{n}}&=82.5188
 +
\end{align}</math>
 +
  
  

Verzia zo dňa a času 09:46, 12. marec 2020

Rozpoznávanie farieb http://blog.xkcd.com/2010/05/03/color-survey-results/

ColorNamesBoysVsGirls.png

Úloha 1:

pripojte senzor QTI k mikroprocesoru, zobrazte aktuálnu hodnotu výstupného signálu a pokúste sa pomocou senzora rozpoznať základné farby


Úloha 2:

zoznámte sa so senzorom farby ColorPAL (fotodióda TAOS TSL12T), pripojte ho k mikropočítaču a rozpoznajte základné farby

Porovnajte dosiahnuté výsledky s kvalitnejším senzorom TCS230

Použite softvér uvedený v príkladoch:


Odovzdať:

  • Nameranú závislosť od vzdialenosti
  • Nameranú závislosť farby pri konštantnej vzdialenosti
  • Ten kúsok programu, ktorý realizoval rozpoznanie farby


Doplnkové informácie

i2c


Vzdialenosť farieb

Keďže farby sú dané troma súradnicami (napr. RGB), je celkom prirodzené použiť na meranie vzdialenosti medzi farbami euklidovskú vzdialenosť v 3D priestore. Lenže ukazuje sa, že vzhľadom na fyziológiu ľudského vnímania farieb nie je celkom vhodné merať to v priesotre RGB, tam to nekorešponduje s ľudskou skúsenosťou. Preto sa na tento účel používa farebný priestor CIE Lab

CIE L*a*b* (CIELAB) je farebný priestor, ktorý zadefinovala CIE (International Commission on Illumination). Je to referenčný model, ktorý opisuje všetky ľudským okom viditeľné farby. Jeho tri súradnice reprezentujú intenzitu farby (L* = 0 je čierna a L* = 100 je rozptýlené biele svetlo), jej polohu na medzi červeno/fialovou a zelenou (a*, záporné čísla pre zelenú, kladné pre fialovú) a jej polohu medzi žltou a modrou (b*, záporné čísla pre modrú, kladné pre žltú).


Konverzia

ToDo: preveriť, či je to naozaj tak.

Pre konverziu z jedného farebného modelu do iného sa používajú štandardizované CIE vzťahy. Neexistuje jednoduchý prevod medzi RGB a Lab priestormi, pretože ten prvý je závislý od zariadenia, ten druhý je device independent. Preto sa používa medziprevod RGB -> sRGB -> XYZ -> Lab


\begin{bmatrix}
X_{D65}\\
Y_{D65}\\
Z_{D65}
\end{bmatrix}
=
\begin{bmatrix}
0.4124 & 0.3576 &0.1805 \\
0.2126 & 0.7152 &0.0722 \\
0.0193 & 0.1192 &0.9505
\end{bmatrix}
\begin{bmatrix}
R_\mathrm{linear}\\ 
G_\mathrm{linear}\\ 
B_\mathrm{linear}\end{bmatrix}


Forward transformation

\begin{align}
  L^\star &= 116 \  f\!\left(\frac{Y}{Y_{\mathrm{n}}}\right) - 16\\
  a^\star &= 500 \left(f\!\left(\frac{X}{X_{\mathrm{n}}}\right) - f\!\left(\frac{Y}{Y_{\mathrm{n}}}\right)\right)\\
  b^\star &= 200 \left(f\!\left(\frac{Y}{Y_{\mathrm{n}}}\right) - f\!\left(\frac{Z}{Z_{\mathrm{n}}}\right)\right)
\end{align}

where

\begin{align}
  f(t) &= \begin{cases}
    \sqrt[3]{t} & \text{if } t > \delta^3 \\
    \frac{t}{3 \delta^2} + \frac{4}{29} & \text{otherwise}
  \end{cases} \\
  \delta &= \frac{6}{29}
\end{align}

Here, Šablóna:Math, Šablóna:Math and Šablóna:Math are the CIE XYZ tristimulus values of the reference white point (the subscript n suggests "normalized").

Under Illuminant D65 with normalization Šablóna:Math, the values are

\begin{align}
X_{\mathrm{n}}&=95.0489,\\
Y_{\mathrm{n}}&=100,\\
Z_{\mathrm{n}}&=108.8840
\end{align}

Values for illuminant D50 are

\begin{align}
X_{\mathrm{n}}&=96.4212,\\
Y_{\mathrm{n}}&=100,\\
Z_{\mathrm{n}}&=82.5188
\end{align}


Návrat na zoznam cvičení...