Posts by: Michael Hirsch

Importing old OpenCV modules from OpenCV 2 in Python on Windows

Some of the legacy modules like Horn Schunck Optical Flow in OpenCV 2.4 are located in “cv” instead of “cv2″ . To be cross-platform compatible, instead of doing import cv,cv2 I suggest doing import cv2 from cv2 import cv —————————————————- Further, in Windows running Anaconda Python 2.7 (or whatever Python 2.7 you choose), OpenCV is […]

Python GNU Find capability

I found myself wanting a recursive pattern search in Python like GNU Find. I made a simple implementation using os.walk and glob. https://github.com/scienceopen/hist-utils/blob/master/walktree.py It may be possible to add more features like min/max depth of recursion, just ask me if you’d like something more.

Writing multipage TIFF with Python

You can use the freeimage plugin to SciPy as one method. On Windows you might see the error: RuntimeError: Could not find a FreeImage library To fix this, 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\ Example code (assuming you have image […]

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 […]

Marie – please contact me

Marie, we had talked about acoustics on Thursday. I did not receive your text. Please reply via email hirsch617@gmail.com or comment here. (Comments are moderated, so only I will see). Thank you.

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   […]

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 […]

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 […]

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 […]

Python findpeaks

If you’re looking for a Python function that works like Matlab’s “findpeaks” checkout SciPy argrelmax. If you want to do a comparison in the same code, you can call Octave findpeaks using Oct2Py, or use the Matlab Python API in Matlab R2014b