我可以在Buffers菜单中切换行号。但是我希望它默认启用。我在询问左侧的行号,而不是状态栏中的行号。
答案 0 :(得分:0)
请在.jedrc文件中插入以下代码。
public define global_mode_hook (hook_name)
{
set_line_number_mode (1);
}
- )
答案 1 :(得分:0)
opt的答案是正确的,但代码应位于.jedrc的底部。应该有一行这样的内容:
import cv2
import numpy as np
from pynput.keyboard import Key, Controller
import time
keyboard = Controller()
wc = cv2.VideoCapture(0)
time.sleep(2)
for i in range(40):
ret, img = wc.read()
img = cv2.flip(img,1)
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(imgGray, 1.1, 4)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x,y), (x + w, y + h), (255, 0, 0), 2)
centre = [int((x + w + x)/2), int((y + h + y)/2)]
faceCascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
wc = cv2.VideoCapture(0)
# Read until video is completed
while(wc.isOpened()):
# Capture frame-by-frame
ret, img = wc.read()
img = cv2.flip(img,1)
if ret == True:
imgGray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(imgGray, 1.1, 4)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x,y), (x + w, y + h), (255, 0, 0), 2)
centre_new = [int((x + w + x)/2), int((y + h + y)/2)]
cv2.circle(img, (centre_new[0], centre_new[1]), 0, (0,0,255), 5)
if centre_new[0] - centre[0] > 100 :
keyboard.press(Key.right)
keyboard.release(Key.right)
print('right')
if centre_new[0] - centre[0] < -100 :
keyboard.press(Key.left)
keyboard.release(Key.left)
print('left')
if centre_new[1] - centre[1] < -100 :
keyboard.press(Key.up)
keyboard.release(Key.up)
print('up')
if centre_new[1] - centre[1] > 100 :
keyboard = Controller()
keyboard.press(Key.down)
keyboard.release(Key.down)
print('down')
# Display the resulting frame
cv2.imshow('Face',img)
# Press Q on keyboard to exit
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Break the loop
else:
break
# When everything done, release the video capture object
wc.release()
# Closes all the frames
cv2.destroyAllWindows()