小编0xP*_*eek的帖子

使用 cv2 时如何“镜像”实时网络摄像头视频?

我想要两个不同的网络摄像头视频输出,一个是普通的网络摄像头镜头,另一个是它的“镜像”版本。cv2可以吗?

import time, cv2


video=cv2.VideoCapture(0)
a=0
while True:
    a=a+1
    check, frame= video.read()

    gray=cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
    cv2.imshow("Capturing",gray)

    key=cv2.waitKey(1)

    if key==ord('q'):
        break
print(a)

video.release()
cv2.destroyAllWindows
Run Code Online (Sandbox Code Playgroud)

python cv2

7
推荐指数
1
解决办法
5137
查看次数

Get max value of column for rows where a condition is met

I have a DataFrame that looks like this:

| Age | Married | OwnsHouse |
| 23  | True    | False     |
| 35  | True    | True      |
| 14  | False   | False     |
| 27  | True    | True      |
Run Code Online (Sandbox Code Playgroud)

I want to find the highest age of anyone who is married and owns a house. The answer here would be 35. My first thought was to do:

df_subset = df[df['Married'] == True and df['OwnsHouse'] == True] …
Run Code Online (Sandbox Code Playgroud)

python python-3.x pandas

2
推荐指数
1
解决办法
57
查看次数

查找行和列组熊猫的平均值

我想找到平均总收入最高的州,并能够看到1992-2016年所有州的平均总收入最高的州(第40-45位),第35-40位(最高)的州。

数据组织在下图中的数据框中。因此,理想情况下,我可以有另一列如下所示。我想这就是我要做的。

STATE // YEAR // TOTAL_REVENUE // AVG_TOTAL_REVENUE

ALABAMA // 1992 // 5000 // 6059

ALABAMA // 1993 // 4000 // 6059

ALASKA // 1992 // 3000 // 2059

ALABAMA // 1996 // 6019 // 6059
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

这可能吗?我不确定我是否要说出我想正确做的事情,也不确定我在寻找谷歌明智的方法以找出前进的方向。

python pandas

0
推荐指数
1
解决办法
64
查看次数

标签 统计

python ×3

pandas ×2

cv2 ×1

python-3.x ×1