Android Crop during capturing image - android

i want to crop a image during capture not after capture.
like this image.
just replace save button with capture.
the rectangle should be realizable.just like the crop activity.
the thing i was doing was.
1st=capture image.
2nd=crop.
now i want to crop image during capture.
any help???

This is possible, Just think a different approach. Make a trick with camera preview. Taking a picture usually requires that your users see a preview of their subject before clicking the shutter. To do so, you can use a SurfaceView to draw previews of what the camera sensor is picking up. Now create a viewFinder for your camera capture activity. Now your make the compatible code to change the viewFinder size dynamically, which allow you to select the region. And finally save the Image from bitmap view inside ViewFinder. This is exactly what you want.
Please ask if you have not got my point. Best of luck.

Related

Android camera ensure fast response onPictureTaken

I have created a custom camera activity (pretty much followed the Android tutorial)
I implemented a SurfaceView to use a preview and an ImageView to display the image taken on OnPictureTaken
Picture taken takes a while to show up and differs from the preview in terms of aspect ratio, size, lighting, white balance. (probably I didn't set the params properly). The quality of the picture doesn't really matter to me. I just want the app to be responsive, ie still picture shows up immediately, and is identical to the preview.
So what I ended up doing was remove the ImageView and only have the SurfaceView. When the camera button is clicked, I stopPreview(). However, now I don't know how to save the SurfaceView content to bitmap/file. From what I read there isn't really a way to SurfaceView to return a bitmap.
What would be a better way to implement the camera? To reiterate, I need to be able to get a bitmap that is identical to the preview, and have that still image shown to the user immediately.

android capture portion of camera view

I come up to you because I have a big problem.
I would like to capture only a portion of the camera view.
I basically want something like this :
I tried to do the same with AndroidStudio, by adding a picture on the screen, here is the result :
It's ugly but it was just to try.
You basically need to put your face into the transparent area, and then click on "take picture". I would like the camera to not take the black part.
How is it possible ? Is it possible to create a kind of mask for the camera ?
I have in mind that in this case, I'll need to take the entire picture and scale it correctly by software. But then, I have to do it differently for every screen sizes. It looks incredibly difficult.
Instead, is it possible to directly modify the cameraView (SurfaceView, or SurfaceHolder) so that I won't need the image, and the picture will automatically fit the "mask" because it's actually the only thing the camera see.
Have you got some clues ?
thank you very much !
The camera sees whatever enters its lens. You cannot "make" it see only a certain shape out of its normal rectangle (unless you tape some black paper over it :)). The cropping is always done after the picture is taken. The SurfaceView and SurfaceHolder are just tools to help you present the picture (which can be already modified, if you want it to) on the phone screen.
No you cannot mask camera capture. You can apply the mask to result. Note that often you get still picture at a resolution much higher than what you use for preview. And preview resolution is not the same as screen resolution (which you should use to put the black mask on the screen). In such case, your postprocessing mask should match the picture resolution and not the preview resolution.

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 Camera - Can we take a part of an image from the full screen

I want to take an particular part of an image from the image preview. Is it possible, if so how to do that?
for ex,
I just want to show some limit to the user, so they can take partial part of an image. How to show my surface view like the given above picture and how to take particular part of an image??
Thanks is in advance.
I don't know of any way to capture less than the full preview. You could display the crop marks as an overlay, and retrieve that portion of the bitmap in post-processing after you capture the image.

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