Skip to content

Commit

Permalink
Fix ImageInsufficientQualityException crash by updating target image (
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis authored Nov 12, 2023
1 parent 22d9c14 commit 35e0fa3
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
Binary file added app/src/main/assets/augmented_image_target.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed app/src/main/assets/augmented_image_target.png
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/java/fr/smarquis/ar_toolbox/Nodes.kt
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ class Augmented(
private val references: MutableMap<AugmentedImage, Nodes> = mutableMapOf()

fun target(context: Context) = try {
context.applicationContext.assets.open("augmented_image_target.png")
context.applicationContext.assets.open("augmented_image_target.jpg")
} catch (e: Exception) {
null
}?.let { BitmapFactory.decodeStream(it) }
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/java/fr/smarquis/ar_toolbox/SceneActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ class SceneActivity : ArActivity<ActivitySceneBinding>(ActivitySceneBinding::inf
updateMode = UpdateMode.LATEST_CAMERA_IMAGE
cloudAnchorMode = CloudAnchorMode.ENABLED
augmentedImageDatabase = AugmentedImageDatabase(session).apply {
Augmented.target(this@SceneActivity)?.let { addImage("augmented", it) }
Augmented.target(this@SceneActivity)
?.runCatching { addImage("augmented", this) }
?.onFailure(Throwable::printStackTrace) // Might throw ImageInsufficientQualityException
}
augmentedFaceMode = AugmentedFaceMode.DISABLED
focusMode = FocusMode.AUTO
Expand Down

0 comments on commit 35e0fa3

Please sign in to comment.