ch09 edges
#python import cv2import numpy as npdef sobel_derivative(): src = cv2.imread("D:\\projects\\SampleCode\\006939-master\\ch09\\edges\\lenna.bmp", cv2.IMREAD_GRAYSCALE) if src is None: print("Image load failed!") return mx = np.float32([[-1/2.0, 0, 1/2.0]]) my = np.float32([[-1/2.0], [0], [1/2.0]]) dx = cv2.filter2D(src, -1, mx, delta=128) dy = cv2.filter2D(src, -1, ..
더보기
ch08 perspective
#pythonimport cv2import numpy as npsrc = NonesrcPts = np.zeros((4, 2), dtype=np.float32)dstPts = np.zeros((4, 2), dtype=np.float32)def on_mouse(event, x, y, flags, param): global src, srcPts cnt = param[0] if event == cv2.EVENT_LBUTTONDOWN: if cnt // C++#include "opencv2/opencv.hpp"#include using namespace cv;using namespace std;Mat src;Point2f srcPts[4], dstPts[4];void on_mouse(..
더보기
ch08 affine
#python import cv2import numpy as npdef affine_transform(): src = cv2.imread("D:\\projects\\SampleCode\\006939-master\\ch08\\affine\\tekapo.bmp") if src is None: print("Image load failed!") return srcPts = np.array([[0, 0], [src.shape[1] - 1, 0], [src.shape[1] - 1, src.shape[0] - 1]], dtype=np.float32) dstPts = np.array([[50, 50], [src.shape[1] - 100, 100], [src.shape[1..
더보기