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
#change image to thumbnail | |
#but not change width and height aspect ratio | |
#read image and convert grayscal | |
from PIL import Image | |
pil_im = Image.open('./data/empire.jpg').convert('L') | |
pil_im.thumbnail((200,200)) | |
pil_im.show() |
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 PIL import Image | |
pil_im = Image.open('./data/empire.jpg').convert('L') | |
#be careful it may change aspect ratio | |
out = pil_im.resize((128,128)) | |
#show | |
out.show() |
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 PIL import Image | |
pil_im = Image.open('./data/empire.jpg').convert('L') | |
#rotate clockwise | |
out = pil_im.rotate(45) | |
#show | |
out.show() |
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
# convert image to numpy array | |
im = array(Image.open('./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] |
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
<html> | |
<head> | |
<meta http-equiv="content-type" content="text/html;charset=utf-8"> | |
<script type="text/javascript"> | |
var globalTestItemNo = 1; | |
var TESTITEMNUM; | |
var DIVIDEDIMGNUM; | |
function globalTestItemNo2testName(globalTestItemNo){ |
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
(defun my-open-new-memo () | |
(interactive) | |
(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))) |
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 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): | |
QWidget.__init__(self) | |
self.resize(400,400) | |
self.myIsMousePressing = False | |
self.p = QPainter(self) |
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 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() |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#This software is released under the MIT License, see below. | |
#----------------License---------------- | |
#The MIT License (MIT) | |
# | |
#Copyright (c) <2015> <Kei Minagawa> | |
# | |
#Permission is hereby granted, free of charge, to any person obtaining a copy |
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 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 |