본문 바로가기

전체 글137

다각형 검출 프로그램_2026-03-11 #include "opencv2/opencv.hpp"#include using namespace cv;using namespace std;void setLabel(Mat& img, const vector& pts, const String& label){ Rect rc = boundingRect(pts); rectangle(img, rc, Scalar(0, 0, 255), 1); putText(img, label, rc.tl(), FONT_HERSHEY_PLAIN, 1, Scalar(0, 0, 255));}int main(int argc, char* argv[]){ Mat img = imread("polygon.bmp", IMREAD_COLOR); if (img.empty()) { cerr > conto.. 2026. 3. 11.
보행자 검출 프로그램_2026-03-11 #include "opencv2/opencv.hpp"#include using namespace cv;using namespace std;int main(){ VideoCapture cap("vtest.avi"); if (!cap.isOpened()) { cerr > frame; if (frame.empty()) break; vector detected; hog.detectMultiScale(frame, detected); for (Rect r : detected) { Scalar c = Scalar(rand() % 256, rand() % 256, rand() % 256); rectangle(frame, r, c, 3); } imshow("frame", frame); if (w.. 2026. 3. 11.
SSD 얼굴 검출 프로그램_2026-03-11 #include "opencv2/opencv.hpp"#include using namespace cv;using namespace cv::dnn;using namespace std;const String model = "res10_300x300_ssd_iter_140000_fp16.caffemodel";const String config = "deploy.prototxt";//const String model = "opencv_face_detector_uint8.pb";//const String config = "opencv_face_detector.pbtxt";int main(void){ VideoCapture cap(0); if (!cap.isOpened()) { cerr > fram.. 2026. 3. 11.
QR 코드 검출 프로그램_2026-03-11 #include "opencv2/opencv.hpp"#include using namespace cv;using namespace std;int main(){ VideoCapture cap(0); if (!cap.isOpened()) { cerr > frame; if (frame.empty()) { cerr points; String info = detector.detectAndDecode(frame, points); // QR 코드가 검출되었을 때 if (!info.empty() && points.size() == 4) { for (int i = 0; i 2026. 3. 11.
구글넷 영상 인식 프로그램_2026-03-10 #include "opencv2/opencv.hpp"#include #include using namespace cv;using namespace cv::dnn;using namespace std;int main(int argc, char* argv[]){ // Load an image Mat img; if (argc classNames; string name; while (!fp.eof()) { getline(fp, name); if (name.length()) classNames.push_back(name); } fp.close(); // Inference Mat inputBlob = blobFromImage(img, 1, Size(224, 224), Scalar(104, 117, 123)).. 2026. 3. 10.
학습된 모델 파일을 이용한 필기체 숫자 인식_2026-03-10 dnnmnist 프로그램은 HOGDescriptor 클래스 구현상의 문제로 디버그 모드에서는 동작하지 않고 릴리스 모드에서만 동작합니다. 그러므로 Visual Studio 상단 솔루션 구성을 Release로 변경한 후 실행하기 바랍니다.#include "opencv2/opencv.hpp"#include using namespace cv;using namespace cv::dnn;using namespace std;void on_mouse(int event, int x, int y, int flags, void* userdata);int main(){ Net net = readNet("mnist_cnn.pb"); if (net.empty()) { cerr dnnmnist 프로그램을 실행하면 검은색으로 .. 2026. 3. 10.