Preserve meta information while Crop or Scale - android

I capture Image in my camera application (in app camera) and save it to the file system. In file system, it shows me all the meta details like resolution, ISO, Aperture, Date, rotation etc. when I press "Details" button.
But when I crop the same image i lost all this meta information. How can preserver this information in cropped version too.

I haven't tried this class personally but it looks like it will do what you need.
http://developer.android.com/reference/android/media/ExifInterface.html
You'll need to get all the attributes you want from the original image file, and save them on your cropped copy. Good luck!

Related

How to crop image with known path based on user selection

in my app I capture a photo using intent MediaStore.ACTION_IMAGE_CAPTURE and I save image into external storage that is private to my app. I also save the path to taken picture.
In next step I would like to crop 3 pictures from this photo but I cannot figure out how to do it. I found this article Crop an Image by passing the image file path in Android but the answer uses com.android.camera.action.CROP, which is often not supported. I would like to crop it like this
Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.xyz);
resizedbitmap1=Bitmap.createBitmap(bmp, 0,0,yourwidth, yourheight);
but I need to crop picture according to user selection. Can anyone help me with this? I am pretty stuck here.
So I ended up using some third party library for cropping pictures. I recommend you to do the same. You will find plenty of them on github, choose according to your preferences.

Fingerprint scanner using camera of android device

I m trying to implement, capture finger image and then scan that image and get the biometric fingerprints from that image and then finaly sending that image to server.
Basically i dont have idea to work on image processing of these. so i tried Onyx SDK and the problem solved. but its a trail version. Now i need to know what are the proces undergoes inorder to get biometic image of finger, like cropping, inverting, contrasting, etc .
Can anyone tell me the steps to undergone for image processing. Or anyother open source sdk for fingerprint sensor. Ur help is much appreciated.
I m just trying to do something like this.
say img one is captured image and imge two is after reconizing the biometric fingerprint
Basically what you need to do is "match" two images of fingertips: one is the original image of the authorised user's fingertip and the other one is the image of the fingertip the camera just captured.
If the two images "match" then the camera captured the authorised user's fingertip and you shall let her in, otherwise access is to be denied.
Here's the steps I'd fallow to evaluate "matching" between to fingertip images:
Crop the essential part: you can crop an area at the center of the image, or put a square area in overlay on the CameraPreview and ask the user to capture the camera image when this square area is completely covered by her fingertip. Then crop out what's inside that square.
Equalize the cropped image: equalization gives more contrast and betters the image in general.
Detect edges: by detecting edges you'll obtain something like the black and white image you posted, with only the fingerprint lines showing.
Apply SIFT: with SIFT you extract "features" which are Scale-invariant (alsto rotation, tilt, light...-invariant) representations of points in your image. Using these features you can compare two images: they match if features can be found in both images.
Let's give a little practical example
Step 1: Original image
Here's the original user's fingertip image
Step 2: Cropping
We crop it to just the fingertip
Step 3: Equalization
We equalize the cropped image
Step 4: Edges
We find the edges
Now we can save this image and keep it for future authentication reference.
Step 5: New image captured
When a new image of a fingertip is acquired by the camera
Step 6: Process new image
We process it just like the original one
Step 7: Matching
Finally we use SIFT to match the original image wit the new one
See that, even if some point is mismatched (10%), most of them (90%, the big central group) matches correctly. In this example SIFT finds 20 points of match, you could also set a threshold for feature quality which improves matches.
With Android
To do all this stuff with Android, you could use the OpenCV Android Library which has utils for pretty much everything, including SIFT
Hope this helps.

Take a picture in android using android camera

I have a surface view, 3 buttons one each for capture, use(invisible) and retake(invisible). I am using the Camera to take a picture. On image capture, use and retake buttons become visible and capture goes invisible. How to save the image in SD card on clicking the use button. Can anyone help with any example code. ??
Inshort I dont want to skip retake and skip option after capturing a pic in android !!! No use of intents !! only using android camera
How to skip 'retake and use' option after captureing photo from camera
Here is a nice tutorial on taking picture in Android: http://www.vogella.com/tutorials/AndroidCamera/article.html
In the nutshell, after you call Camera.takePicture(), a onPictureTaken() callback is called with jpeg image in byte[]. You convert this image to bitmap (preferably scaled down) for display, and you can write this byte[] as is to a .jpg file if the user likes it.

Android high res photo using camera preview

Is it possible to programmatically take a picture in full/high resolution? I use the camera preview and surface with some custom overlay content. The problem is that the takePhoto function returns data only in preview size low resolutions.
Even if I check the getSupportedPictureSizes the resolutions that are listed are far from the 5Mpix that is the max supported resolution by the system camera. So the question is can I take a photo in max resolution and use custom camera preview or I have to call the system camera Intent to have a full res photo?
Yes you can, you should setPictureSize(), see https://github.com/alexcohn/JBcamera for example.
PS Thanks, Benjamin, for drawing my attention back to this question. if I understand correctly, the author was upset with the resolution of data array returned from IMAGE_CAPTURE intent. But this is only the thumbnail; the actual hi-rez imagis writn to file. You can find this Jpeg file and load it into your app, in onActivityResult()
By default I think it is set to a low resolution. To change this call MediaStore.EXTRA_OUTPUT in your intent. See here for more detail:
http://developer.android.com/reference/android/provider/MediaStore.html#ACTION_IMAGE_CAPTURE

Saving a camera's preview to a bitmap

I need a little help with getting my camera to work right.
What I'm trying to do is have the user take a picture that will then be used in another activity as the view's background. It is important not to have any skewing, and ideally the image would fill the entire background with the highest resolution possible.
I've been having a heck of a time trying to get the outputted picture of my camera to be oriented properly and be the same aspect of the display. So I took some time to think of exactly what I needed to do, and I don't think I need the normal saved image at all.
What I came up with is that I need a surface view to display the preview, and an overlay for some text and a capture button. When the user "takes the picture" it should autofocus, and then I need to capture the preview (under the screen overlays) to a bitmap to use in the other activity.
*Should I extend a SurfaceView for my preview and add it to a XML layout that contains the overlays?
*How do I save the SurfaceView's image to a bitmap?
Thanks.
Matt,
One basic question ,and excuse my naivety, wouldnt it just be easier to use the built in camera to the Android through an Intent? It is doable, I've done it before.
Apparently, there is no good way to convert the image format of the preview frames to a jpeg, so I ended up selecting the size for the camera to take by going through each of the camera's supported resolutions and getting the closest match the the screen aspect with the highest resolution.
Because the camera.setRotation method doesn't seem to do anything, I just rotate the image 90 with a matrix before saving it to the card if I am in portrait mode.

Categories

Resources