Skip to content

Instantly share code, notes, and snippets.

@understar
understar / preproc.py
Last active August 29, 2015 14:07 — forked from kastnerkyle/preproc.py
与scikit learn的pipeline兼容的,ZCA白化,自带特征标准化
# (C) Kyle Kastner, June 2014
# License: BSD 3 clause
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.utils import array2d, as_float_array
from scipy.linalg import eigh
import numpy as np
class ZCA(BaseEstimator, TransformerMixin):
def __init__(self, n_components=None, bias=.1, copy=True):
import numpy as np
def makeGaussian(size, fwhm = 3, center=None):
""" Make a square gaussian kernel.
size is the length of a side of the square
fwhm is full-width-half-maximum, which
can be thought of as an effective radius.
"""
@understar
understar / sides
Created January 15, 2014 08:48
Simple roll sides script.
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 08 18:02:10 2014
@author: understar
"""
from __future__ import division
from collections import Counter
import sys
from random import randint
@understar
understar / PicConverText.py
Created April 11, 2016 08:04 — forked from evi1m0/PicConverText.py
12306 新版验证码识别脚本;
#!/usr/bin/env python
# coding=utf8
# author=evi1m0
# website=linux.im
'''
12306 Captcha Picture:
author: Evi1m0@20150316
1. Download Captcha
2. Pic Conver Text
@understar
understar / gist:2c879afc911d9152e49ca6ded0ac8cfa
Created March 22, 2017 09:08 — forked from drewda/gist:1299198
Jenks natural breaks classification
# code from http://danieljlewis.org/files/2010/06/Jenks.pdf
# described at http://danieljlewis.org/2010/06/07/jenks-natural-breaks-algorithm-in-python/
def getJenksBreaks( dataList, numClass ):
dataList.sort()
mat1 = []
for i in range(0,len(dataList)+1):
temp = []
for j in range(0,numClass+1):
temp.append(0)
@understar
understar / landsat_notes.md
Created April 27, 2017 05:21 — forked from oeon/landsat_notes.md
notes from processing Harmony Landsat post

##This workflow is only for the pansharpened images

####red-green-blue
gdalbuildvrt -separate -q -srcnodata "0 0 0" -vrtnodata "0 0 0" rgb.vrt LC80430352013339LGN00_B4.tif LC80430352013339LGN00_B3.tif LC80430352013339LGN00_B2.tif

####NIR, SWIR, and visible red
gdalbuildvrt -separate -q -srcnodata "0 0 0" -vrtnodata "0 0 0" false.vrt LC80430352013339LGN00_B5.tif LC80430352013339LGN00_B6.tif LC80430352013339LGN00_B4.tif

####color infrared
gdalbuildvrt -separate -q -srcnodata "0 0 0" -vrtnodata "0 0 0" cir.vrt LC80430352013339LGN00_B5.tif LC80430352013339LGN00_B3.tif LC80430352013339LGN00_B4.tif

@understar
understar / img2wav.py
Created July 24, 2014 15:48
基于sstv(slow scan television)技术的图像编码到音频
"""
Demonstrates playing the generated samples directly using PyAudio
Tested on PyAudio 0.2.7 http://people.csail.mit.edu/hubert/pyaudio/
"""
from __future__ import division
from pysstv.sstv import SSTV
from time import sleep
from itertools import islice
import struct, pyaudio
@understar
understar / plot_rbm_logistic_classification.py
Created August 4, 2014 12:14
scikit-learn RBM feature extraction and logistic classification
"""
==============================================================
Restricted Boltzmann Machine features for digit classification
==============================================================
For greyscale image data where pixel values can be interpreted as degrees of
blackness on a white background, like handwritten digit recognition, the
Bernoulli Restricted Boltzmann machine model (:class:`BernoulliRBM
<sklearn.neural_network.BernoulliRBM>`) can perform effective non-linear
feature extraction.