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 matplotlib.pyplot as plt | |
from matplotlib.patches import Rectangle | |
#define Matplotlib figure and axis | |
fig, ax = plt.subplots() | |
#create simple line plot | |
ax.plot([0, 10],[0, 10]) | |
#add rectangle to plot |
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 numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.animation import FuncAnimation | |
fig, ax = plt.subplots() | |
xdata, ydata = [], [] | |
ln, = plt.plot([], [], 'ro') | |
def init(): | |
ax.set_xlim(0, 2*np.pi) |
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 numpy as np | |
import matplotlib.pyplot as plt | |
def f(t): | |
return np.exp(-t) * np.cos(2*np.pi*t) | |
def g(t): | |
return np.sin(np.pi*t) | |
t1 = np.arange(0.0, 5.0, 0.01) |
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
class Node(object): | |
def __init__(self, value = None, pointer = None): | |
self.value = value | |
self.pointer = pointer | |
def getData(self): | |
return self.value | |
def getNext(self): | |
return self.pointer |
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
class LinkedListLIFO(object): | |
def __init__(self): | |
self.head = None | |
self.length = 0 | |
# ํค๋๋ถํฐ ๊ฐ ๋ ธ๋์ ๊ฐ์ ์ถ๋ ฅํ๋ค. | |
def _printList(self): | |
node=self.head | |
while node: | |
print(node.value , end=" ") |
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
# FIFO | |
class LinedListFIFO(object): | |
def __init__(self): | |
self.head = None # ํค๋ | |
self.length = 0 | |
self.tail= None # ํ ์ผ | |
# ํค๋๋ถํฐ ๊ฐ ๋ ธ๋์ ๊ฐ์ ์ถ๋ ฅํ๋ค. |
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 re | |
text = "๋ฌธ์์ฌํญ์ด ์์ผ๋ฉด 032-232-3245 ์ผ๋ก ์ฐ๋ฝ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค." | |
regex = re.compile(r'\d\d\d-\d\d\d-\d\d\d\d') | |
matchobj = regex.search(text) | |
phonenumber = matchobj.group() | |
print(phonenumber) | |
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 re | |
st = [m.start() for m in re.finditer('test', 'test test test test')] | |
print (st) | |
# ์ถ์ฒ: https://metagenomics.tistory.com/entry/์ฌ๋ฌ๋ฒ-์ฐพ๊ธฐ [๋ฉํ์ง๋ ธ๋ฏน์ค] |
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
pattern = r"ca" | |
text = "caabsacasca" | |
# ๋งค์นญ๋ ๊ฐ์ ์ดํฐ๋ ์ดํฐ๋ก ๋ชจ๋ ๋ฐํ | |
iterator = re.finditer(pattern ,text) | |
for match in iterator: | |
print match.group() # 1ๅ็ฎ: ca 2ๅ็ฎ: ca | |
print match.start() # 1ๅ็ฎ: 0 2ๅ็ฎ: 6 | |
print match.end() # 1ๅ็ฎ: 2 2ๅ็ฎ: 8 | |
print match.span() # 1ๅ็ฎ: (0, 2) 2ๅ็ฎ: (6, 8) | |
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 cv2 | |
import numpy as np | |
import glob | |
# ์์ ์ฝ๊ธฐ ๋ฐ ํ์ | |
img = cv2.imread('pistol.jpg') | |
cv2.imshow('query', img) | |
# ๋น๊ตํ ์์๋ค์ด ์๋ ๊ฒฝ๋ก | |
search_dir ="101_ObjectCategories" |