XZL

@b04505009

Joined on Sep 19, 2018

  •  Like  Bookmark
  • import cv2 import numpy as np from matplotlib import pyplot as plt from IPython.display import display from PIL import Image cap = cv2.VideoCapture("filesrc location=street.h264 ! h264parse ! vaapih264dec ! videoconvert ! video/x-raw,format=NV12 ! appsink") ret, vaapi = cap.read() cap.release() rgb_vaapi = cv2.cvtColor(vaapi, cv2.COLOR_YUV2RGB_NV12)
     Like  Bookmark
  • # Graph ## path - a sequence P of nodes v1, v2, ..., vk-1, vk with the property that each consecutive pair vi, vi+1 is joined by an edge in E. - simple: path上沒有重複走過的點(distinct) - cycle: path至少多於2個點,頭尾相連,中間的點distinct - connected: 如果任意點到任意點之間都有path,則graph is connected - distance: minimum number of edges in a u-v path ## tree - An undirected graph is a tree if it is **connected** and does **not contain a cycle** - G若滿足兩個條件即為樹: - G is connected. - G does not contain a cycle. - G has n-1
     Like  Bookmark
  • # Greedy Algorithm ## Concept - builds up a solution in small steps, **choosing a decision at each step myopically** to optimize some underlying criterion - Intuitive and fast - Usually not optimal - prove optimality 1. The greedy algorithm stays ahead. 2. An exchange argument. ## Interval Scheduling Problem - Given: Set of requests {1, 2, ..., n}, ith request corresponds to an interval with start time s(i) and finish time f(i) - interval i: $[s(i), f(i))$ - Find a compatible subset
     Like  Bookmark