What is the world's best camera?
Most Popular Cameras in the Flickr Community
Mobile phones have cameras built in that rival the best point and shoot cameras out there. Some even have optical zoom, built-in flashes and so on.
Not only capture but … (capture, storage, editing, viewing, sharing)
Impossible before, possible now:
Polaroid Android and Samsung Galaxy Camera
Say, Can You Make Phone Calls on That Camera?
What about?
The rise of the camera-phone
Everywhere you go these days, there are people with camera-phones – many of us record, document, and upload the minutae of our lives. But, ultimately, should we be doing it just because we can?
Why are we compelled to document everything? Are we missing anything in the process?
What about privacy? Activism/Protest? Surveillance?
Illicit photos?
Vancouver Riot Identify Suspects
Arab Spring
How to Remove Location Information from Mobile Photo
Intent i = new Intent (android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(i, CAMERA_RESULT);
protected void onActivityResult(int requestCode, int resultCode, Intent intent) { ... Get Bundle extras = intent.getExtras(); Bitmap bmp = (Bitmap) extras.get("data"); ....
File imageFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/myfavoritepicture.jpg"); Uri imageFileUri = Uri.fromFile(imageFile); Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri); startActivityForResult(i, CAMERA_RESULT);
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); bmpFactoryOptions.inSampleSize = 8; Bitmap bmp = BitmapFactory.decodeFile(imageFilePath, bmpFactoryOptions);
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); bmpFactoryOptions.inJustDecodeBounds = true; Bitmap bmp = BitmapFactory.decodeFile(imageFilePath, bmpFactoryOptions); int heightRatio = (int)Math.ceil(bmpFactoryOptions.outHeight/(float) currentDisplay.getHeight()); int widthRatio = (int)Math.ceil(bmpFactoryOptions.outWidth/(float) currentDisplay.getWidth()); if (heightRatio > 1 && widthRatio > 1) { if (heightRatio > widthRatio) { bmpFactoryOptions.inSampleSize = heightRatio; } else { bmpFactoryOptions.inSampleSize = widthRatio; } } bmpFactoryOptions.inJustDecodeBounds = false; bmp = BitmapFactory.decodeFile(imageFilePath, bmpFactoryOptions);
<uses-permission android:name="android.permission.CAMERA" />
<SurfaceView android:id="@+id/CameraView" android:layout_width="fill_parent" android:layout_height="fill_parent"></SurfaceView>
public class SnapShot extends Activity implements SurfaceHolder.Callback { SurfaceView cameraView; SurfaceHolder surfaceHolder; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); cameraView = (SurfaceView) this.findViewById(R.id.CameraView); surfaceHolder = cameraView.getHolder(); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); surfaceHolder.addCallback(this); } public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {} public void surfaceCreated(SurfaceHolder holder) {} public void surfaceDestroyed(SurfaceHolder holder) {}
Camera camera; public void surfaceCreated(SurfaceHolder holder) { camera = Camera.open(); try { camera.setPreviewDisplay(holder); } catch (IOException exception) { camera.release(); } camera.setDisplayOrientation(90); camera.startPreview(); } public void surfaceDestroyed(SurfaceHolder holder) { camera.stopPreview(); camera.release(); }
public class SnapShot extends Activity implements SurfaceHolder.Callback, Camera.PictureCallback { ... public void onPictureTaken(byte[] data, Camera camera) { Uri imageFileUri = getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, new ContentValues()); try { OutputStream imageFileOS = getContentResolver().openOutputStream(imageFileUri); imageFileOS.write(data); imageFileOS.flush(); imageFileOS.close(); } catch (FileNotFoundException e) { } catch (IOException e) {} } public void onCreate(Bundle savedInstanceState) { ... cameraView.setFocusable(true); cameraView.setFocusableInTouchMode(true); cameraView.setClickable(true); cameraView.setOnClickListener(this); } public void onClick(View v) { camera.takePicture(null, null, null, this); }
File imageFile1; File imageFile2; int currentPicture = 1; public void onPictureTaken(byte[] data, Camera camera) { try { File imageFile = File.createTempFile("doubleexposure", ".jpg"); FileOutputStream imageFileOS = new FileOutputStream(imageFile); imageFileOS.write(data); imageFileOS.flush(); imageFileOS.close(); if (currentPicture == 1) { imageFile1 = imageFile; currentPicture++; camera.startPreview(); } else if (currentPicture == 2) { imageFile2 = imageFile; cameraView.setVisibility(View.INVISIBLE); ...
<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <SurfaceView android:id="@+id/CameraView" android:layout_width="fill_parent" android:layout_height="fill_parent"> </SurfaceView> <ImageView android:id="@+id/DoubleExposureView" android:layout_width="fill_parent" android:layout_height="fill_parent"> </ImageView> </FrameLayout>
BitmapFactory.Options bmpFactoryOptions = new BitmapFactory.Options(); bmpFactoryOptions.inJustDecodeBounds = true; Bitmap bmp = BitmapFactory.decodeFile(imageFile1.getPath(), bmpFactoryOptions); int heightRatio = (int)Math.ceil(bmpFactoryOptions.outHeight/(float)getWindowManager().getDefaultDisplay().getHeight()); int widthRatio = (int)Math.ceil(bmpFactoryOptions.outWidth/(float)getWindowManager().getDefaultDisplay().getWidth()); if (heightRatio > 1 && widthRatio > 1) { if (heightRatio > widthRatio) { bmpFactoryOptions.inSampleSize = heightRatio; } else { bmpFactoryOptions.inSampleSize = widthRatio; } } bmpFactoryOptions.inJustDecodeBounds = false; Bitmap picture1bmp = BitmapFactory.decodeFile(imageFile1.getPath(), bmpFactoryOptions); Bitmap picture2bmp = BitmapFactory.decodeFile(imageFile2.getPath(), bmpFactoryOptions);
Bitmap drawingBmp = Bitmap.createBitmap(picture1bmp.getWidth(), picture1bmp.getHeight(), picture1bmp.getConfig()); Canvas canvas = new Canvas(drawingBmp); Paint paint = new Paint();
canvas.drawBitmap(picture1bmp, 0, 0, paint);
paint.setXfermode(new PorterDuffXfermode(android.graphics.PorterDuff.Mode.MULTIPLY)); canvas.drawBitmap(picture2bmp, 0, 0, paint);
ImageView doubleExposureView = (ImageView) this.findViewById(R.id.DoubleExposureView); doubleExposureView.setImageBitmap(drawingBmp);