<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Adeilson</title>
    <description>My first try at blogging. :D</description>
    <link>https://adeilsonsilva.github.io/</link>
    <atom:link href="https://adeilsonsilva.github.io/feed.xml" rel="self" type="application/rss+xml" />
    <pubDate>Thu, 30 Aug 2018 21:28:36 +0000</pubDate>
    <lastBuildDate>Thu, 30 Aug 2018 21:28:36 +0000</lastBuildDate>
    <generator>Jekyll v3.7.3.1</generator>
    
      <item>
        <title>0x0002 - Undestanding LBP feature dimensions</title>
        <description>&lt;h2 id=&quot;lbp-is-really-cool&quot;&gt;LBP is really cool!&lt;/h2&gt;

&lt;p&gt;I was working with Local Binary Patterns (LBP) [1] recently to extract texture from facial images and I could not understand why my feature space was so huge (16384). So I did what I should have done a few years back and then took some time to carefully read the paper, as long as a few other sources, and here is my explanation to myself of it. Here you will find different informations about the subject merged with my thought process to understand it.&lt;/p&gt;

&lt;p&gt;Next image is basic LBP as you may know it. We take a central pixel and compare it with its neighbours, assigning 1 when the neighbour is greater than or equal to the central pixel and 0 otherwise. It yields a binary string that might be interpreted as a decimal number. Considering the regular LBP with 8 neighbours, we get a range of 2^8 numbers (8 bits in the string -&amp;gt; [0-255] in decimal).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/2018/0x0002-lbp.png&quot; alt=&quot;Basic LBP.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;We basically have two options now: we can go further and apply LBP to the image as a whole and get an histogram out of that, or we can divide the image in smaller blocks and concatenate the smaller histograms into a big one.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/2018/0x0002-lbp-hist.png&quot; alt=&quot;LBP Histogram.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;This basic operator was then expanded [1, 2]. Now we can use a different number of neighbours, as well a different radius (distance from the central pixel).&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/2018/0x0002-exlbp.png&quot; alt=&quot;Extented LBP.&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Another idea that came later was “uniform” LBP [2]. An LBP is uniform when it has at most two transitions 1-0 or 0-1. Example: 11000011 is uniform because it has just two transitions while 10110101 is not uniform with its six transitions. If we consider a fixed neighborhood of 8, we might reduce histogram size from 256 to 59. That’s because there are 58 uniform numbers in the range [0-255] (run the python code below and you will see it). We assign a histogram bin for each uniform number and leave an extra bin for every non-uniform one (58 + 1). The number of uniform values can be estimated as P*(P-1)+2 [5] for P neighbours.&lt;/p&gt;

&lt;div class=&quot;language-python highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;number&lt;/span&gt; &lt;span class=&quot;ow&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;range&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;256&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;str&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot; =&amp;gt; &quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;+&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;{0:b}&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;format&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;number&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;SO, my feature dimension was 16384 because I was using regular LBP (not uniform) with 8 neighbours, a radius of 1, and dividing the image in 64 regions. That means I had 64 histograms with 256 bins each. &lt;strong&gt;256 * 64 = 16384!&lt;/strong&gt; Wow! I excel at Math, I know that.&lt;/p&gt;

&lt;h2 id=&quot;references-and-sources&quot;&gt;References and sources&lt;/h2&gt;

&lt;p&gt;[1] &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=1717463&amp;amp;isnumber=36130&quot;&gt;T. Ahonen, A. Hadid and M. Pietikainen, “Face Description with Local Binary Patterns: Application to Face Recognition,” in IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 28, no. 12, pp. 2037-2041, Dec. 2006.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[2] &lt;a href=&quot;http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&amp;amp;arnumber=1017623&amp;amp;isnumber=21893&quot;&gt;T. Ojala, M. Pietikainen and T. Maenpaa, “Multiresolution gray-scale and rotation invariant texture classification with local binary patterns,” in IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 24, no. 7, pp. 971-987, July 2002.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[3] &lt;a href=&quot;https://bytefish.de/blog/local_binary_patterns/&quot;&gt;Local Binary Patterns&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[4] &lt;a href=&quot;http://answers.opencv.org/question/15493/uniform-lbp-mapping-using-lookup-table/&quot;&gt;uniform LBP - mapping using lookup table&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[5] &lt;a href=&quot;https://www.researchgate.net/post/I_dont_understand_how_uniform_pattern_of_LBP_reduces_its_bin_to_59_please_answer_me&quot;&gt;I don’t understand how uniform pattern of LBP reduces its bin to 59? please answer me?&lt;/a&gt;&lt;/p&gt;
</description>
        <pubDate>Thu, 30 Aug 2018 16:37:00 +0000</pubDate>
        <link>https://adeilsonsilva.github.io/blog/0x0002/</link>
        <guid isPermaLink="true">https://adeilsonsilva.github.io/blog/0x0002/</guid>
        
        <category>LBP</category>
        
        <category>Computer Vision</category>
        
        <category>Tutorial</category>
        
        <category>English</category>
        
        
        <category>blog</category>
        
      </item>
    
      <item>
        <title>0x0001</title>
        <description>&lt;h2 id=&quot;e-aí-kbça&quot;&gt;E aí KBÇA!&lt;/h2&gt;

&lt;p&gt;&lt;img src=&quot;/images/posts/2018/0x0001.gif&quot; alt=&quot;Hi from MJ.&quot; height=&quot;400px&quot; /&gt;&lt;/p&gt;

&lt;p&gt;Resolvi tornar públicos alguns dos códigos que produzi durante os anos da graduação.&lt;/p&gt;

&lt;p&gt;Tentei compilar os principais assuntos abordados. Não lembro detalhes de cada código, então caso encontre algum erro (ou um comentário maldoso :P), por favor, aponte.&lt;/p&gt;

&lt;p&gt;Estes foram os principais tópicos que consegui encontrar:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/ILP&quot;&gt;Introdução à Lógica de Programação com Pascal&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/LABC&quot;&gt;Exercícios diversos em C&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/LABC/trab-sockets&quot;&gt;Comunicação em Sockets em C&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/EDA&quot;&gt;Estruturas de Dados básicas em C&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;Listas, Filas, Pilhas, Árvores Binárias&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/PSB&quot;&gt;Exercícios diversos em Assembly&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/PSB/trab01-dijkstra&quot;&gt;Algoritmo de Dijkstra em Assembly&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/POO&quot;&gt;Programação Orientada a Objetos com Java&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/Compiladores&quot;&gt;Diferentes etapas de um Compilador&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/SO&quot;&gt;Conceitos de Sistemas Operacionais em C&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/Analise&quot;&gt;Conceitos de Análise de Algoritmos em C&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/Grafos&quot;&gt;Alguns problemas de Grafos em C&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;URI, SPOJ, Codepit, etc&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/EDA2&quot;&gt;Estruturas de Dados avançadas em C&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/Paradigmas&quot;&gt;Paradigmas de Linguagens de Programação&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;JS funcional, LISP&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/CG&quot;&gt;Conceitos de Computação Gráfica com ThreeJS&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/Biometria&quot;&gt;Uma aplicação biométrica utilizando Geometria das Mãos&lt;/a&gt;
    &lt;ul&gt;
      &lt;li&gt;Marcação de pontos (Ground Truth, detecção de contornos, classificação&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;&lt;a href=&quot;https://github.com/adeilsonsilva/bsc-codes/tree/master/IA&quot;&gt;Alguns algoritmos de inteligência artificial em R&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Sinta-se livre para explorar, encontrar e apontar pontos de melhoria, rir dos erros que cometi, etc. Leve em consideração que quando alguns desses códigos foram produzidos eu não tinha a menor ideia do que eu estava fazendo. Ou seja, nada mudou (risos).&lt;/p&gt;

&lt;p&gt;Dependendo da proporção que isso tomar posso tentar reviver alguns desses projetos e transformá-los em coisas mais úteis, ou explicá-los em alguns posts mais detalhados.&lt;/p&gt;

&lt;p&gt;Até logo!&lt;/p&gt;
</description>
        <pubDate>Thu, 23 Aug 2018 16:24:00 +0000</pubDate>
        <link>https://adeilsonsilva.github.io/blog/0x0001/</link>
        <guid isPermaLink="true">https://adeilsonsilva.github.io/blog/0x0001/</guid>
        
        <category>first</category>
        
        <category>códigos</category>
        
        <category>Português</category>
        
        
        <category>blog</category>
        
      </item>
    
  </channel>
</rss>
