I want to create a simple game for android which is supposed to use a camera. The thing is that I don't really care about the resolution of the picture, what meters to me is speed. I need the picture to be taken the moment a key is pressed. Ideal solution would be to use a frame from camera preview. I need this picture as a table of data for analysis, I don't need a file.
Is this possible to get a single frame form camera/video camera preview?
Or maybe it's easier to get a low resolution picture?
Can you tell me which function would be useful here, and maybe give a short example?
How can I get access to picture data using such a function?
Thanks in advance!
Bye
You may find the ZXing barcode scanner's source code helpful.
Related
I am making an application where the user has to be suggested about the quality of the picture he is about to take.
Like "Brightness is low" and "Your environment is dim".
To achieve this, we need to put an overlay message on the camera preview while the user is viewing the subject.
Does anyone have an idea on how could we take the image brightness from the camera preview by using sensors or some other way in live mode even before the picture is taken?
Any help would be appreciated.
Using the camera parameters as pointed out by #appleskin, would either of these methods help? setWhiteBalance() or setExposureCompensation().If you want to achieve this functionality at run time then use native NDK effect for brightness.you can easily got .so files from github just use according to your further requirement.
I am looking for some kind of auto trim/crop functionality in android.
Which detects a object in captured image and creates a square box around object for
cropping. I have found face detection apis in android, but my problem is captured images are documents/pages not human faces so how can I detected documents or any other object from captured picture.
I am thinking of any algorithms for object detection or some color detection. Is there any apis or libraries available for it.
I have tried following link but not found any desired output.
Find and Crop relevant image area automatically (Java / Android)
https://github.com/biokys/cropimage
Any small hint would also help me alot. Please help. Thanks in advance
That depends on what you intend to capture and crop, but there are many ways to achieve this. Like littleimp suggested, you should use OpenCv for the effect.
I suggest you use edge-detection algorithms, such as Sobel, and perform image transformation on it with, for example, a Threshold function that will turn the image into a binary one (only black and white). Afterwards, you can search the image for the geometric shape you want, using what's suggested here. Filter the object you want by calculating the detected geometric figure's area and ratio.
It would help a lot to know what you're trying to detect in an image. Those methods I described were the ones I used for my specific case, which was developing an algorithm to detect and crop the license plate from a given vehicle image. It works close to perfect and it was all done by using OpenCV.
If you have anything else you'd like to know, don't hesitate to ask. I'm watching this post :)
Use OpenCV for android.
You can use the Watershed (Imgproc.watershed) function to segment the image into foreground and background. Then you can crop around the foreground (which will be the document).
The watershed algorithm needs some markers pre-defining the regions. You can for example assume the document to be in the middle of the image, so create a marked region in the middle of the image to get the watershed algorithm started.
I want to use QR code to get the smart phone's location (either UTM or Lat/Lon). Reading this article, it looks like it is possible to get the position of the smart phone. In addition, I want to render some 3D models on the camera screen. Is it possible? Actually I have no clue from where should I start.
Can anyone help me out regarding this?
Thanks.
If you read that article carefully, all it suggests to get the location of the phone, is to simply encode the lat/lon in the QR code itself. This will only work if the location of the displayed QR codes are fixed (e.g. a sticker on a wall rather than printed on a flyer).
Is it possible to render 3D models on a camera screen? Sure. It wouldn't be the default camera app, you'd have to make your own. It would involve a fair bit of math if you wanted to position the 3D model relative to the QR code. You'd probably try to build planes based on the sides of the squares.
I want to develop a camera demo app using the following web page example.
http://marakana.com/forums/android/examples/39.html
After taking a photo, I want to display the captured image in the main activity. How can I do this? Thanks.
Best to use another example. I can't get this one to work. Judging by the other Camera questions in SO, I think lots of people have the same problem. But before you give up on Marakana's example completely, try moving the elements OUTSIDE the element. And include the Marko forgot.
By doing that, I got past the RuntimeException, and now get a completely different error, one I think is specific to my phone: it is trying to create a Preview with an 'invalid preview size' of 480x604. But Marko's code sets the size from the size of the preview surface created,, so the phone itself is defaulting to an invalid size for the Preview surface.
I'm currently looking into creating an app that takes a picture using the phone's camera. The app will be used for clients that are pre-op for breast augmentation. The user will be able to take a picture of themselves then place two shperes over the picture, then with a slidebar manipulate the size of the spheres. This will give the user an idea which cup size they would like. I understand that there is something in photoshop that has the desired effect and this is what i'm trying to replicate but on the bitmap image.
Are there any suitable libraries out there that i can use. I'm looking into OpenGL as that is for 3D graphics.
Any ideas and input would be appreciated.
thanks Mat.
Java does have it's own 2D and 3D APIs. Hopefully you can these to achieve your goal?