Exemplo n.º 1
0
                    curr_pts = util.dehomogenize(curr_hom_mat * std_pts_hm)

                if show_stacked:
                    new_img = np.copy(curr_img)
                    if show_legend:
                        cv2.rectangle(new_img, (legend_x, legend_y + baseline),
                                      (legend_x + text_size[0],
                                       legend_y - text_size[1] - baseline),
                                      legend_bkg_col, -1)
                        cv2.putText(new_img, tracker['legend'],
                                    (legend_x, legend_y), legend_font_face,
                                    legend_font_size, col_rgb[tracker['col']],
                                    legend_font_thickness,
                                    legend_font_line_type)
                    if show_grid:
                        drawGrid(new_img, curr_pts, grid_res_x, grid_res_y,
                                 col_rgb[tracker['col']], line_thickness)
                    drawRegion(new_img, curr_corners, col_rgb[tracker['col']],
                               line_thickness, annotate_corners,
                               annotation_col, annotation_font_size)
                    curr_img_list.append(new_img)
                else:
                    if show_legend:
                        cv2.rectangle(curr_img,
                                      (legend_x, legend_y + baseline),
                                      (legend_x + text_size[0],
                                       legend_y - text_size[1] - baseline),
                                      legend_bkg_col, -1)
                        cv2.putText(curr_img, tracker['legend'],
                                    (legend_x, legend_y), legend_font_face,
                                    legend_font_size, col_rgb[tracker['col']],
                                    legend_font_thickness,
Exemplo n.º 2
0
                        curr_patch, (patch_size_x, patch_size_y))
                    try:
                        curr_img[patch_start_y:patch_end_y,
                                 patch_start_x:patch_end_x,
                                 channel_id] = curr_patch_resized
                    except IndexError:
                        curr_img[
                            patch_start_y:patch_end_y,
                            patch_start_x:patch_end_x] = curr_patch_resized
            else:
                if show_frame_id:
                    fps_text = 'frame: {:4d}'.format(frame_id + 1)
                    cv2.putText(curr_img, fps_text, (5, 15),
                                cv2.FONT_HERSHEY_COMPLEX_SMALL, 1, gt_col)
            if show_grid:
                drawGrid(curr_img, curr_pts_ss, ss_grid_res_x, ss_grid_res_y,
                         gt_col, gt_thickness)
            else:
                drawRegion(curr_img, curr_corners, gt_col, gt_thickness,
                           label_corners)

            if show_grid_label_connector:
                p1 = (int(curr_corners[0, 0]), int(curr_corners[1, 0]))
                p2 = (int(curr_corners[0, 2]), int(curr_corners[1, 2]))
                cv2.line(curr_img, p1, conn_end_pt_1, conn_col, conn_thickness,
                         legend_font_line_type)
                cv2.line(curr_img, p2, conn_end_pt_2, conn_col, conn_thickness,
                         legend_font_line_type)
                if conn_all_corners:
                    p1 = (int(curr_corners[0, 1]), int(curr_corners[1, 1]))
                    p2 = (int(curr_corners[0, 3]), int(curr_corners[1, 3]))
                    cv2.line(curr_img, p1, conn_end_pt_1, conn_col,