cdocutils.nodes document q)q}q(U nametypesq}qXbasicsqNsUsubstitution_defsq}qUparse_messagesq ]q Ucurrent_sourceq NU decorationq NUautofootnote_startq KUnameidsq}qhUbasicsqsUchildrenq]qcdocutils.nodes section q)q}q(U rawsourceqUUparentqhUsourceqX,/root/project/libs/gil/doc/design/basics.rstqUtagnameqUsectionqU attributesq}q(Udupnamesq]Uclassesq]Ubackrefsq ]Uidsq!]q"haUnamesq#]q$hauUlineq%KUdocumentq&hh]q'(cdocutils.nodes title q()q)}q*(hXBasicsq+hhhhhUtitleq,h}q-(h]h]h ]h!]h#]uh%Kh&hh]q.cdocutils.nodes Text q/XBasicsq0q1}q2(hh+hh)ubaubcdocutils.nodes paragraph q3)q4}q5(hX#Images are essential in any image processing, vision and video project, and yet the variability in image representations makes it difficult to write imaging algorithms that are both generic and efficient. In this section we will describe some of the challenges that we would like to address.q6hhhhhU paragraphq7h}q8(h]h]h ]h!]h#]uh%Kh&hh]q9h/X#Images are essential in any image processing, vision and video project, and yet the variability in image representations makes it difficult to write imaging algorithms that are both generic and efficient. In this section we will describe some of the challenges that we would like to address.q:q;}q<(hh6hh4ubaubh3)q=}q>(hX0In the following discussion an *image* is a 2D array of pixels. A *pixel* is a set of color channels that represents the color at a given point in an image. Each *channel* represents the value of a color component. There are two common memory structures for an image. *Interleaved* images are represented by grouping the pixels together in memory and interleaving all channels together, whereas *planar* images keep the channels in separate color planes. Here is a 4x3 RGB image in which the second pixel of the first row is marked in red, in interleaved form:hhhhhh7h}q?(h]h]h ]h!]h#]uh%K h&hh]q@(h/XIn the following discussion an qAqB}qC(hXIn the following discussion an hh=ubcdocutils.nodes emphasis qD)qE}qF(hX*image*h}qG(h]h]h ]h!]h#]uhh=h]qHh/XimageqIqJ}qK(hUhhEubahUemphasisqLubh/X is a 2D array of pixels. A qMqN}qO(hX is a 2D array of pixels. A hh=ubhD)qP}qQ(hX*pixel*h}qR(h]h]h ]h!]h#]uhh=h]qSh/XpixelqTqU}qV(hUhhPubahhLubh/XY is a set of color channels that represents the color at a given point in an image. Each qWqX}qY(hXY is a set of color channels that represents the color at a given point in an image. Each hh=ubhD)qZ}q[(hX *channel*h}q\(h]h]h ]h!]h#]uhh=h]q]h/Xchannelq^q_}q`(hUhhZubahhLubh/Xa represents the value of a color component. There are two common memory structures for an image. qaqb}qc(hXa represents the value of a color component. There are two common memory structures for an image. hh=ubhD)qd}qe(hX *Interleaved*h}qf(h]h]h ]h!]h#]uhh=h]qgh/X Interleavedqhqi}qj(hUhhdubahhLubh/Xr images are represented by grouping the pixels together in memory and interleaving all channels together, whereas qkql}qm(hXr images are represented by grouping the pixels together in memory and interleaving all channels together, whereas hh=ubhD)qn}qo(hX*planar*h}qp(h]h]h ]h!]h#]uhh=h]qqh/Xplanarqrqs}qt(hUhhnubahhLubh/X images keep the channels in separate color planes. Here is a 4x3 RGB image in which the second pixel of the first row is marked in red, in interleaved form:quqv}qw(hX images keep the channels in separate color planes. Here is a 4x3 RGB image in which the second pixel of the first row is marked in red, in interleaved form:hh=ubeubcdocutils.nodes image qx)qy}qz(hX%.. image:: ../images/interleaved.jpg hhhhhUimageq{h}q|(UuriX design/../images/interleaved.jpgq}h!]h ]h]h]U candidatesq~}qU*h}sh#]uh%Kh&hh]ubh3)q}q(hXand in planar form:qhhhhhh7h}q(h]h]h ]h!]h#]uh%Kh&hh]qh/Xand in planar form:qq}q(hhhhubaubhx)q}q(hX .. image:: ../images/planar.jpg hhhhhh{h}q(UuriXdesign/../images/planar.jpgqh!]h ]h]h]h~}qU*hsh#]uh%Kh&hh]ubh3)q}q(hXbNote also that rows may optionally be aligned resulting in a potential padding at the end of rows.qhhhhhh7h}q(h]h]h ]h!]h#]uh%Kh&hh]qh/XbNote also that rows may optionally be aligned resulting in a potential padding at the end of rows.qq}q(hhhhubaubh3)q}q(hXHThe Generic Image Library (GIL) provides models for images that vary in:qhhhhhh7h}q(h]h]h ]h!]h#]uh%Kh&hh]qh/XHThe Generic Image Library (GIL) provides models for images that vary in:qq}q(hhhhubaubcdocutils.nodes bullet_list q)q}q(hUhhhhhU bullet_listqh}q(UbulletqX*h!]h ]h]h]h#]uh%Kh&hh]q(cdocutils.nodes list_item q)q}q(hX"Structure (planar vs. interleaved)qhhhhhU list_itemqh}q(h]h]h ]h!]h#]uh%Nh&hh]qh3)q}q(hhhhhhhh7h}q(h]h]h ]h!]h#]uh%Kh]qh/X"Structure (planar vs. interleaved)qq}q(hhhhubaubaubh)q}q(hX9Color space and presence of alpha (RGB, RGBA, CMYK, etc.)qhhhhhhh}q(h]h]h ]h!]h#]uh%Nh&hh]qh3)q}q(hhhhhhhh7h}q(h]h]h ]h!]h#]uh%Kh]qh/X9Color space and presence of alpha (RGB, RGBA, CMYK, etc.)qq}q(hhhhubaubaubh)q}q(hX#Channel depth (8-bit, 16-bit, etc.)qhhhhhhh}q(h]h]h ]h!]h#]uh%Nh&hh]qh3)q}q(hhhhhhhh7h}q(h]h]h ]h!]h#]uh%Kh]qh/X#Channel depth (8-bit, 16-bit, etc.)qDžq}q(hhhhubaubaubh)q}q(hX%Order of channels (RGB vs. BGR, etc.)qhhhhhhh}q(h]h]h ]h!]h#]uh%Nh&hh]qh3)q}q(hhhhhhhh7h}q(h]h]h ]h!]h#]uh%K h]qh/X%Order of channels (RGB vs. BGR, etc.)qӅq}q(hhhhubaubaubh)q}q(hX:Row alignment policy (no alignment, word-alignment, etc.) hhhhhhh}q(h]h]h ]h!]h#]uh%Nh&hh]qh3)q}q(hX9Row alignment policy (no alignment, word-alignment, etc.)qhhhhhh7h}q(h]h]h ]h!]h#]uh%K!h]qh/X9Row alignment policy (no alignment, word-alignment, etc.)q߅q}q(hhhhubaubaubeubh3)q}q(hX~It also supports user-defined models of images, and images whose parameters are specified at run-time. GIL abstracts image representation from algorithms applied on images and allows us to write the algorithm once and have it work on any of the above image variations while generating code that is comparable in speed to that of hand-writing the algorithm for a specific image type.qhhhhhh7h}q(h]h]h ]h!]h#]uh%K#h&hh]qh/X~It also supports user-defined models of images, and images whose parameters are specified at run-time. GIL abstracts image representation from algorithms applied on images and allows us to write the algorithm once and have it work on any of the above image variations while generating code that is comparable in speed to that of hand-writing the algorithm for a specific image type.q煁q}q(hhhhubaubh3)q}q(hXThis document follows bottom-up design. Each section defines concepts that build on top of concepts defined in previous sections. It is recommended to read the sections in order.qhhhhhh7h}q(h]h]h ]h!]h#]uh%K)h&hh]qh/XThis document follows bottom-up design. Each section defines concepts that build on top of concepts defined in previous sections. It is recommended to read the sections in order.qq}q(hhhhubaubeubahUU transformerqNU footnote_refsq}qUrefnamesq}qUsymbol_footnotesq]qUautofootnote_refsq]qUsymbol_footnote_refsq]qU citationsq]qh&hU current_lineqNUtransform_messagesr]rUreporterrNUid_startrKU autofootnotesr]rU citation_refsr}rUindirect_targetsr]r Usettingsr (cdocutils.frontend Values r or }r (Ufootnote_backlinksrKUrecord_dependenciesrNU rfc_base_urlrUhttps://tools.ietf.org/html/rU tracebackrUpep_referencesrNUstrip_commentsrNU toc_backlinksrUentryrU language_coderUenrU datestamprNU report_levelrKU _destinationrNU halt_levelrKU strip_classesrNh,NUerror_encoding_error_handlerrUbackslashreplacerUdebugr NUembed_stylesheetr!Uoutput_encoding_error_handlerr"Ustrictr#U sectnum_xformr$KUdump_transformsr%NU docinfo_xformr&KUwarning_streamr'NUpep_file_url_templater(Upep-%04dr)Uexit_status_levelr*KUconfigr+NUstrict_visitorr,NUcloak_email_addressesr-Utrim_footnote_reference_spacer.Uenvr/NUdump_pseudo_xmlr0NUexpose_internalsr1NUsectsubtitle_xformr2U source_linkr3NUrfc_referencesr4NUoutput_encodingr5Uutf-8r6U source_urlr7NUinput_encodingr8U utf-8-sigr9U_disable_configr:NU id_prefixr;UU tab_widthr<KUerror_encodingr=Uasciir>U_sourcer?hUgettext_compactr@U generatorrANUdump_internalsrBNU smart_quotesrCU pep_base_urlrDU https://www.python.org/dev/peps/rEUsyntax_highlightrFUlongrGUinput_encoding_error_handlerrHj#Uauto_id_prefixrIUidrJUdoctitle_xformrKUstrip_elements_with_classesrLNU _config_filesrM]Ufile_insertion_enabledrNU raw_enabledrOKU dump_settingsrPNubUsymbol_footnote_startrQKUidsrR}rShhsUsubstitution_namesrT}rUhh&h}rV(h]h!]h ]Usourcehh]h#]uU footnotesrW]rXUrefidsrY}rZub.