This commit is contained in:
Kacper Dudzic 2019-12-04 23:05:33 +01:00
parent 8b43349501
commit 051fe9d647
38 changed files with 263 additions and 58 deletions

1
Lookify/.idea/.name Normal file
View File

@ -0,0 +1 @@
Lookify_robocze

View File

@ -4,7 +4,7 @@ android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.test"
applicationId "com.example.lookify_robocze"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
@ -27,4 +27,5 @@ dependencies {
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':openCVLibrary348')
}

View File

@ -0,0 +1,27 @@
package com.example.lookify_robocze;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.example.lookify_robocze", appContext.getPackageName());
}
}

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.test">
package="com.example.lookify_robocze">
<uses-permission android:name="android.permission.CAMERA"/>
@ -9,6 +9,12 @@
<uses-feature android:name="android.hardware.camera.front" android:required="false"/>
<uses-feature android:name="android.hardware.camera.front.autofocus" android:required="false"/>
<supports-screens android:resizeable="true"
android:smallScreens="true"
android:normalScreens="true"
android:largeScreens="true"
android:anyDensity="true" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"

View File

@ -0,0 +1,92 @@
package com.example.lookify_robocze;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceView;
import android.view.WindowManager;
import androidx.appcompat.app.AppCompatActivity;
import org.opencv.android.OpenCVLoader;
import org.opencv.android.JavaCameraView;
import org.opencv.android.LoaderCallbackInterface;
import org.opencv.android.CameraBridgeViewBase;
import org.opencv.android.BaseLoaderCallback;
// Napisane z pomocą artykułu spod adresu https://blog.codeonion.com/2016/04/09/show-camera-on-android-app-using-opencv-for-android/
public class MainActivity extends AppCompatActivity {
// Do logowania komunikatów typu success/failure
private static final String TAG = "OCVSample::Activity";
// Laduje kamere OpenCV
private CameraBridgeViewBase mOpenCvCameraView;
// Menadżer OpenCV do komunikacji aplikacji z telefonem
private BaseLoaderCallback mLoaderCallback = new BaseLoaderCallback(this) {
@Override
public void onManagerConnected(int status) {
switch (status) {
case LoaderCallbackInterface.SUCCESS:
{
Log.i(TAG, "OpenCV loaded successfully");
mOpenCvCameraView.enableView();
} break;
default:
{
super.onManagerConnected(status);
} break;
}
}
};
// Inicjalizacja narzędzia do przeglądania logów
public MainActivity() {
Log.i(TAG, "Instantiated new " + this.getClass());
}
// Wyświatlanie kamery przy powstaniu activity
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i(TAG, "called onCreate");
super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
setContentView(R.layout.activity_main);
mOpenCvCameraView = (JavaCameraView) findViewById(R.id.show_camera_activity_java_surface_view);
mOpenCvCameraView.setVisibility(SurfaceView.VISIBLE);
}
// Działanie przy pauzie
@Override
public void onPause()
{
super.onPause();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
// Działanie po wznowieniu
@Override
public void onResume()
{
super.onResume();
if (!OpenCVLoader.initDebug()) {
Log.d(TAG, "Internal OpenCV library not found. Using OpenCV Manager for initialization");
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_3_0_0, this, mLoaderCallback);
} else {
Log.d(TAG, "OpenCV library found inside package. Using it!");
mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);
}
}
// Działanie przy "zamknięciu"
public void onDestroy() {
super.onDestroy();
if (mOpenCvCameraView != null)
mOpenCvCameraView.disableView();
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
xmlns:opencv="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent">
<org.opencv.android.JavaCameraView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:visibility="gone"
android:id="@+id/show_camera_activity_java_surface_view"
opencv:show_fps="false"
opencv:camera_id="any" />
</LinearLayout>

View File

@ -1,3 +1,3 @@
<resources>
<string name="app_name">TEST</string>
<string name="app_name">Lookify_robocze</string>
</resources>

View File

@ -0,0 +1,17 @@
package com.example.lookify_robocze;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

View File

@ -1,4 +1,4 @@
#Sat Nov 30 00:11:39 CET 2019
#Tue Dec 03 21:31:50 CET 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

View File

@ -5,7 +5,7 @@ android {
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 8
minSdkVersion 14
targetSdkVersion 29
}

View File

@ -5,7 +5,7 @@
android:versionName="3.4.8" >
<uses-sdk
android:minSdkVersion="8"
android:minSdkVersion="14"
android:targetSdkVersion="29" />
</manifest>

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\debug\jniLibs"/></dataSet></merger>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\jniLibs"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\debug\jniLibs"/></dataSet></merger>

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\debug\shaders"/></dataSet></merger>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\shaders"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\debug\shaders"/></dataSet></merger>

View File

@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\assets"/><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\build\intermediates\shader_assets\debug\compileDebugShaders\out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\debug\assets"/></dataSet></merger>
<merger version="3"><dataSet config="main" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\assets"/><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\build\intermediates\shader_assets\debug\compileDebugShaders\out"/></dataSet><dataSet config="debug" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\debug\assets"/></dataSet></merger>

View File

@ -1 +1 @@
#Sat Nov 30 00:33:23 CET 2019
#Wed Dec 04 17:04:23 CET 2019

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\res"/><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\build\generated\res\rs\debug"/><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\res"><file path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\res\values\attrs.xml" qualifiers=""><declare-styleable name="CameraBridgeViewBase">
<merger version="3"><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\res"/><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\build\generated\res\rs\debug"/><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="main" generated-set="main$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\res"><file path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\res\values\attrs.xml" qualifiers=""><declare-styleable name="CameraBridgeViewBase">
<attr format="boolean" name="show_fps"/>
<attr format="integer" name="camera_id">
<enum name="any" value="-1"/>
<enum name="back" value="99"/>
<enum name="front" value="98"/>
</attr>
</declare-styleable></file></source><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\build\generated\res\rs\debug"/><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\debug\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\debug\res"/></dataSet><mergedItems><configuration qualifiers=""><declare-styleable name="CameraBridgeViewBase">
</declare-styleable></file></source><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\build\generated\res\rs\debug"/><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\build\generated\res\resValues\debug"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug$Generated" generated="true" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\debug\res"/></dataSet><dataSet aapt-namespace="http://schemas.android.com/apk/res-auto" config="debug" generated-set="debug$Generated" ignore_pattern="!.svn:!.git:!.ds_store:!*.scc:.*:&lt;dir>_*:!CVS:!thumbs.db:!picasa.ini:!*~"><source path="C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\debug\res"/></dataSet><mergedItems><configuration qualifiers=""><declare-styleable name="CameraBridgeViewBase">
<attr format="boolean" name="show_fps"/>
<attr format="integer" name="camera_id">
<enum name="any" value="-1"/>

View File

@ -5,7 +5,7 @@
android:versionName="3.4.8" >
<uses-sdk
android:minSdkVersion="8"
android:minSdkVersion="14"
android:targetSdkVersion="29" />
</manifest>

View File

@ -5,10 +5,10 @@
5 android:versionName="3.4.8" >
6
7 <uses-sdk
7-->C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
8 android:minSdkVersion="8"
8-->C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
7-->C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
8 android:minSdkVersion="14"
8-->C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
9 android:targetSdkVersion="29" />
9-->C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:15-44
9-->C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:15-44
10
11</manifest>

View File

@ -1,37 +1,37 @@
-- Merging decision tree log ---
manifest
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:1-8:12
package
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:3:7-27
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:3:7-27
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
android:versionName
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:5:7-34
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:5:7-34
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
xmlns:android
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:2:11-69
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:2:11-69
android:versionCode
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:4:7-33
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:4:7-33
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
uses-sdk
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
android:targetSdkVersion
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:15-44
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:15-44
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
android:minSdkVersion
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
ADDED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\TEST\openCVLibrary348\src\main\AndroidManifest.xml
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml
ADDED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml:7:5-47
INJECTED from C:\HDD\Moi\Studia\Informatyka\Lookify_robocze_kopia\openCVLibrary348\src\main\AndroidManifest.xml

View File

@ -2,7 +2,6 @@ package org.opencv.android;
import java.util.List;
import org.opencv.BuildConfig;
import org.opencv.R;
import org.opencv.core.Mat;
import org.opencv.core.Size;
@ -11,15 +10,18 @@ import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
/**
* This is a basic class, implementing the interaction with Camera and OpenCV library.
* The main responsibility of it - is to control when camera can be enabled, process the frame,
@ -379,12 +381,47 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
}
}
// Metody updateMatrix i deliverAndDrawFrame zaczerpnięte z https://heartbeat.fritz.ai/working-with-the-opencv-camera-for-android-rotating-orienting-and-scaling-c7006c3e1916
private final Matrix mMatrix = new Matrix();
private void updateMatrix() {
float mw = this.getWidth();
float mh = this.getHeight();
float hw = this.getWidth() / 2.0f;
float hh = this.getHeight() / 2.0f;
float cw = (float)Resources.getSystem().getDisplayMetrics().widthPixels;
float ch = (float)Resources.getSystem().getDisplayMetrics().heightPixels;
float scale = cw / mh;
float scale2 = ch / mw;
if(scale2 > scale){
scale = scale2;
}
mMatrix.reset();
mMatrix.preTranslate(hw, hh);
mMatrix.preRotate(90);
mMatrix.preTranslate(-hw, -hh);
mMatrix.preScale(scale,scale,hw,hh);
}
@Override
public void layout(int l, int t, int r, int b) {
super.layout(l, t, r, b);
updateMatrix();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
updateMatrix();
}
/**
* This method shall be called by the subclasses when they have valid
* object and want it to be delivered to external client (via callback) and
* then displayed on the screen.
* @param frame - the current frame to be delivered
*/
protected void deliverAndDrawFrame(CvCameraViewFrame frame) {
Mat modified;
@ -410,23 +447,26 @@ public abstract class CameraBridgeViewBase extends SurfaceView implements Surfac
Canvas canvas = getHolder().lockCanvas();
if (canvas != null) {
canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR);
if (BuildConfig.DEBUG)
Log.d(TAG, "mStretch value: " + mScale);
int saveCount = canvas.save();
canvas.setMatrix(mMatrix);
if (mScale != 0) {
canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
new Rect((int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2),
(int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2),
(int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2 + mScale*mCacheBitmap.getWidth()),
(int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2 + mScale*mCacheBitmap.getHeight())), null);
new Rect((int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2),
(int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2),
(int)((canvas.getWidth() - mScale*mCacheBitmap.getWidth()) / 2 + mScale*mCacheBitmap.getWidth()),
(int)((canvas.getHeight() - mScale*mCacheBitmap.getHeight()) / 2 + mScale*mCacheBitmap.getHeight())), null);
} else {
canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
new Rect((canvas.getWidth() - mCacheBitmap.getWidth()) / 2,
(canvas.getHeight() - mCacheBitmap.getHeight()) / 2,
(canvas.getWidth() - mCacheBitmap.getWidth()) / 2 + mCacheBitmap.getWidth(),
(canvas.getHeight() - mCacheBitmap.getHeight()) / 2 + mCacheBitmap.getHeight()), null);
canvas.drawBitmap(mCacheBitmap, new Rect(0,0,mCacheBitmap.getWidth(), mCacheBitmap.getHeight()),
new Rect((canvas.getWidth() - mCacheBitmap.getWidth()) / 2,
(canvas.getHeight() - mCacheBitmap.getHeight()) / 2,
(canvas.getWidth() - mCacheBitmap.getWidth()) / 2 + mCacheBitmap.getWidth(),
(canvas.getHeight() - mCacheBitmap.getHeight()) / 2 + mCacheBitmap.getHeight()), null);
}
//Restore canvas after draw bitmap
canvas.restoreToCount(saveCount);
if (mFpsMeter != null) {
mFpsMeter.measure();
mFpsMeter.draw(canvas, 20, 30);

View File

@ -1,3 +1,3 @@
include ':app'
rootProject.name='TEST'
rootProject.name='Lookify_robocze'
include ':openCVLibrary348'