Skip to content

Instantly share code, notes, and snippets.

"""文字分割程式"""
import os
txtpath = 'a.txt'
logfile = 'log.txt'
if os.path.exists(logfile):
with open(logfile, 'r', encoding='utf8')as f:
for filen in f.read().split(','):
@endless3cross3
endless3cross3 / csv2dict.py
Created June 2, 2017 11:05
把CSV轉換成以row第一個值為key的dictionary
"""
把CSV轉換成以row第一個值為key的dictionary
"""
import csv
with open('img_data.csv', mode='r') as infile:
reader = csv.reader(infile)
my_dict = dict((rows[0], rows[1:]) for rows in reader)
  1. 類別: 物件的設計圖

  1. 封裝:將物件的資料與功能包裝起來,並隱藏內在細節。如:電視機的電路及功能

  2. 介面:對物件操作的方法。如:電視機的開關 3. 定義類別就是封裝的過程

  3. 物件: 類別的具體化,也稱為"實例"

@endless3cross3
endless3cross3 / catch3HEV.py
Created March 13, 2017 12:02
調整HSV顏色抓取物體
import cv2
import numpy as np
import imutils
"""
調整HSV顏色抓取物體
"""
def nothing(x):
try:
from images2gif_master.images2gif import writeGif
except:
from images2gif import writeGif
from PIL import Image
import os
folder = r'C:\Users\Public\Pictures\Sample Pictures'
  1. Dropbox Paper

    1. 可以法網路上的文章格式化成 markdown 格式,效果還不錯
    2. 可以放youtube進去
    3. 下載不支援中文標題
    4. 支援拉圖上傳
    5. 有類似投影片的模式
  2. HackMD

    1. 標準的 markdown 編輯器
    2. 支援拉圖上傳
@endless3cross3
endless3cross3 / 0_reuse_code.js
Created January 8, 2017 11:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@endless3cross3
endless3cross3 / o01.py
Last active October 24, 2019 03:29
otsu canny python 自動canny法之二
import cv2
import numpy as np
def otsu_canny(image, lowrate=0.1):
if len(image.shape) > 2:
image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Otsu's thresholding
ret, _ = cv2.threshold(image, thresh=0, maxval=255, type=(cv2.THRESH_BINARY + cv2.THRESH_OTSU))
edged = cv2.Canny(image, threshold1=(ret * lowrate), threshold2=ret)
@endless3cross3
endless3cross3 / find_roi.py
Created November 30, 2016 08:30
抓取ROI程式
import cv2
# 抓取ROI程式
haveP1, haveP2 = False, False
x1, y1, x2, y2 = -1, -1, -1, -1
def draw_circle(event, x, y, flags, param):
global x1, y1, x2, y2, haveP1, haveP2
@endless3cross3
endless3cross3 / JSONData.js
Created November 8, 2016 13:21
json 亂試
var json001 = '{"RegionPoint": [{"maxy": 116.4, "miny": 116.3, "minx": 39.95, "maxx": 40.0}, {"maxy": 116.4, "miny": 116.3, "minx": 39.95, "maxx": 40.0}]}';