Python

    [PyQt5] QGraphicsView로 웹캠 영상 스트리밍하는 데모 만들기

    사각형 드래그 가능 우클릭 누르면 마지막에 그린거 삭제 됨 import sys import cv2 from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QPushButton, QFileDialog, QLabel, QGraphicsView, QGraphicsScene from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout from PyQt5.QtGui import QPixmap, QImage, QPainter, QPen, QColor, QBrush from PyQt5.QtCore import QPointF, QRectF, Qt, QTimer class GraphicView(QGraphicsView): def..

    [PyQt5] QGraphicsView로 Canvas 구현하기

    Pyqt5로 캔버스 구현하기. 근데 QLabel 대신 QGraphicsView 사용. import sys from PyQt5.QtWidgets import QApplication, QMainWindow, QWidget, QPushButton, QFileDialog, QLabel, QGraphicsView, QGraphicsScene from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout from PyQt5.QtGui import QPixmap, QImage, QPainter, QPen, QColor, QBrush from PyQt5.QtCore import QPointF, QRectF, Qt class GraphicView(QGraphicsView): def __i..

    [Opencv] draw event

    import numpy as np import cv2 from math import sqrt, pow img = np.zeros((512, 512, 3), np.uint8) img_ = img.copy() drawing = False mode = True (ix, iy) = (-1, -1) windowName = 'Drawing' cv2.namedWindow(windowName) green = (0, 255, 0) red = (0, 0, 255) def draw(event, x, y): global ix, iy, drawing, mode, img, img_ if event == cv2.EVENT_LBUTTONDOWN: drawing = True (ix, iy) = x, y elif event == cv2..