Skip to content

Commit 3c222dd

Browse files
author
satoo air
committed
update for "OpenCVforUnity2.0.0"
1 parent 809aa95 commit 3c222dd

File tree

3 files changed

+39
-39
lines changed

3 files changed

+39
-39
lines changed

ColorFrameSample.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ void Start ()
9292
//create a striped background.
9393
comicBgMat = new Mat (texture.height, texture.width, CvType.CV_8UC1, new Scalar (255));
9494
for (int i = 0; i < comicBgMat.rows ()*2.5f; i=i+4) {
95-
Core.line (comicBgMat, new Point (0, 0 + i), new Point (comicBgMat.cols (), -comicBgMat.cols () + i), new Scalar (0), 1);
95+
Imgproc.line (comicBgMat, new Point (0, 0 + i), new Point (comicBgMat.cols (), -comicBgMat.cols () + i), new Scalar (0), 1);
9696
}
9797

9898
comicDstMat = new Mat (texture.height, texture.width, CvType.CV_8UC1);
@@ -127,19 +127,19 @@ void Update ()
127127

128128
if (mode == modeType.original) {
129129

130-
Core.putText (rgbaMat, "ORIGINAL MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
130+
Imgproc.putText (rgbaMat, "ORIGINAL MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
131131

132132
} else if (mode == modeType.sepia) {
133133

134134
Core.transform (rgbaMat, rgbaMat, sepiaKernel);
135135

136-
Core.putText (rgbaMat, "SEPIA MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
136+
Imgproc.putText (rgbaMat, "SEPIA MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
137137

138138
} else if (mode == modeType.pixelize) {
139139
Imgproc.resize (rgbaMat, pixelizeIntermediateMat, pixelizeSize0, 0.1, 0.1, Imgproc.INTER_NEAREST);
140140
Imgproc.resize (pixelizeIntermediateMat, rgbaMat, rgbaMat.size (), 0.0, 0.0, Imgproc.INTER_NEAREST);
141141

142-
Core.putText (rgbaMat, "PIXELIZE MODE" + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
142+
Imgproc.putText (rgbaMat, "PIXELIZE MODE" + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
143143

144144
} else if (mode == modeType.comic) {
145145
Imgproc.cvtColor (rgbaMat, comicGrayMat, Imgproc.COLOR_RGBA2GRAY);
@@ -189,7 +189,7 @@ void Update ()
189189

190190
Imgproc.cvtColor (comicDstMat, rgbaMat, Imgproc.COLOR_GRAY2RGBA);
191191

192-
Core.putText (rgbaMat, "COMIC MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
192+
Imgproc.putText (rgbaMat, "COMIC MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
193193

194194
}
195195

MultiSourceFrameSample.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ void Start ()
109109
//create a striped background.
110110
comicBgMat = new Mat (texture.height, texture.width, CvType.CV_8UC1, new Scalar (255));
111111
for (int i = 0; i < comicBgMat.rows ()*2.5f; i=i+4) {
112-
Core.line (comicBgMat, new Point (0, 0 + i), new Point (comicBgMat.cols (), -comicBgMat.cols () + i), new Scalar (0), 1);
112+
Imgproc.line (comicBgMat, new Point (0, 0 + i), new Point (comicBgMat.cols (), -comicBgMat.cols () + i), new Scalar (0), 1);
113113
}
114114

115115
comicDstMat = new Mat (texture.height, texture.width, CvType.CV_8UC1);
@@ -181,23 +181,23 @@ void Update ()
181181

182182
rgbaMat.copyTo (outputMat, maskMat);
183183

184-
Core.putText (outputMat, "ORIGINAL MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
184+
Imgproc.putText (outputMat, "ORIGINAL MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
185185

186186
} else if (mode == modeType.sepia) {
187187

188188
Core.transform (rgbaMat, rgbaMat, sepiaKernel);
189189

190190
rgbaMat.copyTo (outputMat, maskMat);
191191

192-
Core.putText (outputMat, "SEPIA MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
192+
Imgproc.putText (outputMat, "SEPIA MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
193193

194194
} else if (mode == modeType.pixelize) {
195195
Imgproc.resize (rgbaMat, pixelizeIntermediateMat, pixelizeSize0, 0.1, 0.1, Imgproc.INTER_NEAREST);
196196
Imgproc.resize (pixelizeIntermediateMat, rgbaMat, rgbaMat.size (), 0.0, 0.0, Imgproc.INTER_NEAREST);
197197

198198
rgbaMat.copyTo (outputMat, maskMat);
199199

200-
Core.putText (outputMat, "PIXELIZE MODE" + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
200+
Imgproc.putText (outputMat, "PIXELIZE MODE" + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
201201

202202
} else if (mode == modeType.comic) {
203203
Imgproc.cvtColor (rgbaMat, comicGrayMat, Imgproc.COLOR_RGBA2GRAY);
@@ -250,7 +250,7 @@ void Update ()
250250

251251
rgbaMat.copyTo (outputMat, maskMat);
252252

253-
Core.putText (outputMat, "COMIC MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Core.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
253+
Imgproc.putText (outputMat, "COMIC MODE " + texture.width + "x" + texture.height, new Point (5, texture.height - 5), Imgproc.FONT_HERSHEY_PLAIN, 4.0, new Scalar (255, 0, 0, 255), 3);
254254

255255
}
256256

README.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
Kinect with OpenCV for Unity Sample
2-
====================
3-
4-
Demo Video
5-
-----
6-
[![](http://img.youtube.com/vi/_dvsSo8rzA8/0.jpg)](https://www.youtube.com/watch?v=_dvsSo8rzA8)
7-
8-
Environment
9-
-----
10-
Windows 8.1
11-
Unity 5.0.0f4
12-
Kinect V2
13-
14-
Setup
15-
-----
16-
* Import Kinect.2.0.1410.19000.unitypackage
17-
* Import OpenCVForUnity1.1.4 from AssetStore
18-
19-
20-
Samples
21-
-----
22-
**[ColorFrameSample.cs](ColorFrameSample.cs)**
23-
Converts ColorFrame acquired from "Kinect" to Mat of "OpenCV", perform image processing.
24-
25-
**[MultiSourceFrameSample.cs](MultiSourceFrameSample.cs)**
26-
Converts BodyIndexFrame acquired from "Kinect" to Mat of "OpenCV", perform image processing only person.
27-
28-
29-
1+
Kinect with OpenCV for Unity Sample
2+
====================
3+
4+
Demo Video
5+
-----
6+
[![](http://img.youtube.com/vi/_dvsSo8rzA8/0.jpg)](https://www.youtube.com/watch?v=_dvsSo8rzA8)
7+
8+
Environment
9+
-----
10+
Windows 8.1
11+
Unity 5.0.0f4
12+
Kinect V2
13+
14+
Setup
15+
-----
16+
* Import Kinect.2.0.1410.19000.unitypackage
17+
* Import OpenCVForUnity2.0.0 from AssetStore
18+
19+
20+
Samples
21+
-----
22+
**[ColorFrameSample.cs](ColorFrameSample.cs)**
23+
Converts ColorFrame acquired from "Kinect" to Mat of "OpenCV", perform image processing.
24+
25+
**[MultiSourceFrameSample.cs](MultiSourceFrameSample.cs)**
26+
Converts BodyIndexFrame acquired from "Kinect" to Mat of "OpenCV", perform image processing only person.
27+
28+
29+

0 commit comments

Comments
 (0)