You are viewing notbrainsurgery

This · is · Not · a · Brain · Surgery


random thoughts on technology

Recent Entries · Archive · Friends · Profile

* * *
RasperryPI OS (Raspbian) comes with OpenCV 2.3. Many people experimenting with this platform want to use newer OpenCV version 2.4. It could be compiled on this platform but it is a laborious process requiring installing bunch of dependencies. The compilation takes about 10 hours and you need about 4Gb of disk space on your PI to do that.

To save you the pain Codeminders built binary packages which you can easily install on your PI. They are based on Raspbian OpenCV packages for Jessie which are not stable. Use at your own risk. Instructions:

1. Install public Codeminders repository public GPG key:

wget -O - http://www.codeminders.com/raspbian-apt/KEY.txt | sudo apt-key add -

2. Add the following line to /etc/apt/sources.list:

deb http://www.codeminders.com/raspbian-apt/ wheezy main

3. Use the following commands to install:

$ sudo apt-get update
$ sudo apt-get install libopencv-dev


You should see something like this:

root@lordberry:/home/pi# apt-get install libopencv-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libcv-dev libcvaux-dev libhighgui-dev libopencv-calib3d-dev libopencv-calib3d2.4 libopencv-contrib-dev
libopencv-contrib2.4 libopencv-core-dev libopencv-core2.4 libopencv-features2d-dev libopencv-features2d2.4
libopencv-flann-dev libopencv-flann2.4 libopencv-gpu-dev libopencv-gpu2.4 libopencv-highgui-dev
libopencv-highgui2.4 libopencv-imgproc-dev libopencv-imgproc2.4 libopencv-legacy-dev libopencv-legacy2.4
libopencv-ml-dev libopencv-ml2.4 libopencv-objdetect-dev libopencv-objdetect2.4 libopencv-ocl-dev
libopencv-ocl2.4 libopencv-photo-dev libopencv-photo2.4 libopencv-stitching-dev libopencv-stitching2.4
libopencv-superres-dev libopencv-superres2.4 libopencv-ts-dev libopencv-ts2.4 libopencv-video-dev
libopencv-video2.4 libopencv-videostab-dev libopencv-videostab2.4 libopencv2.4-java libopencv2.4-jni
opencv-data
The following NEW packages will be installed:
libcv-dev libcvaux-dev libhighgui-dev libopencv-calib3d-dev libopencv-calib3d2.4 libopencv-contrib-dev
libopencv-contrib2.4 libopencv-core-dev libopencv-core2.4 libopencv-dev libopencv-features2d-dev
libopencv-features2d2.4 libopencv-flann-dev libopencv-flann2.4 libopencv-gpu-dev libopencv-gpu2.4
libopencv-highgui-dev libopencv-highgui2.4 libopencv-imgproc-dev libopencv-imgproc2.4 libopencv-legacy-dev
libopencv-legacy2.4 libopencv-ml-dev libopencv-ml2.4 libopencv-objdetect-dev libopencv-objdetect2.4
libopencv-ocl-dev libopencv-ocl2.4 libopencv-photo-dev libopencv-photo2.4 libopencv-stitching-dev
libopencv-stitching2.4 libopencv-superres-dev libopencv-superres2.4 libopencv-ts-dev libopencv-ts2.4
libopencv-video-dev libopencv-video2.4 libopencv-videostab-dev libopencv-videostab2.4 libopencv2.4-java
libopencv2.4-jni opencv-data
0 upgraded, 43 newly installed, 0 to remove and 62 not upgraded.
Need to get 16.0 MB of archives.
After this operation, 61.4 MB of additional disk space will be used.
Do you want to continue [Y/n]?



4. Enjoy!
* * *
* * *
We use google calendar at our company, and I have some of my colleagues calendars shared with me. This is very convenient as I can check their availability right from my phone when, for example, scheduling a meeting. What I miss is a very simple feature. If I am about to call somebody and his calendar shows that he or she is in a meeting right now, I would like my phone give me a quick warning:

"Alex seems to be in the meeting with Joe for next 40 minutes. Are you sure you want to call him?"

[YES ] [no] [Remind me in 40min]


If somebody would write an app doing that I will be one happy user!
* * *
* * *
When things get virtual we usually start by mimicking familiar physical world. We have mailbox, folder and envelope icons, "old phone" ringtones, and lot of other UI metaphors inspired by things now obsolete. Nothing wrong with that, as long as by doing this we do not limit our creativity. Take a look at this picture of Pebble watch:

pebble-time

In pebble argot this is called "watchface." This is a particularly popular one and there are dozens of variations of it in the Pebble store. The problem shown is that sometimes date "window" (at least this is what it is called on mechanical watches) is obstructed by watch hands and you could not tell the date. There is nothing you can do about it in old style mechanical watch, but on Pebble you can, for example, move the date window position around to make it always visible.
Tags: ,
* * *
* * *
Being heavy calendar user (my life is very busy) I recently realized that most calendaring applications lack an essential feature. There are 3 types of things I need to keep track of:

1. Events. Example: business meeting at particular time and date.
2. TODO items: Example: Change oil in my car.
3. Tasks: Examples: Finish a paper by a conference submission deadline. Read a book before it is due back to the library.

Most calendaring applications (Apple iCal, Google Calendar, etc.) support #1 and #2 pretty well. However I am yet to find one which have a good support for #3.
At the first glance a TODO item (which could be given a due date) could be treated as a Task. The difference is in how to present it to the user. TODO items are usually
shown as a list and you can associate a reminders with them. If you have several ongoing tasks it is very handy to be able to see how much time you have left on each of them,
be able to gauge your progress and pace rate of your work. If you ever used project management software like Microsoft Project you can imagine what I am talking about.
Ideally I would like to see something like simplified Gantt Chat.

So I wish Google Calendar or RTM could add support for Tasks which progress tracking. I guess somebody could put together a simple web app using their APIs to visualize some TODO items as tasks. I will be glad to beta test.
* * *
* * *
Over the years I contributed to many open source projects. As a rule whenever I write an utility or small hack for my private use I open source it, not matter how trivial, dirty or embarrassing the code might be. I used to maintain a list on my home page but frankly most of this stuff is obsolete and I have since removed it. When Source Forge was announced I eagerly moved my projects there. Unfortunately after a while SF development stagnated and I become increasingly annoyed by antique CVS and nineties-style web UI. Then came Google Code. It was simpler and cleaner, and Mercurial support sealed the deal for me and I started using it for all my new projects. Finally GitHub arrived and took over the open-source world. The last thing I wanted is another project hosting site, but it sucked me via network effects and I ended up using it for my newer projects.

My friends know that I embraced distributed version control systems early on. I was fascinated with DARCS, and tried to use it for production projects but it was a failure because frankly back then it was not ready. Then I found Mercurial and it become and still is my preferred version control system. I am not agains Git, and I think both systems have their merits, but big factor why Git is winning is because of GitHub, not Git itself. There is a BitBucket as an answer to GitHub and it looks nice, but I am afraid they were too late. Even they understood that when added support Git repositories now in addition to Mercurial.  Right now I am basically I gave up on Mercurial and going with the flow, using GitHub and Git for all my new projects. Of course something new is destined to come sooner or later and replace it. I keep my eyes open...

P.S. Links to lists of my open source projects on sites mentioned above:
* * *
* * *
Some of you might have noticed that the new generation of mobile phone's touchscreen sensors offer some interesting new features. In particular, they could sense a finger or a tool before it touches the screen. Sony calls this the “Floating Touch” (video). Samsung calls it “AirView” (video). These capabilities open a door to many exiting new features, like 3D gestures and posture detection, for example as described in my paper.

As a part of my research I have looked at how this works on Samsung Galaxy S4. First off let us clarify the terminology. It is tempting to refer to this as a "proximity" but this could be confused with proximity sensor in S4, so the term "hovering" is used instead. However in kernel source code sometimes these terms are mixed. From Java application one can subscribe to receive hovering events.

On hardware level, Galaxy S4 touch sensing is powered by Synaptics sensor. It communicates with the driver using RMI protocol over I2C bus. The protocol version 4 is documented. However the specification is missing any information about hovering. Fortunately Synaptics have contributed an open source Linux driver which have hovering/proximity support (provided by undocumented function F51).

Synaptics Linux driver translates RMI protocol to Linux Multitouch Protocol. In particular, statefull type "B" MT protocol is used. The events are sent via standard Linux "input" subsystem. On rooted Android phone one can see them using getevent utility. Here is an example of finger hovering events:

$ getevent -t -q /dev/input/event3

EV_ABS       ABS_MT_TRACKING_ID   00003146
EV_ABS       ABS_MT_POSITION_X    000001c5
EV_ABS       ABS_MT_POSITION_Y    0000037a
EV_ABS       ABS_MT_DISTANCE      000000d1
EV_SYN       SYN_REPORT           00000000
EV_ABS       ABS_MT_POSITION_X    000001c9
EV_ABS       ABS_MT_POSITION_Y    0000037b
EV_SYN       SYN_REPORT           00000000
EV_ABS       ABS_MT_POSITION_X    000001cf
EV_ABS       ABS_MT_POSITION_Y    0000037c
EV_SYN       SYN_REPORT           00000000


If you do not see ABS_MT_DISTANCE events that might mean that your proximity sensing (hovering) property has been disabled. You can re-enable it via sysfs interface
writing 0x03 (ON) or 0x82 (OFF) values to /sys/class/input/event3/device/proximity_enables.

What kind of information the driver gives us? As finger is approaching it starts reporting it coordinates and the distance. Additionally it reports estimated size of finger ellipse (as length of major and minor axis) using ABS_MT_WIDTH_MAJOR and ABS_MT_WIDTH_MINOR events. Finally, upon the contact, the driver reports contact area shape via ABS_MT_TOUCH_MAJOR and ABS_MT_TOUCH_MINOR. Additionally ABS_MT_ANGLE (0x3c) events are reported which supposed to report an angle of finger approach. More on these below.

Some Galaxy S4 specifics: For approach events, only ABS_MT_WIDTH_MAJOR is sent. So we have to assume that the finger share is a circle, not an ellipse. Upon touch both axis length is reported. However ABS_MT_ORIENTATION events are never generated and we do not know how the touch area ellipse is oriented. I suspect that ABS_MT_ANGLE, a Samsung-specific event is used by them instead of ABS_MT_ORIENTATION , but this hypothesis needs to be tested. Additionally, the driver detects palm touch which is reported as ABS_MT_PALM (0x3d).

This is just a quick overview post to share some technical information. I am still working on this and will post more as project progresses.

I also want to announce that I have created a new blog, where I will be sharing links to various industry news about touch sensing, gestures, etc. I do not plan to write original material there - just links to relevant news from around the web. If you interested in gestures and touch user interfaces, please subscribe and follow.
* * *
* * *
You might not be aware that not all USB chargers are made equal. Without going into technical details, the type of charger and cable you have might significantly affect how fast your cell phone will charge. If you leave it charging overnight, it is probably not such a big issue, but if you want to quickly pump some juice during a layover in an airport it could become critical. It is not always easy to predict based on phone and charged features their compatibility, so I decided to do a quick test using P3 International P4400 Kill A Watt Electricity Usage Monitor. I tested the following equipment:

Cell phones:
1. AT&T Samsung Galaxy S4
2. HTC One

Chargers:
1. iXCC (tm) Dual USB Port FAST 2.1A 10W AC White Travel Wall Charger
2. Stock USB charger which comes with Galaxy S4
4. Apple USB charger

Cables:
1. Samsung USB cable (white)
3. Generic USB cable (black)

You can see pictures of raw measurements here

The conclusions are:

1. Cable does matter. Samsung cable provides fastest charging (charger permitting)
2. Galaxy S4 can draw more current than HTC.
3. Samsung and iXCC chargers performed the best (about the same except iXCC has 2 ports you can use simultaneously).
Tags: ,
* * *
* * *
As part of a small research project I have set to built a small sensor network to monitor temperatures at my home and office. Doing this I did some hardware (wireless Zigbee temperature sensors) and software to collect data from existing ones. The purpose of this post is to share quick links to scripts I have developed.

1. Main project page: https://github.com/vzaliva/xbee_temp_sensor contains Wireless sensor harware design and a collection scripts for:
a) Collecting data from my XBee-based sensors
b) Collecting data from 3M CT-50 Radio thermostat
c) Recording data from Weatherunderground.com weather stations
d) Submitting data to COSM (now renamed to XIVELY.com)

2. Data collection from a cheap USB temperature sensor and COSM submission: https://github.com/vzaliva/temper-python

3. Data collection from NEST thermostat and COSM submission: https://github.com/vzaliva/pynest

4. Data collection from Linux PC sensors (LMSENSORS) and COSM submission: https://github.com/vzaliva/lmsensors-cosm

If you want to learn more about the project, you can read my preliminary report or take a look at the presentation.
* * *
* * *
I probably already mentioned weather similarity service. Today I got curious: how the map of earth would look like if cities are organized by temperature similarity, no matter where they are located geographically. Below is a picture of what I got:

weather similarity map

(I have labelled only cities with population over 2 million).

I wish I had a better way to show it in the browser. It would be nice to be able to zoom and show tooltips with city names. I have not find readily available JavaScript library for this and I do not have time to code this myself. If somebody interested in visualizing this I will be glad to share my data.
* * *
* * *
Once you switch to "retina" display on MacBook Pro, there is no going back. You just could not stop seeing huge pixels and artifacts on lower resolution screens. So, naturally when buying various devices with screens you want to keep an eye on PPI (pixels per inch). Here are some numbers (in decreasing order):


Nokia Lumia 920 - 332 PPI
iPhone 4/4S/5 Retina - 326 PPI
Samsung Galaxy S3 - 306 PPI
iPad 3 - 264 PPI
MacBook Pro 15-inch Retina display - 220 PPI
Amazon Kindle/Kindle Touch - 167 PPI
Microsoft Surface - 148 PPI
iPad 2 - 132 PPI
MacBook Air 13-inch - 128 PPI


(More numbers here)
* * *
* * *

Previous