示例#1
0
                 #cv2.circle(img,(textx,texty),10,(0,0,0),-1)
                #cv2.circle(img, (j[1], j[0]), 5, (0,0,255), -1)
                cv2.putText(img, f'{ordered_bolt_no}', (textx,texty), cv2.FONT_HERSHEY_SIMPLEX, 1.5, (255,0,255), 3)
            bolt_no += 1
#        for i in bolts:
#            cv2.circle(img,(i[0],i[1]),10,(0,0,255),-1)

        if(angleCounter!=0):
            averageAngle = averageAngle / angleCounter
            if(suppressInput == False):
                print("-----------------------AVERAGE ANGLE = ", averageAngle)        
    


#########################Obtaining statistics on incorrectly labelled features##########################################


if(labellingStats == True):
    incorrectlyMatchedFeatures = comparingLabelling.compare(inputFileType, outputTextFilename, "he_bolts239.txt")


    for i in incorrectlyMatchedFeatures:
        cv2.circle(img,(int(float(i[1])),int(float(i[2]))),5,(255,255,255),1)
        text = i[0][-2:]
        text = text.lstrip("0")
        cv2.putText(img, f'{text}', (int(float(i[1])),int(float(i[2]))), cv2.FONT_HERSHEY_PLAIN, 1, (255,255,180), 1)
      
cv2.imwrite("OUTPUT.jpg",img)
cv2.imshow(filename,img)

示例#2
0
                           ordered_input_bolts[bolt_no][1]), (textx, texty),
                     (0, 140, 140),
                     thickness=1,
                     lineType=8,
                     shift=0)

            cv2.putText(img, f'{ordered_bolt_no}', (textx, texty),
                        cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0), 1)
            bolt_no += 1

#############################################################################################
outputFile.close()

#########################Obtaining statistics on incorrectly labelled features##########################################
#bolt_dict = {b: reco_transformed[fitter_all.feature_index[b]] for b in common_bolt_locations.keys()}

if (labellingStats == True):
    incorrectlyMatchedFeatures = comparingLabelling.compare(
        inputFileType, outputTextFilename, "045-manualLabelling.txt")

    for i in incorrectlyMatchedFeatures:
        cv2.circle(img, (int(float(i[1])), int(float(i[2]))), 5,
                   (255, 255, 255), 1)
        text = i[0][-2:]
        text = text.lstrip("0")
        cv2.putText(img, f'{text}', (int(float(i[1])), int(float(i[2]))),
                    cv2.FONT_HERSHEY_PLAIN, 1, (255, 255, 180), 1)

cv2.imwrite("OUTPUT.jpg", img)
cv2.imshow(filename, img)
                texty = int(item[1] + (30) * np.sin(angle))
            pointerx = int((textx + textx + 20) / 2)
            pointery = int((texty + texty - 20) / 2)

            cv2.line(img, (item[0], item[1]), (textx, texty), (0, 150, 150),
                     thickness=2,
                     lineType=8,
                     shift=0)
            #cv2.rectangle(img,(textx,texty),(textx+15,texty-15),(0,0,0), thickness=-1, lineType=8, shift=0)
            #cv2.circle(img,(textx,texty),10,(0,0,0),-1)
            #cv2.circle(img, (item[1], item[0]), 5, (0,0,255), -1)
            cv2.putText(img, f'{ordered_bolt_no}', (textx, texty),
                        cv2.FONT_HERSHEY_PLAIN, 1, (0, 255, 0), 1)

#############################################################################################
if (labellingStats == True):
    incorrectlyMatchedFeatures = comparingLabelling.compare(
        inputFileType, outputTextFilename, "379 (BJ).txt")

    for i in incorrectlyMatchedFeatures:
        cv2.circle(img, (int(float(i[1])), int(float(i[2]))), 5,
                   (255, 255, 255), 1)
        text = i[0][-2:]
        text = text.lstrip("0")
        cv2.putText(img, f'{text}', (int(float(i[1])), int(float(i[2]))),
                    cv2.FONT_HERSHEY_PLAIN, 1, (255, 255, 180), 1)

cv2.imwrite("OUTPUT.jpg", img)
cv2.imshow(filename, img)
outputFile.close()