OpenCV-005:图片的基本像素操作
来源:互联网 发布:电脑软件服务打不开 编辑:程序博客网 时间:2024/06/06 05:37
#https://opencv-python-tutroals.readthedocs.io/en/latest/py_tutorials/py_core/py_basic_ops/py_basic_ops.html#basic-ops###############################################Import Module ####import cv2import numpy as np###############################################Global Parameter ####img = cv2.imread('D:\\Data\\016_ComputerVision\\img\\messi5.jpg',cv2.IMREAD_COLOR)###############################################Main Function #### print imgprint img.shapeprint img.size#img.dtype is very important while debugging because a large number of errors in OpenCV-Python code is caused by invalid datatype.print img.dtypecv2.imshow("opencv005-1",img) cv2.waitKey (1000) px = img[100,100]#read the pixel's colorprint px#accessing only blue pixel,BGR File#every img is created by value matrix,#for example 2*2 image:#in datastorage ,saved as this#[[0,0,[255.128.0]][0,1,[255.128.0]],[1,0,[255.128.0]][1,1,[255.128.0]]]# Y X BGR values#[0,0,[255.128.0]],[0,1,[255.128.0]]#[1,0,[255.128.0]],[1,1,[255.128.0]]#every pixel contains three values:x-position,y-position,BGR Color,0:B,1:G,2:Rblue = img[100,100,0]print bluegreen = img[100,100,1]print greenred = img[100,100,2]print red#paint a white point on the imageimg[100,150] = [255,255,255]#Notice:There is a white point on the image!!!cv2.imshow("opencv005-2",img) cv2.waitKey(0)cv2.destroyAllWindows()
阅读全文
0 0
- OpenCV-005:图片的基本像素操作
- OpenCV对像素的操作
- OpenCV对像素的操作
- opencv2 像素的基本操作
- 【opencv】1. 图片基本操作。
- opencv取图片像素的方法
- openCV—访问与操作像素(图片的区域的更改)
- Opencv中Mat对于像素的操作
- 初学opencv小记-对像素的操作
- 【OpenCV】Mat对于像素的操作
- opencv关于像素操作的汇总2
- Opencv中三种操作像素的方法
- opencv像素基本操作及图像遍历at
- opencv像素基本操作及图像遍历at
- opencv像素基本操作及图像遍历at
- OpenCV 对图片的基本操作(nice)
- 【OpenCV学习笔记 005】 操作像素
- opencv 操作像素
- 从服务器上下载压缩包
- 多线程编程之八:pthread读写锁
- mysql——windows相关配置
- Http网络请求数据
- 对输入数据进行多个异常处理
- OpenCV-005:图片的基本像素操作
- 获取文件的信息
- java序列化
- STL 二分查找 upper_bound和lower_bound用法
- 关于java数据库章节connection连接不成功的时候!!!
- triplet loss总结
- js简单字母验证码
- swagger与springMVC、maven整合
- uboot的环境变量操作