python对图像进行处理_python – 捕获图像进行处理

Video Capture by Markus Gritsch

from VideoCapture import Device

from numpy import *

from PIL import Image

cam = Device(devnum=0,showVideoWindow=0) #devnum=0 means you are using the device set in 0 position probably your webcam

blackimg= cam.getImage() #this return a PIL image but I don't know why the first is always black

#blackimag.show()#try to check if you want

image=cam.getImage() #this is a real image PIL image

imgarray = asarray(image) #convert the image into a matrix

#imgarrayfloat = imgarray.astype('float') # in many cases of processing you have to convert to a float matrix because can occur overflow (e.g. for average images summing pixels values of 255 and 3 of two images and divide by 2 gives you 1/2 for imgarray and 258/2 for imgarrayfloat

#recovertedimage=processedimage.astype ("uint8")#if you us

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值