This file contains hidden or 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 numpy as np | |
| from os import listdir | |
| from os.path import isfile, join | |
| from PIL import Image | |
| from sklearn.datasets.base import Bunch | |
| from sklearn import svm | |
| from sklearn.naive_bayes import MultinomialNB | |
This file contains hidden or 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 numpy as np | |
| from keras.models import Sequential | |
| from keras.layers import Dense | |
| from keras.layers import LSTM | |
| # This does work by using only one sample: | |
| data = [[0,0,0,0,0,0,0,0,0,2,1]] | |
| data = np.array(data, dtype=float) | |
| target = [0,0,0,0,0,0,0,0,2,1,0] |
This file contains hidden or 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 PIL import Image, ImageDraw, ImageFont, ImageOps | |
| import numpy as np | |
| import random | |
| try: | |
| unichr | |
| except NameError: | |
| unichr = chr | |
| def render(input_arr): | |
| output = input_arr |
This file contains hidden or 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 pybrain.structure import FeedForwardNetwork | |
| from pybrain.structure import LinearLayer, SigmoidLayer | |
| from pybrain.structure import FullConnection | |
| from pybrain.rl.agents import LearningAgent | |
| from PIL import Image, ImageDraw, ImageFont, ImageOps | |
| import numpy as np | |
| import copy | |
| def mse(imageA, imageB): | |
| # the 'Mean Squared Error' between the two images is the |
This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| from PIL import Image, ImageDraw, ImageFont, ImageOps | |
| import numpy as np | |
| import os | |
| width = 600 | |
| halfwidth = width/2 | |
| avatarsize = 48 | |
| height = 800 | |
| background_color = (255, 255, 255, 0) |
This file contains hidden or 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
| //==================================================== | |
| // gmplay 2.1 - geekmaster's kindle video player | |
| // Copyright (C) 2012 by geekmaster, with MIT license: | |
| // http://www.opensource.org/licenses/mit-license.php | |
| // Modified by Stefan Murawski ([email protected]) | |
| //---------------------------------------------------- | |
| // Tested on DX,DXG,K3,K4main,K4diags,K5main,K5diags. | |
| //---------------------------------------------------- | |
| #include <sys/ioctl.h> // ioctl | |
| #include <sys/mman.h> // mmap, munmap |
This file contains hidden or 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 numpy as np | |
| cimport numpy as np | |
| cimport cython | |
| DTYPE = np.double | |
| ctypedef np.double_t DTYPE_t | |
| DTYPE2 = np.uint8 | |
| ctypedef np.uint8_t DTYPE2_t | |
| @cython.boundscheck(False) # turn off bounds-checking for entire function |
This file contains hidden or 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 numpy as np | |
| def apply_ordered_dither(inputarray, bayer_map, bayer_size): | |
| width, height = inputarray.shape | |
| for y in range(height): | |
| for x in range(width): | |
| inputarray[x, y] = 0 if inputarray[x, y] < bayer_map[x % bayer_size, y % bayer_size] else 255 | |
| return inputarray |
This file contains hidden or 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 numpy as np | |
| import cv2 | |
| import gzip | |
| import sys, os | |
| from time import sleep, time | |
| def main(): | |
| width = 600 | |
| height = 800 |
This file contains hidden or 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
| # //==================================================== | |
| # // raw2gmv 1.0a - raw to geekmaster video transcoder | |
| # // Copyright (C) 2012 by geekmaster, with MIT license: | |
| # // http://www.opensource.org/licenses/mit-license.php | |
| # //---------------------------------------------------- | |
| ##include <stdio.h> // stdin,stdout | |
| # typedef unsigned char u8; typedef unsigned int u32; | |
| # int main(void) { | |
| # u8 o,to,tb,wb0[800*600]; u32 x,y,xi,yi,c=250,b=120; // c=contrast, b=brightness | |
| # while (fread(wb0,800*600,1,stdin)) for (y=0;y<800;y++) { xi=y; tb=0; |