質問編集履歴
1
ソースコードを見直したらエラーコードが変わったので変更しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,19 +10,17 @@
|
|
10
10
|
|
11
11
|
コンパイルは通りますが、実行時にエラーが出ます。「~~Error:」の後に具体的なことが書かれてない(他の例では○○がないよ!とかが英語で書かれている)ので理解ができません。
|
12
12
|
|
13
|
-
|
13
|
+
おそらく「fourcc」関連のことだと思って、いろいろなコーデックを試してみましたが、さっぱりです
|
14
14
|
|
15
15
|
```
|
16
16
|
|
17
|
-
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.videoio.VideoWriter.
|
17
|
+
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.opencv.videoio.VideoWriter.fourcc_0(CCCC)I
|
18
18
|
|
19
|
-
|
19
|
+
at org.opencv.videoio.VideoWriter.fourcc_0(Native Method)
|
20
20
|
|
21
|
-
|
21
|
+
at org.opencv.videoio.VideoWriter.fourcc(VideoWriter.java:348)
|
22
22
|
|
23
|
-
at MkMovie.<init>(MkMovie.java:12)
|
24
|
-
|
25
|
-
|
23
|
+
at MkMovie.main(MkMovie.java:36)
|
26
24
|
|
27
25
|
```
|
28
26
|
|
@@ -46,75 +44,93 @@
|
|
46
44
|
|
47
45
|
import org.opencv.imgcodecs.*;
|
48
46
|
|
47
|
+
import org.opencv.videoio.VideoWriter;
|
48
|
+
|
49
|
-
import org.opencv.videoio.
|
49
|
+
import org.opencv.videoio.Videoio;
|
50
50
|
|
51
51
|
|
52
52
|
|
53
53
|
public class MkMovie{
|
54
54
|
|
55
|
-
|
55
|
+
Mat takedImage;
|
56
56
|
|
57
|
-
|
57
|
+
|
58
58
|
|
59
|
+
public void nanika(String image){
|
60
|
+
|
61
|
+
//try {
|
62
|
+
|
59
|
-
|
63
|
+
takedImage = Imgcodecs.imread(image);
|
64
|
+
|
65
|
+
//}catch(IOException e){
|
66
|
+
|
67
|
+
//}
|
68
|
+
|
69
|
+
}
|
60
70
|
|
61
71
|
|
62
72
|
|
63
|
-
|
73
|
+
public void nanika2(String time, VideoWriter Mov){
|
64
74
|
|
65
|
-
//try {
|
66
|
-
|
67
|
-
|
75
|
+
int totalFrame = Integer.valueOf(time)*30;
|
68
|
-
|
69
|
-
//}catch(IOException e){
|
70
|
-
|
71
|
-
//}
|
72
|
-
|
73
|
-
}
|
74
76
|
|
75
77
|
|
76
78
|
|
77
|
-
public void nanika2(String time){
|
78
79
|
|
80
|
+
|
79
|
-
|
81
|
+
for(int i=0; i<totalFrame; i++){
|
82
|
+
|
83
|
+
Mov.write(takedImage);
|
84
|
+
|
85
|
+
}
|
80
86
|
|
81
87
|
|
82
88
|
|
83
|
-
for(int i=0; i<totalFrame; i++){
|
84
|
-
|
85
|
-
this.bideotsukuru(this.takedImage);
|
86
|
-
|
87
|
-
|
89
|
+
}
|
88
|
-
|
89
|
-
}
|
90
90
|
|
91
91
|
|
92
92
|
|
93
|
-
|
93
|
+
public void bideotsukuru(Mat frame){
|
94
|
-
|
95
|
-
this.gMovie.write(frame);
|
96
|
-
|
97
|
-
}
|
98
94
|
|
99
95
|
|
100
96
|
|
101
|
-
|
97
|
+
}
|
102
98
|
|
103
|
-
MkMovie go = new MkMovie();
|
104
99
|
|
105
|
-
go.nanika(args[0]);
|
106
100
|
|
107
|
-
|
101
|
+
public static void main(String[] args) {
|
108
102
|
|
103
|
+
Size frameSize = new Size(1280, 720);
|
104
|
+
|
105
|
+
int fourcc = VideoWriter.fourcc('D','I','V','X');
|
106
|
+
|
107
|
+
VideoWriter gMovie = new VideoWriter("generatedMovie.avi", fourcc, 30, frameSize, true);
|
108
|
+
|
109
|
+
if(!gMovie.isOpened()){
|
110
|
+
|
111
|
+
System.out.println("Cant Open");
|
112
|
+
|
109
|
-
|
113
|
+
}
|
114
|
+
|
115
|
+
MkMovie go = new MkMovie();
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
//gMovie.open();
|
120
|
+
|
121
|
+
go.nanika(args[0]);
|
122
|
+
|
123
|
+
go.nanika2(args[1], gMovie);
|
124
|
+
|
125
|
+
gMovie.release();
|
126
|
+
|
127
|
+
}
|
110
128
|
|
111
129
|
|
112
130
|
|
113
131
|
|
114
132
|
|
115
133
|
}
|
116
|
-
|
117
|
-
|
118
134
|
|
119
135
|
```
|
120
136
|
|
@@ -148,7 +164,7 @@
|
|
148
164
|
|
149
165
|
C:\OpenCV\opencv\build\x64\vc15\bin
|
150
166
|
|
151
|
-
C:\OpenCV\opencv\build\java\x
|
167
|
+
C:\OpenCV\opencv\build\java\x64
|
152
168
|
|
153
169
|
C:\OpenCV\opencv\build\bin
|
154
170
|
|