Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
cleaning up duplicated libs, testing different memory allocation
  • Loading branch information
radames committed Apr 29, 2016
1 parent 522c98f commit 4f5eb8f
Show file tree
Hide file tree
Showing 77 changed files with 24 additions and 27 deletions.
12 changes: 6 additions & 6 deletions Android/selfieMemememe3/.idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 0 additions & 11 deletions Android/selfieMemememe3/app/build.gradle
Expand Up @@ -65,14 +65,3 @@ dependencies {
compile files('src/main/libs/JTransforms-3.0.jar')
compile files('src/main/libs/jumblr-0.0.10-jar-with-dependencies.jar')
}

task copyJniLibs(type: Copy) {
from 'src/main/libs/armeabi-v7a'
into 'src/main/jniLibs'
}

tasks.withType(JavaCompile) {
compileTask -> compileTask.dependsOn(copyJniLibs)
}

//clean.dependsOn 'cleanCopyJniLibs'
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Expand Up @@ -74,7 +74,8 @@ private static enum State {WAITING, SEARCHING, REFLECTING, FLASHING, POSTING, SC

private Mat mRgba;
private Mat mGray;
private Mat mTempRgba;
private Mat mTempRgba;
private Mat tempT;
private File mCascadeFile;

private float mRelativeDetectSize = 0.15f;
Expand Down Expand Up @@ -129,7 +130,7 @@ public void onManagerConnected(int status) {
os.close();

mNativeDetector = new DetectionBasedTracker(mCascadeFile.getAbsolutePath(), 0);

mNativeDetector.start();
cascadeDir.delete();
}
catch (IOException e) {
Expand Down Expand Up @@ -252,17 +253,19 @@ public void onDestroy() {
}

public void onCameraViewStarted(int width, int height) {
mGray = new Mat();
mRgba = new Mat();
mGray = new Mat();
mTempRgba = new Mat();
tempT = new Mat();
}

public void onCameraViewStopped() {
mNativeDetector.stop();
mAbsoluteDetectSize = 0;
mGray.release();
mRgba.release();
mGray.release();
mTempRgba.release();
tempT.release();
}

private Thread sendCommandToPlatform(String cmd){
Expand All @@ -287,7 +290,8 @@ public void run() {
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {

mTempRgba = inputFrame.rgba();
Core.flip(inputFrame.gray().t(), mGray, 0);
tempT = inputFrame.gray().t();
Core.flip(tempT, mGray, 0);

// save images for video...
/*
Expand All @@ -298,13 +302,15 @@ public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
*/

// only need to do this once

if (mAbsoluteDetectSize == 0) {
int height = mGray.cols();
Log.e("NUMNUM", "COLUMUNS:" + String.valueOf(height));

if (Math.round(height*mRelativeDetectSize) > 0) {
mAbsoluteDetectSize = Math.round(height*mRelativeDetectSize);
}
mNativeDetector.setMinFaceSize(mAbsoluteDetectSize);
mNativeDetector.start();
}

// always detect in order to keep NativeDetector consistent with camera
Expand Down Expand Up @@ -549,8 +555,8 @@ else if(mCurrentState == State.FLASHING){
Log.d(TAG, "state := SEARCHING");
sendCommandToPlatform("search").start();
}

Core.flip(mTempRgba.t(), mRgba, 1);
tempT = mTempRgba.t();
Core.flip(tempT, mRgba, 1);
for(int i=0; i<mRandomGenerator.nextInt(5)+2; i++){
mCurrentFlashText = TEXTS[mRandomGenerator.nextInt(TEXTS.length)];
Size mTextSize = Imgproc.getTextSize(mCurrentFlashText, Core.FONT_HERSHEY_PLAIN, 1, 16, null);
Expand All @@ -561,7 +567,8 @@ else if(mCurrentState == State.FLASHING){
mRandomGenerator.nextInt((int)(mRgba.height() - mTextSize.height)));
Imgproc.putText(mRgba, mCurrentFlashText, mTextOrigin, Core.FONT_HERSHEY_PLAIN, mWidthScale, SCREEN_COLOR_BLACK, 16);
}
Core.flip(mRgba.t(), mTempRgba, 1);
tempT = mRgba.t();
Core.flip(tempT, mTempRgba, 1);
}
else if(mCurrentState == State.WAITING){
mTempRgba.setTo(SCREEN_COLOR_BLACK);
Expand All @@ -575,7 +582,8 @@ else if(mCurrentState == State.WAITING){
}
}
else if(mCurrentState == State.POSTING){
Core.flip(mTempRgba.t(), mRgba, 0);
tempT = mTempRgba.t();
Core.flip(tempT, mRgba, 0);
Imgproc.cvtColor(mRgba, mRgba, Imgproc.COLOR_BGR2RGB);

String selfieFilename = SELFIE_FILE_NAME+(System.currentTimeMillis()/1000)+".jpg";
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 4f5eb8f

Please sign in to comment.