Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Firstly, I haven't tested it. Because, I'm using OpenCV 4.0.1. I have 2 errors for you. I noticed that you are using dictionary. You will have to remove p1. The correct way to do like this.

imgDictionary['p1'] = (int(t[0]), int(t[1]))

Secondly, put inside for block:

for t in triangleList:
    p1 = (int(t[0]), int(t[1]))
    p2 = (int(t[2]), int(t[3]))
    p3 = (int(t[4]), int(t[5]))

Firstly, I haven't tested it. Because, I'm using OpenCV 4.0.1. I have 2 errors for you. I noticed that you are using dictionary. You will have to remove p1. The correct way to do like this.

imgDictionary['p1'] = (int(t[0]), int(t[1]))

Secondly, put inside for block:

for t in triangleList:
    p1 = (int(t[0]), int(t[1]))
    p2 = (int(t[2]), int(t[3]))
    p3 = (int(t[4]), int(t[5]))
    if rect_contains(rect, p1) and rect_contains(rect, p2) and rect_contains(rect, p3):
        value = imgDictionary[p1]