Skip to content

Instantly share code, notes, and snippets.

@vighneshbirodkar
vighneshbirodkar / DisplayBase.py
Last active December 18, 2015 19:38
RenderContext and LayerStack Base classes.
from abc import ABCMeta,abstractmethod
class Display:
__metaclass__ = ABCMeta
#TODO add text for adjusting image size to fit
"""
**SUMMARY**
@vighneshbirodkar
vighneshbirodkar / display.py
Created July 1, 2013 20:05
notebook display example
from IPython.core.display import Javascript as JS
str = """
window = window.open('http://simplecv.org/sites/all/themes/kalypso/images/SM_logo_color.png','simplecv','width=500,height=500')
"""
JS(str)
@vighneshbirodkar
vighneshbirodkar / repeat.py
Last active December 19, 2015 08:19
a demo to illustrate repeating ids in python
from time import sleep
from SimpleCV import Image
class Example:
def __init__(self):
pass
while(True):
l = Example()
@vighneshbirodkar
vighneshbirodkar / qt.py
Last active December 19, 2015 10:29
Qt code
img = Image('abc.png')
img.show() # should open a new qt window to show the image
#this call should not block, and should reutrn immediately to allow the user to do further image processing
#additional image processing
img.toGray()
img.whatever()
from SimpleCV import Image
from SimpleCV.DisplayNew import GtkDisplay
from socket import setdefaulttimeout
setdefaulttimeout(None)
d1 = GtkDisplay(title = "Resize to fit", fit = GtkDisplay.RESIZE)
d2 = GtkDisplay(title = "Crop to fit", fit = GtkDisplay.CROP)
img = Image('lenna')
fs = img.findLines()
from SimpleCV import Image
from SimpleCV import Display,Camera
from socket import setdefaulttimeout
import SimpleCV as scv
setdefaulttimeout(None)
cam = Camera()
d1 = Display(title = "Resize to fit", fit = scv.RESIZE)
d2 = Display(title = "Crop to fit", fit = scv.SCROLL)
@vighneshbirodkar
vighneshbirodkar / lns.cpp
Created August 20, 2013 19:07
A simulation of Log Normal Shadowing based Path Loss.
/**
Program to simlulate Log Normal Shadowing
Program generates data in "plot.dat" file which can be plottes using gnuplot
*Compile with
g++ lns.cpp -o lns -std=c++11
*Plot with
plot "plot.dat" ;set xlabel "Seperation";set ylabel "Path Loss"
@vighneshbirodkar
vighneshbirodkar / for-prob.py
Created August 26, 2013 19:55
Python tricky for
l = [1,2,3,4]
for x in l:
x = 10
print l
@vighneshbirodkar
vighneshbirodkar / camera.py
Created August 29, 2013 17:10
camera code
from SimpleCV import *
import time
cam = Camera(threaded = True)
c = 0
time.sleep(1)
while True:
cam.getImage().show()
print c
c +=1
from ..Base import Display
from ..Base.Display import DisplayBase
from tornado.web import Application
import tornado
from IPython.core.display import Javascript as JS
from IPython.core.display import display
import os
import threading
import tempfile