๋ชฉ๋ก๐ฉโ๐ป IoT (Embedded)/Image Processing (77)
๐ ๊ณต๋ถํ๋ ์ง์ง์ํ์นด๋ ์ฒ์์ด์ง?

๐ threshold ๋ก tone ์กฐ์ ํ๊ธฐ import numpy as np def two_tone(img, threshold=128): output = (img > threshold) * 255 return output.astype(np.uint8) import cv2 img = cv2.imread("images/lena.jpg", 0) # 100 ์ดํ๋ฉด 0 black, 100 ์ด์์ด๋ฉด 255 white new_img = two_tone(img, threshold=100) cv2.imwrite('lena_bin.jpg', new_img) cv2.imshow('img', new_img) cv2.waitKey(0) cv2.destroyAllWindows() ๐ threshold ๋ก ์ค์๊ฐ webcam to..

๐ NORMAL & MIXED import cv2 import numpy as np # ํ๋ ฌ (์ ์ ๋ณด b g r) logo = cv2.imread('images/logo.png') lena = cv2.imread('images/lena.jpg') mask = np.full_like(logo, 255) height, width = lena.shape[:2] center = (width//2, height//2) # ์์ค ์ด๋ฏธ์ง, destination, ๋ณต์ ์ฃผ๋ณ mask, center ์ด๋ฏธ์ง, flag normal = cv2.seamlessClone(logo, lena, mask, center, cv2.NORMAL_CLONE) # ๋ธ๋ฌ์ฒ๋ฆฌ mixed = cv2.seamlessClone(logo, lena..

Murtaza's Workshop ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>=> LEARN OPENCV C++ in 4 HOURS | Including 3x Projects | Computer Vision ๐ Project3 - License Plate Detector๐ง russian number Detect ํ๊ธฐ #include // OpenCV์์ ์ง์ํ๋ ๋ชจ๋ ๊ธฐ๋ฅ#include // ๋น๋์ค ์ถ์ ๋ฐ ๋ฐฐ๊ฒฝ segmentation๊ณผ ๊ด๋ จ๋ ๋ฃจํด#include // ๊ธฐ๋ณธ ๋ฐ์ดํฐ ํ์ ์ด ์ ์ธ (Mat ์ด๋ Point๊ฐ ์ ์ธ, ํ๋ ฌ ์ฐ์ฐ ํน์ ๋ฒกํฐ ์ฐ์ฐ)#include // ์๋์ฐ ํ๋ฉด, UI์ฒ๋ฆฌ(์ฌ๋ผ์ด๋, ๋ฒํผ ๋ฑ) ๋ฐ ๋ง์ฐ์ค ์ ์ด ๊ฐ๋ฅ#include #include #incl..

Murtaza's Workshop ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>=> LEARN OPENCV C++ in 4 HOURS | Including 3x Projects | Computer Vision ๐ Project2 - Document Scanner๐ง ๋ฌธ์ ์ด๋ฏธ์ง์ dilate ์ ์ฉ์ผ๋ก ์ค์บ ํ๊ธฐdilate : ํฐ์ ํฝ์ ์ ์ค์ด๋ ์ญํ #include // OpenCV์์ ์ง์ํ๋ ๋ชจ๋ ๊ธฐ๋ฅ#include // ๋น๋์ค ์ถ์ ๋ฐ ๋ฐฐ๊ฒฝ segmentation๊ณผ ๊ด๋ จ๋ ๋ฃจํด#include // ๊ธฐ๋ณธ ๋ฐ์ดํฐ ํ์ ์ด ์ ์ธ (Mat ์ด๋ Point๊ฐ ์ ์ธ, ํ๋ ฌ ์ฐ์ฐ ํน์ ๋ฒกํฐ ์ฐ์ฐ)#include // ์๋์ฐ ํ๋ฉด, UI์ฒ๋ฆฌ(์ฌ๋ผ์ด๋, ๋ฒํผ ๋ฑ) ๋ฐ ๋ง์ฐ์ค ์ ์ด ๊ฐ๋ฅ#includ..

Murtaza's Workshop ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>=> LEARN OPENCV C++ in 4 HOURS | Including 3x Projects | Computer Vision ๐ Project1 - Virtual Painter๐ง Trackbar ๋ก ์ด๋ฏธ์ง mask ์ ์ด ํ๊ธฐ#include // OpenCV์์ ์ง์ํ๋ ๋ชจ๋ ๊ธฐ๋ฅ#include // ๋น๋์ค ์ถ์ ๋ฐ ๋ฐฐ๊ฒฝ segmentation๊ณผ ๊ด๋ จ๋ ๋ฃจํด#include // ๊ธฐ๋ณธ ๋ฐ์ดํฐ ํ์ ์ด ์ ์ธ (Mat ์ด๋ Point๊ฐ ์ ์ธ, ํ๋ ฌ ์ฐ์ฐ ํน์ ๋ฒกํฐ ์ฐ์ฐ)#include // ์๋์ฐ ํ๋ฉด, UI์ฒ๋ฆฌ(์ฌ๋ผ์ด๋, ๋ฒํผ ๋ฑ) ๋ฐ ๋ง์ฐ์ค ์ ์ด ๊ฐ๋ฅ#include #include #include usi..

Murtaza's Workshop ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>=> LEARN OPENCV C++ in 4 HOURS | Including 3x Projects | Computer Vision ๐ Face Detection๐ง haarcascade_frontalface_default.xml (์ ๋ฉด ์ผ๊ตด ๊ฒ์ถํ๊ธฐ) ๋ค์ด๋ฐ์์ Resources/ ์ ๋ฃ๊ธฐ CascadeClassifier.detectMultiScale(image, scaleFactor=None, minNeighbors=None, flags=None, minSize=None, maxSize=None)image : ์ ๋ ฅ ์์ (cv2.CV_8U)scaleFactor : ์์ ์ถ์ ๋น์จ. ๊ธฐ๋ณธ๊ฐ์ 1.1.minNeighb..

Murtaza's Workshop ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>=> LEARN OPENCV C++ in 4 HOURS | Including 3x Projects | Computer Vision ๐ Shapes/Contour Detection๐ง getStructuringElementํฌ๊ธฐ์ ๋ชจ์์ ์ค์ ํ๊ณ ๊ณ ์ ์ ์์น๋ ์์๋๋ก ๊ฒฐ์ getStructuringElement(shape, ksize, anchor=None) shape : ์ปค๋์ ๋ชจ์ (ํ์ : cv::MorphShapes) โบ MORPH_CROSS : ์ญ์๊ฐํ โบ MORPH_ELLIPSE : ํ์ํ โบ MORPH_RECT : ์ง์ฌ๊ฐํksize : ์ปค๋์ ํฌ๊ธฐanchor : ์ปค๋์ ๊ธฐ์ค์ ..

Murtaza's Workshop ์ ์ ํ๋ธ๋ฅผ ์ฐธ๊ณ ํด์ ๊ณต๋ถํ๋ฉฐ ์์ฑํ์์ต๋๋ค :-)>=> LEARN OPENCV C++ in 4 HOURS | Including 3x Projects | Computer Vision ๐ Color Detection๐ง HSV3๊ฐ์ ์ฑ๋ H(Hue, ์์กฐ), S(Saturation, ์ฑ๋), V(Value, ๋ช ๋) ๊ฐ๋ ์์ ์ด๋ฏธ์ง ํํ๋ฒ H ๊ฐ์ ์ด๋ฏธ์ง๊ฐ ์ด๋ค ์์์ธ์งS๋ ์ด๋ฏธ์ง์ ์์์ด ์ผ๋ง๋ ์์ํ๊ฒ ํฌํจ๋์ด ์๋์งV๋ ์์์ด ์ผ๋ง๋ ๋ฐ์์ง ์ด๋์ด์ง๋ฅผ ํํ#include // OpenCV์์ ์ง์ํ๋ ๋ชจ๋ ๊ธฐ๋ฅ#include // ๋น๋์ค ์ถ์ ๋ฐ ๋ฐฐ๊ฒฝ segmentation๊ณผ ๊ด๋ จ๋ ๋ฃจํด#include // ๊ธฐ๋ณธ ๋ฐ์ดํฐ ํ์ ์ด ์ ์ธ (Mat ์ด๋ Point..