Android App use HED with OpenCV and Deep Learning(Java) - 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.

Related

How can I do face recognition of two images using opencv java in android

I'm trying to create a face recognition application in android studio in java language. I spent considerable amount of time, searching for step by step guides for achieving this function. I found many tutorials for python language and i couldn't find any proper tutorial or atleast a video tutorial for java.
Can someone please provide me with a proper link with the steps to do face recognition with OpenCv in android using java language.
I'm new to OpenCv, so i have no big idea on its functions.
Your help is highly appreciated
Update 1 ::
I'm trying to capture the image of the user and then cross check the taken image with an image that is already available in the gallery.
I want to know if both are the same so that i can allow the user to use the application.
I actually made a Java program that utilised OpenCV for facial recognition earlier this year.
For me it was an utter nightmare. Guides to doing this on Java are basically nonexistent and the documentation for Java OpenCV is very poor.
What I ended up doing to get to grips with OpenCV was I used PyImageSearch to learn how OpenCV works and then just trawled through the OpenCV javadocs until I found the most similar classes to what was being used in PyImageSearch.
There are a few guides for OpenCV recognition using Java (I'll have a look through my notes when I get a chance and see if I saved any links for my own reference) but none of them were for what I needed.
If you edit your post with some more information on the recognition you're trying to do (video or jpeg or png?; frontal faces or side faces?; specific faces or faces in general?) I may be able to help a little more.
The Youtube link that #Varma posted might help you get to grips with OpenCV as a whole, but that series doesn't seem to cover facial recognition.
EDIT #1
Okay, recognising who someone is via an image is definitely doable with OpenCV, but it's not something I've done. Here's a PyImageSearch page on how to do it in Python. The methodology for doing it in Java with OpenCV will most likely be more or less the same even thought the syntax will - of course - make it look very different (should mostly be a matter of finding the equivalent Java classes and methods).
If it proves difficult, there are alternatives to OpenCV you could use, like these or Google's API. Keep in mind though that facial recognition is not very secure and does come with some controversy.

Android Camera preview with funhouse mirror effect

I created a android small app that uses the front facing camera to shoot a selfie. But what i want to accomplish is a funhouse mirror effect.
I searched the internet trying to find a solution or a way to do this but i am guessing i am searching for the wrong terms here:
Sample Image
Can someone push me in the right direction or how this is made? I searched for morphing, distortion etc.
What i have right now:
A basic camera app wich is saving a taken photo using the Camera2 API in Android SDK 23
Just only Camera2 API are not enough to develop an app which is like mentioned you. You should use computer vision libraries such as OpenCV or OpenGL.
First of all, please check it out for creating theoretical background.
Here is an example application which is using OpenCV and it is about funny effects.
This can be another reference application which is about fun house effects and it was developed by using GLSL.
Also this post can be helpful for you.
Moreover, you can check it and it out. And, you can use "image warping" term to search to find solutions for your problem on internet.

3d effects in android and Iphone

We have a lot of days of research but can't find a solution for the following project. We need to convert a flux project to IOS and android native app. But as flux supports flash scripting it has easily implementing some 3d effects like shadow, emboss gradient etc. Please check the link here for seeing the swf file we have. We need to convert all this features into a native IOS and android app. We have research some area and found that most of the item we can implement except one icon here. The fourth icon have some 3d effects, shadow effects, border, emboss, contour and gradient etc. Can anybody check on this and guide us whether this can be implemented in IOS and android. I am pasting the entire url here again http://projects.zoondia.org/signfabcreator/signCreator.swf. Please check and let me know if this is possible. Let me if this is possible or not. If yes it will be helpful for me if anybody can give me a clue about implementing those in both android and ios
Very interesting! But I'm afraid you have to reimplement all this functionality by yourself. Don't be upset. There are good news for you - OpenGL ES and GLSL are extremely portable. So you can reuse 100% of your shaders. What is even better now you can share the other code too and stay native. Not long ago Intel announced the Multi-OS Engine. It enables you to develop native mobile applications for iOS and Android with Java. There are a bunch of tutorials inside installation package. One of them is especially dedicated to cross-platform OpenGL capabilities. Please check out my OpenGLBox sample.

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.

Detecting and cropping a face from an picture?

I am working on a Face Recognition system for my internship. I am developing the project in Java right now. I am using OpenCV library, but it does not seem to work correctly in detecting faces.
I am at a point, where I capture image from the desktop and store it on the hard drive.
All I want now is to detect a face in that image (NOT IDENTIFY). I just need to detect that face and crop it.
Please help me with it. If anyone has specific code in Java to detect faces in a images, please send me that too.72236
This library already has face detection built in. You'd probably be better off using it.

Categories