This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | |
<title>Sticky Notes board</title> | |
<meta name="description" content="Sticky Notes by Edmond Ko"> | |
<meta name="author" content="Edmond Ko"> | |
<link href='https://fonts.googleapis.com/css?family=Gloria+Hallelujah' rel='stylesheet' type='text/css'> | |
</head> | |
<body> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android{ | |
compileOptions { | |
sourceCompatibility JavaVersion.VERSION_1_8 | |
targetCompatibility JavaVersion.VERSION_1_8 | |
} | |
} | |
dependencies { | |
// Add CameraX dependencies | |
implementation "androidx.camera:camera-core:1.0.0-beta05" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<SurfaceView | |
android:id="@+id/overlay" | |
android:layout_width="0dp" | |
android:layout_height="0dp" | |
app:layout_constraintBottom_toBottomOf="parent" | |
app:layout_constraintEnd_toEndOf="parent" | |
app:layout_constraintStart_toStartOf="parent" | |
app:layout_constraintTop_toTopOf="parent" /> | |
<androidx.camera.view.PreviewView |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PreviewView mCameraView; | |
SurfaceHolder holder; | |
SurfaceView surfaceView; | |
Canvas canvas; | |
Paint paint; | |
int cameraHeight, cameraWidth, xOffset, yOffset, boxWidth, boxHeight; | |
private ListenableFuture<ProcessCameraProvider> cameraProviderFuture; | |
private ExecutorService executor = Executors.newSingleThreadExecutor(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
//Image Analysis Function | |
//Set static size according to your device or write a dynamic function for it | |
ImageAnalysis imageAnalysis = | |
new ImageAnalysis.Builder() | |
.setTargetResolution(new Size(720, 1488)) | |
.setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST) | |
.build(); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int degreesToFirebaseRotation(int degrees) { | |
switch (degrees) { | |
case 0: | |
return FirebaseVisionImageMetadata.ROTATION_0; | |
case 90: | |
return FirebaseVisionImageMetadata.ROTATION_90; | |
case 180: | |
return FirebaseVisionImageMetadata.ROTATION_180; | |
case 270: | |
return FirebaseVisionImageMetadata.ROTATION_270; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MainActivity extends AppCompatActivity implements SurfaceHolder.Callback { | |
TextView textView; | |
PreviewView mCameraView; | |
SurfaceHolder holder; | |
SurfaceView surfaceView; | |
Canvas canvas; | |
Paint paint; | |
int cameraHeight, cameraWidth, xOffset, yOffset, boxWidth, boxHeight; | |
private ListenableFuture<ProcessCameraProvider> cameraProviderFuture; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dependencies { | |
// ... implementation 'com.google.firebase:firebase-ml-vision:24.0.3' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<application ...> | |
... | |
<meta-data | |
android:name="com.google.firebase.ml.vision.DEPENDENCIES" | |
android:value="ocr" /> | |
</application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<uses-permission android:name="android.permission.CAMERA"/> |
OlderNewer