@@ -34,13 +34,13 @@ class PortraitModePlugin : PhotoModePlugin() {
3434 get() = " portrait"
3535
3636 private var imageSegmenter: ImageSegmenter ? = null
37- private lateinit var viewModel: StoneCameraViewModel
3837
3938 init {
4039 setupImageSegmenter()
4140 }
4241
4342 override fun initialize (viewModel : StoneCameraViewModel ) {
43+ super .initialize(viewModel)
4444 setupImageSegmenter()
4545 }
4646
@@ -50,7 +50,7 @@ class PortraitModePlugin : PhotoModePlugin() {
5050 ) {
5151
5252 // TODO: This kind of check should probably be built into the plugin interface, something reusable
53- if (viewModel.selectedMode = = modeLabel) {
53+ if (viewModel.selectedMode ! = modeLabel) {
5454 return
5555 }
5656
@@ -269,7 +269,9 @@ class PortraitModePlugin : PhotoModePlugin() {
269269
270270 private fun setupImageSegmenter () {
271271 val baseOptionsBuilder = BaseOptions .builder()
272- baseOptionsBuilder.setDelegate(Delegate .GPU )
272+ // TODO fix error when using gpu mode
273+ // Error occurs when getting MediaPipe task result. com.google.mediapipe.framework.MediaPipeException: invalid argument: Expected buffer size 31961088 got: 7990272, width 3264, height 2448, channels 1
274+ baseOptionsBuilder.setDelegate(Delegate .CPU )
273275 baseOptionsBuilder.setModelAssetPath(" selfie_segmenter.tflite" )
274276
275277 try {
@@ -278,7 +280,7 @@ class PortraitModePlugin : PhotoModePlugin() {
278280 .setRunningMode(RunningMode .IMAGE )
279281 .setBaseOptions(baseOptions)
280282 .setOutputCategoryMask(true )
281- .setOutputConfidenceMasks(true )
283+ .setOutputConfidenceMasks(false )
282284
283285 val options = optionsBuilder.build()
284286 imageSegmenter = ImageSegmenter .createFromOptions(MyApplication .getAppContext(), options)
0 commit comments