├── .gitattributes ├── .gitignore ├── .idea ├── .name ├── codeStyles │ ├── Project.xml │ └── codeStyleConfig.xml ├── compiler.xml ├── copyright │ ├── Dev_Sebastian.xml │ └── profiles_settings.xml ├── jarRepositories.xml ├── misc.xml ├── modules.xml └── vcs.xml ├── LICENSE.txt ├── README.md ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── wonderscan │ │ └── android │ │ └── ExampleInstrumentedTest.java │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── wonderscan │ │ │ └── android │ │ │ ├── WonderScanApp.kt │ │ │ ├── activity │ │ │ ├── BaseActivity.kt │ │ │ ├── CropActivity.kt │ │ │ ├── CropAndListFramesActivity.kt │ │ │ ├── EditActivity.kt │ │ │ ├── ListFramesActivity.kt │ │ │ ├── MainActivity.kt │ │ │ ├── ScanActivity.kt │ │ │ ├── SearchActivity.kt │ │ │ └── ViewPageActivity.kt │ │ │ ├── adapter │ │ │ ├── DocumentsAdapter.kt │ │ │ ├── GalleryAdapter.kt │ │ │ ├── ProgressFramesAdapter.kt │ │ │ └── ViewFrameAdapter.kt │ │ │ ├── dao │ │ │ ├── DocumentDao.kt │ │ │ └── FrameDao.kt │ │ │ ├── data │ │ │ ├── BoundingRect.kt │ │ │ ├── Document.kt │ │ │ └── Frame.kt │ │ │ ├── fragment │ │ │ ├── GalleryFragment.kt │ │ │ ├── MainFragment.kt │ │ │ └── SettingsFragment.kt │ │ │ ├── utils │ │ │ ├── BrightnessAndContrastController.kt │ │ │ ├── Database.kt │ │ │ ├── DetectBox.kt │ │ │ ├── ExportPdf.kt │ │ │ ├── Filter.kt │ │ │ ├── Utils.kt │ │ │ └── YuvToRgbConverter.kt │ │ │ ├── view │ │ │ ├── CropView.kt │ │ │ ├── CustomViewPager.kt │ │ │ ├── ScanView.kt │ │ │ └── SquareFrameLayout.kt │ │ │ └── viewmodel │ │ │ ├── CropActivityViewModel.kt │ │ │ ├── CropAndListFramesActivityViewModel.kt │ │ │ ├── EditActivityViewModel.kt │ │ │ ├── ListFrameActivityViewModel.kt │ │ │ ├── MainActivityViewModel.kt │ │ │ ├── MainViewModel.kt │ │ │ ├── ScanActivityViewModel.kt │ │ │ ├── SearchActivityViewModel.kt │ │ │ └── ViewPageActivityViewModel.kt │ └── res │ │ ├── color │ │ ├── bottom_navigation_icon.xml │ │ └── bottom_navigation_text.xml │ │ ├── drawable-hdpi │ │ └── ic_launcher.png │ │ ├── drawable-mdpi │ │ └── ic_launcher.png │ │ ├── drawable-xhdpi │ │ └── ic_launcher.png │ │ ├── drawable-xxhdpi │ │ └── ic_launcher.png │ │ ├── drawable-xxxhdpi │ │ └── ic_launcher.png │ │ ├── drawable │ │ ├── background_bottom_bar.xml │ │ ├── background_dialog.xml │ │ ├── background_progress.xml │ │ ├── background_toolbar.xml │ │ ├── ic_camera_button.xml │ │ ├── ic_check.xml │ │ ├── ic_close.xml │ │ ├── ic_close_circle.xml │ │ ├── ic_code.xml │ │ ├── ic_crop.xml │ │ ├── ic_crop_free.xml │ │ ├── ic_developer.xml │ │ ├── ic_doc.xml │ │ ├── ic_download.xml │ │ ├── ic_edit.xml │ │ ├── ic_feedback.xml │ │ ├── ic_frames.xml │ │ ├── ic_gallery.xml │ │ ├── ic_gear.xml │ │ ├── ic_home.xml │ │ ├── ic_image_bubble.xml │ │ ├── ic_info.xml │ │ ├── ic_modify.xml │ │ ├── ic_note.xml │ │ ├── ic_ocr.xml │ │ ├── ic_rotate_left.xml │ │ ├── ic_rotate_right.xml │ │ ├── ic_search.xml │ │ ├── ic_share.xml │ │ ├── ic_thumbs_up.xml │ │ └── rounded_button_enabled.xml │ │ ├── font │ │ └── source_sans_pro_bold.xml │ │ ├── layout │ │ ├── activity_crop.xml │ │ ├── activity_edit.xml │ │ ├── activity_list_frames.xml │ │ ├── activity_main.xml │ │ ├── activity_scan.xml │ │ ├── activity_search.xml │ │ ├── activity_view_frames.xml │ │ ├── dialog_note.xml │ │ ├── fragment_gallery.xml │ │ ├── fragment_main.xml │ │ ├── layout_toolbar.xml │ │ ├── row_document.xml │ │ ├── row_documents_footer.xml │ │ ├── row_frame.xml │ │ ├── row_image.xml │ │ └── row_page.xml │ │ ├── menu │ │ ├── menu_bottom_navigation_edit_scan.xml │ │ ├── menu_bottom_navigation_main.xml │ │ ├── menu_bottom_navigation_view_frame.xml │ │ ├── menu_bottom_navigation_view_scan.xml │ │ ├── menu_bottom_navigation_view_scan_modify.xml │ │ ├── menu_fragment_gallery.xml │ │ ├── menu_fragment_main.xml │ │ ├── menu_list_frames.xml │ │ └── menu_view_frames.xml │ │ ├── values │ │ ├── attrs.xml │ │ ├── colors.xml │ │ ├── dimens.xml │ │ ├── font_certs.xml │ │ ├── preloaded_fonts.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ ├── file_paths.xml │ │ └── preferences.xml │ └── test │ └── java │ └── com │ └── wonderscan │ └── android │ └── ExampleUnitTest.java ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── import-summary.txt ├── openCVLibrary344 ├── build.gradle ├── lint.xml └── src │ └── main │ ├── AndroidManifest.xml │ ├── aidl │ └── org │ │ └── opencv │ │ └── engine │ │ └── OpenCVEngineInterface.aidl │ ├── java │ └── org │ │ └── opencv │ │ ├── android │ │ ├── AsyncServiceHelper.java │ │ ├── BaseLoaderCallback.java │ │ ├── Camera2Renderer.java │ │ ├── CameraBridgeViewBase.java │ │ ├── CameraGLRendererBase.java │ │ ├── CameraGLSurfaceView.java │ │ ├── CameraRenderer.java │ │ ├── FpsMeter.java │ │ ├── InstallCallbackInterface.java │ │ ├── JavaCamera2View.java │ │ ├── JavaCameraView.java │ │ ├── LoaderCallbackInterface.java │ │ ├── OpenCVLoader.java │ │ ├── StaticHelper.java │ │ └── Utils.java │ │ ├── calib3d │ │ ├── Calib3d.java │ │ ├── StereoBM.java │ │ ├── StereoMatcher.java │ │ └── StereoSGBM.java │ │ ├── core │ │ ├── Algorithm.java │ │ ├── Core.java │ │ ├── CvException.java │ │ ├── CvType.java │ │ ├── DMatch.java │ │ ├── KeyPoint.java │ │ ├── Mat.java │ │ ├── MatOfByte.java │ │ ├── MatOfDMatch.java │ │ ├── MatOfDouble.java │ │ ├── MatOfFloat.java │ │ ├── MatOfFloat4.java │ │ ├── MatOfFloat6.java │ │ ├── MatOfInt.java │ │ ├── MatOfInt4.java │ │ ├── MatOfKeyPoint.java │ │ ├── MatOfPoint.java │ │ ├── MatOfPoint2f.java │ │ ├── MatOfPoint3.java │ │ ├── MatOfPoint3f.java │ │ ├── MatOfRect.java │ │ ├── MatOfRect2d.java │ │ ├── MatOfRotatedRect.java │ │ ├── Point.java │ │ ├── Point3.java │ │ ├── Range.java │ │ ├── Rect.java │ │ ├── Rect2d.java │ │ ├── RotatedRect.java │ │ ├── Scalar.java │ │ ├── Size.java │ │ ├── TermCriteria.java │ │ └── TickMeter.java │ │ ├── dnn │ │ ├── DictValue.java │ │ ├── Dnn.java │ │ ├── Layer.java │ │ └── Net.java │ │ ├── features2d │ │ ├── AKAZE.java │ │ ├── AgastFeatureDetector.java │ │ ├── BFMatcher.java │ │ ├── BOWImgDescriptorExtractor.java │ │ ├── BOWKMeansTrainer.java │ │ ├── BOWTrainer.java │ │ ├── BRISK.java │ │ ├── DescriptorExtractor.java │ │ ├── DescriptorMatcher.java │ │ ├── FastFeatureDetector.java │ │ ├── Feature2D.java │ │ ├── FeatureDetector.java │ │ ├── Features2d.java │ │ ├── FlannBasedMatcher.java │ │ ├── GFTTDetector.java │ │ ├── KAZE.java │ │ ├── MSER.java │ │ ├── ORB.java │ │ └── Params.java │ │ ├── imgcodecs │ │ └── Imgcodecs.java │ │ ├── imgproc │ │ ├── CLAHE.java │ │ ├── Imgproc.java │ │ ├── LineSegmentDetector.java │ │ ├── Moments.java │ │ └── Subdiv2D.java │ │ ├── ml │ │ ├── ANN_MLP.java │ │ ├── ANN_MLP_ANNEAL.java │ │ ├── Boost.java │ │ ├── DTrees.java │ │ ├── EM.java │ │ ├── KNearest.java │ │ ├── LogisticRegression.java │ │ ├── Ml.java │ │ ├── NormalBayesClassifier.java │ │ ├── ParamGrid.java │ │ ├── RTrees.java │ │ ├── SVM.java │ │ ├── SVMSGD.java │ │ ├── StatModel.java │ │ └── TrainData.java │ │ ├── objdetect │ │ ├── BaseCascadeClassifier.java │ │ ├── CascadeClassifier.java │ │ ├── HOGDescriptor.java │ │ ├── Objdetect.java │ │ └── QRCodeDetector.java │ │ ├── osgi │ │ ├── OpenCVInterface.java │ │ └── OpenCVNativeLoader.java │ │ ├── photo │ │ ├── AlignExposures.java │ │ ├── AlignMTB.java │ │ ├── CalibrateCRF.java │ │ ├── CalibrateDebevec.java │ │ ├── CalibrateRobertson.java │ │ ├── MergeDebevec.java │ │ ├── MergeExposures.java │ │ ├── MergeMertens.java │ │ ├── MergeRobertson.java │ │ ├── Photo.java │ │ ├── Tonemap.java │ │ ├── TonemapDrago.java │ │ ├── TonemapDurand.java │ │ ├── TonemapMantiuk.java │ │ └── TonemapReinhard.java │ │ ├── utils │ │ └── Converters.java │ │ ├── video │ │ ├── BackgroundSubtractor.java │ │ ├── BackgroundSubtractorKNN.java │ │ ├── BackgroundSubtractorMOG2.java │ │ ├── DenseOpticalFlow.java │ │ ├── DualTVL1OpticalFlow.java │ │ ├── FarnebackOpticalFlow.java │ │ ├── KalmanFilter.java │ │ ├── SparseOpticalFlow.java │ │ ├── SparsePyrLKOpticalFlow.java │ │ └── Video.java │ │ └── videoio │ │ ├── VideoCapture.java │ │ ├── VideoWriter.java │ │ └── Videoio.java │ └── res │ └── values │ └── attrs.xml └── settings.gradle /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | *.aab 5 | 6 | # Files for the ART/Dalvik VM 7 | *.dex 8 | 9 | # Java class files 10 | *.class 11 | 12 | # Generated files 13 | bin/ 14 | gen/ 15 | out/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | 36 | # IntelliJ 37 | *.iml 38 | .idea/workspace.xml 39 | .idea/tasks.xml 40 | .idea/gradle.xml 41 | .idea/assetWizardSettings.xml 42 | .idea/dictionaries 43 | .idea/libraries 44 | .idea/caches 45 | 46 | # Keystore files 47 | *.jks 48 | *.keystore 49 | 50 | # External native build folder generated in Android Studio 2.2 and later 51 | .externalNativeBuild 52 | 53 | # Google Services (e.g. APIs or Firebase) 54 | google-services.json 55 | 56 | # Freeline 57 | freeline.py 58 | freeline/ 59 | freeline_project_description.json 60 | 61 | # fastlane 62 | fastlane/report.xml 63 | fastlane/Preview.html 64 | fastlane/screenshots 65 | fastlane/test_output 66 | fastlane/readme.md 67 | 68 | #OpenCV 69 | jniLibs/ 70 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | WonderScan -------------------------------------------------------------------------------- /.idea/codeStyles/codeStyleConfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/Dev_Sebastian.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 25 | 26 | 27 | 28 | 29 | 30 | 32 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/wonderscan/android/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android; 20 | 21 | import android.content.Context; 22 | 23 | import androidx.test.platform.app.InstrumentationRegistry; 24 | import androidx.test.ext.junit.runners.AndroidJUnit4; 25 | 26 | import org.junit.Test; 27 | import org.junit.runner.RunWith; 28 | 29 | import static org.junit.Assert.*; 30 | 31 | /** 32 | * Instrumented test, which will execute on an Android device. 33 | * 34 | * @see Testing documentation 35 | */ 36 | @RunWith(AndroidJUnit4.class) 37 | public class ExampleInstrumentedTest { 38 | @Test 39 | public void useAppContext() { 40 | // Context of the app under test. 41 | Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); 42 | assertEquals("com.devsebastian.test", appContext.getPackageName()); 43 | } 44 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/WonderScanApp.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android 20 | 21 | import android.app.Application 22 | import com.wonderscan.android.utils.MyDatabase 23 | 24 | class WonderScanApp : Application() { 25 | val database by lazy { MyDatabase.geDatabase(this) } 26 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/activity/BaseActivity.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.activity 19 | 20 | import androidx.appcompat.app.AppCompatActivity 21 | 22 | open class BaseActivity : AppCompatActivity() { 23 | // properties that are shared between all activities can be added here later 24 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/adapter/ViewFrameAdapter.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.adapter 19 | 20 | import android.annotation.SuppressLint 21 | import android.app.Activity 22 | import android.view.View 23 | import android.view.ViewGroup 24 | import android.widget.ImageView 25 | import androidx.viewpager.widget.PagerAdapter 26 | import com.bumptech.glide.Glide 27 | import com.bumptech.glide.load.engine.DiskCacheStrategy 28 | import com.wonderscan.android.R 29 | import com.wonderscan.android.data.Frame 30 | import com.jsibbold.zoomage.ZoomageView 31 | 32 | class ViewFrameAdapter(private val activity: Activity, private var frames: MutableList) : 33 | PagerAdapter() { 34 | 35 | override fun getCount(): Int { 36 | return frames.size 37 | } 38 | 39 | fun get(index: Int): Frame { 40 | return frames[index] 41 | } 42 | 43 | override fun isViewFromObject(view: View, `object`: Any): Boolean { 44 | return view === `object` 45 | } 46 | 47 | fun setFrames(frames: MutableList) { 48 | this.frames = frames 49 | } 50 | 51 | private fun loadImage(uri: String?, imageView: ImageView) { 52 | Glide.with(activity).load(uri).diskCacheStrategy(DiskCacheStrategy.NONE) 53 | .skipMemoryCache(true).into(imageView) 54 | } 55 | 56 | override fun instantiateItem(container: ViewGroup, position: Int): Any { 57 | val frame = frames[position] 58 | 59 | @SuppressLint("InflateParams") 60 | val v = activity.layoutInflater.inflate(R.layout.row_page, null) 61 | val imageView: ZoomageView = v.findViewById(R.id.ssiv_page) 62 | when { 63 | frame.editedUri != null -> loadImage(frame.editedUri, imageView) 64 | frame.croppedUri != null -> loadImage(frame.croppedUri, imageView) 65 | else -> loadImage(frame.uri, imageView) 66 | } 67 | container.addView(v) 68 | return v 69 | } 70 | 71 | override fun destroyItem(container: ViewGroup, position: Int, `object`: Any) { 72 | container.removeView(`object` as View) 73 | } 74 | 75 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/dao/DocumentDao.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.dao 20 | 21 | import androidx.lifecycle.LiveData 22 | import androidx.room.* 23 | import com.wonderscan.android.data.Document 24 | 25 | @Dao 26 | interface DocumentDao { 27 | @Insert(onConflict = OnConflictStrategy.REPLACE) 28 | fun insert(document: Document) 29 | 30 | @Update 31 | fun update(document: Document) 32 | 33 | @Delete 34 | fun delete(document: Document) 35 | 36 | @Query("DELETE FROM Document where id=:docId") 37 | fun delete(docId: String) 38 | 39 | @Query("SELECT * FROM Document WHERE id=:docId") 40 | fun getDocument(docId: String): LiveData 41 | 42 | @Query("SELECT * FROM Document WHERE id=:docId") 43 | suspend fun getDocumentSync(docId: String): Document 44 | 45 | @Query("SELECT name FROM Document WHERE id=:docId") 46 | suspend fun getDocumentName(docId: String): String 47 | 48 | @Query("SELECT * FROM Document ORDER BY dateTime DESC") 49 | fun getAllDocuments(): LiveData> 50 | 51 | @Query("SELECT * FROM Document WHERE name LIKE :query ORDER BY dateTime DESC") 52 | suspend fun search(query: String): MutableList 53 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/dao/FrameDao.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.dao 20 | 21 | import androidx.lifecycle.LiveData 22 | import androidx.room.* 23 | import com.wonderscan.android.data.Frame 24 | 25 | @Dao 26 | interface FrameDao { 27 | @Insert(onConflict = OnConflictStrategy.REPLACE) 28 | fun insert(frame: Frame): Long 29 | 30 | @Update 31 | fun update(frame: Frame) 32 | 33 | @Delete 34 | fun delete(frame: Frame) 35 | 36 | @Query("SELECT * FROM Frame WHERE docId=:docId ORDER BY `index`") 37 | fun getFrames(docId: String): LiveData> 38 | 39 | @Query("SELECT * FROM Frame WHERE id=:id") 40 | fun getFrame(id: Long): LiveData 41 | 42 | @Query("SELECT * FROM Frame WHERE docId=:docId ORDER BY `index`") 43 | suspend fun getFramesSync(docId: String): MutableList 44 | 45 | @Query("SELECT COUNT(id) FROM Frame WHERE docId=:docId") 46 | fun getFrameCount(docId: String): LiveData 47 | 48 | @Query("SELECT uri FROM Frame WHERE docId=:docId AND `index`=0") 49 | fun getFrameUri(docId: String): LiveData 50 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/data/Document.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.data 19 | 20 | import androidx.room.Entity 21 | import androidx.room.PrimaryKey 22 | import java.util.* 23 | 24 | @Entity 25 | class Document { 26 | @PrimaryKey 27 | var id: String = UUID.randomUUID().toString() 28 | var name: String? = null 29 | var dateTime: Long = 0 30 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/data/Frame.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.data 19 | 20 | import androidx.room.ColumnInfo 21 | import androidx.room.Entity 22 | import androidx.room.ForeignKey 23 | import androidx.room.ForeignKey.CASCADE 24 | import androidx.room.PrimaryKey 25 | import java.io.Serializable 26 | 27 | @Entity( 28 | foreignKeys = [ForeignKey( 29 | entity = Document::class, 30 | childColumns = ["docId"], 31 | parentColumns = ["id"], 32 | onDelete = CASCADE 33 | )] 34 | ) 35 | class Frame( 36 | @PrimaryKey(autoGenerate = true) 37 | var id: Long = 0, 38 | @ColumnInfo(index = true) 39 | var docId: String, 40 | var index: Int, 41 | var timeInMillis: Long, 42 | var angle: Int, 43 | var name: String? = null, 44 | var note: String? = null, 45 | var ocr: String? = null, 46 | var uri: String, 47 | var editedUri: String? = null, 48 | var croppedUri: String? = null 49 | ) : Serializable -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/fragment/MainFragment.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.fragment 19 | 20 | import android.content.Intent 21 | import android.os.Bundle 22 | import android.view.LayoutInflater 23 | import android.view.View 24 | import android.view.ViewGroup 25 | import androidx.fragment.app.Fragment 26 | import androidx.lifecycle.ViewModelProvider 27 | import androidx.recyclerview.widget.LinearLayoutManager 28 | import androidx.recyclerview.widget.RecyclerView 29 | import com.wonderscan.android.WonderScanApp 30 | import com.wonderscan.android.R 31 | import com.wonderscan.android.activity.ScanActivity 32 | import com.wonderscan.android.adapter.DocumentsAdapter 33 | import com.wonderscan.android.viewmodel.MainActivityViewModel 34 | import com.wonderscan.android.viewmodel.MainActivityViewModelFactory 35 | 36 | open class MainFragment : Fragment() { 37 | private lateinit var documentsAdapter: DocumentsAdapter 38 | private lateinit var viewModel: MainActivityViewModel 39 | 40 | private fun initialiseViewModel() { 41 | activity?.let { activity -> 42 | (activity.application as WonderScanApp).database?.let { db -> 43 | viewModel = ViewModelProvider( 44 | activity, 45 | MainActivityViewModelFactory(db.documentDao(), db.frameDao()) 46 | ).get(MainActivityViewModel::class.java) 47 | } 48 | } 49 | } 50 | 51 | override fun onCreateView( 52 | inflater: LayoutInflater, 53 | container: ViewGroup?, 54 | savedInstanceState: Bundle? 55 | ): View? { 56 | val v = inflater.inflate(R.layout.fragment_main, container, false) 57 | val fab = v.findViewById(R.id.fab) 58 | fab.setOnClickListener { 59 | startActivity(Intent(requireActivity(), ScanActivity::class.java)) 60 | } 61 | 62 | initialiseViewModel() 63 | 64 | documentsAdapter = DocumentsAdapter(requireActivity(), emptyList(), viewModel) 65 | 66 | v.findViewById(R.id.recycler_view).let { 67 | it.setHasFixedSize(true) 68 | it.layoutManager = LinearLayoutManager(context) 69 | it.adapter = documentsAdapter 70 | viewModel.getAllDocuments()?.observe(viewLifecycleOwner) { documents -> 71 | documentsAdapter.updateDocuments(documents) 72 | } 73 | } 74 | return v 75 | } 76 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/utils/BrightnessAndContrastController.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.utils 19 | 20 | import org.opencv.core.Mat 21 | 22 | class BrightnessAndContrastController(var brightness: Double, var contrast: Double) { 23 | var mat: Mat? = null 24 | 25 | fun setBrightness(sourceMat: Mat, value: Double): Mat { 26 | brightness = value 27 | process(sourceMat).let { 28 | mat = it 29 | return it 30 | } 31 | } 32 | 33 | fun setContrast(sourceMat: Mat, value: Double): Mat { 34 | contrast = value 35 | process(sourceMat).let { 36 | mat = it 37 | return it 38 | } 39 | } 40 | 41 | private fun process(sourceMat: Mat): Mat { 42 | val mat = Mat() 43 | sourceMat.copyTo(mat) 44 | mat.convertTo(mat, -1, contrast, brightness) 45 | return mat 46 | } 47 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/utils/Database.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.utils 20 | 21 | import android.content.Context 22 | import androidx.room.Database 23 | import androidx.room.Room 24 | import androidx.room.RoomDatabase 25 | import com.wonderscan.android.dao.DocumentDao 26 | import com.wonderscan.android.dao.FrameDao 27 | import com.wonderscan.android.data.Document 28 | import com.wonderscan.android.data.Frame 29 | 30 | 31 | @Database(entities = [Document::class, Frame::class], version = 5, exportSchema = false) 32 | abstract class MyDatabase : RoomDatabase() { 33 | abstract fun frameDao(): FrameDao 34 | abstract fun documentDao(): DocumentDao 35 | 36 | companion object { 37 | private var INSTANCE: MyDatabase? = null 38 | 39 | fun geDatabase(context: Context): MyDatabase? { 40 | synchronized(Database::class) { 41 | if (INSTANCE == null) { 42 | INSTANCE = Room.databaseBuilder( 43 | context.applicationContext, 44 | MyDatabase::class.java, 45 | "database" 46 | ).fallbackToDestructiveMigration().build() 47 | } 48 | } 49 | return INSTANCE 50 | } 51 | } 52 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/utils/ExportPdf.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.utils 19 | 20 | import android.graphics.Bitmap 21 | import android.graphics.BitmapFactory 22 | import android.graphics.Color 23 | import android.graphics.Paint 24 | import android.graphics.pdf.PdfDocument 25 | import com.wonderscan.android.data.Frame 26 | 27 | class ExportPdf { 28 | 29 | companion object { 30 | 31 | private fun createPage(pdfDocument: PdfDocument, bitmap: Bitmap, width: Int, height: Int) { 32 | val pageInfo = PdfDocument.PageInfo.Builder(width, height, 0).create() 33 | val page = pdfDocument.startPage(pageInfo) 34 | val canvas = page.canvas 35 | val paint = Paint() 36 | paint.color = Color.WHITE 37 | canvas.drawPaint(paint) 38 | canvas.drawBitmap( 39 | bitmap, 40 | (width - bitmap.width) / 2f, 41 | (height - bitmap.height) / 2f, 42 | null 43 | ) 44 | pdfDocument.finishPage(page) 45 | } 46 | 47 | fun exportPdf(frames: List): PdfDocument { 48 | var bitmap: Bitmap? 49 | val pdf = PdfDocument() 50 | var width = 0 51 | var height = 0 52 | for (frame in frames) { 53 | bitmap = BitmapFactory.decodeFile(frame.editedUri) 54 | if (bitmap.width > width) width = bitmap.width 55 | if (bitmap.height > height) height = bitmap.height 56 | createPage(pdf, bitmap, width, height) 57 | } 58 | return pdf 59 | } 60 | } 61 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/view/CustomViewPager.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.view 19 | 20 | import android.view.MotionEvent 21 | import androidx.viewpager.widget.ViewPager 22 | import android.content.* 23 | import android.util.AttributeSet 24 | import android.util.Log 25 | import java.lang.IllegalArgumentException 26 | 27 | class CustomViewPager : ViewPager { 28 | constructor(context: Context) : super(context) 29 | constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) 30 | 31 | override fun onTouchEvent(ev: MotionEvent?): Boolean { 32 | try { 33 | return super.onTouchEvent(ev) 34 | } catch (e: IllegalArgumentException) { 35 | Log.e(TAG, Log.getStackTraceString(e)) 36 | } 37 | return false 38 | } 39 | 40 | override fun onInterceptTouchEvent(ev: MotionEvent?): Boolean { 41 | try { 42 | return super.onInterceptTouchEvent(ev) 43 | } catch (e: IllegalArgumentException) { 44 | Log.e(TAG, Log.getStackTraceString(e)) 45 | } 46 | return false 47 | } 48 | 49 | companion object { 50 | private val TAG = CustomViewPager::class.java.simpleName 51 | } 52 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/view/SquareFrameLayout.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | package com.wonderscan.android.view 19 | 20 | import android.widget.FrameLayout 21 | import android.content.* 22 | import android.util.AttributeSet 23 | 24 | /** 25 | * A RelativeLayout that will always be square -- same width and height, 26 | * where the height is based off the width. 27 | */ 28 | class SquareFrameLayout : FrameLayout { 29 | constructor(context: Context) : super(context) 30 | constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) 31 | constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super( 32 | context, 33 | attrs, 34 | defStyleAttr 35 | ) 36 | 37 | override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) { 38 | super.onMeasure(widthMeasureSpec, widthMeasureSpec) 39 | } 40 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/viewmodel/CropActivityViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.viewmodel 20 | 21 | import androidx.lifecycle.* 22 | import com.wonderscan.android.WonderScanApp 23 | import com.wonderscan.android.dao.FrameDao 24 | import com.wonderscan.android.data.BoundingRect 25 | import com.wonderscan.android.data.Frame 26 | 27 | 28 | class CropActivityViewModel( 29 | application: WonderScanApp, 30 | frameDao: FrameDao, 31 | frameId: Long 32 | ) : AndroidViewModel(application) { 33 | var frame: LiveData = frameDao.getFrame(frameId) 34 | private var boundingRect: MutableLiveData = MutableLiveData() 35 | 36 | // TODO 37 | } 38 | 39 | class CropActivityViewModelFactory( 40 | private val application: WonderScanApp, 41 | private val frameDao: FrameDao, 42 | private val frameId: Long 43 | ) : ViewModelProvider.Factory { 44 | 45 | @Suppress("UNCHECKED_CAST") 46 | override fun create(modelClass: Class): T { 47 | return CropActivityViewModel(application, frameDao, frameId) as T 48 | } 49 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/viewmodel/EditActivityViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.viewmodel 20 | 21 | import androidx.lifecycle.AndroidViewModel 22 | import androidx.lifecycle.LiveData 23 | import androidx.lifecycle.ViewModel 24 | import androidx.lifecycle.ViewModelProvider 25 | import com.wonderscan.android.WonderScanApp 26 | import com.wonderscan.android.dao.FrameDao 27 | import com.wonderscan.android.data.Frame 28 | 29 | class EditActivityViewModel( 30 | application: WonderScanApp, 31 | private val frameDao: FrameDao 32 | ) : AndroidViewModel(application) { 33 | var frame: LiveData? = null 34 | 35 | fun getFrame(frameId: Long): LiveData? { 36 | frame = frameDao.getFrame(frameId) 37 | return frame 38 | } 39 | } 40 | 41 | class EditActivityViewModelFactory( 42 | private val application: WonderScanApp, 43 | private val frameDao: FrameDao 44 | ) : ViewModelProvider.Factory { 45 | override fun create(modelClass: Class): T { 46 | @Suppress("UNCHECKED_CAST") 47 | return EditActivityViewModel(application, frameDao) as T 48 | } 49 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/viewmodel/MainActivityViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.viewmodel 20 | 21 | import androidx.lifecycle.LiveData 22 | import androidx.lifecycle.ViewModel 23 | import androidx.lifecycle.ViewModelProvider 24 | import androidx.lifecycle.viewModelScope 25 | import com.wonderscan.android.dao.DocumentDao 26 | import com.wonderscan.android.dao.FrameDao 27 | import com.wonderscan.android.data.Document 28 | import kotlinx.coroutines.launch 29 | 30 | class MainActivityViewModel( 31 | private val documentDao: DocumentDao?, 32 | frameDao: FrameDao? 33 | ) : MainViewModel(frameDao) { 34 | var docId: Long? = null 35 | private var documents: LiveData>? = null 36 | 37 | fun getAllDocuments(): LiveData>? { 38 | if (documents == null) { 39 | viewModelScope.launch { 40 | documents = documentDao?.getAllDocuments() 41 | } 42 | } 43 | return documents 44 | } 45 | } 46 | 47 | class MainActivityViewModelFactory( 48 | private val documentDao: DocumentDao, 49 | private val frameDao: FrameDao 50 | ) : ViewModelProvider.Factory { 51 | override fun create(modelClass: Class): T { 52 | @Suppress("UNCHECKED_CAST") 53 | return MainActivityViewModel(documentDao, frameDao) as T 54 | } 55 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/viewmodel/MainViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.viewmodel 20 | 21 | import androidx.lifecycle.LiveData 22 | import androidx.lifecycle.MutableLiveData 23 | import androidx.lifecycle.ViewModel 24 | import androidx.lifecycle.viewModelScope 25 | import com.wonderscan.android.dao.FrameDao 26 | import kotlinx.coroutines.launch 27 | 28 | open class MainViewModel( 29 | private val frameDao: FrameDao? 30 | ) : ViewModel() { 31 | 32 | fun getPageCount(docId: String): LiveData { 33 | lateinit var count: LiveData 34 | viewModelScope.launch { 35 | count = frameDao?.getFrameCount(docId) ?: MutableLiveData(0) 36 | } 37 | return count 38 | } 39 | 40 | fun getFirstFrameImagePath(docId: String): LiveData? { 41 | return frameDao?.getFrameUri(docId) 42 | } 43 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/viewmodel/SearchActivityViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.viewmodel 20 | 21 | import androidx.lifecycle.* 22 | import com.wonderscan.android.dao.DocumentDao 23 | import com.wonderscan.android.dao.FrameDao 24 | import com.wonderscan.android.data.Document 25 | import kotlinx.coroutines.Dispatchers 26 | import kotlinx.coroutines.launch 27 | 28 | class SearchActivityViewModel( 29 | private val documentDao: DocumentDao, 30 | frameDao: FrameDao, 31 | ) : MainViewModel(frameDao) { 32 | 33 | var documents: MutableLiveData> = MutableLiveData() 34 | 35 | fun search(query: String) { 36 | viewModelScope.launch(Dispatchers.Main) { 37 | documents.postValue(documentDao.search("%$query%")) 38 | } 39 | } 40 | 41 | } 42 | 43 | class SearchActivityViewModelFactory( 44 | private val documentDao: DocumentDao, 45 | private val frameDao: FrameDao 46 | ) : ViewModelProvider.Factory { 47 | override fun create(modelClass: Class): T { 48 | @Suppress("UNCHECKED_CAST") 49 | return SearchActivityViewModel(documentDao, frameDao) as T 50 | } 51 | } -------------------------------------------------------------------------------- /app/src/main/java/com/wonderscan/android/viewmodel/ViewPageActivityViewModel.kt: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android.viewmodel 20 | 21 | import androidx.lifecycle.LiveData 22 | import androidx.lifecycle.ViewModel 23 | import androidx.lifecycle.ViewModelProvider 24 | import androidx.lifecycle.viewModelScope 25 | import com.wonderscan.android.dao.DocumentDao 26 | import com.wonderscan.android.dao.FrameDao 27 | import com.wonderscan.android.data.Document 28 | import com.wonderscan.android.data.Frame 29 | import kotlinx.coroutines.Dispatchers 30 | import kotlinx.coroutines.launch 31 | 32 | class ViewPageActivityViewModel( 33 | documentDao: DocumentDao, 34 | private val frameDao: FrameDao, 35 | docId: String 36 | ) : ViewModel() { 37 | 38 | val document: LiveData = documentDao.getDocument(docId) 39 | val frames: LiveData> = frameDao.getFrames(docId) 40 | var currentIndex = 0 41 | 42 | fun updateFrame(frame: Frame) { 43 | viewModelScope.launch(Dispatchers.IO) { 44 | frameDao.update(frame) 45 | } 46 | } 47 | 48 | fun deleteFrame(frame: Frame) { 49 | viewModelScope.launch(Dispatchers.IO) { 50 | frameDao.delete(frame) 51 | } 52 | } 53 | } 54 | 55 | class ViewPageActivityViewModelFactory( 56 | private val documentDao: DocumentDao, 57 | private val frameDao: FrameDao, 58 | private val docId: String 59 | ) : ViewModelProvider.Factory { 60 | override fun create(modelClass: Class): T { 61 | @Suppress("UNCHECKED_CAST") 62 | return ViewPageActivityViewModel(documentDao, frameDao, docId) as T 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/res/color/bottom_navigation_icon.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/color/bottom_navigation_text.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsebastian/WonderScan/6baf7d052e61908449807a514a43e61724d76a46/app/src/main/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsebastian/WonderScan/6baf7d052e61908449807a514a43e61724d76a46/app/src/main/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsebastian/WonderScan/6baf7d052e61908449807a514a43e61724d76a46/app/src/main/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsebastian/WonderScan/6baf7d052e61908449807a514a43e61724d76a46/app/src/main/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsebastian/WonderScan/6baf7d052e61908449807a514a43e61724d76a46/app/src/main/res/drawable-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_bottom_bar.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 25 | 26 | 27 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_dialog.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_progress.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/background_toolbar.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 24 | 25 | 26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_camera_button.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 29 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_check.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_close.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_close_circle.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_code.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_crop.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_crop_free.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_developer.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_doc.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_download.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_edit.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_feedback.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_frames.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_gallery.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_gear.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_home.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_image_bubble.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_info.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_modify.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 27 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_note.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 28 | 29 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_ocr.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_rotate_left.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_rotate_right.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 28 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_search.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_share.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/ic_thumbs_up.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 24 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/drawable/rounded_button_enabled.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/font/source_sans_pro_bold.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_list_frames.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 26 | 27 | 28 | 29 | 35 | 36 | 40 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 27 | 28 | 29 | 30 | 35 | 36 | 46 | 47 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_search.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 26 | 27 | 31 | 32 | 43 | 44 | 45 | 46 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_view_frames.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 28 | 29 | 30 | 31 | 36 | 37 | 49 | 50 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 26 | 27 | 33 | 34 | 38 | -------------------------------------------------------------------------------- /app/src/main/res/layout/layout_toolbar.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 29 | 30 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/row_documents_footer.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 34 | 35 | -------------------------------------------------------------------------------- /app/src/main/res/layout/row_frame.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 26 | 27 | 30 | 31 | 36 | 37 | 48 | 49 | 50 | 55 | 56 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /app/src/main/res/layout/row_image.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 25 | 26 | 30 | 31 | 32 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/row_page.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_bottom_navigation_edit_scan.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 26 | 31 | 32 | 33 | 34 | 35 | 40 | 45 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_bottom_navigation_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 26 | 27 | 32 | 37 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_bottom_navigation_view_frame.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 27 | 32 | 37 | 42 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_bottom_navigation_view_scan.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 26 | 31 | 36 | 41 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_bottom_navigation_view_scan_modify.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 26 | 31 | 36 | 41 | 46 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_fragment_gallery.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_fragment_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 30 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_list_frames.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 29 | 30 | 35 | 36 | 41 | -------------------------------------------------------------------------------- /app/src/main/res/menu/menu_view_frames.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 22 | 23 | 28 | 29 | 34 | 35 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | #1C1E26 22 | #242832 23 | #0086F0 24 | 25 | #242832 26 | #FFFFFF 27 | #2E323D 28 | 29 | #1C1E26 30 | 31 | #818698 32 | #FFFFFF 33 | #242832 34 | 35 | #FFFFFF 36 | #818698 37 | #363847 38 | 39 | #121319 40 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | -------------------------------------------------------------------------------- /app/src/main/res/values/preloaded_fonts.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | @font/source_sans_pro_bold 23 | 24 | 25 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 18 | 19 | 20 | 21 | 35 | 36 | 37 | 52 | 53 | -------------------------------------------------------------------------------- /app/src/main/res/xml/file_paths.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | // store in public directory for sharing. Associate with getExternalStorageDirectory 22 | // file path will be storage/emulated/0/Example/Media/Example Images/ 23 | 24 | 25 | // store in Android app package name directory. Associate with getExternalFilesDir 26 | // file path will be storage/emulated/0/Android/data/com.example.ex/files/Example Images/ 27 | 28 | 29 | // store in root directory. Cannot access without root. Associate with getFilesDir 30 | // file path will be storage/data/user/0/Android/data/com.example.ex/files/Example Images/ 31 | 32 | 33 | -------------------------------------------------------------------------------- /app/src/main/res/xml/preferences.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 28 | 29 | 30 | 31 | 32 | 36 | 37 | 42 | 43 | 48 | 49 | 54 | 55 | 56 | 57 | 58 | 63 | 64 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /app/src/test/java/com/wonderscan/android/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package com.wonderscan.android; 20 | 21 | import org.junit.Test; 22 | 23 | import static org.junit.Assert.*; 24 | 25 | /** 26 | * Example local unit test, which will execute on the development machine (host). 27 | * 28 | * @see Testing documentation 29 | */ 30 | public class ExampleUnitTest { 31 | @Test 32 | public void addition_isCorrect() { 33 | assertEquals(4, 2 + 2); 34 | } 35 | } -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 20 | buildscript { 21 | repositories { 22 | google() 23 | jcenter() 24 | } 25 | dependencies { 26 | classpath 'com.android.tools.build:gradle:7.0.2' 27 | classpath 'com.google.gms:google-services:4.3.10' 28 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.30" 29 | 30 | // NOTE: Do not place your application dependencies here; they belong 31 | // in the individual module build.gradle files 32 | } 33 | } 34 | 35 | allprojects { 36 | repositories { 37 | google() 38 | jcenter() 39 | mavenCentral() { 40 | url "https://dl.bintray.com/piasy/maven" 41 | } 42 | } 43 | } 44 | 45 | task clean(type: Delete) { 46 | delete rootProject.buildDir 47 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021 Dev Sebastian 3 | # This file is part of WonderScan . 4 | # 5 | # WonderScan is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # WonderScan is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with WonderScan. If not, see . 17 | # 18 | 19 | # Project-wide Gradle settings. 20 | # IDE (e.g. Android Studio) users: 21 | # Gradle settings configured through the IDE *will override* 22 | # any settings specified in this file. 23 | # For more details on how to configure your build environment visit 24 | # http://www.gradle.org/docs/current/userguide/build_environment.html 25 | # Specifies the JVM arguments used for the daemon process. 26 | # The setting is particularly useful for tweaking memory settings. 27 | org.gradle.jvmargs=-Xmx2048m 28 | # When configured, Gradle will run in incubating parallel mode. 29 | # This option should only be used with decoupled projects. More details, visit 30 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 31 | # org.gradle.parallel=true 32 | # AndroidX package structure to make it clearer which packages are bundled with the 33 | # Android operating system, and which are packaged with your app"s APK 34 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 35 | android.useAndroidX=true 36 | # Automatically convert third-party libraries to use AndroidX 37 | android.enableJetifier=true -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/devsebastian/WonderScan/6baf7d052e61908449807a514a43e61724d76a46/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (C) 2021 Dev Sebastian 3 | # This file is part of WonderScan . 4 | # 5 | # WonderScan is free software: you can redistribute it and/or modify 6 | # it under the terms of the GNU General Public License as published by 7 | # the Free Software Foundation, either version 3 of the License, or 8 | # (at your option) any later version. 9 | # 10 | # WonderScan is distributed in the hope that it will be useful, 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | # GNU General Public License for more details. 14 | # 15 | # You should have received a copy of the GNU General Public License 16 | # along with WonderScan. If not, see . 17 | # 18 | 19 | #Sun Nov 15 00:09:04 IST 2020 20 | distributionBase=GRADLE_USER_HOME 21 | distributionPath=wrapper/dists 22 | zipStoreBase=GRADLE_USER_HOME 23 | zipStorePath=wrapper/dists 24 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip 25 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /openCVLibrary344/build.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | apply plugin: 'com.android.library' 20 | 21 | android { 22 | compileSdkVersion 30 23 | //noinspection GradleDependency 24 | buildToolsVersion "30.0.3" 25 | 26 | defaultConfig { 27 | minSdkVersion 24 28 | targetSdkVersion 30 29 | } 30 | 31 | buildTypes { 32 | release { 33 | minifyEnabled false 34 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /openCVLibrary344/lint.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/aidl/org/opencv/engine/OpenCVEngineInterface.aidl: -------------------------------------------------------------------------------- 1 | package org.opencv.engine; 2 | 3 | /** 4 | * Class provides a Java interface for OpenCV Engine Service. It's synchronous with native OpenCVEngine class. 5 | */ 6 | interface OpenCVEngineInterface 7 | { 8 | /** 9 | * @return Returns service version. 10 | */ 11 | int getEngineVersion(); 12 | 13 | /** 14 | * Finds an installed OpenCV library. 15 | * @param OpenCV version. 16 | * @return Returns path to OpenCV native libs or an empty string if OpenCV can not be found. 17 | */ 18 | String getLibPathByVersion(String version); 19 | 20 | /** 21 | * Tries to install defined version of OpenCV from Google Play Market. 22 | * @param OpenCV version. 23 | * @return Returns true if installation was successful or OpenCV package has been already installed. 24 | */ 25 | boolean installVersion(String version); 26 | 27 | /** 28 | * Returns list of libraries in loading order, separated by semicolon. 29 | * @param OpenCV version. 30 | * @return Returns names of OpenCV libraries, separated by semicolon. 31 | */ 32 | String getLibraryList(String version); 33 | } 34 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/android/FpsMeter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.android; 20 | 21 | import java.text.DecimalFormat; 22 | 23 | import org.opencv.core.Core; 24 | 25 | import android.graphics.Canvas; 26 | import android.graphics.Color; 27 | import android.graphics.Paint; 28 | import android.util.Log; 29 | 30 | public class FpsMeter { 31 | private static final String TAG = "FpsMeter"; 32 | private static final int STEP = 20; 33 | private static final DecimalFormat FPS_FORMAT = new DecimalFormat("0.00"); 34 | 35 | private int mFramesCounter; 36 | private double mFrequency; 37 | private long mprevFrameTime; 38 | private String mStrfps; 39 | Paint mPaint; 40 | boolean mIsInitialized = false; 41 | int mWidth = 0; 42 | int mHeight = 0; 43 | 44 | public void init() { 45 | mFramesCounter = 0; 46 | mFrequency = Core.getTickFrequency(); 47 | mprevFrameTime = Core.getTickCount(); 48 | mStrfps = ""; 49 | 50 | mPaint = new Paint(); 51 | mPaint.setColor(Color.BLUE); 52 | mPaint.setTextSize(20); 53 | } 54 | 55 | public void measure() { 56 | if (!mIsInitialized) { 57 | init(); 58 | mIsInitialized = true; 59 | } else { 60 | mFramesCounter++; 61 | if (mFramesCounter % STEP == 0) { 62 | long time = Core.getTickCount(); 63 | double fps = STEP * mFrequency / (time - mprevFrameTime); 64 | mprevFrameTime = time; 65 | if (mWidth != 0 && mHeight != 0) 66 | mStrfps = FPS_FORMAT.format(fps) + " FPS@" + Integer.valueOf(mWidth) + "x" + Integer.valueOf(mHeight); 67 | else 68 | mStrfps = FPS_FORMAT.format(fps) + " FPS"; 69 | Log.i(TAG, mStrfps); 70 | } 71 | } 72 | } 73 | 74 | public void setResolution(int width, int height) { 75 | mWidth = width; 76 | mHeight = height; 77 | } 78 | 79 | public void draw(Canvas canvas, float offsetx, float offsety) { 80 | Log.d(TAG, mStrfps); 81 | canvas.drawText(mStrfps, offsetx, offsety, mPaint); 82 | } 83 | 84 | } 85 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/android/InstallCallbackInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.android; 20 | 21 | /** 22 | * Installation callback interface. 23 | */ 24 | public interface InstallCallbackInterface 25 | { 26 | /** 27 | * New package installation is required. 28 | */ 29 | static final int NEW_INSTALLATION = 0; 30 | /** 31 | * Current package installation is in progress. 32 | */ 33 | static final int INSTALLATION_PROGRESS = 1; 34 | 35 | /** 36 | * Target package name. 37 | * @return Return target package name. 38 | */ 39 | public String getPackageName(); 40 | /** 41 | * Installation is approved. 42 | */ 43 | public void install(); 44 | /** 45 | * Installation is canceled. 46 | */ 47 | public void cancel(); 48 | /** 49 | * Wait for package installation. 50 | */ 51 | public void wait_install(); 52 | }; 53 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/android/LoaderCallbackInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.android; 20 | 21 | /** 22 | * Interface for callback object in case of asynchronous initialization of OpenCV. 23 | */ 24 | public interface LoaderCallbackInterface 25 | { 26 | /** 27 | * OpenCV initialization finished successfully. 28 | */ 29 | static final int SUCCESS = 0; 30 | /** 31 | * Google Play Market cannot be invoked. 32 | */ 33 | static final int MARKET_ERROR = 2; 34 | /** 35 | * OpenCV library installation has been canceled by the user. 36 | */ 37 | static final int INSTALL_CANCELED = 3; 38 | /** 39 | * This version of OpenCV Manager Service is incompatible with the app. Possibly, a service update is required. 40 | */ 41 | static final int INCOMPATIBLE_MANAGER_VERSION = 4; 42 | /** 43 | * OpenCV library initialization has failed. 44 | */ 45 | static final int INIT_FAILED = 0xff; 46 | 47 | /** 48 | * Callback method, called after OpenCV library initialization. 49 | * @param status status of initialization (see initialization status constants). 50 | */ 51 | public void onManagerConnected(int status); 52 | 53 | /** 54 | * Callback method, called in case the package installation is needed. 55 | * @param callback answer object with approve and cancel methods and the package description. 56 | */ 57 | public void onPackageInstall(final int operation, InstallCallbackInterface callback); 58 | }; 59 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/core/CvException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.core; 20 | 21 | public class CvException extends RuntimeException { 22 | 23 | private static final long serialVersionUID = 1L; 24 | 25 | public CvException(String msg) { 26 | super(msg); 27 | } 28 | 29 | @Override 30 | public String toString() { 31 | return "CvException [" + super.toString() + "]"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/core/DMatch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.core; 20 | 21 | //C++: class DMatch 22 | 23 | /** 24 | * Structure for matching: query descriptor index, train descriptor index, train 25 | * image index and distance between descriptors. 26 | */ 27 | public class DMatch { 28 | 29 | /** 30 | * Query descriptor index. 31 | */ 32 | public int queryIdx; 33 | /** 34 | * Train descriptor index. 35 | */ 36 | public int trainIdx; 37 | /** 38 | * Train image index. 39 | */ 40 | public int imgIdx; 41 | 42 | // javadoc: DMatch::distance 43 | public float distance; 44 | 45 | // javadoc: DMatch::DMatch() 46 | public DMatch() { 47 | this(-1, -1, Float.MAX_VALUE); 48 | } 49 | 50 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _distance) 51 | public DMatch(int _queryIdx, int _trainIdx, float _distance) { 52 | queryIdx = _queryIdx; 53 | trainIdx = _trainIdx; 54 | imgIdx = -1; 55 | distance = _distance; 56 | } 57 | 58 | // javadoc: DMatch::DMatch(_queryIdx, _trainIdx, _imgIdx, _distance) 59 | public DMatch(int _queryIdx, int _trainIdx, int _imgIdx, float _distance) { 60 | queryIdx = _queryIdx; 61 | trainIdx = _trainIdx; 62 | imgIdx = _imgIdx; 63 | distance = _distance; 64 | } 65 | 66 | public boolean lessThan(DMatch it) { 67 | return distance < it.distance; 68 | } 69 | 70 | @Override 71 | public String toString() { 72 | return "DMatch [queryIdx=" + queryIdx + ", trainIdx=" + trainIdx 73 | + ", imgIdx=" + imgIdx + ", distance=" + distance + "]"; 74 | } 75 | 76 | } 77 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/core/Point.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.core; 20 | 21 | //javadoc:Point_ 22 | public class Point { 23 | 24 | public double x, y; 25 | 26 | public Point(double x, double y) { 27 | this.x = x; 28 | this.y = y; 29 | } 30 | 31 | public Point() { 32 | this(0, 0); 33 | } 34 | 35 | public Point(double[] vals) { 36 | this(); 37 | set(vals); 38 | } 39 | 40 | public void set(double[] vals) { 41 | if (vals != null) { 42 | x = vals.length > 0 ? vals[0] : 0; 43 | y = vals.length > 1 ? vals[1] : 0; 44 | } else { 45 | x = 0; 46 | y = 0; 47 | } 48 | } 49 | 50 | public Point clone() { 51 | return new Point(x, y); 52 | } 53 | 54 | public double dot(Point p) { 55 | return x * p.x + y * p.y; 56 | } 57 | 58 | @Override 59 | public int hashCode() { 60 | final int prime = 31; 61 | int result = 1; 62 | long temp; 63 | temp = Double.doubleToLongBits(x); 64 | result = prime * result + (int) (temp ^ (temp >>> 32)); 65 | temp = Double.doubleToLongBits(y); 66 | result = prime * result + (int) (temp ^ (temp >>> 32)); 67 | return result; 68 | } 69 | 70 | @Override 71 | public boolean equals(Object obj) { 72 | if (this == obj) return true; 73 | if (!(obj instanceof Point)) return false; 74 | Point it = (Point) obj; 75 | return x == it.x && y == it.y; 76 | } 77 | 78 | public boolean inside(Rect r) { 79 | return r.contains(this); 80 | } 81 | 82 | @Override 83 | public String toString() { 84 | return "{" + x + ", " + y + "}"; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/core/Point3.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.core; 20 | 21 | //javadoc:Point3_ 22 | public class Point3 { 23 | 24 | public double x, y, z; 25 | 26 | public Point3(double x, double y, double z) { 27 | this.x = x; 28 | this.y = y; 29 | this.z = z; 30 | } 31 | 32 | public Point3() { 33 | this(0, 0, 0); 34 | } 35 | 36 | public Point3(Point p) { 37 | x = p.x; 38 | y = p.y; 39 | z = 0; 40 | } 41 | 42 | public Point3(double[] vals) { 43 | this(); 44 | set(vals); 45 | } 46 | 47 | public void set(double[] vals) { 48 | if (vals != null) { 49 | x = vals.length > 0 ? vals[0] : 0; 50 | y = vals.length > 1 ? vals[1] : 0; 51 | z = vals.length > 2 ? vals[2] : 0; 52 | } else { 53 | x = 0; 54 | y = 0; 55 | z = 0; 56 | } 57 | } 58 | 59 | public Point3 clone() { 60 | return new Point3(x, y, z); 61 | } 62 | 63 | public double dot(Point3 p) { 64 | return x * p.x + y * p.y + z * p.z; 65 | } 66 | 67 | public Point3 cross(Point3 p) { 68 | return new Point3(y * p.z - z * p.y, z * p.x - x * p.z, x * p.y - y * p.x); 69 | } 70 | 71 | @Override 72 | public int hashCode() { 73 | final int prime = 31; 74 | int result = 1; 75 | long temp; 76 | temp = Double.doubleToLongBits(x); 77 | result = prime * result + (int) (temp ^ (temp >>> 32)); 78 | temp = Double.doubleToLongBits(y); 79 | result = prime * result + (int) (temp ^ (temp >>> 32)); 80 | temp = Double.doubleToLongBits(z); 81 | result = prime * result + (int) (temp ^ (temp >>> 32)); 82 | return result; 83 | } 84 | 85 | @Override 86 | public boolean equals(Object obj) { 87 | if (this == obj) return true; 88 | if (!(obj instanceof Point3)) return false; 89 | Point3 it = (Point3) obj; 90 | return x == it.x && y == it.y && z == it.z; 91 | } 92 | 93 | @Override 94 | public String toString() { 95 | return "{" + x + ", " + y + ", " + z + "}"; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/core/Range.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.core; 20 | 21 | //javadoc:Range 22 | public class Range { 23 | 24 | public int start, end; 25 | 26 | public Range(int s, int e) { 27 | this.start = s; 28 | this.end = e; 29 | } 30 | 31 | public Range() { 32 | this(0, 0); 33 | } 34 | 35 | public Range(double[] vals) { 36 | set(vals); 37 | } 38 | 39 | public void set(double[] vals) { 40 | if (vals != null) { 41 | start = vals.length > 0 ? (int) vals[0] : 0; 42 | end = vals.length > 1 ? (int) vals[1] : 0; 43 | } else { 44 | start = 0; 45 | end = 0; 46 | } 47 | 48 | } 49 | 50 | public int size() { 51 | return empty() ? 0 : end - start; 52 | } 53 | 54 | public boolean empty() { 55 | return end <= start; 56 | } 57 | 58 | public static Range all() { 59 | return new Range(Integer.MIN_VALUE, Integer.MAX_VALUE); 60 | } 61 | 62 | public Range intersection(Range r1) { 63 | Range r = new Range(Math.max(r1.start, this.start), Math.min(r1.end, this.end)); 64 | r.end = Math.max(r.end, r.start); 65 | return r; 66 | } 67 | 68 | public Range shift(int delta) { 69 | return new Range(start + delta, end + delta); 70 | } 71 | 72 | public Range clone() { 73 | return new Range(start, end); 74 | } 75 | 76 | @Override 77 | public int hashCode() { 78 | final int prime = 31; 79 | int result = 1; 80 | long temp; 81 | temp = Double.doubleToLongBits(start); 82 | result = prime * result + (int) (temp ^ (temp >>> 32)); 83 | temp = Double.doubleToLongBits(end); 84 | result = prime * result + (int) (temp ^ (temp >>> 32)); 85 | return result; 86 | } 87 | 88 | @Override 89 | public boolean equals(Object obj) { 90 | if (this == obj) return true; 91 | if (!(obj instanceof Range)) return false; 92 | Range it = (Range) obj; 93 | return start == it.start && end == it.end; 94 | } 95 | 96 | @Override 97 | public String toString() { 98 | return "[" + start + ", " + end + ")"; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/core/Size.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.core; 20 | 21 | //javadoc:Size_ 22 | public class Size { 23 | 24 | public double width, height; 25 | 26 | public Size(double width, double height) { 27 | this.width = width; 28 | this.height = height; 29 | } 30 | 31 | public Size() { 32 | this(0, 0); 33 | } 34 | 35 | public Size(Point p) { 36 | width = p.x; 37 | height = p.y; 38 | } 39 | 40 | public Size(double[] vals) { 41 | set(vals); 42 | } 43 | 44 | public void set(double[] vals) { 45 | if (vals != null) { 46 | width = vals.length > 0 ? vals[0] : 0; 47 | height = vals.length > 1 ? vals[1] : 0; 48 | } else { 49 | width = 0; 50 | height = 0; 51 | } 52 | } 53 | 54 | public double area() { 55 | return width * height; 56 | } 57 | 58 | public boolean empty() { 59 | return width <= 0 || height <= 0; 60 | } 61 | 62 | public Size clone() { 63 | return new Size(width, height); 64 | } 65 | 66 | @Override 67 | public int hashCode() { 68 | final int prime = 31; 69 | int result = 1; 70 | long temp; 71 | temp = Double.doubleToLongBits(height); 72 | result = prime * result + (int) (temp ^ (temp >>> 32)); 73 | temp = Double.doubleToLongBits(width); 74 | result = prime * result + (int) (temp ^ (temp >>> 32)); 75 | return result; 76 | } 77 | 78 | @Override 79 | public boolean equals(Object obj) { 80 | if (this == obj) return true; 81 | if (!(obj instanceof Size)) return false; 82 | Size it = (Size) obj; 83 | return width == it.width && height == it.height; 84 | } 85 | 86 | @Override 87 | public String toString() { 88 | return (int)width + "x" + (int)height; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/features2d/FlannBasedMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.features2d; 23 | 24 | import org.opencv.features2d.DescriptorMatcher; 25 | import org.opencv.features2d.FlannBasedMatcher; 26 | 27 | // C++: class FlannBasedMatcher 28 | //javadoc: FlannBasedMatcher 29 | 30 | public class FlannBasedMatcher extends DescriptorMatcher { 31 | 32 | protected FlannBasedMatcher(long addr) { super(addr); } 33 | 34 | // internal usage only 35 | public static FlannBasedMatcher __fromPtr__(long addr) { return new FlannBasedMatcher(addr); } 36 | 37 | // 38 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr()) 39 | // 40 | 41 | //javadoc: FlannBasedMatcher::FlannBasedMatcher() 42 | public FlannBasedMatcher() 43 | { 44 | 45 | super( FlannBasedMatcher_0() ); 46 | 47 | return; 48 | } 49 | 50 | 51 | // 52 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create() 53 | // 54 | 55 | //javadoc: FlannBasedMatcher::create() 56 | public static FlannBasedMatcher create() 57 | { 58 | 59 | FlannBasedMatcher retVal = FlannBasedMatcher.__fromPtr__(create_0()); 60 | 61 | return retVal; 62 | } 63 | 64 | 65 | @Override 66 | protected void finalize() throws Throwable { 67 | delete(nativeObj); 68 | } 69 | 70 | 71 | 72 | // C++: cv::FlannBasedMatcher::FlannBasedMatcher(Ptr_flann_IndexParams indexParams = makePtr(), Ptr_flann_SearchParams searchParams = makePtr()) 73 | private static native long FlannBasedMatcher_0(); 74 | 75 | // C++: static Ptr_FlannBasedMatcher cv::FlannBasedMatcher::create() 76 | private static native long create_0(); 77 | 78 | // native support for java finalize() 79 | private static native void delete(long nativeObj); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/ml/Ml.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.ml; 23 | 24 | 25 | 26 | // C++: class Ml 27 | //javadoc: Ml 28 | 29 | public class Ml { 30 | 31 | public static final int 32 | VAR_NUMERICAL = 0, 33 | VAR_ORDERED = 0, 34 | VAR_CATEGORICAL = 1, 35 | TEST_ERROR = 0, 36 | TRAIN_ERROR = 1, 37 | ROW_SAMPLE = 0, 38 | COL_SAMPLE = 1; 39 | 40 | 41 | 42 | 43 | } 44 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/objdetect/BaseCascadeClassifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.objdetect; 23 | 24 | import org.opencv.core.Algorithm; 25 | 26 | // C++: class BaseCascadeClassifier 27 | //javadoc: BaseCascadeClassifier 28 | 29 | public class BaseCascadeClassifier extends Algorithm { 30 | 31 | protected BaseCascadeClassifier(long addr) { super(addr); } 32 | 33 | // internal usage only 34 | public static BaseCascadeClassifier __fromPtr__(long addr) { return new BaseCascadeClassifier(addr); } 35 | 36 | @Override 37 | protected void finalize() throws Throwable { 38 | delete(nativeObj); 39 | } 40 | 41 | 42 | 43 | // native support for java finalize() 44 | private static native void delete(long nativeObj); 45 | 46 | } 47 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/objdetect/Objdetect.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.objdetect; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import org.opencv.core.Mat; 27 | import org.opencv.core.MatOfInt; 28 | import org.opencv.core.MatOfRect; 29 | import org.opencv.utils.Converters; 30 | 31 | // C++: class Objdetect 32 | //javadoc: Objdetect 33 | 34 | public class Objdetect { 35 | 36 | public static final int 37 | CASCADE_DO_CANNY_PRUNING = 1, 38 | CASCADE_SCALE_IMAGE = 2, 39 | CASCADE_FIND_BIGGEST_OBJECT = 4, 40 | CASCADE_DO_ROUGH_SEARCH = 8; 41 | 42 | 43 | // 44 | // C++: void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 45 | // 46 | 47 | //javadoc: groupRectangles(rectList, weights, groupThreshold, eps) 48 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold, double eps) 49 | { 50 | Mat rectList_mat = rectList; 51 | Mat weights_mat = weights; 52 | groupRectangles_0(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold, eps); 53 | 54 | return; 55 | } 56 | 57 | //javadoc: groupRectangles(rectList, weights, groupThreshold) 58 | public static void groupRectangles(MatOfRect rectList, MatOfInt weights, int groupThreshold) 59 | { 60 | Mat rectList_mat = rectList; 61 | Mat weights_mat = weights; 62 | groupRectangles_1(rectList_mat.nativeObj, weights_mat.nativeObj, groupThreshold); 63 | 64 | return; 65 | } 66 | 67 | 68 | 69 | 70 | // C++: void cv::groupRectangles(vector_Rect& rectList, vector_int& weights, int groupThreshold, double eps = 0.2) 71 | private static native void groupRectangles_0(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold, double eps); 72 | private static native void groupRectangles_1(long rectList_mat_nativeObj, long weights_mat_nativeObj, int groupThreshold); 73 | 74 | } 75 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/osgi/OpenCVInterface.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.osgi; 20 | 21 | /** 22 | * Dummy interface to allow some integration testing within OSGi implementation. 23 | */ 24 | public interface OpenCVInterface 25 | { 26 | } 27 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/osgi/OpenCVNativeLoader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | package org.opencv.osgi; 20 | 21 | import java.util.logging.Level; 22 | import java.util.logging.Logger; 23 | 24 | /** 25 | * This class is intended to provide a convenient way to load OpenCV's native 26 | * library from the Java bundle. If Blueprint is enabled in the OSGi container 27 | * this class will be instantiated automatically and the init() method called 28 | * loading the native library. 29 | */ 30 | public class OpenCVNativeLoader implements OpenCVInterface { 31 | 32 | public void init() { 33 | System.loadLibrary("opencv_java3"); 34 | Logger.getLogger("org.opencv.osgi").log(Level.INFO, "Successfully loaded OpenCV native library."); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/photo/AlignExposures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.photo; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import org.opencv.core.Algorithm; 27 | import org.opencv.core.Mat; 28 | import org.opencv.utils.Converters; 29 | 30 | // C++: class AlignExposures 31 | //javadoc: AlignExposures 32 | 33 | public class AlignExposures extends Algorithm { 34 | 35 | protected AlignExposures(long addr) { super(addr); } 36 | 37 | // internal usage only 38 | public static AlignExposures __fromPtr__(long addr) { return new AlignExposures(addr); } 39 | 40 | // 41 | // C++: void cv::AlignExposures::process(vector_Mat src, vector_Mat dst, Mat times, Mat response) 42 | // 43 | 44 | //javadoc: AlignExposures::process(src, dst, times, response) 45 | public void process(List src, List dst, Mat times, Mat response) 46 | { 47 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 48 | Mat dst_mat = Converters.vector_Mat_to_Mat(dst); 49 | process_0(nativeObj, src_mat.nativeObj, dst_mat.nativeObj, times.nativeObj, response.nativeObj); 50 | 51 | return; 52 | } 53 | 54 | 55 | @Override 56 | protected void finalize() throws Throwable { 57 | delete(nativeObj); 58 | } 59 | 60 | 61 | 62 | // C++: void cv::AlignExposures::process(vector_Mat src, vector_Mat dst, Mat times, Mat response) 63 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_mat_nativeObj, long times_nativeObj, long response_nativeObj); 64 | 65 | // native support for java finalize() 66 | private static native void delete(long nativeObj); 67 | 68 | } 69 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/photo/CalibrateCRF.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.photo; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import org.opencv.core.Algorithm; 27 | import org.opencv.core.Mat; 28 | import org.opencv.utils.Converters; 29 | 30 | // C++: class CalibrateCRF 31 | //javadoc: CalibrateCRF 32 | 33 | public class CalibrateCRF extends Algorithm { 34 | 35 | protected CalibrateCRF(long addr) { super(addr); } 36 | 37 | // internal usage only 38 | public static CalibrateCRF __fromPtr__(long addr) { return new CalibrateCRF(addr); } 39 | 40 | // 41 | // C++: void cv::CalibrateCRF::process(vector_Mat src, Mat& dst, Mat times) 42 | // 43 | 44 | //javadoc: CalibrateCRF::process(src, dst, times) 45 | public void process(List src, Mat dst, Mat times) 46 | { 47 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 48 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 49 | 50 | return; 51 | } 52 | 53 | 54 | @Override 55 | protected void finalize() throws Throwable { 56 | delete(nativeObj); 57 | } 58 | 59 | 60 | 61 | // C++: void cv::CalibrateCRF::process(vector_Mat src, Mat& dst, Mat times) 62 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 63 | 64 | // native support for java finalize() 65 | private static native void delete(long nativeObj); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/photo/MergeDebevec.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.photo; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import org.opencv.core.Mat; 27 | import org.opencv.photo.MergeExposures; 28 | import org.opencv.utils.Converters; 29 | 30 | // C++: class MergeDebevec 31 | //javadoc: MergeDebevec 32 | 33 | public class MergeDebevec extends MergeExposures { 34 | 35 | protected MergeDebevec(long addr) { super(addr); } 36 | 37 | // internal usage only 38 | public static MergeDebevec __fromPtr__(long addr) { return new MergeDebevec(addr); } 39 | 40 | // 41 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times, Mat response) 42 | // 43 | 44 | //javadoc: MergeDebevec::process(src, dst, times, response) 45 | public void process(List src, Mat dst, Mat times, Mat response) 46 | { 47 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 48 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 49 | 50 | return; 51 | } 52 | 53 | 54 | // 55 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times) 56 | // 57 | 58 | //javadoc: MergeDebevec::process(src, dst, times) 59 | public void process(List src, Mat dst, Mat times) 60 | { 61 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 62 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 63 | 64 | return; 65 | } 66 | 67 | 68 | @Override 69 | protected void finalize() throws Throwable { 70 | delete(nativeObj); 71 | } 72 | 73 | 74 | 75 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times, Mat response) 76 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 77 | 78 | // C++: void cv::MergeDebevec::process(vector_Mat src, Mat& dst, Mat times) 79 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 80 | 81 | // native support for java finalize() 82 | private static native void delete(long nativeObj); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/photo/MergeExposures.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.photo; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import org.opencv.core.Algorithm; 27 | import org.opencv.core.Mat; 28 | import org.opencv.utils.Converters; 29 | 30 | // C++: class MergeExposures 31 | //javadoc: MergeExposures 32 | 33 | public class MergeExposures extends Algorithm { 34 | 35 | protected MergeExposures(long addr) { super(addr); } 36 | 37 | // internal usage only 38 | public static MergeExposures __fromPtr__(long addr) { return new MergeExposures(addr); } 39 | 40 | // 41 | // C++: void cv::MergeExposures::process(vector_Mat src, Mat& dst, Mat times, Mat response) 42 | // 43 | 44 | //javadoc: MergeExposures::process(src, dst, times, response) 45 | public void process(List src, Mat dst, Mat times, Mat response) 46 | { 47 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 48 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 49 | 50 | return; 51 | } 52 | 53 | 54 | @Override 55 | protected void finalize() throws Throwable { 56 | delete(nativeObj); 57 | } 58 | 59 | 60 | 61 | // C++: void cv::MergeExposures::process(vector_Mat src, Mat& dst, Mat times, Mat response) 62 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 63 | 64 | // native support for java finalize() 65 | private static native void delete(long nativeObj); 66 | 67 | } 68 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/photo/MergeRobertson.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.photo; 23 | 24 | import java.util.ArrayList; 25 | import java.util.List; 26 | import org.opencv.core.Mat; 27 | import org.opencv.photo.MergeExposures; 28 | import org.opencv.utils.Converters; 29 | 30 | // C++: class MergeRobertson 31 | //javadoc: MergeRobertson 32 | 33 | public class MergeRobertson extends MergeExposures { 34 | 35 | protected MergeRobertson(long addr) { super(addr); } 36 | 37 | // internal usage only 38 | public static MergeRobertson __fromPtr__(long addr) { return new MergeRobertson(addr); } 39 | 40 | // 41 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times, Mat response) 42 | // 43 | 44 | //javadoc: MergeRobertson::process(src, dst, times, response) 45 | public void process(List src, Mat dst, Mat times, Mat response) 46 | { 47 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 48 | process_0(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj, response.nativeObj); 49 | 50 | return; 51 | } 52 | 53 | 54 | // 55 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times) 56 | // 57 | 58 | //javadoc: MergeRobertson::process(src, dst, times) 59 | public void process(List src, Mat dst, Mat times) 60 | { 61 | Mat src_mat = Converters.vector_Mat_to_Mat(src); 62 | process_1(nativeObj, src_mat.nativeObj, dst.nativeObj, times.nativeObj); 63 | 64 | return; 65 | } 66 | 67 | 68 | @Override 69 | protected void finalize() throws Throwable { 70 | delete(nativeObj); 71 | } 72 | 73 | 74 | 75 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times, Mat response) 76 | private static native void process_0(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj, long response_nativeObj); 77 | 78 | // C++: void cv::MergeRobertson::process(vector_Mat src, Mat& dst, Mat times) 79 | private static native void process_1(long nativeObj, long src_mat_nativeObj, long dst_nativeObj, long times_nativeObj); 80 | 81 | // native support for java finalize() 82 | private static native void delete(long nativeObj); 83 | 84 | } 85 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/photo/Tonemap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.photo; 23 | 24 | import org.opencv.core.Algorithm; 25 | import org.opencv.core.Mat; 26 | 27 | // C++: class Tonemap 28 | //javadoc: Tonemap 29 | 30 | public class Tonemap extends Algorithm { 31 | 32 | protected Tonemap(long addr) { super(addr); } 33 | 34 | // internal usage only 35 | public static Tonemap __fromPtr__(long addr) { return new Tonemap(addr); } 36 | 37 | // 38 | // C++: float cv::Tonemap::getGamma() 39 | // 40 | 41 | //javadoc: Tonemap::getGamma() 42 | public float getGamma() 43 | { 44 | 45 | float retVal = getGamma_0(nativeObj); 46 | 47 | return retVal; 48 | } 49 | 50 | 51 | // 52 | // C++: void cv::Tonemap::process(Mat src, Mat& dst) 53 | // 54 | 55 | //javadoc: Tonemap::process(src, dst) 56 | public void process(Mat src, Mat dst) 57 | { 58 | 59 | process_0(nativeObj, src.nativeObj, dst.nativeObj); 60 | 61 | return; 62 | } 63 | 64 | 65 | // 66 | // C++: void cv::Tonemap::setGamma(float gamma) 67 | // 68 | 69 | //javadoc: Tonemap::setGamma(gamma) 70 | public void setGamma(float gamma) 71 | { 72 | 73 | setGamma_0(nativeObj, gamma); 74 | 75 | return; 76 | } 77 | 78 | 79 | @Override 80 | protected void finalize() throws Throwable { 81 | delete(nativeObj); 82 | } 83 | 84 | 85 | 86 | // C++: float cv::Tonemap::getGamma() 87 | private static native float getGamma_0(long nativeObj); 88 | 89 | // C++: void cv::Tonemap::process(Mat src, Mat& dst) 90 | private static native void process_0(long nativeObj, long src_nativeObj, long dst_nativeObj); 91 | 92 | // C++: void cv::Tonemap::setGamma(float gamma) 93 | private static native void setGamma_0(long nativeObj, float gamma); 94 | 95 | // native support for java finalize() 96 | private static native void delete(long nativeObj); 97 | 98 | } 99 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/video/DenseOpticalFlow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.video; 23 | 24 | import org.opencv.core.Algorithm; 25 | import org.opencv.core.Mat; 26 | 27 | // C++: class DenseOpticalFlow 28 | //javadoc: DenseOpticalFlow 29 | 30 | public class DenseOpticalFlow extends Algorithm { 31 | 32 | protected DenseOpticalFlow(long addr) { super(addr); } 33 | 34 | // internal usage only 35 | public static DenseOpticalFlow __fromPtr__(long addr) { return new DenseOpticalFlow(addr); } 36 | 37 | // 38 | // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow) 39 | // 40 | 41 | //javadoc: DenseOpticalFlow::calc(I0, I1, flow) 42 | public void calc(Mat I0, Mat I1, Mat flow) 43 | { 44 | 45 | calc_0(nativeObj, I0.nativeObj, I1.nativeObj, flow.nativeObj); 46 | 47 | return; 48 | } 49 | 50 | 51 | // 52 | // C++: void cv::DenseOpticalFlow::collectGarbage() 53 | // 54 | 55 | //javadoc: DenseOpticalFlow::collectGarbage() 56 | public void collectGarbage() 57 | { 58 | 59 | collectGarbage_0(nativeObj); 60 | 61 | return; 62 | } 63 | 64 | 65 | @Override 66 | protected void finalize() throws Throwable { 67 | delete(nativeObj); 68 | } 69 | 70 | 71 | 72 | // C++: void cv::DenseOpticalFlow::calc(Mat I0, Mat I1, Mat& flow) 73 | private static native void calc_0(long nativeObj, long I0_nativeObj, long I1_nativeObj, long flow_nativeObj); 74 | 75 | // C++: void cv::DenseOpticalFlow::collectGarbage() 76 | private static native void collectGarbage_0(long nativeObj); 77 | 78 | // native support for java finalize() 79 | private static native void delete(long nativeObj); 80 | 81 | } 82 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/java/org/opencv/video/SparseOpticalFlow.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | // 20 | // This file is auto-generated. Please don't modify it! 21 | // 22 | package org.opencv.video; 23 | 24 | import org.opencv.core.Algorithm; 25 | import org.opencv.core.Mat; 26 | 27 | // C++: class SparseOpticalFlow 28 | //javadoc: SparseOpticalFlow 29 | 30 | public class SparseOpticalFlow extends Algorithm { 31 | 32 | protected SparseOpticalFlow(long addr) { super(addr); } 33 | 34 | // internal usage only 35 | public static SparseOpticalFlow __fromPtr__(long addr) { return new SparseOpticalFlow(addr); } 36 | 37 | // 38 | // C++: void cv::SparseOpticalFlow::calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat()) 39 | // 40 | 41 | //javadoc: SparseOpticalFlow::calc(prevImg, nextImg, prevPts, nextPts, status, err) 42 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status, Mat err) 43 | { 44 | 45 | calc_0(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj, err.nativeObj); 46 | 47 | return; 48 | } 49 | 50 | //javadoc: SparseOpticalFlow::calc(prevImg, nextImg, prevPts, nextPts, status) 51 | public void calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat nextPts, Mat status) 52 | { 53 | 54 | calc_1(nativeObj, prevImg.nativeObj, nextImg.nativeObj, prevPts.nativeObj, nextPts.nativeObj, status.nativeObj); 55 | 56 | return; 57 | } 58 | 59 | 60 | @Override 61 | protected void finalize() throws Throwable { 62 | delete(nativeObj); 63 | } 64 | 65 | 66 | 67 | // C++: void cv::SparseOpticalFlow::calc(Mat prevImg, Mat nextImg, Mat prevPts, Mat& nextPts, Mat& status, Mat& err = cv::Mat()) 68 | private static native void calc_0(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj, long err_nativeObj); 69 | private static native void calc_1(long nativeObj, long prevImg_nativeObj, long nextImg_nativeObj, long prevPts_nativeObj, long nextPts_nativeObj, long status_nativeObj); 70 | 71 | // native support for java finalize() 72 | private static native void delete(long nativeObj); 73 | 74 | } 75 | -------------------------------------------------------------------------------- /openCVLibrary344/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2021 Dev Sebastian 3 | * This file is part of WonderScan . 4 | * 5 | * WonderScan is free software: you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation, either version 3 of the License, or 8 | * (at your option) any later version. 9 | * 10 | * WonderScan is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * You should have received a copy of the GNU General Public License 16 | * along with WonderScan. If not, see . 17 | */ 18 | 19 | include ':app' 20 | rootProject.name = "WonderScan" 21 | include ':openCVLibrary344' 22 | --------------------------------------------------------------------------------