Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Ear recognition
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Boston University
Ear recognition
Commits
ecbc12ff
Commit
ecbc12ff
authored
Oct 08, 2015
by
Josejulio Martínez Magaña
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed the way to create the temp file, to use the Image utility method to create a temp file.
parent
aed65324
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
27 deletions
+16
-27
ActivityEarCapture.java
...n/java/com/aluxoft/earrecognition/ActivityEarCapture.java
+16
-27
No files found.
app/src/main/java/com/aluxoft/earrecognition/ActivityEarCapture.java
View file @
ecbc12ff
...
...
@@ -6,17 +6,26 @@ import android.content.Intent;
import
android.database.Cursor
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Environment
;
import
android.util.Log
;
import
android.view.View
;
import
android.view.View.OnClickListener
;
import
android.widget.Button
;
import
android.widget.Toast
;
import
com.aluxoft.earrecognition.utils.ImageUtils
;
import
org.apache.commons.io.FileUtils
;
import
org.opencv.highgui.Highgui
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
ActivityEarCapture
extends
Activity
{
...
...
@@ -76,13 +85,13 @@ public class ActivityEarCapture extends Activity {
public
void
onClick
(
View
v
)
{
Intent
i
=
new
Intent
(
android
.
provider
.
MediaStore
.
ACTION_IMAGE_CAPTURE
);
try
{
location
=
File
.
createTempFile
(
"image"
+
System
.
currentTimeMillis
(),
".jpg"
);
location
=
ImageUtils
.
createTempImageFile
(
);
}
catch
(
IOException
e1
)
{
// TODO Auto-generated catch block
e1
.
printStackTrace
();
return
;
}
// if this gets modified, the onActivityResult in
// FormEntyActivity will also need to be updated.
i
.
putExtra
(
android
.
provider
.
MediaStore
.
EXTRA_OUTPUT
,
Uri
.
fromFile
(
location
));
...
...
@@ -92,7 +101,7 @@ public class ActivityEarCapture extends Activity {
Toast
.
makeText
(
ActivityEarCapture
.
this
,
"No Camera"
,
Toast
.
LENGTH_SHORT
).
show
();
}
}
});
if
(
this
.
getLastNonConfigurationInstance
()
!=
null
)
{
...
...
@@ -114,31 +123,10 @@ public class ActivityEarCapture extends Activity {
if
(
location
==
null
||
!
location
.
exists
())
{
location
=
null
;
}
else
{
String
path
=
location
.
getAbsolutePath
();
EarIdentifier
identifier
=
new
EarIdentifier
(
null
);
Intent
intent
=
new
Intent
(
"com.auriclon.activity_sift"
);
File
file
=
new
File
(
location
.
getAbsolutePath
()
+
".jpg"
);
InputStream
input
=
null
;
OutputStream
output
=
null
;
try
{
input
=
new
FileInputStream
(
location
);
output
=
new
FileOutputStream
(
file
);
byte
[]
buf
=
new
byte
[
1024
];
int
bytesread
;
while
((
bytesread
=
input
.
read
(
buf
))
>
0
)
{
output
.
write
(
buf
,
0
,
bytesread
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
input
.
close
();
output
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
intent
.
putExtra
(
"image_path"
,
file
);
intent
.
putExtra
(
"image_path"
,
path
);
startActivity
(
intent
);
}
}
...
...
@@ -167,4 +155,5 @@ public class ActivityEarCapture extends Activity {
public
Object
onRetainNonConfigurationInstance
()
{
return
this
;
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment