Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry exported="true" kind="lib" path="libs/httpmime-4.3.jar"/>
<classpathentry exported="true" kind="lib" path="libs/httpcore-4.3.jar"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin/classes"/>
</classpath>
12 changes: 9 additions & 3 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
android:versionName="1.0" >

<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="19" />
android:minSdkVersion="11"
android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.CAMERA" />

Expand All @@ -19,6 +19,8 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.RECORD_VIDEO"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>

<application
android:allowBackup="true"
Expand All @@ -40,13 +42,17 @@
android:name="edu.bupt.camera.CameraActivity"
android:label="@string/title_activity_camera"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
>
</activity>
<activity
android:name="edu.bupt.pickimg.ImagePickActivity"
android:label="@string/title_activity_image_pick"
android:screenOrientation="portrait" >
</activity>
<activity android:name="edu.bupt.camera.VideoActivity"></activity>
<activity android:name="edu.buptant.pointscloudviewer.MainActivity"></activity>
<activity android:name="edu.bupt.camera.WebCameraActivity"></activity>
<service android:name="edu.bupt.camera.FrameLifting"></service>
</application>

</manifest>
Empty file modified libs/httpcore-4.3.jar
100755 → 100644
Empty file.
Empty file modified libs/httpmime-4.3.jar
100755 → 100644
Empty file.
4 changes: 2 additions & 2 deletions project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

# Project target.
target=android-19
android.library.reference.1=../../appcompat_v7
target=android-21
android.library.reference.1=../android-support-v7-appcompat
43 changes: 43 additions & 0 deletions res/layout/activity_auto_capture.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true" >

<SurfaceView android:id="@+id/SurfaceView"
android:visibility="visible"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="match_parent">
</SurfaceView>
</FrameLayout>

<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:gravity="center">

<ProgressBar
android:id="@+id/progressBar_record_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:visibility="gone" />"

<Button
android:id="@+id/start"
android:layout_below="@id/progressBar_record_progress"
android:layout_centerInParent="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Capture" />

</RelativeLayout>
</RelativeLayout>
22 changes: 21 additions & 1 deletion res/layout/activity_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,30 @@
android:textSize="20sp"
android:text="MCC" />

<TextView android:id="@+id/title4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/bt_mcc"
android:layout_marginTop="5dp"
android:layout_marginLeft="10dp"
android:textSize="22sp"
android:textColor="#0000FF"
android:text="Reconstruction result"/>

<Button
android:id="@+id/bt_result"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/title4"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:textSize="20sp"
android:text="3D Viewer" />

<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/bt_mcc"
android:layout_below="@id/bt_result"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
Expand Down
18 changes: 18 additions & 0 deletions res/layout/frame_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/et_frame_dialog"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="1"
android:ems="10" >

<requestFocus />
</EditText>

</LinearLayout>
18 changes: 18 additions & 0 deletions res/layout/threshold_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/et_threshold_dialog"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="0.01"
android:ems="10" >

<requestFocus />
</EditText>

</LinearLayout>
18 changes: 18 additions & 0 deletions res/layout/url_dialog.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<EditText
android:id="@+id/et_url_dialog"
android:layout_width="280dp"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="10.105.32.59"
android:ems="10" >

<requestFocus />
</EditText>

</LinearLayout>
12 changes: 12 additions & 0 deletions res/layout/webcamera.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >

<SurfaceView
android:id="@+id/sView"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

</RelativeLayout>
21 changes: 21 additions & 0 deletions res/menu/main.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:id="@+id/capture_mode"
android:title="Capture Mode">
<menu >
<group android:checkableBehavior="single">
<item android:id="@+id/camera" android:title="Camera"></item>
<item android:id="@+id/video" android:title="Video" android:checked="true"></item>
</group>
</menu>
</item>
<item android:id="@+id/web_camera" android:title="Web Camera"/>
<item android:id="@+id/frame_lifting"
android:title="Frame Lifting"/>
<item android:id="@+id/peek_threshold"
android:title="Peek Threshold"/>
<item android:id="@+id/upload_url"
android:title="Upload Url"/>
<item android:id="@+id/clear_history"
android:title="Clear History"/>
</menu>
2 changes: 1 addition & 1 deletion res/values-v11/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Base application theme for API 11+. This theme completely replaces
AppBaseTheme from res/values/styles.xml on API 11+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<style name="AppBaseTheme" parent="android:Theme.Holo.Light">
<!-- API 11 theme customizations can go here. -->
</style>

Expand Down
2 changes: 1 addition & 1 deletion res/values-v14/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
AppBaseTheme from BOTH res/values/styles.xml and
res/values-v11/styles.xml on API 14+ devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
<!-- API 14 theme customizations can go here. -->
</style>

Expand Down
2 changes: 1 addition & 1 deletion res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Base application theme, dependent on API level. This theme is replaced
by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
-->
<style name="AppBaseTheme" parent="Theme.AppCompat.Light">
<style name="AppBaseTheme" parent="android:Theme.Light">
<!--
Theme customizations available in newer API levels can go in
res/values-vXX/styles.xml, while customizations related to
Expand Down
40 changes: 38 additions & 2 deletions src/edu/bupt/camera/CameraActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

import edu.bupt.mccam.MainActivity;
import edu.bupt.mccam.R;
import edu.bupt.mccam.MainActivity.MyUploadHelper;
import edu.bupt.utils.UploadHelper;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
Expand All @@ -19,10 +23,13 @@
import android.graphics.PorterDuff.Mode;
import android.hardware.Camera;
import android.hardware.Camera.AutoFocusCallback;
import android.hardware.Camera.Parameters;
import android.hardware.Camera.PictureCallback;
import android.media.ExifInterface;
import android.media.MediaScannerConnection;
import android.media.MediaScannerConnection.MediaScannerConnectionClient;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
Expand Down Expand Up @@ -94,7 +101,7 @@ public void onAutoFocus(boolean success, Camera camera) {
Log.d("AutoFocus", "success!");
if(!onTouchFocus) {
try {
camera.takePicture(null, null, mPicture);
camera.takePicture(null, null, mPicture);
} catch(Exception e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -176,12 +183,17 @@ protected void onPostExecute(File result) {
try {
ExifInterface exif = new ExifInterface(result.getAbsolutePath());
Log.d("orientation", " " + exif.getAttribute(ExifInterface.TAG_ORIENTATION));
Log.d("make", " " + exif.getAttribute(ExifInterface.TAG_MAKE));
Log.d("model", " " + exif.getAttribute(ExifInterface.TAG_MODEL));
exif.setAttribute(ExifInterface.TAG_ORIENTATION, "" + ExifInterface.ORIENTATION_ROTATE_90);
exif.saveAttributes();
} catch (IOException e) {
e.printStackTrace();
}
Toast.makeText(getApplicationContext(), "Picture saved", Toast.LENGTH_LONG).show();
File[] files = new File[1];
files[0] = result;
new PicRealtimeUpload(MainActivity.serverIp).executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, files);
newFile = result;
scanImages(result.getAbsolutePath(), false);
}
Expand Down Expand Up @@ -284,6 +296,13 @@ public void onClick(View v) {
}
}

public boolean isNetworkConnected() {
ConnectivityManager connManager = (ConnectivityManager) this
.getSystemService(CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connManager.getActiveNetworkInfo();
return networkInfo != null ? networkInfo.isConnected() : false;
}

private void scanImages(final String scanPath, final boolean open) {
conn = new MediaScannerConnection(this,
new MediaScannerConnectionClient() {
Expand Down Expand Up @@ -425,7 +444,9 @@ private void setCameraParameters(){
List<Camera.Size> picSizes = params.getSupportedPictureSizes();
Camera.Size mSize = picSizes.get(0);
for(Camera.Size s:picSizes){
if(s.width > mSize.width){
Log.d("camera_size", "w" + s.width + ",h" + s.height);
int tmp = s.width*s.height;
if(tmp > 300000 && tmp < 340000){
mSize = s;
}
}
Expand Down Expand Up @@ -468,6 +489,21 @@ private Camera.Size getOptimalPreviewSize(List<Camera.Size> sizes, int w, int h)
return optimalSize;
}

public class PicRealtimeUpload extends UploadHelper{
public String user_upload_url;

public PicRealtimeUpload(String addr) {
super(addr);
this.user_upload_url = addr;
}

@Override
protected Object doInBackground(File[]... params) {
super.uploadFile(params[0]);
return null;
}
}

@Override
protected void onPause() {
releaseCamera();
Expand Down
Loading