Sunday, April 17, 2016

Get Bash on Windows 10 Build 14316

To get Bash (Ubuntu) as part of Windows 10, you first need to become an 'insider'.
  • Go to Settings > Update & Security > Advanced Options and toggle the Get Insider Preview Builds option with the level to Fast.
  • From Settings > Update & Security > For Developers enable Developer mode.
  • Go to Settings > Update & Security > Advanced Options and in the section Choose how updates are delivered, turn the option for PC's on my local network and the internet on. (This isn't required, but let me download the build immediately after I enabled it).
  • After you get the build, go to Programs and Features from the Control Panel and choose option Turn Windows Features on or off. Enable Windows subsystem for Linux (Beta)
  • Search for bash in the start menu and you're all set!



Saturday, April 16, 2016

IPython freeze on OpenCV destroyAllWindows

If you are running OpenCV on an IPython console, chances are cv2.destroyAllWindows() will freeze your image window and ultimately kill the kernel. To get around this, intersperse your code with the following functions (startWindowThread() and waitKey(1)) :

cv2.namedWindow('image')
cv2.startWindowThread()
.
.
.
cv2.waitKey(1)
cv2.destroyAllWindows()
cv2.waitKey(1)

Should hopefully solve the issue!

OpenCV Error on Anaconda


Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config

Solution:
conda remove opencv
conda update conda
conda install --channel menpo opencv

This installs the opencv from public channel menpo which works fine.

Saturday, March 5, 2016

Convert binaryproto format to numpy (Readable)

To view the values of image-mean data stored in binaryproto format, use the following:

import caffe
import numpy as np
import sys

blob = caffe.proto.caffe_pb2.BlobProto()
data = open( 'YOURBPFILE.binaryproto' , 'rb' ).read()
blob.ParseFromString(data)

arr = np.array( caffe.io.blobproto_to_array(blob) )
print arr