Beispiel #1
0
def view_show(depth_heightmap,out1,out2,flag,gconf):
    pre = Predictor()
    while True:

        np.clip(depth_heightmap, 0, 0.2,out=depth_heightmap)
        depth_heightmap_used=depth_heightmap[range(239,-1,-1),:]

        location, angle, PlanningTime, lable, depth,patch=pre.GCNN_LCNN(depth_heightmap_used)
        gconf[0]=location[0]
        gconf[1]=location[1]
        gconf[2]=angle
        gconf[3]=depth

        get_grasppoint(patch)
        #print(gconf)

        depth_out = ((depth_heightmap_used+0.04)*1000).astype(np.uint8)

        color_1=out1.copy()
        index=flag==0
        color_1[index]=out2[index]
        color_1=color_1[range(239,-1,-1),:]



        cv2.line(color_1, (int(location[1]+36*math.cos(angle*math.pi/180.)), int(location[0]+36*math.sin(angle*math.pi/180.))),
                 (int(location[1] - 36 * math.cos(angle*math.pi/180.)), int(location[0] - 36 * math.sin(angle*math.pi/180.))), (0, 0, 255), 3)


        cv2.imshow("color1",color_1)
        cv2.imshow("image",depth_out)


        graspability=(cv2.pyrUp(cv2.pyrUp(cv2.pyrUp(lable)))*255).astype(np.uint8)
        graspability=cv2.applyColorMap(graspability, cv2.COLORMAP_JET)

        cv2.imshow("depth",graspability)


        key = cv2.waitKey(1)