Some time ago I've found on the web this really cool but outdated tutorial: https://www.sparkfun.com/tutorials/304
I've ported the code to Python, because OpenCV is only maintained for C++ and Python.
The results can be found here: https://dl.dropboxusercontent.com/u/1542785/PanTiltFaceTracking.zip
Hardware and arduino software should be done according to the original tutorial.
For Python part I assume that Linux and Python are installed and other prerequisites can be obtained using:
sudo apt-get install python-numpy
sudo apt-get install python-opencv
To run the program simply type:
sudo ./go
Administrative privileges are needed to access arduino serial port. In case when a wrong camera is used just change the first argument in "go" from 0 to 1...
Have fun!
niecodzienne spojrzenie, głębsze przemyślenie, faktów skojarzenie ze szczyptą humoru.
piątek, 19 lutego 2016
czwartek, 19 listopada 2015
The ultimate guide to life
"When
I was a little boy, my father told me to always listen to my heart.
When
I was a big boy, my father told me that only money counts.
The
wind blows and breaks the weak trees, the wind blows and pets the strong trees.
The most important thing is to be strong."
This
is a free translation of the "Kiedy byłem małym chłopcem" ("When
I was a little boy") song by the famous polish blues band Breakout. This
great piece really puzzles my children: which advice is the right one, why did
the father lie at some point? Let's take a closer look at all three advices
with a little help of physical and cognitive sciences, but we'll start in the
reverse order.
3. The most important thing is to be
strong
The
weak are meat the strong do eat. Being strong is a basic principle of life, we
were shaped by the evolution to maximize our chances of survival and
reproduction, otherwise we wouldn't be here. So that's it, the end of the song
presents the ultimate wisdom, which can also be applied to the companies or the
nations and help us mentally endure during the bad times.
Well,
not so fast, there are some catches. First of all being strong can lead to an
arms race, stifling the cooperation and possibly leading to a risky
confrontation, it also consumes an energy, which we'll examine later on.
Secondly it doesn't change our fate, which is death, so maybe the resistance is
futile. Even if we come up with a recipe for immortality, the stars will burn
out and the whole Universe will become cold and inhabitable, we can't win with an
entropy.
2. Only money counts
Money
makes the world go round. This saying depicts the role of the money in our
society, which is an equivalent of the energy in physics, nothing happens
without it. Connection between the money and the energy is more than symbolic,
because for example we need the money to buy a fuel or an electricity, and
without them all the present social structures would die, just like a living
creature without a food. So focusing on the money (or the energy in general)
seems like a very good advice.
Life
needs the energy to fight with the entropy, but the energy comes from the
outside world, making life a predator. Becoming stronger in order to grab more
energy creates an addiction to the higher energy needs, which can backfire when
the environment changes and the energy supply becomes short. That’s why the
nature doesn’t blindly seek for more, but rather reach some equilibrium and
minimize the energy consumption where possible.
1. Always listen to your heart
There
seems to be a more precious resource than the energy, which is our limited
time. We can spend the time to get more energy, but we can’t buy the time back.
Think about it for a while, you can even measure with a stopwatch what really
matters in your life. Here we reach our first advice, listen to your heart to
know what really matters. It may seem a bit cheesy or sentimental, but it has
another strong justification. Every second you process a huge amount of data
from your senses. Most of this information is discarded and the emotions filter
what gets attention, what gets analyzed and remembered, which is very efficient
and saves a lot of energy. We can even think of ourselves as the patterns of
neurons getting excited by the certain inputs.
Listening
to the emotions which provide the optimal default hints for our specie to
survive and reproduce in the Stone Age may not always be the best in the modern
times. Evolution never optimized us for a precise reception of the reality, we
get it as a side effect to a degree in which it helps us to survive and
reproduce at the minimal energy costs, keep this in mind and don’t treat your
world image too literally. Our genes didn’t have enough time to adapt to the
abundance of food, to the lack of most dangers, to the longer lifespan and to
the complexity of the modern world, instead our cognition is full of biases,
which make us vulnerable and are ruthlessly abused by the marketing folks. Of
course we can rely on the science for the better hints and practice Buddhist
like discipline to retain a better control of our emotional life, but it’s very
difficult as those things are so deeply wired in our brains.
Reading between the lines
After
analyzing all three advices we can see that none of them is perfect, they all
have the strong bases, but can fail us in the certain situations, they can also
produce either similar or contradictory hints. Father didn’t lie, things are
just more complicated. There are no golden rules and there can’t be, because it
all depends on both our abilities and the external conditions. What used to
work for some great person, probably won’t work for us, because we are
different and the world has already changed since then, otherwise everybody
would simply do it. Luck is an important ingredient of all great successes,
because the right abilities must meet the right conditions at the right moment,
the world may not be technologically or socially ready for your great start-up
or it can be already too late, because the competition is too fierce.
Fortunately we don’t have to depend on the luck, but should rather help it by
adapting to the changing environment conditions, which happens to be a
definition of an intelligence.
Intelligence
Even
a behavior of a simple creature fleeing from a danger and seeking the
opportunities is considered intelligent and our capacities are much bigger. We
can adjust our patterns of behavior, we can predict the changes instead of
being surprised by them, we can even change the environment to better suit us.
It may all sound so simple, but is actually the most difficult thing in the
world, life is the art of making choices. First difficulty comes from the fact
that we can even choose what we want to optimize. If you don’t believe in some
divine powers, then there are no objective values and the whole meaning is just
local and subjectively created by the individuals or the society. It’s even
worse, different people represent different values, which you have to take into
account when optimizing for your own values, and each person including you can
have a conflict among their values. Now let’s add the complexity of the
external world and we can imagine the scale of the problem. I really admire how
our simplified thinking often leads to the surprisingly good results, but
sometimes it fails miserably, in such cases we can only adapt again and again. There
is an interesting alternative definition of the intelligence, which is
maximizing your choice options. This may come at some cost, but in the long run
should allow for a better choice and avoid reaching a dead-end, where you’ll no
longer be able to adapt. This sounds familiar to the notion of freedom, but they
are not always the same.
Cooperation
Our
specie excels in a cooperation. We have defeated the Neanderthals by
outnumbering them, even though they were stronger and smarter, but the bigger
brain and more muscles required more energy and the same area of land could
feed a smaller group. Cooperation of similar yet diverse individuals have many
benefits: common problems get better solutions as more people work on them or
some specialize in them, resources are used more efficiently when they can be
shared, risk is minimized when people help each other. Contrary to the animals,
which only trust their own herd, we also trust the strangers and can form the
groups as big as the society, which can be compared to a meta-organism or a
human hive. So maybe the final advice should be to join or create the best
groups?
Being
a group member comes at the cost of freedom, but can actually increase your
choice options as the whole group has more possibilities. On the other hand
being an outcast requires you to be more self-sufficient rather than specialized
or managing, which can be beneficial when the whole group is in trouble.
Conclusion
My
advice for the children is to adapt using the available information and other advices
as the good hints. Don’t regret your choices, because they were the best what
you could come up with at the given moment, failure is simply a part of a trial
and error process, and if you don’t like the outcomes adapt again…
czwartek, 14 maja 2015
Bacon
Was Francis Bacon right writing "We must obey the forces we want to command."? This quote definitely refers to the virtue called humility, which is not very popular in the modern times. Nevertheless I would like to advocate for the wisdom of this message.
"If there is one thing the history of evolution has taught us it's that life will not be contained. Life breaks free, it expands to new territories and crashes through barriers, painfully, maybe even dangerously, but, uh... well, there it is". These words by Dr. Ian Malcolm from Jurassic Park predicted the incoming disaster. Life will eventually find its way through every obstacle, whether we consider biology, business or society. No matter how weak it may seem, plethora of creatures given enough time is unpredictable. Collapse of the slavery was unimaginable for centuries and yet it happened, leading to the society we know today.
"To answer power with power, the Jedi way this is not. In this war, a danger there is, of losing who we are". This quote by master Yoda from Star Wars points to another danger. Not only we cannot fully control the reality, but the act of control can change us in a way we do not desire. Control requires us to create the mental models of reality, which are leaky by definition. Incorporating those models in our thinking is changing us, so we must carefully choose them. Famous experiment conducted by Philip Zimbardo with the students acting either as prisoners or guards can be a very good warning. Guards showed no respect to the prisoners, which led to a violence.
To sum up, Bacon's message is universal and withstands the trial of time, it warns us about the many mistakes that arrogance can lead us to.
"If there is one thing the history of evolution has taught us it's that life will not be contained. Life breaks free, it expands to new territories and crashes through barriers, painfully, maybe even dangerously, but, uh... well, there it is". These words by Dr. Ian Malcolm from Jurassic Park predicted the incoming disaster. Life will eventually find its way through every obstacle, whether we consider biology, business or society. No matter how weak it may seem, plethora of creatures given enough time is unpredictable. Collapse of the slavery was unimaginable for centuries and yet it happened, leading to the society we know today.
"To answer power with power, the Jedi way this is not. In this war, a danger there is, of losing who we are". This quote by master Yoda from Star Wars points to another danger. Not only we cannot fully control the reality, but the act of control can change us in a way we do not desire. Control requires us to create the mental models of reality, which are leaky by definition. Incorporating those models in our thinking is changing us, so we must carefully choose them. Famous experiment conducted by Philip Zimbardo with the students acting either as prisoners or guards can be a very good warning. Guards showed no respect to the prisoners, which led to a violence.
To sum up, Bacon's message is universal and withstands the trial of time, it warns us about the many mistakes that arrogance can lead us to.
niedziela, 23 lutego 2014
piątek, 22 listopada 2013
Cena prywatności
Jak ze wszystkimi rzeczami na świecie, poziom prywatności który mamy jest pewnym kompromisem, warto sobie to uświadomić i znać konsekwencje takiego stanu rzeczy. Chronić możemy naszą tożsamość (w tym osobowość prawną, wygląd), naszą informację medyczną (w szczególności genetyczną), informację o naszych preferencjach i zachowaniach (w szczególności dotyczących wydawania pieniędzy), kanały kontaktu z nami.
O ile nie jesteśmy łakomym kąskiem dla służb/szpiegów gospodarczych lub paparazzich, informacją o nas zainteresowany jest głównie biznes oraz być może przestępcy, gdy gra jest warta świeczki. Firmy handlowe chcę przewidywać i wpływać na nasze zakupy, pracodawcy poznać swojego pracownika, ubezpieczalnie unikać wysokiego ryzyka, windykatorzy i telemarketerzy skontaktować się z nami, jest nawet cała branża firm handlująca taką informacją. Dane posiadają pewną wartość a w najgorszym przypadku mogą nawet zostać użyte przeciwko nam lub dać komuś pewną przewagę.
Nie ma darmowego lunchu, za zniżkę w programie lojalnościowym, za darmową pocztę na gmail, za darmowe konto w mBanku, za gadżety w zamian za dane kontaktowe płacimy informacją. Zawsze warto się zastanowić czy taka wymiana jest uczciwa i korzystna dla obu stron, zniżki łatwo policzyć, cenę odpowiednich płatnych usług znaleźć. Osobiście z zasady nie udostępniam prawdziwych informacji za jednorazową korzyść, gdyż dane wyszły już na zawsze, pomimo zapewnień o możliwości ich usunięcia.
Rzeczywistość jest jednak bardziej skomplikowana, czasem nie mamy wyboru alternatywy usługi dającej nam większą prywatność albo inne okoliczności zmuszają nas do użycia konkretnej usługi. Czasem informacja zbierane są bez naszej zgody i wiedzy, co miało np. miejsce w nowych "inteligentnych" telewizorach.
Prywatność stoi w sprzeczności z personalizacją, która może bardzo ułatwiać życie i dostarczać interesujących nas informacji. Pamiętać trzeba tylko o tym, że algorytmy będą znały nas dużo lepiej niż my sami a podsuwane rozwiązania są najkorzystniejsze dla drugiej strony a tylko przy okazji dla nas.
Żeby docenić wartość prywatności, zobaczmy jak kosztowne, pracochłonne i ograniczające wolność byłoby jej całkowite utrzymanie:
- Kanały informacji możemy chronić używając tylko niezarejestrowanego telefonu na kartę, internetu przez ten telefon z dodatkowymi zabezpieczeniami typu VPN/TOR, szyfrowanej poczty na prywatnym serwerze, prywatnego firewalla blokującego domyślnie cały ruch oraz rezygnując całkowicie z ciasteczek i usług w chmurze.
- Żeby nie zostawiać informacji finansowych w sklepach i bankach, trzeba zlikwidować wszystkie karty i konta po czym przejść na gotówkę. Gotówka nie inwestowana traci na wartości o inflację i jest bardziej podatna na kradzież więc potrzebujemy sejfu/skrytki, ale nikt nie może np. zablokować nam konta.
- Informację medyczną można chronić np. lecząc się tylko prywatnie i przychodząc z własnym zeszytem jako kartą choroby.
- Żeby nie zostawiać informacji państwu trzeba pracować i wynajmować mieszkanie na czarno oraz nie korzystać z rzadnych jego usług, co jest dość niewygodne i ryzykowne.
- Swój wygląd możemy chronić chodząc w kapturze lub masce.
- Zostaje nam już ostatnie niestety najsłabsze ogniwo czyli inni ludzie. Informujemy bliskich o zostaniu objętym programem ochrony świadków i znikamy na wieczną samotność... lub sfingujemy własną śmierć po wykupieniu ubezpieczenia na życie. Załatwiamy fałszywe dokumenty, bo zawsze mogą się przydać.
Wdrażanie kolejnych punktów z powyższego planu jest coraz bardziej uciążliwe i budzące podejrzenia o chorobę psychiczną lub działalność przestępczą. Właśnie walka z mafią jest jednym z argumentów za całkowitą likwidacją gotówki, ale bądźmy czujni, bo któregoś dnia obudzimy się z chipem...
O ile nie jesteśmy łakomym kąskiem dla służb/szpiegów gospodarczych lub paparazzich, informacją o nas zainteresowany jest głównie biznes oraz być może przestępcy, gdy gra jest warta świeczki. Firmy handlowe chcę przewidywać i wpływać na nasze zakupy, pracodawcy poznać swojego pracownika, ubezpieczalnie unikać wysokiego ryzyka, windykatorzy i telemarketerzy skontaktować się z nami, jest nawet cała branża firm handlująca taką informacją. Dane posiadają pewną wartość a w najgorszym przypadku mogą nawet zostać użyte przeciwko nam lub dać komuś pewną przewagę.
Nie ma darmowego lunchu, za zniżkę w programie lojalnościowym, za darmową pocztę na gmail, za darmowe konto w mBanku, za gadżety w zamian za dane kontaktowe płacimy informacją. Zawsze warto się zastanowić czy taka wymiana jest uczciwa i korzystna dla obu stron, zniżki łatwo policzyć, cenę odpowiednich płatnych usług znaleźć. Osobiście z zasady nie udostępniam prawdziwych informacji za jednorazową korzyść, gdyż dane wyszły już na zawsze, pomimo zapewnień o możliwości ich usunięcia.
Rzeczywistość jest jednak bardziej skomplikowana, czasem nie mamy wyboru alternatywy usługi dającej nam większą prywatność albo inne okoliczności zmuszają nas do użycia konkretnej usługi. Czasem informacja zbierane są bez naszej zgody i wiedzy, co miało np. miejsce w nowych "inteligentnych" telewizorach.
Prywatność stoi w sprzeczności z personalizacją, która może bardzo ułatwiać życie i dostarczać interesujących nas informacji. Pamiętać trzeba tylko o tym, że algorytmy będą znały nas dużo lepiej niż my sami a podsuwane rozwiązania są najkorzystniejsze dla drugiej strony a tylko przy okazji dla nas.
Żeby docenić wartość prywatności, zobaczmy jak kosztowne, pracochłonne i ograniczające wolność byłoby jej całkowite utrzymanie:
- Kanały informacji możemy chronić używając tylko niezarejestrowanego telefonu na kartę, internetu przez ten telefon z dodatkowymi zabezpieczeniami typu VPN/TOR, szyfrowanej poczty na prywatnym serwerze, prywatnego firewalla blokującego domyślnie cały ruch oraz rezygnując całkowicie z ciasteczek i usług w chmurze.
- Żeby nie zostawiać informacji finansowych w sklepach i bankach, trzeba zlikwidować wszystkie karty i konta po czym przejść na gotówkę. Gotówka nie inwestowana traci na wartości o inflację i jest bardziej podatna na kradzież więc potrzebujemy sejfu/skrytki, ale nikt nie może np. zablokować nam konta.
- Informację medyczną można chronić np. lecząc się tylko prywatnie i przychodząc z własnym zeszytem jako kartą choroby.
- Żeby nie zostawiać informacji państwu trzeba pracować i wynajmować mieszkanie na czarno oraz nie korzystać z rzadnych jego usług, co jest dość niewygodne i ryzykowne.
- Swój wygląd możemy chronić chodząc w kapturze lub masce.
- Zostaje nam już ostatnie niestety najsłabsze ogniwo czyli inni ludzie. Informujemy bliskich o zostaniu objętym programem ochrony świadków i znikamy na wieczną samotność... lub sfingujemy własną śmierć po wykupieniu ubezpieczenia na życie. Załatwiamy fałszywe dokumenty, bo zawsze mogą się przydać.
Wdrażanie kolejnych punktów z powyższego planu jest coraz bardziej uciążliwe i budzące podejrzenia o chorobę psychiczną lub działalność przestępczą. Właśnie walka z mafią jest jednym z argumentów za całkowitą likwidacją gotówki, ale bądźmy czujni, bo któregoś dnia obudzimy się z chipem...
piątek, 25 października 2013
7 kryteriów wyboru idealnej pracy
Ciężko porównuje się jabłka do pomarańczy, ale nawet w takim przypadku można przyznawać punkty za doznania zmysłów, wartości odżywcze, cenę, itp. Wybór owocu odbywa się najczęściej intuicyjnie, natomiast nad pracą w której spędzamy jedną trzecią życia warto się lepiej zastanowić.
1. Ciekawa branża
Czy firma pracuje w branży pokrywającej się z naszymi pasjami, czy umieramy w niej z nudów? Czy zmieniamy świat na lepsze, czy zamiast tego mamy dylematy etyczne? W przypadku firm informatycznych rozważania dotyczą również dziedziny z której pochodzą klienci.
2. Zespół i kultura organizacji
Czy wolę szalony start up czy spokojną pracę w korporacji? Jacy ludzie pracują w firmie, czy jest dużo rówieśników?
3. Wynagrodzenie
Czy firma płaci średnią rynkową dla odpowiednich stanowisk, czy odbiega od niej w którymś kierunku?
4. Rozwój umiejętności
Czy posiadam umiejętności potrzebne do pracy w firmie i czy będę mógł je dalej rozwijać?
5. Dodatkowe atrakcje
Lista zachęt może być długa, począwszy od zagranicznych delegacji i imprez integracyjnych po różne inne bonusy.
6. Perspektywy kariery
Czy firma rozwija się i jest wystarczająco duża by można było w niej awansować? Jak wygląda struktura hierarchiczna?
7. Udogodnienia i uciążliwości
Jak blisko lub daleko będę miał do pracy? Czy godziny pracy są elastyczne a może można pracować z domu?
Pora teraz na algorytm, dla każdego kryterium przyznajemy +1/-1 lub 0 gdy nie możemy się zdecydować albo +2/-2 gdy firma bardzo się pod jakimś względem wybija, sumujemy et voila!
Oceny są oczywiście subiektywne i ta sama firma może zostać różnie oceniona przez inne osoby. Co więcej nawet ocena tej samej firmy przez tą samą osobę może ulec zmianie w czasie. Ciekawym ćwiczeniem jest wykonanie porównania byłych, obecnego i potencjalnych pracodawców. Dla byłych pracodawców można nawet policzyć dwie wersje - jak przychodziliśmy i odchodziliśmy z firmy. Miłej zabawy i owocnych wyborów!
1. Ciekawa branża
Czy firma pracuje w branży pokrywającej się z naszymi pasjami, czy umieramy w niej z nudów? Czy zmieniamy świat na lepsze, czy zamiast tego mamy dylematy etyczne? W przypadku firm informatycznych rozważania dotyczą również dziedziny z której pochodzą klienci.
2. Zespół i kultura organizacji
Czy wolę szalony start up czy spokojną pracę w korporacji? Jacy ludzie pracują w firmie, czy jest dużo rówieśników?
3. Wynagrodzenie
Czy firma płaci średnią rynkową dla odpowiednich stanowisk, czy odbiega od niej w którymś kierunku?
4. Rozwój umiejętności
Czy posiadam umiejętności potrzebne do pracy w firmie i czy będę mógł je dalej rozwijać?
5. Dodatkowe atrakcje
Lista zachęt może być długa, począwszy od zagranicznych delegacji i imprez integracyjnych po różne inne bonusy.
6. Perspektywy kariery
Czy firma rozwija się i jest wystarczająco duża by można było w niej awansować? Jak wygląda struktura hierarchiczna?
7. Udogodnienia i uciążliwości
Jak blisko lub daleko będę miał do pracy? Czy godziny pracy są elastyczne a może można pracować z domu?
Pora teraz na algorytm, dla każdego kryterium przyznajemy +1/-1 lub 0 gdy nie możemy się zdecydować albo +2/-2 gdy firma bardzo się pod jakimś względem wybija, sumujemy et voila!
Oceny są oczywiście subiektywne i ta sama firma może zostać różnie oceniona przez inne osoby. Co więcej nawet ocena tej samej firmy przez tą samą osobę może ulec zmianie w czasie. Ciekawym ćwiczeniem jest wykonanie porównania byłych, obecnego i potencjalnych pracodawców. Dla byłych pracodawców można nawet policzyć dwie wersje - jak przychodziliśmy i odchodziliśmy z firmy. Miłej zabawy i owocnych wyborów!
piątek, 3 maja 2013
Imagine
Wyobraź sobie piękny film o odwadze upadania i życia w pełni możliwości, o iluzoryczności naszych doznań i wyobrażeń, o ponadprzeciętnej zmysłowości. Głębokie filozoficzne studium teorii poznania i tego czym jest prawda. A teraz wyobraź sobie, że jest to historia o osobach niewidzących. Obraz ten powinien zobaczyć każdy niewidomy, który patrzy a nie widzi.
Subskrybuj:
Posty (Atom)