Click here to Skip to main content
15,918,193 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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
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">

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900