Skip to content

Instantly share code, notes, and snippets.

@nithikan
Created April 17, 2018 08:36
Show Gist options
  • Save nithikan/06a8f1a625e698346f0270d9874e1718 to your computer and use it in GitHub Desktop.
Save nithikan/06a8f1a625e698346f0270d9874e1718 to your computer and use it in GitHub Desktop.
##### Exercise 4 Pick two points on an image, draw a thick red between these points
##### and show the image.
##### 17/04/2018
##### Nithikan Srinakrung - Bam
##### DFL, FTSM, UKM
import cv2
import random
import numpy as np
import matplotlib.pyplot as plt
import time
im = cv2.imread("C:\\Users\\User\\Pictures\\chainsmokers-paris.jpg")
lowest = 0
highest = 500
#random_num = np.random.randint(lowest,highest)
x1 = np.random.randint(lowest,highest)
y1 = np.random.randint(lowest,highest)
x2 = np.random.randint(lowest,highest)
y2 = np.random.randint(lowest,highest)
print((x1,y1))
print((x2,y2))
line_img = cv2.line(im,(x1,y1),(x2,y2),(0,0,255),thickness=2,lineType=8, shift=0)
print(im.shape)
cv2.imshow("Picture",im)
cv2.waitKey(0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment