Skip to content

Instantly share code, notes, and snippets.

View vijay120's full-sized avatar

Vijay Ramakrishnan vijay120

  • Cisco Inc.
  • United States
View GitHub Profile
[~/Yahtzee vramakrishnan]$ bash test_yahtzee_manager.sh node_name
erlc yahtzee_manager.erl
yahtzee_manager.erl:237: Warning: variable 'LoginTicket' is unused
yahtzee_manager.erl:253: Warning: variable 'Username' is unused
erlc tournament_manager.erl
tournament_manager.erl:64: Warning: variable 'ActiveUsernames' is unused
tournament_manager.erl:87: Warning: function calcRoundSize/2 is unused
erlc referee.erl
referee.erl:77: Warning: variable 'PlayerAPid' is unused
referee.erl:80: Warning: variable 'PlayerBPid' is unused
2014-05-02 22:40:11.479: Referee<0.48.0> > My node is node_name@hollyhock
2014-05-02 22:40:11.479: Referee<0.48.0> > My pid is <0.48.0>
2014-05-02 22:40:11.893: Referee<0.48.0> > In handle game
Is timeout is false
inside true block
2014-05-02 22:40:12.171: Referee<0.48.0> > in handle roll
2014-05-02 22:40:12.171: Referee<0.48.0> > Before message sent
2014-05-02 22:40:12.172: Referee<0.48.0> > Player a username is: "enugent1"
2014-05-02 22:40:12.172: Referee<0.48.0> > Player b username is: "enugent2"
2014-05-02 22:40:12.172: Referee<0.48.0> > After message sent
2014-05-02 22:42:31.259: Referee<0.48.0> > Player A tuple is {<5378.2.0>,vijay1@ash,
"enugent1","hunter1",
#Ref<0.0.0.47>,true,0,0,0,0}
2014-05-02 22:42:31.259: Referee<0.48.0> > Player B tuple is {<5379.2.0>,vijay2@lothlorien,
"enugent2","hunter2",
#Ref<0.0.0.67>,true,0,0,0,0}
2014-05-02 22:42:31.260: Referee<0.48.0> > My node is node_name@hollyhock
2014-05-02 22:42:31.260: Referee<0.48.0> > My pid is <0.48.0>
2014-05-02 22:42:31.679: Referee<0.48.0> > In handle game
Is timeout is false
@vijay120
vijay120 / imports.py
Created December 4, 2016 01:55
imports
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
%matplotlib inline
#importing some useful packages
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
import cv2
import math
import sys
%matplotlib inline
def grayscale(img):
"""Applies the Grayscale transform
This will return an image with only one color channel
but NOTE: to see the returned image as grayscale
you should call plt.imshow(gray, cmap='gray')"""
return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
image = mpimg.imread('test_images/solidYellowCurve2.jpg')
# grayscale the image
grayscaled = grayscale(image)
def gaussian_blur(img, kernel_size):
"""Applies a Gaussian Noise kernel"""
return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)
# apply gaussian blur
kernelSize = 5
gaussianBlur = gaussian_blur(grayscaled, kernelSize)
def canny(img, low_threshold, high_threshold):
"""Applies the Canny transform"""
return cv2.Canny(img, low_threshold, high_threshold)
# canny
minThreshold = 100
maxThreshold = 200
edgeDetectedImage = canny(gaussianBlur, minThreshold, maxThreshold)
def region_of_interest(img, vertices):
"""
Applies an image mask.
Only keeps the region of the image defined by the polygon
formed from `vertices`. The rest of the image is set to black.
"""
#defining a blank mask to start with
mask = np.zeros_like(img)
@vijay120
vijay120 / hough.py
Last active December 4, 2016 07:52
def hough_lines(img, rho, theta, threshold, min_line_len, max_line_gap):
"""
`img` should be the output of a Canny transform.
Returns an image with hough lines drawn.
"""
lines = cv2.HoughLinesP(img, rho, theta, threshold, np.array([]), minLineLength=min_line_len, maxLineGap=max_line_gap)
line_img = np.zeros((*img.shape, 3), dtype=np.uint8)
draw_lines(line_img, lines)