-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
안드로이드 간단한 예제 추가 #5
base: master
Are you sure you want to change the base?
Changes from all commits
1c10b54
8681eb0
6f7c58e
93c370f
e316bc2
5033036
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ | |
/captures | ||
.externalNativeBuild | ||
.cxx | ||
.idea |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Juhyun Song <[email protected]> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
anger | ||
disgust/contempt | ||
afraid | ||
happiness | ||
sadness | ||
surprise | ||
neutral |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,31 @@ | ||
package com.mercy.tl_droid | ||
|
||
import androidx.appcompat.app.AppCompatActivity | ||
import android.graphics.drawable.BitmapDrawable | ||
import android.os.Bundle | ||
import androidx.appcompat.app.AppCompatActivity | ||
import com.mercy.classification.Classifier | ||
import kotlinx.android.synthetic.main.activity_main.* | ||
|
||
class MainActivity : AppCompatActivity() { | ||
|
||
private var mClassifier: Classifier? = null | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_main) | ||
|
||
mClassifier = Classifier.create(this, Classifier.Device.CPU, 1) | ||
|
||
val drawable = resources.getDrawable(R.drawable.lenna, null) | ||
val bitmap = (drawable as BitmapDrawable).bitmap | ||
|
||
val results = mClassifier?.recognizeImage(bitmap) | ||
tv_result.text = results.toString() | ||
} | ||
|
||
override fun onStop() { | ||
super.onStop() | ||
|
||
mClassifier?.close() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onCreate 메소드에서 초기화되는 property이므로
lateinit var
로 선언해도 괜찮을 것 같은데 어떻게 생각하시나요?