image recognition in android/java - java

I am developing an application in android.In this application I want to find the shape of an object in a black and white snaps. If i have a triangular object in the snap then i want to find the angle between the edges of the objects programmatically. I do not want to draw the line manually on the object and find the angle. My actual need is that scan the image and find angle of the object using objects pixel intensity.
Can anyone please suggest me how to proceed for this work.
Thanks in advance.

The OpenCV library, which can be built for Android, can perform such shape detection. Here's a tutorial about triangle and other shapes detection. It shows how to extract vertices, from which you should be able to get angles easily. It's in C# but should be easy to port to C.
I don't think that you'll find a ready-to-use OpenCV Java binding for Android. But using the Android NDK, you could encapsulate calls to the OpenCV C API, and expose a few functions in Java through JNI. A google search about "opencv android java" yields a couple of tips.

Not really sure if this is a good solution for a mobile device, but it sounds like you should use a Hough transform to find the lines, and then find a triangle using those lines.

It sounds like you need to use some Edge detection, Which is what Hough transform is part of. There are many different complex approaches to this process, but this is definitely a starting point to read up on.

Related

Android App use HED with OpenCV and Deep Learning(Java)

I am developing an android app to scan documents with my phone. I am using openCV and Canny edge detection and it works ok but if I try to scan an document on a background without enough contrast between the document and the background it fails. I have tried other apps in the Play Store and they are still able to scan the document with less contrast. So I was looking for ways to improve my edge detection and found this:
https://www.pyimagesearch.com/2019/03/04/holistically-nested-edge-detection-with-opencv-and-deep-learning/
But I can't figure out how to use HED in my Android Studio Java project. More precisely I can't find out how to create the custom layer cropping class for the neural network in Java. I was able to get the rest of the tutorial to work but I dont know how to create the custom layer cropping class.
At the moment im am registering an empty or wrong class as cropping layer and I'm getting blank images.
If any of you guys know something or can point me in the right direction I'd be very thankfull.
(edit) I did some research and apparently you have to create a class in c++ and use it in java but i can't find instructions on how to achieve this.

library to use visual attributes of faces in an image for face recognition

I am working on a project that uses visual attributes like gender, age, jaw shape, nose etc... for face recognition.But is there any library available that can do this operation?
If you want to extract faces from images, OpenCV provides a Face Recognition API which you can use to detect faces in images. JavaCV is a Java Wrapper which should allow you to interact with it.
If on the other hand, you want to match those faces to actual people then you might want to use an Artificial Neural Network. You can take a look here to get started. Alternatively, you can take a look at Neuroph's face recognition.
The good thing about neural networks is that they can be trained so that they are resilient to certain changes. Obviously pre-processing of the image will help in increasing the success rate of the face recognition.

How to get the projection and model view transforms in Android in java

I'm trying to calculate a ray in my 3D world from a tap on an Android phone screen.
I thought I could just take the projection*modelview transform and inverse it. However, getting hold of the actual matrices doesn't seem to be so straightforward as I expected in OpenGL ES.
After a good while searching around the internet, options seem to be:
Many people seem to be using a bunch of classes from an Android demo source (MatrixGrabber, MatrixTrackingGL..).
Use glGetFloatv. However this doesn't seem to exist in GL10. It seems to have been added in GL11 with some problems and with no documentation.
Implement your own matrix code.
Now it's almost two years since most of the stuff I've found was written and I find it hard to believe that google hasn't got around to make this easier for game developers on Android, so I'm assuming I'm just being blind. Is there an official or recommended way of doing this? Maybe something supported in the sdk?
Many thanks.

Drawing API for java?

I want to be able to draw and erase on an image in java (NOT javascript). Are there any APIs for that? Bonus points if i can also draw vectors, but it's not necessary. I want to use it in my program, so I'm not looking for a stand alone program. Thank you!
Why not use the graphics classes built into java? There is a simple tutorial for this here. You really just need to get a graphics context and then you can draw whatever you like on the image.
Another option would be to use Processing
diagrams and images can be drawn using an API that can produce SVG images. I can remember two API's that are capable of this. One of them is Batik and the other is SVG Salamander.

Rubik's Cube solving API in Java

I'm currently building a robot which solves a Rubik's Cube. I use an Android phone to scan the cube and I want to solve it in Android too. Is there a library which can solve a Rubik's Cube?
Thanks in advance
There is a VB 6.0 source code on this page: http://www.dutchthewiz.com/vb/games/
Porting the algorithm to Java will not be that difficult.
The problem comes in what type of cube you are doing? 2x2, 3x3, 4x4, 5x5 etc. Each of those will use the same algorithm to switch corners and edge pieces, however the trickier part will come with the center blocks.
http://www.wrongway.org/cube/solve.html is a good site to go to, you might be able to talk to the author about his algorithms.
http://www.swinburne.edu.au/ict/videos/media/Rubiks_cube_robot_480X270.html is another interesting site.
Don't be afraid to talk to people who have developed these ideas and solutions. They are sometimes willing to help you design yours.
Check out:
http://sourceforge.net/projects/rubikcube3x3pac/

Categories