I have detected the edge of the wires. Now I need to get the color of each wire column and make a list of the color from left to right but I don't know how to do it or what function should I use to get the color for each wire column.
What I have tried:
I wanted to try this
np.count_nonzero()
to get the pixel/color inside the wires but if I don't know the correct logic to code it.
I have used this code to detect the wires by using canny edge detection.
<pre lang="Python">
import cv2
import numpy as np
image= cv2.imread('Template.jpg')
gray= cv2.cvtColor(image,cv2.COLOR_BGR2GRAY)
gray = cv2.GaussianBlur(gray, (5,5),0)
_, bin = cv2.threshold(gray,120,255,1)
bin = cv2.dilate(bin, None)
bin = cv2.dilate(bin, None)
bin = cv2.erode(bin, None)
bin = cv2.erode(bin, None)
edges= cv2.Canny(gray, 50,200)
cv2.imshow("Image", original_image)
cv2.imshow("Grayscale", gray)
cv2.imshow("Edges", edges)
<pre lang="Python">