Skip to content

Commit 3cbedce

Browse files
committed
first
0 parents  commit 3cbedce

File tree

182 files changed

+42013
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+42013
-0
lines changed

.gitignore

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
*.iml
2+
.gradle
3+
/local.properties
4+
/.idea/caches
5+
/.idea/libraries
6+
/.idea/modules.xml
7+
/.idea/workspace.xml
8+
/.idea/navEditor.xml
9+
/.idea/assetWizardSettings.xml
10+
.DS_Store
11+
/build
12+
/captures
13+
.externalNativeBuild

.idea/encodings.xml

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

+15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 29
5+
buildToolsVersion "29.0.0"
6+
defaultConfig {
7+
applicationId "formatfa.fvideo"
8+
minSdkVersion 17
9+
targetSdkVersion 29
10+
versionCode 1
11+
versionName "1.0"
12+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
21+
sourceSets{
22+
main{
23+
jni.srcDirs = []
24+
jniLibs.srcDirs = ['jniLibs']
25+
}
26+
27+
}
28+
}
29+
30+
dependencies {
31+
implementation fileTree(dir: 'libs', include: ['*.jar'])
32+
implementation 'androidx.appcompat:appcompat:1.0.2'
33+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
34+
testImplementation 'junit:junit:4.12'
35+
androidTestImplementation 'androidx.test:runner:1.2.0'
36+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
37+
implementation project(path: ':opencv')
38+
implementation 'com.leon:lfilepickerlibrary:1.8.0'
39+
}
17.5 MB
Binary file not shown.
9.41 MB
Binary file not shown.

app/jniLibs/x86/libopencv_java4.so

44.8 MB
Binary file not shown.

app/jniLibs/x86_64/libopencv_java4.so

66.2 MB
Binary file not shown.

app/proguard-rules.pro

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package formatfa.fvideo;
2+
3+
import android.content.Context;
4+
5+
import androidx.test.InstrumentationRegistry;
6+
import androidx.test.runner.AndroidJUnit4;
7+
8+
import org.junit.Test;
9+
import org.junit.runner.RunWith;
10+
11+
import static org.junit.Assert.*;
12+
13+
/**
14+
* Instrumented test, which will execute on an Android device.
15+
*
16+
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
17+
*/
18+
@RunWith(AndroidJUnit4.class)
19+
public class ExampleInstrumentedTest {
20+
@Test
21+
public void useAppContext() {
22+
// Context of the app under test.
23+
Context appContext = InstrumentationRegistry.getTargetContext();
24+
25+
assertEquals("formatfa.fvideo", appContext.getPackageName());
26+
}
27+
}

app/src/main/AndroidManifest.xml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="formatfa.fvideo">
4+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/AppTheme">
12+
<activity android:name=".MainActivity">
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package formatfa.fvideo;
2+
3+
public interface FrameExtraListener {
4+
public void update(FrameExtraTask.ExtraMessage msg);
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
package formatfa.fvideo;
2+
3+
import android.os.AsyncTask;
4+
5+
import org.opencv.core.Mat;
6+
import org.opencv.imgcodecs.Imgcodecs;
7+
import org.opencv.videoio.VideoCapture;
8+
9+
import java.io.File;
10+
11+
public class FrameExtraTask extends AsyncTask<String, FrameExtraTask.ExtraMessage,String> {
12+
13+
// frame extra task
14+
public static class ExtraMessage
15+
{
16+
public int count;
17+
public int now;
18+
public String message;
19+
20+
public ExtraMessage(int count, int now, String message) {
21+
this.count = count;
22+
this.now = now;
23+
this.message = message;
24+
}
25+
26+
@Override
27+
public String toString() {
28+
return "ExtraMessage{" +
29+
"count=" + count +
30+
", now=" + now +
31+
", message='" + message + '\'' +
32+
'}';
33+
}
34+
}
35+
36+
private File outPath;
37+
38+
private FrameExtraListener listener;
39+
public FrameExtraTask(File outpath,FrameExtraListener listener) {
40+
this.outPath = outpath;
41+
this.listener=listener;
42+
43+
if(!outpath.exists())outpath.mkdirs();
44+
45+
}
46+
47+
@Override
48+
protected void onPreExecute() {
49+
50+
}
51+
52+
@Override
53+
protected void onProgressUpdate(ExtraMessage... values) {
54+
if(listener!=null)listener.update(values[0]);
55+
}
56+
57+
@Override
58+
protected String doInBackground(String... strings) {
59+
60+
61+
VideoCapture video = new VideoCapture(strings[0]);
62+
63+
Mat frame = new Mat();
64+
65+
int index = 0;
66+
while(video.read(frame))
67+
{
68+
File out = new File(this.outPath,String.format("%d.png",index));
69+
Imgcodecs.imwrite(out.getAbsolutePath(),frame);
70+
index+=1;
71+
72+
publishProgress(new ExtraMessage(0,index,out.getAbsolutePath()));
73+
74+
}
75+
76+
return null;
77+
}
78+
}

0 commit comments

Comments
 (0)