Skip to content

Commit

Permalink
removed debugging, added privacy policy
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranbrowne committed Feb 13, 2020
1 parent 8be84e6 commit 623418d
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 28 deletions.
18 changes: 18 additions & 0 deletions PrivacyPolicy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Privacy Policy

Camera Adversaria ("the app") is an open source Android camera application written by Kieran Browne.

This page covers its privacy policy.

## Information Collection and Use

Camera Adversaria DOES NOT collect user data of any kind, with the exception of data automatically collected by Google Play. No data is transmitted by the app during usage. I do not collect data. I do not run servers. I do not keep logs. No information about your photographs, or indeed the photographs themselves is/are transmitted ever.

## Security of Data

When you take a photo with Camera Adversaria two versions are stored; one unprocessed the other processed with an adversarial filter.

The unprocessed one is stored privately on your phone; no other applications can access it. We keep this version so that you can change the amount of filtering on the processed image.

The processed image is the one viewable on the gallery view. This is part of Android's public camera roll. This means that other apps can access it. The point of this is that you can upload this version to social media or cloud storage, it is as accessible as a photo you take with any regular camera app.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.kieranbrowne.cameraadversaria

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import kotlinx.android.synthetic.main.activity_gallery.*
import java.io.*

Expand All @@ -12,7 +11,6 @@ class GalleryActivity : AppCompatActivity() {

private fun addPhotos() {
for (f in filesDir.listFiles().reversed()) {
Log.d("PATHS",f.toString())
if(f.toString().contains("""JPEG_\d+_\d+.jpg""".toRegex()))
photos.add(f)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class GalleryAdapter(private val photos: ArrayList<File>, val context: android.c
private fun loadLabelList(activity: Activity): List<String> {
val labels = ArrayList<String>()
val reader = BufferedReader(InputStreamReader(activity.assets.open("labels_mobilenet_quant_v1_224.txt")))
Log.d("CHECK", activity.assets.open("labels_mobilenet_quant_v1_224.txt").toString())
var line: String?
while (true) {
line = reader.readLine()
Expand Down Expand Up @@ -88,7 +87,7 @@ class GalleryAdapter(private val photos: ArrayList<File>, val context: android.c
for (x in 0..DIM_IMG_SIZE_X-1) {
for (y in 0..DIM_IMG_SIZE_Y-1) {
val v: Int = intValues[idx++]
//Log.d("idx", idx.toString())

imgData.putFloat( (((v shr 16) and 0xFF) - IMG_MEAN)/IMG_STD )
imgData.putFloat( (((v shr 8) and 0xFF) - IMG_MEAN)/IMG_STD )
imgData.putFloat( (((v) and 0xFF) - IMG_MEAN)/IMG_STD )
Expand All @@ -104,11 +103,9 @@ class GalleryAdapter(private val photos: ArrayList<File>, val context: android.c
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PhotoHolder {


//Log.d("LOAD", "loading model")

model = Interpreter(loadModelFile(activity))

//Log.d("LOAD", "loading labels")

labels = loadLabelList(activity)


Expand Down Expand Up @@ -236,7 +233,7 @@ class GalleryAdapter(private val photos: ArrayList<File>, val context: android.c
val bitmap = BitmapFactory.decodeFile(private_file)
val filteredBitmap = gpuImage.getBitmapWithFilterApplied(bitmap)

if(gpuImage != null) {
try {

val publicDir = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "Camera Adversaria")
val filtered = File(publicDir, "adversarial_"+private_file.split("/").last())
Expand All @@ -256,8 +253,8 @@ class GalleryAdapter(private val photos: ArrayList<File>, val context: android.c

output.close()

} else {
Log.e("ERROR", "IT was null")
} catch (e : Exception) {

}

return filteredBitmap
Expand Down Expand Up @@ -323,11 +320,6 @@ class GalleryAdapter(private val photos: ArrayList<File>, val context: android.c
}
}

if(labels?.get(0) != null)
Log.d("LABELS ", labels?.get(0))
else
Log.d("LABELS ", "no label 0")
Log.d("LABELS ", labels?.size.toString())

// ...
return labels?.get(biggestidx).toString() + " " + "%.2f".format(biggest*100.0)+"%"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,22 @@ import android.hardware.camera2.CameraCaptureSession
import java.io.File
import java.io.FileOutputStream
import android.content.Context
import android.os.Build
import android.support.annotation.RequiresApi
import android.util.Log
import android.Manifest.permission
import android.support.v4.app.ActivityCompat
import android.content.pm.PackageManager
import android.support.v4.content.ContextCompat
import android.support.v4.content.FileProvider
import android.media.ImageReader
import android.Manifest
import android.view.TextureView
import android.view.SurfaceHolder
import java.nio.ByteBuffer
import android.widget.Toast
import android.content.ContentResolver;
import android.graphics.*
import android.media.Image
import android.media.MediaScannerConnection
import android.media.ThumbnailUtils
import android.net.Uri
import android.os.Environment
import android.util.DisplayMetrics
import android.view.animation.AlphaAnimation
import android.view.animation.Animation
import jp.co.cyberagent.android.gpuimage.GPUImage
import jp.co.cyberagent.android.gpuimage.filter.GPUImageSepiaToneFilter
import com.kieranbrowne.cameraadversaria.AdversarialFilter
import java.lang.Exception


Expand Down Expand Up @@ -298,7 +287,7 @@ class MainActivity : Activity(), TextureView.SurfaceTextureListener {
open_gallery.alpha = 1.0f

} catch (e: java.io.IOException) {
Log.e("ERROR", e.toString())

} finally {

//val files = filesDir.listFiles();
Expand Down Expand Up @@ -329,7 +318,7 @@ class MainActivity : Activity(), TextureView.SurfaceTextureListener {


} catch (e : Exception) {
Log.e("ERROR", "IT was null")

}

image.close();
Expand Down

0 comments on commit 623418d

Please sign in to comment.