获取并且绘制出特征点匹配结果.

def get_and_plot_keypoints(self, method_name, plot=False):
        """获取并且绘制出特征点匹配结果."""
        if method_name not in self.method_object_dict.keys():
            print("'%s' is not in MATCHING_METHODS" % method_name)
            return None
        kp_sch, kp_src, good, result = self._get_result(method_name)

        if not plot or result is None:
            return kp_sch, kp_src, good, result
        else:
            im_search, im_source = deepcopy(self.im_search), deepcopy(self.im_source)
            # 绘制特征点识别情况、基于特征的图像匹配结果:
            h_sch, w_sch = im_search.shape[:2]
            h_src, w_src = im_source.shape[:2]
            # init the plot image:
            plot_img = np.zeros([max(h_sch, h_src), w_sch + w_src, 3], np.uint8)
            plot_img[:h_sch, :w_sch, :] = im_search
            plot_img[:h_src, w_sch:, :] = im_source
            # plot good matche points:
            for m in good:
                color = tuple([int(random() * 255) for _ in range(3)])  # 随机颜色画线
                cv2.line(plot_img, (int(kp_sch[m.queryIdx].pt[0]), int(kp_sch[m.queryIdx].pt[1])), (int(kp_src[m.trainIdx].pt[0] + w_sch), int(kp_src[m.trainIdx].pt[1])), color)
            # plot search_image
            for kp in kp_sch:
                color = tuple([int(random() * 255) for _ in range(3)])  # 随机颜色画点
                pos = (int(kp.pt[0]), int(kp.pt[1]))
                mark_point(im_search, pos, circle=False, color=color, radius=5)
            # plot source_image
            for kp in kp_src:
                color = tuple([int(random() * 255) for _ in range(3)])  # 随机颜色画点
                pos = (int(kp.pt[0]), int(kp.pt[1]))
                mark_point(im_source, pos, circle=False, color=color, radius=10)

            from airtest.aircv import show
            show(plot_img)
            show(im_search)
            show(im_source)