void polybezier()
{
Mat image(400, 400, CV_8UC3);
image.setTo(Scalar(255, 255, 255));
imshow("BezierPoly", image);
Mat imdeer = imread("C:\\temp\\siksin\\173646402820_middle.jpg");
imshow("Deer", imdeer);
Mat result(400, 400, CV_8UC3);
result.setTo(Scalar(255, 255, 255));
while (1) {
int k = waitKey(1);
if (k == 27)
break;
if (k == 'd'){
HWND hwnd = FindWindow(NULL, L"BezierPoly");
HDC hdc = GetDC(hwnd);
POINT point[4];
point[0].x = 100; point[1].x = 150; point[2].x = 200; point[3].x = 100;
point[0].y = 100; point[1].y = 150; point[2].y = 50; point[3].y = 100;
PolyBezier(hdc, point, 4);
HANDLE oldobj = SelectObject(hdc, GetStockObject(BLACK_BRUSH));
ExtFloodFill(hdc,
(point[0].x + point[1].x + point[2].x + point[3].x) / 4,
(point[0].y + point[1].y + point[2].y + point[3].y) / 4,
RGB(0, 0, 0), FLOODFILLBORDER);
SelectObject(hdc, oldobj);
for (int r = 0; r < 400; r++) {
for (int c = 0; c < 400; c ++ ) {
COLORREF color = GetPixel(hdc, c, r);
if (color == RGB(0, 0, 0)) {
Point p = { r, c };
result.at<Vec3b>(r, c)[0] = imdeer.at<Vec3b>(r, c)[0];
result.at<Vec3b>(r, c)[1] = imdeer.at<Vec3b>(r, c)[1];
result.at<Vec3b>(r, c)[2] = imdeer.at<Vec3b>(r, c)[2];
}
}
}
ReleaseDC(hwnd, hdc);
imshow("result", result);
imwrite("c:\\temp\\siksin\\bezierpoly-result.jpg", result);
}
}
}
'TensorFlow OpenCV' 카테고리의 다른 글
TensorFlow epoch, batch 2018. 9. (0) | 2019.10.05 |
---|---|
Tensorflow로 faceswap을 해보자 (0) | 2019.10.05 |
darknet DEBUG BUILD 오류 해결 2018. 1. 16. (0) | 2019.10.05 |
마이크로 소프트의 CNTK 설치할 때 환경 변수 지정. 2017. 12. 1. 10:48 (0) | 2019.10.05 |
PyCharm, Tensorflow, Keras 설치 2017. 11. 25. (0) | 2019.10.05 |