java.lang.OutOfMemoryError – BitmapFactory.decode(strPath)

You need to recycle Bitmap object . Bitmap bm = BitmapFactory.decodeFile(strPath); imageView.setImageBitmap(bm); After above lines of code in your get view just add the code written below ///now recycle your bitmap this will free up your memory on every iteration if(bm!=null) { bm.recycle(); bm=null; } After this also if you are getting same error the … Read more

What is the best method to capture images from a live video device for use by a Java-based application?

This JavaCV implementation works fine. CODE: import com.googlecode.javacv.OpenCVFrameGrabber; import com.googlecode.javacv.cpp.opencv_core.IplImage; import static com.googlecode.javacv.cpp.opencv_highgui.*; public class CaptureImage { private static void captureFrame() { // 0-default camera, 1 – next…so on final OpenCVFrameGrabber grabber = new OpenCVFrameGrabber(0); try { grabber.start(); IplImage img = grabber.grab(); if (img != null) { cvSaveImage(“capture.jpg”, img); } } catch (Exception e) { … Read more

How to capture image from custom CameraView in Android?

try to use Surface View for creating dynamic camera view and set in your required portion. following code try variables set Class level (Global) Button btn_capture; Camera camera1; SurfaceView surfaceView; SurfaceHolder surfaceHolder; public static boolean previewing = false; Following code in onCreate() method getWindow().setFormat(PixelFormat.UNKNOWN); surfaceView = new SurfaceView(this); surfaceHolder = surfaceView.getHolder(); surfaceHolder.addCallback(this); surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); btn_capture = … Read more

Images taken with ACTION_IMAGE_CAPTURE always returns 1 for ExifInterface.TAG_ORIENTATION on some Gingerbread devices

Ok guys, it seems like this bug for android won’t be fixed for a while. Although I found a way to implement the ExifInformation so that both devices (ones with proper Exif tag, and also improper exif tags work together).. So the issue is on some (newer) devices, there’s a bug that makes the picture … Read more

How to capture UIView to UIImage without loss of quality on retina display

Switch from use of UIGraphicsBeginImageContext to UIGraphicsBeginImageContextWithOptions (as documented on this page). Pass 0.0 for scale (the third argument) and you’ll get a context with a scale factor equal to that of the screen. UIGraphicsBeginImageContext uses a fixed scale factor of 1.0, so you’re actually getting exactly the same image on an iPhone 4 as … Read more