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
import sys, os, time, numpy, Image, pywt | |
import matplotlib.pyplot as plt | |
def wavelet_transform(data, threshold): | |
wavelet_type = 'haar' | |
clean_coef = list() | |
compose = list() | |
cA2, cD2, cD1 = pywt.wavedec2(data, wavelet_type, level=2) | |
clean_coef.append(cA2) |
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
import sys, pylab, numpy, Image, pywt | |
def edges(path): | |
im = Image.open(path).convert('L') | |
arr = numpy.fromstring(im.tostring(), numpy.uint8) | |
arr.shape = (im.size[1], im.size[0]) | |
data = pywt.swt2(arr, 'haar', level=3, start_level=0) | |
LL, (LH, HL, HH) = data[2] | |
pylab.imshow(LH, interpolation='nearest', cmap=pylab.cm.gray) |
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
import sys, time, Image, numpy, pywt | |
def load_image(image, effect, size=None): | |
im = Image.open(image) | |
if size is not None and im.size != size: | |
im = im.resize(size, Image.ANTIALIAS) | |
im = im.convert('RGB') | |
if effect == 'sepia': | |
im = sepia(im) | |
return im |
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
from Tkinter import * | |
import math, Image, ImageTk | |
SIZE = 5 | |
class Interface: | |
def __init__(self, root): | |
self.root = root | |
self.root.title('Geolocalization') | |
self.root.resizable(width=False, height=False) |
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
import sys, random, numpy | |
def binary_matrix(matrix): | |
for element in numpy.nditer(matrix, op_flags=['readwrite']): | |
if element > 1 and element%2 == 0: | |
element[...] = 0 | |
if element > 1 and element%2 != 0: | |
element[...] = 1 | |
return matrix |
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_polygons_detected(self, image, polygons_found): | |
draw = ImageDraw.Draw(image) | |
max_w, max_h = get_image_size(image) | |
counter = 0 | |
for polygon in polygons_found: | |
center, sides = polygon | |
x, y = center | |
r = random.randint(100, 255) | |
g = random.randint(100, 255) |
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 namtrace-all [open out.nam w] | |
set topology [lindex $argv 0] | |
set traffic_app [lindex $argv 1] | |
proc finish {} { | |
exec nam out.nam & | |
exit 0 | |
} |
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
import sys, random | |
class Node: | |
def __init__(self, char, freq, left=None, right=None): | |
self.char = char | |
self.freq = freq | |
self.left = left | |
self.right = right | |
self.father = None | |
self.bit = None |
NewerOlder