kiiti分割的数据及其处理
kitti和cityscape的gt的分割不太一样,下边缘不再是从黑色开始的,而是直接是类别
red,green,blue = img_gt[i,j]
1.道路的颜色(紫色):128 64 128
2.汽车的颜色(蓝色):142 0 0
3.人行道的颜色(朱红色):232 35 244
4.树和绿色植物的颜色(绿色):35 142 107
5.灰色:70 70 70
6.绿地(浅绿色):152 251 152
7.石子路(肉色、浅粉红色):160 170 250
8.另一种石子路(土褐色):81 0 81(图83_10.png)
75_10.png这张图中黄色柱状物下面的图黄色那部分如何处理其实是一个很大的问题,处理掉,但是确实这个东西有高度,不处理掉,那上面的柱状物体就检测不出来
要处理的有3,6,7,8
处理代码和之前在cityscape的略微有点不同:
import cv2
import numpy as np with open('/media/hdc/xing/data_semantics/training/semantic_rgb/a.txt','r') as file:
# num = 0
for line in file:
# if num == 1:
# break
# num += 1
gt_image = '/media/hdc/xing/data_semantics/training/semantic_rgb/' + line.strip().split('./')[1]
# print gt_image
save_dir = '/media/hdc/xing/data_semantics/training/label012/' + line.strip().split('./')[1]
img_gt = cv2.imread(gt_image)
# print type(img_gt)
height = img_gt.shape[0]
width = img_gt.shape[1]
# print width,height
result = np.zeros((height,width))
for i in range(width):
index = height-1
red,green,blue = img_gt[index,i]
# print i,red,green,blue
while index >= 1 and (red != 128 or green != 64 or blue != 128):
index -= 1
red,green,blue = img_gt[index,i]
while index >= 1 and red == 128 and green == 64 and blue == 128:
index -= 1
result[index][i] = 1
# result[index][i] = 255
red,green,blue = img_gt[index,i]
while (index >= 1 and red == 232 and green == 35 and blue == 244) or (index >= 1 and red == 152 and green == 251 and blue == 152) or (index >= 1 and red == 160 and green == 170 and blue == 250) or (index >= 1 and red == 81 and green == 0 and blue == 81):
index -= 1
red,green,blue = img_gt[index,i]
while index >= 1 and red == 128 and green == 64 and blue == 128:
index -= 1
result[index][i] = 1
# result[index][i] = 255
red,green,blue = img_gt[index,i]
blue1 = blue
green1 = green
red1 = red
# print blue1,green1,red1
while index >= 1 and blue == blue1 and green == green1 and red == red1:
result[index][i] = 2
# result[index][i] = 150
index -= 1
red,green,blue = img_gt[index,i]
while index >= 1 and red == 128 and green == 64 and blue == 128:
index -= 1
result[index][i] = 1
# result[index][i] = 255
red,green,blue = img_gt[index,i]
while index >= 1 and blue == blue1 and green == green1 and red == red1:
result[index][i] = 2
# result[index][i] = 150
index -= 1
red,green,blue = img_gt[index,i]
# while index >= 1 and (red != 128 or green != 64 or blue != 128):
# index -= 1
# red,green,blue = img_gt[index,i]
# while index >= 1 and red == 128 and green == 64 and blue == 128:
# index -= 1
# # result[index][i] = 1
# result[index][i] = 255
# red,green,blue = img_gt[index,i]
# while index >= 1 and red == 250 and green == 170 and blue == 160:
# index -= 1
# red,green,blue = img_gt[index,i]
# while index >= 1 and red == 244 and green == 35 and blue == 232:
# index -= 1
# red,green,blue = img_gt[index,i]
# while index >= 1 and red == 152 and green == 251 and blue == 152:
# index -= 1
# red,green,blue = img_gt[index,i]
# blue2 = blue
# green2 = green
# red2 = red
# while index >= 1 and blue == blue2 and green == green2 and red == red2:
# index -= 1
# # result[index][i] = 2
# result[index][i] = 150
# red,green,blue = img_gt[index,i]
# print index
for i in range(width):
for j in range(height):
red,green,blue = img_gt[j,i]
if blue == 0 and green == 0 and red == 0:
result[j][i] = 0
cv2.imwrite(save_dir,result)
print save_dir
kiiti分割的数据及其处理的更多相关文章
- Mysql数据处理/行转列/列转行/分割/拼接/数据复制汇总
mysql数据处理记录(使用的 Workbench) 生成随机数 逗号或分号拼接的字符串分割成多行 多行数据转化成用逗号拼接的字符串 将A表的数据添加到B表 一.生成随机数 生成18位:(19位就加颗 ...
- SQL Server查询中对于单列数据','分割的数据进行的拆分操作,集合的每一个行变多行
1.cross apply cross apply 我们可以把它看作成是inner join 来使用 2.outer apply outer apply我们可以把它看做是left join 来使用 注 ...
- Oracle字段根据逗号分割查询数据
需求是表里的某个字段存储的值是以逗号分隔开来的,要求根据分隔的每一个值都能查出来数据,但是不能使用like查询. 数据是这样的: 查询的sql如下: select * from ( select gu ...
- Linq 分组(group by)求和(sum)并且按照分隔符(join)分割列数据
转载:http://www.cnblogs.com/zq281660880/archive/2012/09/26/2704836.html 今天在使用linq处理一下需求时碰到一点小问题,特此记录. ...
- JavaScript拆分字符串并将分割的数据放到数组中
1 2 3 4 5 6 7 var splitArray = new Array(); var string="太平洋.大西洋.印度洋.北冰洋"; var regex = /./; ...
- Wireshark wireshake数据包分割及捕包过滤器介绍
wireshake数据包分割及捕包过滤器介绍 by:授客 QQ:1033553122 wireshake自带工具editcap分割数据包 操作: 进入到目录,然后 editcap.exe -c < ...
- Hadoop ->> 关于数据分割(Data Split)的思考
今天开始学习Hadoop这门热门的数据库技术.直接从被奉为Hadoop圣经的<Hadoop The Definitive Guide 4th Edition>入手.第一章作者写到一个关于分 ...
- (数据科学学习手札27)sklearn数据集分割方法汇总
一.简介 在现实的机器学习任务中,我们往往是利用搜集到的尽可能多的样本集来输入算法进行训练,以尽可能高的精度为目标,但这里便出现一个问题,一是很多情况下我们不能说搜集到的样本集就能代表真实的全体,其分 ...
- SQL Server 游标运用:鼠标轨迹字符串分割
一.本文所涉及的内容(Contents) 本文所涉及的内容(Contents) 背景(Contexts) 游标模板(Cursor Template) 鼠标轨迹字符串分割SQL脚本实现(SQL Code ...
随机推荐
- NET CORE Learning
ASP.NET Core 基础教程https://www.cnblogs.com/lonelyxmas/tag/ASP.NET%20Core%20%E5%9F%BA%E7%A1%80%E6%95%99 ...
- mysql初始化
注意:--install前,必须用mysql启动命令的绝对路径 # 制作MySQL的Windows服务,在终端执行此命令: mysqld --install # 移除MySQL的Windows服务,在 ...
- 在Mac上安装mysql
进入这个网站: https://dev.mysql.com/downloads/mysql/ 然后点击安装就行了. 注意在这里启动mysql 然后mac上所有的mysql命令都得用绝对路径才能生效
- ERROR:105: Unable to locate a modulefile for 'xxx'
查看可用的 module:module avail 将xxx替换为屏幕输出中已有的模块.
- Unity脚本的生命周期 同一脚本/不同脚本/游戏对象激没激活/脚本激没激活,几种情况下的Awake,OnEnable,Start的执行顺序
可以自己在Unity里面试一下 游戏对象在Hierarchy面板不是激活的,它的脚本没作用,脚本中的函数不会执行; 游戏对象在Hierarchy面板是激活的,脚本没激活,Awake会执行,OnEnab ...
- ZK典型应用场景
1. 数据发布/订阅--动态获取数据 2.Master选举 a). 利用Zk会保证无法重复创建一个已经存在的节点 b). 多个客户端同时创建,创建成功的即是master,并监控master节点,一旦m ...
- (七)使用jedis连接单机和集群(一步一个坑踩出来的辛酸泪)
环境准备: redis-4.0.9,最新版了 ruby:redis-x.x.x.gem 这个gem什么版本都行,我redis4用3.0.0的gem正常跑 jedis-2.9.0.jar,最新版 ...
- [CF 612E]Square Root of Permutation
A permutation of length n is an array containing each integer from 1 to n exactly once. For example, ...
- Unity 滚轮实现UGUI ScrollView的缩放
本文原创,转载请注明出处http://www.cnblogs.com/AdvancePikachu/p/7908754.html 前段时间在做一个类似AnimationCurve的可视化编辑器,其中在 ...
- Oauth服务端协议开发
授权流程图 AS : Authorization Server (权限服务器) RS : Resource Server (资源服务器) Client :Client RS(资源服务器)流程图 以上仅 ...