Skip to content

Instantly share code, notes, and snippets.

@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"
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)
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()
@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()
@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 / 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 / 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**
==4870== Memcheck, a memory error detector
==4870== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==4870== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==4870== Command: python tsne_test.py
==4870==
==4870== Invalid read of size 4
==4870== at 0x57398A: PyObject_GC_Del (in /usr/bin/python2.7)
==4870== by 0x55A056: ??? (in /usr/bin/python2.7)
==4870== by 0x4F7BA5: ??? (in /usr/bin/python2.7)
==4870== by 0x5B1F2C: ??? (in /usr/bin/python2.7)
# distutils: language = c++
# https://groups.google.com/forum/#!topic/cython-users/Ady-DdWu6rE
from cython.parallel import parallel, prange, threadid
from libcpp.vector cimport vector
from libc.stdlib cimport malloc, free
cimport openmp
import time
print("Threads = ", openmp.omp_get_max_threads())
# distutils: language = c++
from cython.parallel import parallel, prange
from libcpp.vector cimport vector
from libc.stdlib cimport malloc, free
cdef struct Data:
int x
int y