Skip to content

Commit

Permalink
Beta Release 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
w9jds committed Mar 1, 2014
1 parent 073d506 commit b62cd13
Show file tree
Hide file tree
Showing 152 changed files with 326 additions and 300 deletions.
Empty file modified .idea/.name
100644 → 100755
Empty file.
Empty file modified .idea/compiler.xml
100644 → 100755
Empty file.
Empty file modified .idea/copyright/profiles_settings.xml
100644 → 100755
Empty file.
Empty file modified .idea/encodings.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/google_play_services.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/gson_2_2_2.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/mobileservices_1_1_0.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/opencv_library___2_4_8.xml
100644 → 100755
Empty file.
Empty file modified .idea/misc.xml
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions .idea/modules.xml
100644 → 100755

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

Empty file modified .idea/scopes/scope_settings.xml
100644 → 100755
Empty file.
Empty file modified .idea/uiDesigner.xml
100644 → 100755
Empty file.
Empty file modified .idea/vcs.xml
100644 → 100755
Empty file.
452 changes: 169 additions & 283 deletions .idea/workspace.xml
100644 → 100755

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Gallery4Glass.iml
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<orderEntry type="library" name="google-play-services" level="project" />
<orderEntry type="library" name="gson-2.2.2" level="project" />
<orderEntry type="library" name="mobileservices-1.1.0" level="project" />
<orderEntry type="module" module-name="OpenCV Library - 2.4.8" />
<orderEntry type="module" module-name="OpenCV-2.4.8" />
</component>
</module>

Binary file modified out/production/Gallery4Glass/Gallery4Glass.apk
Binary file not shown.
Binary file modified out/production/Gallery4Glass/Gallery4Glass.unaligned.apk
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 added out/production/OpenCV-2.4.8/org/opencv/R$attr.class
Binary file not shown.
Binary file added out/production/OpenCV-2.4.8/org/opencv/R$id.class
Binary file not shown.
Binary file not shown.
Binary file added out/production/OpenCV-2.4.8/org/opencv/R.class
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.
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package org.opencv.engine;

/**
* Class provides a Java interface for OpenCV Engine Service. It's synchronous with native OpenCVEngine class.
*/
interface OpenCVEngineInterface
{
/**
* @return Returns service version.
*/
int getEngineVersion();

/**
* Finds an installed OpenCV library.
* @param OpenCV version.
* @return Returns path to OpenCV native libs or an empty string if OpenCV can not be found.
*/
String getLibPathByVersion(String version);

/**
* Tries to install defined version of OpenCV from Google Play Market.
* @param OpenCV version.
* @return Returns true if installation was successful or OpenCV package has been already installed.
*/
boolean installVersion(String version);

/**
* Returns list of libraries in loading order, separated by semicolon.
* @param OpenCV version.
* @return Returns names of OpenCV libraries, separated by semicolon.
*/
String getLibraryList(String version);
}
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 added out/production/OpenCV-2.4.8/org/opencv/ml/Ml.class
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.
3 changes: 2 additions & 1 deletion project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is automatically generated by IntelliJ IDEA
# Project target.
target=Google Inc.:Glass Development Kit Sneak Peek:15
android.library.reference.1=../workspace/OpenCV Library - 2.4.8
android.library.reference.1=../../SDKs/OpenCV-2.4.8-android-sdk/sdk/java


132 changes: 120 additions & 12 deletions src/com/w9jds/gallery4glass/EffectActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.imgproc.Imgproc;

Expand Down Expand Up @@ -62,8 +63,9 @@ protected void onCreate(Bundle savedInstanceState)
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_effect);

// OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_2, this, mLoaderCallback);
//start openCV manager
OpenCVLoader.initDebug();

maManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

Intent iThis = getIntent();
Expand Down Expand Up @@ -99,8 +101,8 @@ private void setMainView()
malsEffects.add(getString(R.string.grayscale_effect));
malsEffects.add(getString(R.string.sepia_effect));
malsEffects.add(getString(R.string.invert_effect));
malsEffects.add(getString(R.string.emboss_effect));
malsEffects.add(getString(R.string.engrave_effect));
malsEffects.add("Canny");
malsEffects.add("Pixelize");
malsEffects.add(getString(R.string.sharpen_effect));


Expand Down Expand Up @@ -177,12 +179,14 @@ protected Boolean doInBackground(Void... params)
case 2:
bitMain = toInvert(mcpPaths.getCurrentPositionPath());
break;
// case 3:
case 3:
bitMain = toCanny(mcpPaths.getCurrentPositionPath());
// bitMain = toEmboss(mcpPaths.getCurrentPositionPath());
// break;
// case 4:
break;
case 4:
bitMain = toPixelize(mcpPaths.getCurrentPositionPath());
// bitMain = toEngrave(mcpPaths.getCurrentPositionPath());
// break;
break;
case 5:
bitMain = toSharpen(mcpPaths.getCurrentPositionPath());
break;
Expand All @@ -199,8 +203,16 @@ protected Boolean doInBackground(Void... params)

String[] saPath = mcpPaths.getCurrentPositionPath().split("/|\\.");

//create a new file with the added _x for the vignette to be stored in
java.io.File fImage = new java.io.File(path, saPath[saPath.length - 2] + "_" + malsEffects.get(mnEffect) + ".jpg");
//create new file
File fImage;

if (malsEffects.get(mnEffect).length() > 6)
//create a new file with the added _effectname for the vignette to be stored in
fImage = new File(path, saPath[saPath.length - 2] + "_" + malsEffects.get(mnEffect).substring(0,6) + ".jpg");
else
//create a new file with the added _effectname for the vignette to be stored in
fImage = new File(path, saPath[saPath.length - 2] + "_" + malsEffects.get(mnEffect) + ".jpg");

//create an output stream with the new file
FileOutputStream fOut = new FileOutputStream(fImage);

Expand All @@ -209,9 +221,6 @@ protected Boolean doInBackground(Void... params)
fOut.flush();
fOut.close();

//store the new file
MediaStore.Images.Media.insertImage(mcContext.getContentResolver(), fImage.getAbsolutePath(), fImage.getName(), fImage.getName());

//add to media scanner
new SingleMediaScanner(mcContext, fImage);
}
Expand Down Expand Up @@ -292,6 +301,105 @@ public Bitmap toSharpen(String sPath)
return bSharpen;
}

public Bitmap toCanny(String sPath)
{
Mat mOriginal = new Mat();

Utils.bitmapToMat(BitmapFactory.decodeFile(sPath), mOriginal);

Mat mIntermediateMat = new Mat();

Imgproc.Canny(mOriginal, mIntermediateMat, 80, 90);
Imgproc.cvtColor(mIntermediateMat, mOriginal, Imgproc.COLOR_GRAY2BGRA, 4);

Bitmap bCanny = Bitmap.createBitmap(mOriginal.width(), mOriginal.height(), Bitmap.Config.RGB_565);

Utils.matToBitmap(mOriginal, bCanny);

return bCanny;
}

public Bitmap toPixelize(String sPath)
{
Mat mOriginal = new Mat();
//bring in the bitmap into the mat
Utils.bitmapToMat(BitmapFactory.decodeFile(sPath), mOriginal);
//intermediate mat
Mat mIntermediateMat = new Mat();

Imgproc.resize(mOriginal, mIntermediateMat, new Size(), 0.1, 0.1, Imgproc.INTER_NEAREST);
Imgproc.resize(mIntermediateMat, mOriginal, mOriginal.size(), 0., 0., Imgproc.INTER_NEAREST);

Bitmap bPixelize = Bitmap.createBitmap(mOriginal.width(), mOriginal.height(), Bitmap.Config.RGB_565);

Utils.matToBitmap(mOriginal, bPixelize);

return bPixelize;

}

// public Bitmap toPosterize(String sPath)
// {
// Mat mOriginal = new Mat();
//
// Utils.bitmapToMat(BitmapFactory.decodeFile(sPath), mOriginal);
//
// Mat mIntermediateMat = new Mat();
//
// Imgproc.Canny(mOriginal, mIntermediateMat, 80, 90);
// mOriginal.setTo(new Scalar(0, 0, 0, 255), mIntermediateMat);
// Core.convertScaleAbs(mOriginal, mIntermediateMat, 1./16, 0);
// Core.convertScaleAbs(mIntermediateMat, mOriginal, 16, 0);
//
// Bitmap bPosterize = Bitmap.createBitmap(mOriginal.width(), mOriginal.height(), Bitmap.Config.RGB_565);
//
// Utils.matToBitmap(mOriginal, bPosterize);
//
// return bPosterize;
// }

// public Bitmap toHist(String sPath)
// {
// Mat hist = new Mat();
// int thikness = (int) (sizeRgba.width / (mHistSizeNum + 10) / 5);
// if(thikness > 5) thikness = 5;
// int offset = (int) ((sizeRgba.width - (5*mHistSizeNum + 4*10)*thikness)/2);
// // RGB
// for(int c=0; c<3; c++) {
// Imgproc.calcHist(Arrays.asList(rgba), mChannels[c], mMat0, hist, mHistSize, mRanges);
// Core.normalize(hist, hist, sizeRgba.height/2, 0, Core.NORM_INF);
// hist.get(0, 0, mBuff);
// for(int h=0; h<mHistSizeNum; h++) {
// mP1.x = mP2.x = offset + (c * (mHistSizeNum + 10) + h) * thikness;
// mP1.y = sizeRgba.height-1;
// mP2.y = mP1.y - 2 - (int)mBuff[h];
// Core.line(rgba, mP1, mP2, mColorsRGB[c], thikness);
// }
// }
// // Value and Hue
// Imgproc.cvtColor(rgba, mIntermediateMat, Imgproc.COLOR_RGB2HSV_FULL);
// // Value
// Imgproc.calcHist(Arrays.asList(mIntermediateMat), mChannels[2], mMat0, hist, mHistSize, mRanges);
// Core.normalize(hist, hist, sizeRgba.height/2, 0, Core.NORM_INF);
// hist.get(0, 0, mBuff);
// for(int h=0; h<mHistSizeNum; h++) {
// mP1.x = mP2.x = offset + (3 * (mHistSizeNum + 10) + h) * thikness;
// mP1.y = sizeRgba.height-1;
// mP2.y = mP1.y - 2 - (int)mBuff[h];
// Core.line(rgba, mP1, mP2, mWhilte, thikness);
// }
// // Hue
// Imgproc.calcHist(Arrays.asList(mIntermediateMat), mChannels[0], mMat0, hist, mHistSize, mRanges);
// Core.normalize(hist, hist, sizeRgba.height/2, 0, Core.NORM_INF);
// hist.get(0, 0, mBuff);
// for(int h=0; h<mHistSizeNum; h++) {
// mP1.x = mP2.x = offset + (4 * (mHistSizeNum + 10) + h) * thikness;
// mP1.y = sizeRgba.height-1;
// mP2.y = mP1.y - 2 - (int)mBuff[h];
// Core.line(rgba, mP1, mP2, mColorsHue[h], thikness);
// }
//
// }

@Override
protected void onPostExecute(Boolean uploaded)
Expand Down
3 changes: 0 additions & 3 deletions src/com/w9jds/gallery4glass/VignetteActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,6 @@ protected Boolean doInBackground(Void... params)
fOut.flush();
fOut.close();

//store the new file
MediaStore.Images.Media.insertImage(mcContext.getContentResolver(), fImage.getAbsolutePath(), fImage.getName(),fImage.getName());

//add to media scanner
new SingleMediaScanner(mcContext, fImage);
}
Expand Down

0 comments on commit b62cd13

Please sign in to comment.