首页 > 解决方案 > 我无法从 python 代码中理解这个形状

问题描述

我是 python 新手。我在谷歌上搜索有关 python 代码以获取路牌检测的信息,我找到了一些代码,但我不明白代码的含义。

elif dominant_color[0] > 80:
            zone_0 = square[square.shape[0]*3//8:square.shape[0]
                            * 5//8, square.shape[1]*1//8:square.shape[1]*3//8]
            cv2.imshow('Zone0', zone_0)
            zone_0_color = warnadominan(zone_0, 1)

            zone_1 = square[square.shape[0]*1//8:square.shape[0]
                            * 3//8, square.shape[1]*3//8:square.shape[1]*5//8]
            cv2.imshow('Zone1', zone_1)
            zone_1_color = warnadominan(zone_1, 1)

            zone_2 = square[square.shape[0]*3//8:square.shape[0]
                            * 5//8, square.shape[1]*5//8:square.shape[1]*7//8]
            cv2.imshow('Zone2', zone_2)
            zone_2_color = warnadominan(zone_2, 1)

提前致谢

标签: python-3.xnumpyopencv

解决方案


Assuming square has shape (8, 8)

我认为这张图可能会有所帮助:

在此处输入图像描述

编辑:代码正在尝试提取图像中显示的区域


推荐阅读