http://jepsonsblog.blogspot.kr/2012/11/rotation-in-3d-using-opencvs.html


회전행렬 사용한 듯

1
2
3
4
5
Mat sticker;
sticker.create(height, width, CV_8UC4);
//캔버스 배경색 투명하게 만들기
//맨 끝의 0값 - alpha
sticker = Scalar(2552552550);
cs


Scalar를 이용해서 채널들의 값을 바꿔주면 된다

alpha값을 0으로!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
inline std::vector<image_window::overlay_line> render_face_detections (
        const std::vector<full_object_detection>& dets,
        const rgb_pixel color = rgb_pixel(0,255,0)
    )
    {
        std::vector<image_window::overlay_line> lines;
        for (unsigned long i = 0; i < dets.size(); ++i)
        {
            DLIB_CASSERT(dets[i].num_parts() == 68,
                "\t std::vector<image_window::overlay_line> render_face_detections()"
                << "\n\t Invalid inputs were given to this function. "
                << "\n\t dets["<<i<<"].num_parts():  " << dets[i].num_parts() 
            );
 
            const full_object_detection& d = dets[i];
            // Around Chin. Ear to Ear
            for (unsigned long i = 1; i <= 16++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
                
            // Line on top of nose
            for (unsigned long i = 28; i <= 30++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            
            // left eyebrow
            for (unsigned long i = 18; i <= 21++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            // Right eyebrow
            for (unsigned long i = 23; i <= 26++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            // Bottom part of the nose
            for (unsigned long i = 31; i <= 35++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            // Line from the nose to the bottom part above
            lines.push_back(image_window::overlay_line(d.part(30), d.part(35), color));
 
            // Left eye
            for (unsigned long i = 37; i <= 41++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            lines.push_back(image_window::overlay_line(d.part(36), d.part(41), color));
 
            // Right eye
            for (unsigned long i = 43; i <= 47++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            lines.push_back(image_window::overlay_line(d.part(42), d.part(47), color));
 
            // Lips outer part
            for (unsigned long i = 49; i <= 59++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            lines.push_back(image_window::overlay_line(d.part(48), d.part(59), color));
 
            // Lips inside part
            for (unsigned long i = 61; i <= 67++i)
                lines.push_back(image_window::overlay_line(d.part(i), d.part(i-1), color));
            lines.push_back(image_window::overlay_line(d.part(60), d.part(67), color));
        }
        return lines;
    }
cs



1~16 : 턱

18~21 : 왼쪽 눈썹

23~26 : 오른쪽 눈썹

28~30 : 콧대

31~35 : 콧망울

37~41 : 왼쪽 눈

43~47 : 오른쪽 눈

49~59 : 입술 바깥 라인

61~67 : 입술 안쪽 라인

+ Recent posts