请选择 进入手机版 | 继续访问电脑版
楼主: Nicolle
1895 8

OpenCV Computer Vision with Python [推广有奖]

巨擘

0%

还不是VIP/贵宾

-

TA的文库  其他...

Python(Must-Read Books)

SAS Programming

Must-Read Books

威望
16
论坛币
12402323 个
通用积分
1620.7415
学术水平
3305 点
热心指数
3329 点
信用等级
3095 点
经验
477211 点
帖子
23879
精华
91
在线时间
9878 小时
注册时间
2005-4-23
最后登录
2022-3-6

Nicolle 学生认证  发表于 2015-7-13 12:59:40 |显示全部楼层 |坛友微信交流群
提示: 作者被禁止或删除 内容自动屏蔽

本帖被以下文库推荐

牛尾巴 发表于 2015-7-19 14:50:14 |显示全部楼层 |坛友微信交流群
请查收了。

本帖隐藏的内容

OpenCV Computer Vision with Python.pdf (1.49 MB)



已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
Nicolle + 100 + 100 + 1 + 1 + 1 精彩帖子

总评分: 经验 + 100  论坛币 + 100  学术水平 + 1  热心指数 + 1  信用等级 + 1   查看全部评分

使用道具

lzguo568 在职认证  发表于 2015-7-20 11:02:15 |显示全部楼层 |坛友微信交流群
  1. Displaying camera frames in a window
  2. OpenCV allows named windows to be created, redrawn, and destroyed using the
  3. namedWindow(), imshow(), and destroyWindow() functions. Also, any window
  4. may capture keyboard input via the waitKey() function and mouse input via the
  5. setMouseCallback() function. Let's look at an example where we show frames of
  6. live camera input:
  7. import cv2
  8. clicked = False
  9. def onMouse(event, x, y, flags, param):
  10. global clicked
  11. if event == cv2.cv.CV_EVENT_LBUTTONUP:
  12. clicked = True
  13. cameraCapture = cv2.VideoCapture(0)
  14. cv2.namedWindow('MyWindow')
  15. cv2.setMouseCallback('MyWindow', onMouse)
  16. print 'Showing camera feed. Click window or press any key to stop.'
  17. success, frame = cameraCapture.read()
  18. while success and cv2.waitKey(1) == -1 and not clicked:
  19. cv2.imshow('MyWindow', frame)
  20. success, frame = cameraCapture.read()
  21. cv2.destroyWindow('MyWindow')
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

使用道具

bnd10 发表于 2015-7-28 13:52:15 |显示全部楼层 |坛友微信交流群
  1. Formulating a curve
  2. Our first step toward curve-based filters is to convert control points to a function.
  3. Most of this work is done for us by a SciPy function called interp1d(), which takes
  4. two arrays (x and y coordinates) and returns a function that interpolates the points.
  5. As an optional argument to interp1d(), we may specify a kind of interpolation,
  6. which, in principle, may be linear, nearest, zero, slinear (spherical linear),
  7. quadratic, or cubic, though not all options are implemented in the current version
  8. of SciPy. Another optional argument, bounds_error, may be set to False to permit
  9. extrapolation as well as interpolation.
  10. Let's edit utils.py and add a function that wraps interp1d() with a slightly
  11. simpler interface:
  12. def createCurveFunc(points):
  13. """Return a function derived from control points."""
  14. if points is None:
  15. return None
  16. numPoints = len(points)
  17. if numPoints < 2:
  18. return None
  19. xs, ys = zip(*points)
  20. if numPoints < 4:
  21. kind = 'linear'
  22. # 'quadratic' is not implemented.
  23. else:
  24. kind = 'cubic'
  25. return scipy.interpolate.interp1d(xs, ys, kind,
  26. bounds_error = False)
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

使用道具

Shaolin1 发表于 2015-7-28 13:54:32 |显示全部楼层 |坛友微信交流群

Caching and applying a curve

  1. Caching and applying a curve
  2. Now we can get the function of a curve that interpolates arbitrary control points.
  3. However, this function might be expensive. We do not want to run it once per
  4. channel, per pixel (for example, 921,600 times per frame if applied to three channels
  5. of 640 x 480 video). Fortunately, we are typically dealing with just 256 possible input
  6. values (in 8 bits per channel) and we can cheaply precompute and store that many
  7. output values. Then, our per-channel, per-pixel cost is just a lookup of the cached
  8. output value.
  9. Let's edit utils.py and add functions to create a lookup array for a given function
  10. and to apply the lookup array to another array (for example, an image):
  11. def createLookupArray(func, length = 256):
  12. """Return a lookup for whole-number inputs to a function.

  13. The lookup values are clamped to [0, length - 1].

  14. """
  15. if func is None:
  16. return None
  17. lookupArray = numpy.empty(length)
  18. i = 0
  19. while i < length:
  20. func_i = func(i)
  21. lookupArray[i] = min(max(0, func_i), length - 1)
  22. i += 1
  23. return lookupArray
  24. def applyLookupArray(lookupArray, src, dst):
  25. """Map a source to a destination using a lookup."""
  26. if lookupArray is None:
  27. return
  28. dst[:] = lookupArray[src]
复制代码

已有 1 人评分论坛币 收起 理由
Nicolle + 20 精彩帖子

总评分: 论坛币 + 20   查看全部评分

使用道具

Nicolle 学生认证  发表于 2016-8-18 04:45:34 |显示全部楼层 |坛友微信交流群
提示: 作者被禁止或删除 内容自动屏蔽

使用道具

Nicolle 学生认证  发表于 2016-8-18 04:45:56 |显示全部楼层 |坛友微信交流群

Capturing camera frames

提示: 作者被禁止或删除 内容自动屏蔽

使用道具

Nicolle 学生认证  发表于 2016-8-18 04:47:02 |显示全部楼层 |坛友微信交流群
提示: 作者被禁止或删除 内容自动屏蔽

使用道具

ReneeBK 发表于 2016-12-19 03:55:19 |显示全部楼层 |坛友微信交流群

使用道具

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群

京ICP备16021002-2号 京B2-20170662号 京公网安备 11010802022788号 论坛法律顾问:王进律师 知识产权保护声明   免责及隐私声明

GMT+8, 2024-3-29 06:25