Skip to content

Instantly share code, notes, and snippets.

from subprocess import call
from pylab import *
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.patches import Rectangle
from time import sleep
import cv2
# Read template image
templateImageGray = cv2.imread("./images/templateImage.png", cv2.IMREAD_GRAYSCALE)
templateImageGray = cv2.resize(templateImageGray, (0, 0), fx=16, fy=16, interpolation=cv2.INTER_CUBIC)
import os
from glob import glob
import cv2
import numpy as np
from numpy import arange
import matplotlib.pyplot as plt
from matplotlib.figure import Figure
from matplotlib.backend_bases import key_press_handler
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#This software is released under the MIT License, see below.
#The MIT License (MIT)
#Copyright (c) <2015> <Kei Minagawa>
#Permission is hereby granted, free of charge, to any person obtaining a copy
from PySide.QtGui import *
from PySide.QtCore import QTimer
app = QApplication([])
widget = QWidget()
textbox = QLineEdit()
startbutton = QPushButton("start/stop")
resetbutton = QPushButton("reset")
timelabel = QLabel("00:00:00")
counttimer = QTimer()
hboxlayout = QHBoxLayout()
from PySide.QtGui import QApplication, QMainWindow, QAction, QActionGroup, QWidget, QCursor, QPainter
from PySide.QtCore import QTimer
import PySide.QtCore as QtCore
class W(QWidget):
def __init__(self):
self.myIsMousePressing = False
self.p = QPainter(self)
View memo.el
(defun my-open-new-memo ()
(let ((my-regexp "\\([0-9]+\\)[.]memo")
(my-max 1)
(my-matched-num 0)
(file-list (directory-files "~/.emacs.d/memo/")))
(dolist (i file-list)
(setq my-matched-num (string-to-number (replace-regexp-in-string my-regexp "\\1" i)))
(if (< my-max my-matched-num)
(setq my-max my-matched-num)))
View index.html
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script type="text/javascript">
var globalTestItemNo = 1;
function globalTestItemNo2testName(globalTestItemNo){
View cvDrawStar
# convert image to numpy array
im = array('./data/empire.jpg')) #return numpy array
# show
imshow(im, interpolation='nearest')#or interpolation='None'
# star point
x = [100,100,400,400]
y = [200,500,200,500]
View cvRotate
from PIL import Image
pil_im ='./data/empire.jpg').convert('L')
#rotate clockwise
out = pil_im.rotate(45)
View cvResizeImage
from PIL import Image
pil_im ='./data/empire.jpg').convert('L')
#be careful it may change aspect ratio
out = pil_im.resize((128,128))
You can’t perform that action at this time.