Python Forum

Full Version: how calculate length of detected line in image openCV Numpy
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I coding for detect lines in simple blueprint image and calculate full length of detected lines
i coded using opencv detect lines in image.
i don't know how get detect lines and how calculate length.
this is my current code
import cv2
import numpy as np
import matplotlib
from matplotlib.pyplot import imshow
from matplotlib import pyplot as plt

# white color mask
img = cv2.imread(filein)
#converted = convert_hls(img)
image = cv2.cvtColor(img,cv2.COLOR_BGR2HLS)
lower = np.uint8([0, 200, 0])
upper = np.uint8([255, 255, 255])
white_mask = cv2.inRange(image, lower, upper)
# yellow color mask
lower = np.uint8([10, 0,   100])
upper = np.uint8([40, 255, 255])
yellow_mask = cv2.inRange(image, lower, upper)
# combine the mask
mask = cv2.bitwise_or(white_mask, yellow_mask)
result = img.copy()
cv2.imshow("mask",mask) 

what functions should i use

how identify and measure lines
Think