質問編集履歴
1
特徴点抽出のためのコードを追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -31,3 +31,111 @@
|
|
31
31
|
OpenCvSharp2.4.10
|
32
32
|
|
33
33
|
Visual Studio 2017
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
以下のコードのように、Star Detector を用いて特徴点の抽出を行ってみました。
|
38
|
+
|
39
|
+
これをパノラマ画像の生成に使うことはできますか?
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
```C#
|
44
|
+
|
45
|
+
using System;
|
46
|
+
|
47
|
+
using System.Collections.Generic;
|
48
|
+
|
49
|
+
using System.Linq;
|
50
|
+
|
51
|
+
using System.Text;
|
52
|
+
|
53
|
+
using System.Threading.Tasks;
|
54
|
+
|
55
|
+
using OpenCvSharp;
|
56
|
+
|
57
|
+
using OpenCvSharp.Blob;
|
58
|
+
|
59
|
+
using OpenCvSharp.Extensions;
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
namespace gousei
|
68
|
+
|
69
|
+
{
|
70
|
+
|
71
|
+
class Program
|
72
|
+
|
73
|
+
{
|
74
|
+
|
75
|
+
static void Main(string[] args)
|
76
|
+
|
77
|
+
{
|
78
|
+
|
79
|
+
using (IplImage img = new IplImage("C:\pictures\lena.png", LoadMode.Color))
|
80
|
+
|
81
|
+
using (IplImage cimg = new IplImage("C:\pictures\lena.png", LoadMode.GrayScale))
|
82
|
+
|
83
|
+
using (CvMemStorage storage = new CvMemStorage(0))
|
84
|
+
|
85
|
+
{
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
CvStarDetectorParams param = new CvStarDetectorParams(45);
|
90
|
+
|
91
|
+
CvSeq<CvStarKeypoint> keypoints = Cv.GetStarKeypoints(img, storage, param);
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
if (keypoints != null)
|
96
|
+
|
97
|
+
{
|
98
|
+
|
99
|
+
for (int i = 0; i < keypoints.Total; i++)
|
100
|
+
|
101
|
+
{
|
102
|
+
|
103
|
+
CvStarKeypoint kpt = keypoints[i].Value;
|
104
|
+
|
105
|
+
int r = kpt.Size / 2;
|
106
|
+
|
107
|
+
Cv.Circle(img, kpt.Pt, r, new CvColor(0, 255, 0));
|
108
|
+
|
109
|
+
Cv.Line(img, new CvPoint(kpt.Pt.X + r, kpt.Pt.Y + r), new CvPoint(kpt.Pt.X - r, kpt.Pt.Y - r), new CvColor(0, 255, 0));
|
110
|
+
|
111
|
+
Cv.Line(img, new CvPoint(kpt.Pt.X - r, kpt.Pt.Y + r), new CvPoint(kpt.Pt.X + r, kpt.Pt.Y - r), new CvColor(0, 255, 0));
|
112
|
+
|
113
|
+
}
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
using (new CvWindow("img", img))
|
120
|
+
|
121
|
+
using (new CvWindow("features", cimg))
|
122
|
+
|
123
|
+
{
|
124
|
+
|
125
|
+
Cv.WaitKey();
|
126
|
+
|
127
|
+
}
|
128
|
+
|
129
|
+
}
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
}
|
138
|
+
|
139
|
+
}
|
140
|
+
|
141
|
+
```
|