In my project I want to extract color of vehicle as one of feature.I have images as shown below. Can someone suggest a way to extract color of the vehicle on image.
I am trying to extract vehicle region. Than it is easy to extract color of that region. I tried above code for edge detection and connected component detection. But it is not detecting contours of image.
im1=cv2.imread("frame121020.jpg")
blurred = cv2.blur(im1, (3,3))
edges = cv2.Canny(blurred,50,200)
connectivity = 4
output = cv2.connectedComponentsWithStats(edges, connectivity, cv2.CV_32S)
num_labels = output[0]
Stats = output[2]
for label in range(1,num_labels):
cv2.rectangle(edges,(Stats[label,0],Stats[label,1]),(Stats[label,0]+Stats[label,2],Stats[label,1]+Stats[label,3]),(0,0,255),2)
cv2.imwrite("edges.jpg" ,edges)