I need to get the area of a known object inside a scene to get the distance from that. The problem is rectifying it so that the area is independent from the angle.
I'm using opencv (on Android) with some java code that is equivalent to this:
http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html#feature-homography
In other words: how do i get the area of the object observed perpendicularly from that distance given the H matrix.
Thank you in advance and sorry for my poor english... :)
You can call cvCalibrateCamera, but am not sure if it works with one image only. The algorithm it is based upon can cope with the one image case, see section 3.1. where it says "if n=1...". So in a pinch you can re-implement it.
Related
I am trying to detect with OpenCv for Android hexagon fields of a map for a board game. The map looks something like that:
[Sample map]
I tried getting contours using only Value from HSV and I managed to get some of the hexagons, but unfortunately not all of them, I had mostly trouble detecting hexagons that had rivers or roads passing through them.
I managed to get something like that:
[Detected hexagons]
I even tried to make the borders thicker, but it didn't help a lot.
To detect all of the hexagons I thought of averaging the approximite size of the detected and then go on pixel by pixel trying to detect a change in the color (close to black). Later I would like to detect hexagons even on photos of a map, so then I couldn't really rely on the size of other hexagons.
What do you think would be the best way to solve this problem?
EDIT:
Thank you
I just began to implement your idea and it works great, for now i got the horizontal lines:
You deal with regular grid, so you just need to detect just a few, or even one, to compute all others. More will be better, because you'll be able to compute mean, and it will be more accurate. To find contours, it might be useful to find color gradient.
I'm looking for the best way(s) of getting the position of a point I touched on an image and get it's coordinates relative to the image size.
For example, I get, as the parent image, the map of a building floor. And the user need to be able to zoom in and point on the map a point that will be registered in a database in order to be retreived later.
I never really had to work with images and canvases on Android so I'm a bit confused. What might be the best approach. I already found a lot of document but couldn't find one that would fit the idea I need to develop.
Thanks in advance for you help,
Matthieu
I am looking for logic to show various location markers based on area visible through camera view of a device on android.
Something similar to attached image.
I know following things
Get location
I have all locations to be marked
I know how to create an overlay on camera view
You can check my tutorial: https://www.netguru.co/blog/augmented-reality-mobile-android
I've described step by step what you need to do to achieve similar outcome but very simplified. If you have any questions I'm ready to help.
Each location need to have it own REAL position. For example you need a database of GPS location of each point.
Than you analyze frames from your camera. In each analyzed frame you're checking the azimuth on which you are currently looking. Let say you`re looking straight north, azimuth 0 degrees. If we assume that your camera has 90 degree field of view (FOV) than you know that your FOV is from <45, 0) to <0, 315> (in terms of azimuths)
Now you need to check which of your points are on such azimuth and if one of them is you just display them
Augmented reality is helpful for your problem.
After searching a lot found following things
An SDK which is open
https://artoolkit.org/documentation/doku.php?id=1_Getting_Started:about_installing
and these examples
https://github.com/tvbarthel/ChaseWhisplyProject
https://code.tutsplus.com/tutorials/android-sdk-augmented-reality-location-distance--mobile-8004
Hope this helps someone else as well.
Check this framework https://www.layar.com/. Theres 2 ways to plot your images on view. The first one is, through GPS pre-marked; another one is through image recognition (you can use a simple QRcode cards, I guess it's the most simple. But if your motivated to create a awesome solution, do a grateful solution).
Regards.
Fairly new at android dev, haven't got any code for this particular step yet so ill try give as much detail as possible. I'm trying to make an ImageView object move around the android view/activity, unlike java im not able to use the random generator to translate it onto an x and or y position on the frame, if anyone could point me on the right direction or more importantly have a good idea on how to do this, that'd be great.
There is a class in android called Random. And there is a function called nextInt() which can give you a random number. You can also calculate the width and height of your screen using DisplayMetrices so that you can keep the image inside the device's screen. And you can also move the ImageView. See this link.
I am hoping this question/issue is not too vague as I have tried asking something earlier but seemed to have came to a dead end.
Basically I am looking at stretching/pinching parts of a Bitmap within my Android project. There would be coordinates passed to the function in order to indicate where the move would need to take place (x,y).
I need to find a way to shift pixels up and down (in either a line or arc type format) and allow the pixels in between to be warped accordingly (not disappear or hide).
A sample image of what I am trying to achieve would be something like:
I would paste an image here but apparently am not allowed yet. (Image URL: http://t1.gstatic.com/images?q=tbn:ANd9GcQtLEHS-ZRQs3p7XmeU2TM6Vwgfh7DGnh-5nDIDu3Yd7zTIR0zX)
(Just grabbed a random Google face warp)
I have read about a few things like openCV and javaCV but they seem like overkill. I am simply looking for something that might allow me to move an array of coordinates from a source point to destination and allow for a smooth warp.
Any help/information is greatly appreciated.
Brad,
Heres a link on how to create a smudge tool. That should help you create images like the one you included within your post.
Hope that helps!