提交 2f1cf1f3 编写于 作者: W wizardforcel

2019-11-19 23:58:23

上级 569a9a23
......@@ -4,7 +4,7 @@
![Car Tracking with OpenCV](img/41e5801abd44884a07aa898717a7e69e.jpg)
Car Tracking with OpenCV
使用 OpenCV 进行汽车追踪
在本教程中,我们将研究使用 [haar 功能](https://en.wikipedia.org/wiki/Haar-like_features)的车辆跟踪。 我们有一个经过训练的 haar 级联文件。
......@@ -49,7 +49,7 @@ while rval:
## 汽车追踪算法
For every frame:
对于每一帧:
* 检测潜在的感兴趣区域
* 根据垂直,水平相似度过滤检测到的区域
......
......@@ -36,7 +36,7 @@ while rval:
## 使用 OpenCV 进行人脸检测
We will display a rectangle on top of the face. To avoid flickering of the rectangle, we will show it at it latest known position if the face is not detected.
我们将在脸部上方显示一个矩形。 为了避免矩形的闪烁,如果未检测到面部,我们将在最新的已知位置显示该矩形。
```py
#! /usr/bin/python
......
......@@ -11,7 +11,7 @@
![template matching opencv](img/3d85797cd44b2c4b3348bfd4fc8a7795.jpg)
Template matching with OpenCV and Python. Template (left), result image (right)
与 OpenCV 和 Python 匹配的模板。 模板(左),结果图像(右)
[下载代码](https://pythonspot.com/download-vision-examples/)
......@@ -21,11 +21,11 @@ Template matching with OpenCV and Python. Template (left), result image (right)
* **模板图像(T)**:模板图像
The template image T is slided over the source image S (moved over the source image), and the program tries to find matches using statistics.
模板图像`T`在源图像`S`上滑动(在源图像上移动),并且程序尝试使用统计信息查找匹配项。
## 模板匹配示例
Lets have a look at the code:
让我们看一下代码:
```py
import numpy as np
......@@ -63,7 +63,7 @@ cv2.waitKey(0)
## 说明
First we load both the source image and template image with imread().  We resize themand convert them to grayscale for faster detection:
首先,我们使用`imread()`加载源图像和模板图像。我们调整它们的大小并将其转换为灰度以便更快地进行检测:
```py
......@@ -80,7 +80,7 @@ templateGray = cv2.cvtColor(template, cv2.COLOR_BGR2GRAY)
![Template Matching](img/671697da89293504fef04cfadad29c6b.jpg)
Pick the right statistical method for your application. TM_CCOEFF (right), TM_SQDIFF(left)
为您的应用选择正确的统计方法。`TM_CCOEFF`(右),`TM_SQDIFF`(左)
此方法具有六个匹配方法:CV_TM_SQDIFF,CV_TM_SQDIFF_NORMED,CV_TM_CCORR,CV_TM_CCORR_NORMED,CV_TM_CCOEFF 和 CV_TM_CCOEFF_NORMED。
这是完全不同的[统计比较方法](https://docs.opencv.org/modules/imgproc/doc/object_detection.html?highlight=matchtemplate#matchtemplate)
......@@ -89,7 +89,7 @@ Pick the right statistical method for your application. TM_CCOEFF (right), TM_SQ
## 局限性
Template matching is not scale invariant nor is it rotation invariant. It is a very basic and straightforward method where we find the most correlating area. Thus, this method of object detection depends on the kind of application you want to build. For non scale and rotation changing input, this method works great.
模板匹配不是比例不变的,也不是旋转不变的。 这是一种非常基本和直接的方法,可在其中找到最相关的区域。 因此,这种对象检测方法取决于您要构建的应用程序的类型。 对于非比例和旋转变化的输入,此方法效果很好。
您可能会喜欢:[机器人技术](https://pythonspot.com/robotics)[具有级联](https://pythonspot.com/car-tracking-with-cascades/)的汽车跟踪。
......
......@@ -3,7 +3,7 @@
> 原文: [https://pythonspot.com/netflix-like-thumbnails-with-python/](https://pythonspot.com/netflix-like-thumbnails-with-python/)
[Netflix](https://techblog.netflix.com/2016/03/extracting-image-metadata-at-scale.html) 的启发,我们决定实施对焦点算法。 如果您在移动网站上使用生成的缩略图,则可能会增加 YouTube 视频的点击率(CTR)。
Eiterway,这是一个有趣的实验。
无论如何,这是一个有趣的实验。
## 焦点
......
......@@ -11,11 +11,11 @@
![python-text-game](img/e700a43a387c917fef1acdb35ac275a0.jpg)
Simple text game with Python
使用 Python 的简单文字游戏
## 随机数
The user will be asked to guess the random number. We first pick the random number:
将要求用户猜测随机数。 我们首先选择随机数:
```py
from random import randint
......@@ -42,7 +42,7 @@ while guess != x:
## Python 猜测游戏
The code below starts the game:
下面的代码开始游戏:
```py
from random import randint
......
......@@ -137,9 +137,9 @@ if __name__ == "__main__" :
现在,您可以使用箭头键在屏幕上移动该块。
<caption id=”attachment_589” align=”alignnone” width=”400”]![pygame](img/deee1c79e1cf5a6bd033391e65334fe7.jpg)
![pygame](img/deee1c79e1cf5a6bd033391e65334fe7.jpg)
pygame example. Move the block around the screen
pygame 的例子。在屏幕上移动块
## 构建玩家(蛇)
......@@ -319,7 +319,7 @@ if __name__ == "__main__" :
结果:
<caption id=”attachment_594” align=”alignnone” width=”592”]![python snake](img/c2a6a40115692ff004dc8fce43168e64.jpg)
![python snake](img/c2a6a40115692ff004dc8fce43168e64.jpg)
python snake
......@@ -333,7 +333,7 @@ python snake
* 如果一条蛇自行倒下,请继续游戏。
We start by creating a new class that enables us to create apples:
我们首先创建一个新类,使我们能够创建苹果:
```py
class Apple:
......
......@@ -39,7 +39,7 @@ if (keys[K_RIGHT]):
```
The complete code gives us the ability to move the player across the screen:
完整的代码使我们能够在屏幕上移动播放器:
```py
from pygame.locals import *
......@@ -130,7 +130,8 @@ if __name__ == "__main__" :
```
You can now move the block around the screen with the arrow keys.
现在,您可以使用箭头键在屏幕上移动该块。
![pygame](img/deee1c79e1cf5a6bd033391e65334fe7.jpg)
pygame
......@@ -278,7 +279,7 @@ if __name__ == "__main__" :
![maze](img/d08118dfea2a3c65bb9fb3442f0f1ead.jpg)
maze
迷宫
## 结论
......
......@@ -8,8 +8,9 @@ Google 还创建了 JavaScript Web Speech API,因此您可以根据需要在 J
## 安装
Google Speech API v2 is limited to 50 queries per day. Make sure you have a good microphone.
Are you are looking for [text to speech](https://pythonspot.com/speech-engines-with-python-tutorial/) instead?
Google Speech API v2 每天最多只能查询 50 个查询。确保您的麦克风良好。
您是否正在寻找[文字转语音](https://pythonspot.com/speech-engines-with-python-tutorial/)
这是 Ubuntu Linux 的安装指南。 但这可能在其他平台上也很好。 您将需要安装一些软件包:PyAudio,PortAudio 和 SpeechRecognition。 PyAudio 0.2.9 是必需的,您可能需要手动进行编译。
......@@ -26,7 +27,7 @@ sudo pip3 install SpeechRecognition
## 程序
This program will record audio from your microphone, send it to the speech API and return a Python string.
该程序将记录来自麦克风的音频,将其发送到语音 API 并返回 Python 字符串。
使用语音识别模块记录音频,该模块将包括在程序顶部。 其次,我们将录制的语音发送到 Google 语音识别 API,然后该 API 返回输出。
**r.recognize_google(audio)**返回一个字符串。
......
......@@ -10,21 +10,21 @@
* [**口头回答(文本到语音)**](https://pythonspot.com/speech-engines-with-python-tutorial/)
* 回答简单的命令
For this tutorial you will need (Ubuntu) Linux, [**Python**](https://pythonspot.com) and a working microphone.
对于本教程,您将需要(Ubuntu)Linux,[**Python**](https://pythonspot.com) 和可正常使用的麦克风。
#### 视频
This is what you’ll create (watch the whole video, demo at the end):
这是您要创建的(观看整个视频,最后是演示):
&lt;iframe allow="autoplay; encrypted-media" allowfullscreen="" frameborder="0" height="315" src="https://www.youtube-nocookie.com/embed/ErGAhUa_rlA?rel=0" width="560"&gt;&lt;/iframe&gt;
<https://www.youtube-nocookie.com/embed/ErGAhUa_rlA?rel=0>
### 识别语音
Speech recognition can by done using the Python SpeechRecognition module. We make use of the [Google Speech API](https://pythonspot.com/speech-recognition-using-google-speech-api/ "Google Speech Recognition in Python") because of it’s great quality.
可以使用 Python 语音识别模块完成语音识别。我们使用 [Google Speech API](https://pythonspot.com/speech-recognition-using-google-speech-api/),因为它的质量很高。
### 以语音回答(文字转语音)
Various [**APIs and programs are available for text to speech applications**](https://pythonspot.com/speech-engines-with-python-tutorial/ "TTS"). Espeak and pyttsx work out of the box but sound very robotic. We decided to go with the Google Text To Speech API, gTTS.
各种 [**API 和程序可用于文本到语音的应用程序**](https://pythonspot.com/speech-engines-with-python-tutorial/)。Espeak 和 pyttsx 开箱即用,但听起来很机器人。我们决定使用 Google 文字到语音 API gTTS。
```py
......@@ -44,11 +44,11 @@ os.system("mpg321 hello.mp3")
```
[&lt;picture&gt;&lt;source srcset="/wp-content/uploads/2015/07/gtts.png.webp" type="image/webp"&gt; &lt;source srcset="/wp-content/uploads/2015/07/gtts.png" type="image/jpeg"&gt; ![gtts](img/538e4461fb4b4cc380ce7b29759028f8.jpg)&lt;/picture&gt; ](/wp-content/uploads/2015/07/gtts.png)
![gtts](img/538e4461fb4b4cc380ce7b29759028f8.jpg)
### 完整程序
The program below will answer spoken questions.
下面的程序将回答口头问题。
```py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册