質問編集履歴

3

AHO

2019/12/05 04:16

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- あああああああああああ
1
+ $ GG:HOGE \rightarrow AHO $ となるような $GG$ を構成したい。
test CHANGED
@@ -1 +1,13 @@
1
- ああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ
1
+ お世話になります。weak semantic supervisionを用いて $hoge \in HOGE, aho \in AHO$を $ GG:HOGE \rightarrow AHO $ とする $GG$ が欲しいのですが実装できません。
2
+
3
+
4
+
5
+ 参考:
6
+
7
+ http://openaccess.thecvf.com/content_ICCV_2017/papers/Zhu_Unpaired_Image-To-Image_Translation_ICCV_2017_paper.pdf
8
+
9
+ 2年前の化石のようなペーパーで申し訳ありません。
10
+
11
+
12
+
13
+ 宜しくお願い致します。

2

あああああああああああああああああ

2019/12/05 04:16

投稿

退会済みユーザー
test CHANGED
@@ -1 +1 @@
1
- KOTLIN ANDROIDSTUDIO
1
+ あああああああああああ
test CHANGED
@@ -1,359 +1 @@
1
- お世話になります。KOTLIN以下のコードを書いたところエラーとなりました。
2
-
3
-
4
-
5
- setTargetAspectRatio(screenAspectRatio) >>>>>>>>>>>>>>>>>>>>エラー
6
-
7
-
8
-
9
- 全体コードは以下になります。
10
-
11
-
12
-
13
- ```ここに言語を入力
14
-
15
- private fun startCamera() {
16
-
17
-
18
-
19
-
20
-
21
- CameraX.unbindAll()
22
-
23
-
24
-
25
- val size = arrayOfNulls<Size>(5)
26
-
27
- size[0] = Size(240, 320)
28
-
29
- size[1] = Size(320, 480)
30
-
31
- size[2] = Size(480, 640)
32
-
33
- size[3] = Size(720, 960)
34
-
35
- size[4] = Size(1080, 1960)
36
-
37
-
38
-
39
- val savedSize = size[2]
40
-
41
- val w1 = savedSize?.width as Int
42
-
43
- val h1 =savedSize.height
44
-
45
-
46
-
47
- //
48
-
49
- val wm = this.getSystemService(Context.WINDOW_SERVICE) as WindowManager
50
-
51
- val display = wm.defaultDisplay
52
-
53
- val sizeF = Point()
54
-
55
- display.getSize(sizeF)
56
-
57
- val x1 = sizeF.x
58
-
59
- val y1 = sizeF.y
60
-
61
- //
62
-
63
-
64
-
65
- val metrics = DisplayMetrics().also { viewFinder.display.getRealMetrics(it) }
66
-
67
- val screenSize = Size(metrics.widthPixels, metrics.heightPixels)
68
-
69
- val ww = metrics.widthPixels
70
-
71
- val hh = metrics.heightPixels
72
-
73
-
74
-
75
- val w2 = x1*100/w1
76
-
77
- val h2 = y1*100/h1
78
-
79
- val screenAspectRatio = Rational(w2, h2)
80
-
81
- //when (check) {
82
-
83
- // true ->{ screenAspectRatio = Rational(w2, h2)}
84
-
85
- // false ->{ screenAspectRatio = Rational(h2, w2)}
86
-
87
- //}
88
-
89
- // Create configuration object for the viewfinder use case
90
-
91
- val previewConfig = PreviewConfig.Builder().apply {
92
-
93
- setTargetAspectRatio(screenAspectRatio)
94
-
95
- setTargetResolution(screenSize)
96
-
97
- setLensFacing(cameraFace)
98
-
99
- setTargetRotation(viewFinder.display.rotation)
100
-
101
- }.build()
102
-
103
-
104
-
105
- // Build the viewfinder use case
106
-
107
- val preview = Preview(previewConfig)
108
-
109
-
110
-
111
- /*
112
-
113
- val viewFinderConfig = PreviewConfig.Builder().apply {
114
-
115
- //...
116
-
117
- setTargetAspectRatio(screenAspectRatio)
118
-
119
- setTargetResolution(screenSize)
120
-
121
- setLensFacing(cameraFace)
122
-
123
- setTargetRotation(viewFinder.display.rotation)
124
-
125
- }.build()
126
-
127
-
128
-
129
- val preview = AutoFitPreviewBuilder.build(viewFinderConfig, viewFinder)
130
-
131
- */
132
-
133
-
134
-
135
- // Every time the viewfinder is updated, recompute layout
136
-
137
- preview.setOnPreviewOutputUpdateListener {
138
-
139
-
140
-
141
- // To update the SurfaceTexture, we have to remove it and re-add it
142
-
143
- val parent = viewFinder.parent as ViewGroup
144
-
145
- parent.removeView(viewFinder)
146
-
147
- parent.addView(viewFinder, 0)
148
-
149
-
150
-
151
- viewFinder.surfaceTexture = it.surfaceTexture
152
-
153
- updateTransform()
154
-
155
- }
156
-
157
-
158
-
159
- // Create configuration object for the image capture use case
160
-
161
-
162
-
163
- val imageCaptureConfig = ImageCaptureConfig.Builder()
164
-
165
- .apply {
166
-
167
- //setTargetAspectRatio(Rational(1,1))
168
-
169
- setTargetResolution(savedSize)
170
-
171
- setLensFacing(cameraFace)
172
-
173
-
174
-
175
- // We don't set a resolution for image capture; instead, we
176
-
177
- // select a capture mode which will infer the appropriate
178
-
179
- // resolution based on aspect ration and requested mode
180
-
181
- setCaptureMode(ImageCapture.CaptureMode.MIN_LATENCY)
182
-
183
- setFlashMode(FlashMode.AUTO)
184
-
185
- setTargetRotation(windowManager.defaultDisplay.rotation)
186
-
187
- }.build()
188
-
189
-
190
-
191
-
192
-
193
- // Build the image capture use case and attach button click listener
194
-
195
- val imageCapture = ImageCapture(imageCaptureConfig)
196
-
197
-
198
-
199
- val relativeLocation = externalMediaDirs.first()
200
-
201
- //val relativeLocation = getExternalFilesDir(Environment.DIRECTORY_DCIM)
202
-
203
-
204
-
205
- findViewById<ImageButton>(R.id.capture_button).setOnClickListener {
206
-
207
-
208
-
209
- val dateFormat = SimpleDateFormat("ddMMyyyy_kkmmss")
210
-
211
- val currentTime_1 = Date()
212
-
213
- val dateString = dateFormat.format(currentTime_1)
214
-
215
-
216
-
217
- //val file = File(relativeLocation, "CX_${System.currentTimeMillis()}.jpg")
218
-
219
- val fileNameIs = "CX_${dateString}.jpg"
220
-
221
- val file = File(relativeLocation, fileNameIs)
222
-
223
-
224
-
225
- imageCapture.takePicture(file,
226
-
227
- object : ImageCapture.OnImageSavedListener {
228
-
229
- override fun onError(error: ImageCapture.UseCaseError,
230
-
231
- message: String, exc: Throwable?) {
232
-
233
- val msg = "Photo capture failed: $message"
234
-
235
- Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
1
+ ああああああああああああああああああああああああああああああああああああああああああああああああああああああああああああ
236
-
237
- Log.e("CameraXApp", msg)
238
-
239
- exc?.printStackTrace()
240
-
241
- }
242
-
243
-
244
-
245
- override fun onImageSaved(file: File) {
246
-
247
- //val msg = "Photo capture succeeded: ${file.absolutePath}"
248
-
249
-
250
-
251
- val msg = "Photo capture & saved succeeded..."+"\n" +"fileNameIs: " + fileNameIs
252
-
253
- Toast.makeText(baseContext, msg, Toast.LENGTH_SHORT).show()
254
-
255
-
256
-
257
- Log.d("CameraXApp", msg)
258
-
259
-
260
-
261
- run{ mDx.play(SHUTTER_CLICK)}
262
-
263
-
264
-
265
- sleep (100)
266
-
267
-
268
-
269
- }
270
-
271
- })
272
-
273
- }
274
-
275
-
276
-
277
- // Setup image analysis pipeline that computes average pixel luminance
278
-
279
- val analyzerConfig = ImageAnalysisConfig.Builder().apply {
280
-
281
- // Use a worker thread for image analysis to prevent glitches
282
-
283
- val analyzerThread = HandlerThread(
284
-
285
- "LuminosityAnalysis").apply { start() }
286
-
287
- setCallbackHandler(Handler(analyzerThread.looper))
288
-
289
- // In our analysis, we care more about the latest image than
290
-
291
- // analyzing *every* image
292
-
293
- setImageReaderMode(
294
-
295
- ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE)
296
-
297
- }.build()
298
-
299
-
300
-
301
- // Build the image analysis use case and instantiate our analyzer
302
-
303
- val analyzerUseCase = ImageAnalysis(analyzerConfig).apply {
304
-
305
- analyzer = LuminosityAnalyzer()
306
-
307
- }
308
-
309
-
310
-
311
- // Bind use cases to lifecycle
312
-
313
- // If Android Studio complains about "this" being not a LifecycleOwner
314
-
315
- // try rebuilding the project or updating the appcompat dependency to
316
-
317
- // version 1.1.0 or higher.
318
-
319
-
320
-
321
- //CameraX.bindToLifecycle( this, preview, imageCapture, analyzerUseCase)
322
-
323
- CameraX.bindToLifecycle( this, preview, imageCapture)
324
-
325
-
326
-
327
- }
328
-
329
- ```
330
-
331
-
332
-
333
- #エラー
334
-
335
-
336
-
337
- ```ここに言語を入力
338
-
339
- Type mismatch: inferred type is Rational but AspectRatio was expected
340
-
341
- ```
342
-
343
-
344
-
345
- 型の不一致:推定される型はRationalですが、AspectRatioが予期されていました。とエラーですが型の不一致を解消する為にはどのように実装すればいいのでしょうか?val screenAspectRatio = Rational(w2, h2)が格納されていました。
346
-
347
- val w2 = x1*100/w1
348
-
349
- val h2 = y1*100/h1
350
-
351
-
352
-
353
- #しらべたこと
354
-
355
- https://teratail.com/questions/181358
356
-
357
-
358
-
359
- お手数おかけしますがよろしくお願いします。

1

2019/12/05 01:21

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -344,6 +344,10 @@
344
344
 
345
345
  型の不一致:推定される型はRationalですが、AspectRatioが予期されていました。とエラーですが型の不一致を解消する為にはどのように実装すればいいのでしょうか?val screenAspectRatio = Rational(w2, h2)が格納されていました。
346
346
 
347
+ val w2 = x1*100/w1
348
+
349
+ val h2 = y1*100/h1
350
+
347
351
 
348
352
 
349
353
  #しらべたこと