This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def minimums_in_histogram(self, hist): | |
minimums = list() | |
for i, value in enumerate(hist): | |
try: | |
if hist[i-2] > value and hist[i-1] > value and value <= hist[i+1]: | |
minimums.append(i) | |
except: | |
pass | |
return minimums |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def bfs(self, image, start_pixel_pos, color): | |
pixels = image.load() | |
width, height = get_image_size(image) | |
queue = [] | |
copy = [] | |
count = 0 | |
queue.append(start_pixel_pos) | |
original = pixels[start_pixel_pos] | |
while 0 < len(queue): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ns [new Simulator] | |
$ns color 1 Blue | |
$ns color 2 Red | |
set nf [open out.nam w] | |
$ns namtrace-all $nf | |
set nd [open out.tr w] | |
$ns trace-all $nd | |
proc finish {} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BEGIN { | |
highest_packet_id = 0; | |
} | |
{ | |
action = $1; | |
time = $2; | |
from = $3; | |
to = $4; | |
type = $5; | |
pktsize = $6; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def draw_ellipses_found(self, image, ellipses_found): | |
draw = ImageDraw.Draw(image) | |
max_w, max_h = get_image_size(image) | |
counter = 0 | |
for ellipse in ellipses_found: | |
x, y, xd, yd = ellipse | |
print 'Ellipse detected at center (%d, %d)' % (x, y) | |
print '> Semidiameters:', xd, yd | |
draw.ellipse((x-xd, y-yd, x+xd, y+yd), outline=(255, 255, 0), fill=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def search_ellipse(self, can_be_ellipses, image, Gx, Gy): | |
width, height = get_image_size(image) | |
pixels_gx = Gx.load() | |
pixels_gy = Gy.load() | |
l = 80 | |
ellipses_found = [] | |
for ellipse in can_be_ellipses: | |
pixels = image.load() | |
votes = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def frequency_dictionary(text): | |
dictionary = dict() | |
for i in range(len(text)): | |
if dictionary.has_key(text[i]): | |
dictionary[text[i]] += 1 | |
else: | |
dictionary[text[i]] = 1 | |
return dictionary | |
class Node: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ns [new Simulator -multicast on] | |
$ns color 1 Red | |
$ns color 30 Purple | |
$ns color 31 Green | |
set f [open out.tr w] | |
$ns trace-all $f | |
$ns namtrace-all [open out.nam w] | |
proc finish {} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set ns [new Simulator] | |
$ns color 1 Blue | |
$ns color 2 Red | |
set file1 [open out.tr w] | |
$ns trace-all $file1 | |
set file2 [open out.nam w] | |
$ns namtrace-all $file2 | |
proc finish {} { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int firstPinDisplayOne = 2; | |
const int firstPinDisplayTwo = 22; | |
const int difPin = firstPinDisplayTwo-firstPinDisplayOne; | |
const int timer = 400; | |
const int a = 2; | |
const int b = 3; | |
const int c = 4; | |
const int d = 5; | |
const int e = 6; | |
const int f = 7; |