兩個矩陣有值的點的疊加

        # 合成整體圖像
        layer_sum = np.zeros((100, 100, 3), dtype="bool")  
        layer_sum_255 = np.zeros((100, 100, 3), dtype="bool")  

        # 與原矩陣進行或運算
        for obj_id in obj_id_list:
            temp = self.operator_observe_layer_cache[obj_id] % 2  # 127 255 都是奇數
            layer_sum += temp.astype(np.bool)
            temp = self.operator_observe_layer_cache[obj_id] // 255  # 只有255能被整除
            layer_sum_255 += temp.astype(np.bool)

        layer_sum =layer_sum.astype(np.int)
        layer_sum_255 = layer_sum_255.astype(np.int)

        layer_sum = layer_sum * 127 + layer_sum_255 * 128

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章