- 類別: 物件的設計圖
-
封裝:將物件的資料與功能包裝起來,並隱藏內在細節。如:電視機的電路及功能
-
介面:對物件操作的方法。如:電視機的開關 3. 定義類別就是封裝的過程
-
物件: 類別的具體化,也稱為"實例"
"""文字分割程式""" | |
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(','): |
""" | |
把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) |
封裝:將物件的資料與功能包裝起來,並隱藏內在細節。如:電視機的電路及功能
介面:對物件操作的方法。如:電視機的開關 3. 定義類別就是封裝的過程
物件: 類別的具體化,也稱為"實例"
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' |
Dropbox Paper
HackMD
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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) |
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 |
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}]}'; |