'2019/05/10'에 해당되는 글 4건

  1. 2019.05.10 opencv face detect
  2. 2019.05.10 vscode python3 opencv lint
  3. 2019.05.10 리눅스 gdm 키맵 변경
  4. 2019.05.10 glfw3 in ubuntu 19.04
Programming/openCV2019. 5. 10. 19:17

 

 

import cv2

 

dirname = '/home/user/.local/lib/python3.6/site-packages/cv2/data/'

 

face_cascade = cv2.CascadeClassifier(dirname + 'haarcascade_frontalface_default.xml')

eye_cascade = cv2.CascadeClassifier(dirname + 'haarcascade_eye.xml')

 

cam = cv2.VideoCapture(0)

cam.set(3, 160) # CV_CAP_PROP_FRAME_WIDTH

cam.set(4, 120) # CV_CAP_PROP_FRAME_HEIGHT

cam.set(5, 60) # CV_CAP_PROP_FPS

print(cam.get(3))

print(cam.get(4))

print(cam.get(5))

 

while True:

ret_val, img = cam.read()

gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

 

faces = face_cascade.detectMultiScale(gray, 1.3, 5)

print(faces)

for (x, y, w, h) in faces:

img = cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)

roi_gray = gray[y:y+h, x:x+w]

roi_color = img[y:y+h, x:x+w]

eyes = eye_cascade.detectMultiScale(roi_gray)

for (ex, ey, ew, eh) in eyes:

cv2.rectangle(roi_color, (ex, ey), (ex+ew, ey+eh), (0, 255, 0), 2)

 

cv2.imshow("Cam Viewer", img)

cv2.imshow("Cam Viewer gray", gray)

if cv2.waitKey(1) == 27:

break

 

[링크 : https://opencv-python-tutroals.readthedocs.io/.../py_face_detection/py_face_detection.html]

[링크 : https://stackoverflow.com/questions/30508922/error-215-empty-in-function-detectmultiscale]

'Programming > openCV' 카테고리의 다른 글

virtual mouse  (0) 2022.01.25
opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
vscode python3 opencv lint  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
Posted by 구차니
Programming/openCV2019. 5. 10. 19:05

 

{

"python.linting.pylintArgs": ["--extension-pkg-whitelist=cv2"]

}

[ : https://github.com/Microsoft/vscode-python/issues/2879]

'Programming > openCV' 카테고리의 다른 글

opencv-3.4.0 어플리케이션 빌드  (0) 2021.01.14
opencv face detect  (0) 2019.05.10
opencv cannyedge  (0) 2019.01.16
opencv 원 추정  (0) 2019.01.16
OpenCV 분산처리  (0) 2018.04.25
Posted by 구차니
Linux/Ubuntu2019. 5. 10. 10:30

뜬금없이 우측 alt 키가 한글에서 ALT-R로 인식이 바뀌어서 급 멘붕. (포맷해야하나..)

아무튼 바꿀순 있는데 걍... alt-r로 바뀐김에 한글변환키를 alt-r로 추가해주는게 현재로서는 가장 편하네..(덜 귀찮..)

 

[링크 : https://hyoungx.tistory.com/38]

[링크 : https://lhb0517.tistory.com/entry/우분투-기계식-키보드-오른쪽-알트키AltR를-한영전환키로-변경]

'Linux > Ubuntu' 카테고리의 다른 글

우분투 리눅스에 카카오톡 깔기  (2) 2019.07.09
ubuntu sftp with nautilius  (0) 2019.06.03
ubuntu 18.04 hibernate 적용하기  (0) 2019.05.06
intel hd 3000 GLSL  (0) 2019.05.05
linux smbus?  (0) 2019.05.04
Posted by 구차니
Programming/openGL2019. 5. 10. 08:34

원인은 모르겠는데.. 링크할때 파일명이랑 순서가 영향을 주네? 머지?

 

$ sudo apt-get install libglfw3-dev libglfw3

$ vi glfw.c

#include <GLFW/glfw3.h>
#include 
#include 
static void error_callback(int error, const char* description)
{
    fputs(description, stderr);
}
static void key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if (key == GLFW_KEY_ESCAPE && action == GLFW_PRESS)
        glfwSetWindowShouldClose(window, GL_TRUE);
}
int main(void)
{
    GLFWwindow* window;
    glfwSetErrorCallback(error_callback);
    if (!glfwInit())
        exit(EXIT_FAILURE);
    window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
    if (!window)
    {
        glfwTerminate();
        exit(EXIT_FAILURE);
    }
    glfwMakeContextCurrent(window);
    glfwSetKeyCallback(window, key_callback);
    while (!glfwWindowShouldClose(window))
    {
        float ratio;
        int width, height;
        glfwGetFramebufferSize(window, &width, &height);
        ratio = width / (float) height;
        glViewport(0, 0, width, height);
        glClear(GL_COLOR_BUFFER_BIT);
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(-ratio, ratio, -1.f, 1.f, 1.f, -1.f);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        glRotatef((float) glfwGetTime() * 50.f, 0.f, 0.f, 1.f);
        glBegin(GL_TRIANGLES);
        glColor3f(1.f, 0.f, 0.f);
        glVertex3f(-0.6f, -0.4f, 0.f);
        glColor3f(0.f, 1.f, 0.f);
        glVertex3f(0.6f, -0.4f, 0.f);
        glColor3f(0.f, 0.f, 1.f);
        glVertex3f(0.f, 0.6f, 0.f);
        glEnd();
        glfwSwapBuffers(window);
        glfwPollEvents();
    }
    glfwDestroyWindow(window);
    glfwTerminate();
    exit(EXIT_SUCCESS);
}

$ gcc glfw.c -lglfw -lGL

 

[링크 : https://www.glfw.org/docs/3.0/quick.html]

'Programming > openGL' 카테고리의 다른 글

gl model view projection mat  (0) 2019.05.29
gluPerspective()  (0) 2019.05.28
openGL vao(Vertex Array Object)  (0) 2019.05.07
glfw - gl framework  (0) 2019.05.07
openGL 3.0 tutorial  (0) 2019.05.07
Posted by 구차니