Writing multipage TIFF with Python

You can use the freeimage plugin to SciPy as one method to write multipage TIFF images. You can also use tifffile or libtiff.

On Windows you might see the error:
RuntimeError: Could not find a FreeImage library

On Linux you might see the error:
freeimage had a problem: Could not find a FreeImage library in any of…

To fix this on Windows, download the FreeImge DLL from

http://freeimage.sourceforge.net/download.html

Then extract the file
dist/FreeImage.dll
to the following directory (assuming you’re using Anaconda Python)
C:\Anaconda\Lib\site-packages\skimage\io\_plugins\

To fix this on Linux, type
sudo apt-get install libfreeimage3

Example code (assuming you have image stored in C-ordered 3-D array images):

from skimage.io._plugins import freeimage_plugin as freeimg
freeimg.write_multipage(images,'myimages.tiff')

or try this example test code

reference:

https://groups.google.com/a/continuum.io/forum/#!topic/anaconda/wFu3yJtmiBo

OpenCV cv.CalcOpticalFlowHS Horn-Schunck smoothness lambda parameter

More details to come, but I was comparing the performance of OpenCV to Matlab Computer Vision Toolbox for the dense estimates of optical flow given by the Horn Schunck algorithm. I was getting a very different result with OpenCV vs. Matlab for the Optical Flow Estimation. It seemed that OpenCV was washing out fine details in the optical flow. After carefully comparing Matlab Computer Vision and OpenCV outputs for Horn Schunck optical flow, I found that the default lambda/smoothness parameter of 1.0 for cv.CalcOpticalFlowHS is not the same as what Matlab calls 1.0.

I need to quantify this further, but for now I found that in OpenCV cv.CalcOpticalFlowHS setting lambda=0.001 gives results that are much more like Matlab–I can see the fine details. This is just a rough guess, if I have time I’ll quantify it in my forthcoming article on segmenting terabtyes of aurora borealis video in an hour!

PySide in Anaconda3

When using Matplotlib in Anaconda 3, and if you’re trying to use QT4Agg, you may get the error message
ImportError: No module named 'PySide'

To fix this, you can try (using your Anaconda3 pip)
pip install pyside
This will take several minutes and may require the prerequisites:

sudo apt-get install libxext-dev python-qt4 qt4-dev-tools build-essential

 

Reference: http://movingthelamppost.com/blog/html/2013/07/12/installing_pyqt____because_it_s_too_good_for_pip_or_easy_install_.html

Using USB-serial FTDI adapters with Intel Edison

The current Yocto kernel distro available for the Intel Edison (version 68 by configure_edison --version) does not include the FTDI driver. Thus when you plug a USB-serial adapter into the USB OTG host port, you’ll see it partially recognized in dmesg tail upon plugin, but you won’t see an assignment to a /dev/ttyUSB_ device.

You need to install the FTDI kernel module first.
opkg install kernel-module-ftdi-sio
This assumes you have already setup the unofficial opkg repository.

Now when you type dmesg tail you’ll see the line something like
usb: FTDI USB Serial Device converter now attached to ttyUSB0

You may have to update your kernel if this doesn’t work.

Connecting to Boston University’s 802.1x Wifi from a Linux device

If you don’t have a graphical desktop, BU’s Enterprise Wifi requires the following manual settigns. The settings below are from BU’s recommended settings.  Their webpage has now been updated per my suggestion.


# nano /etc/wpa_supplicant/wpa_supplicant.conf

paste at the end
network={
ssid=”BU (802.1x)”

key_mgmt=WPA-EAP
pairwise=CCMP TKIP
eap=TTLS PEAP MSCHAPV2
identity=”Your BU login”
password=”your Kerberos Password: be aware others can read this file!”
phase2=”auth=MSCHAPV2″
}

Then

# reboot

This results in the feedback upon successful connection:

# wpa_cli -i wlan0 status

ssid=BU (802.1x)
id=2
mode=station
pairwise_cipher=CCMP
group_cipher=TKIP
key_mgmt=WPA2/IEEE 802.1X/EAP
wpa_state=COMPLETED
ip_address=155.41.65.23
Supplicant PAE state=AUTHENTICATED
suppPortStatus=Authorized
EAP state=SUCCESS
selectedMethod=21 (EAP-TTLS)
EAP TLS cipher=DHE-RSA-AES256-SHA
EAP-TTLSv0 Phase2 method=MSCHAPV2

WriteLatex vs. ShareLatex

Short answer: Use ShareLatex

Why?
1) ShareLatex is much faster to compile. I have a 30 page journal article draft with numerous figures, and WriteLatex seems to take on the order of a minute to compile while ShareLatex was substantially less.

2) ShareLatex has far better error/warning feedback and a much better IDE overall. WriteLatex error/warnings keep disappearing and the line number with error is not clearly indicated.

3) ShareLatex is open-source. WriteLatex is NOT open source.

Intel Edison: Measuring USB voltage on breakout board

I have been trying out a variety of power sources. One is the 4xAA battery holder to female USB Verbatim 97928 available for about $10. It seems to have a well regulated 5.0 volt output.

edisonpower

The red arrow points to the side of the “74” diode that comes right off the micro USB connector. I measured 5.00 Volts there with the Edison running on the Verbatim 97928. On the other side (downstream) of the diode I measured 4.72 Volts with the Edison idling. This voltage drop is expected due to the forward bias diode voltage drop.

Under 100% of one core CPU load, I measured 4.98V on the USB side, and 4.66V on the Edison side of this diode while powering from the USB port on the Verbatim 97928. The miniscule apparent 20mV voltage drop on the battery/USB side of the diode is likely to come from ohmic losses in the USB connector and cable.

Based on measurements of Intel Edison power consumption, and assuming 2000mAh, I estimate 10-12 hours of battery life on 4xAA alkaline batteries assuming continuous 100% CPU of one of the two CPU cores (other core idle). Normally the Edison will be mostly resting, drawing perhaps 100mW.

Thus with mixed use, I might expect to get up to 4-5 days of continuous mixed use operation on 4xAA batteries for the Intel Edison.