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.
Related
What's the simplest zoom function featuring "+/-" button in Lua [Corona SDK]?
My point is to have button (2 buttons, + and -) that does not change its size while zooming and to have overally smooth zoom that allows you to scroll background when it is zoomed. I'm basically new to coding, so I'm having some trouble with handling that. I'm making my first project (piano app), so I'd like it to be simple, I have been searching how to do that long, but I still couldn't find any exact readable sample of code which I would be able to use. How about your ideas?
Thanks
I do not understood what you want to do. But if you want to zoom an image you can change the xScale and the yScale property of an object. And you should insert the image object into a scrollview object to scroalling.
As of now, when Android Vision detects a QR-code, the array "Barcode.cornerPoints" (which contains the code's corner points) is populated in a seemingly random order. I need is to determine which 3 out of the 4 corner points that contains "orientation squares".
The current approach I am using is very unsatisfying:
For every detected QR-code, I am forced to create a bitmap and attempt to find the QR-code again with another library (Zxing) that always returns the corner points in a consistent order with respect to rotation.
If Zxing finds the QR-code (which sadly doesn't happen about four times out of five), I need to cross-check and match the Zxing-corners with Android Vision corners.
What I would like is to get the array "Barcode.cornerPoints" populated with respect to orientation.
For example and clarification:
cornerPoints[0] = //First corner-point with an orientation square
cornerPoints[1] = //Second corner-point with an orientation square
cornerPoints[2] = //Third corner-point with an orientation square
cornerPoints[3] = //The corner-point that does not contain a orientation square
> Like in this picture <
I have been trying to find a clever workaround to this issue for quire a while now but I can't come up with any good solution, and it does not appear as Google has open source'd the code used when population the qrCorners array so i can't extend it...
Any help out there? I am not the only one who has been looking for a solution to this issue:
https://github.com/googlesamples/android-vision/issues/103
I am in a similar situation as well. What might help you to know is that Android Vision does not return the corner points in a completely random order.
I believe that the detector scans the image from top left to bottom right of the frame. The QR-code-corner which is detected first in the image will be returned as corner 0 and the rest in a clockwise direction.
What would be really helpful was if Android Vision returned the corners like you said, in a "static" order depending on orientation. I barely see any reason for the chosen way to return the corner points. Maybe better performance? For the QR-code to be read it has to be done according to a certain orientation which is determined by the corners of the QR-code. Which means Android Vision already has identified the orientation and corners but does not give this information to us.
Maybe this could be added in future updates?
Is there any way to create a 360 degree object view from photos? I have a set of 71 photos of a single car viewed from different angles. I want to combine them and be able to rotate the car when touching the screen seeing it from different angles.
I've done researching but I couldn't find anything done in android. One example is found here
This example is made with Jquery. What I need is to implement it directly inside an android app. How can I do this?
Edit1: Until now I managed to create an animation between images in this way:
The problem is that the animation starts on click and works by itself. I want to be able to move the car from left to right and right to left when keeping the finger pressed and moving to right or left. How can I do that so I can see the car from the angle I want?
I just tested that Jquery plugin page on my device and it seems to work alright. So you could still presumeably use that plugin to make some html content that you could then load into a WebView. That would give the rotation thing inside of your application.
If you don't want to use html/javascript to do it you'll have to use an ImageView with a TouchListener attached to it that handles the drag events by swapping to the next image at the appropriate interval.
Or probably somehow with Canvas, though I am not as familiar with that, I would knot how to describe what you'd need to do to make it work this way.
After hours of trying to accomplish this task I stopped using the Drawable animation method because at point I was loading the images the app would of crashed because was out of memory.
Instead I found another way to do it which I use it right now. Example
I changed the .html with the images I need and the layout I want then I implement it inside my app using a webview. Is working pretty well.
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.
I'm fairly new to the Android platform and was wondering if I could get some advice for my current head scratcher:
I'm making an app which in one view will need an image, which can be scrolled on one axis, with a load of selectable points over the top of it. Each point needs to be positionable on the x and y (unlikely to change once the app is running, but I'll need to fine tune the positions whilst I'm developing it).
I'd like to be able to let the user select each point and have a graphic drawn on the point the user has selected or just draw a graphic on one/more points without user intervention.
I though for the selectable points I could extend the checkbox with a custom image for the selected state - does that sounds right, or is there a better way of doing this? Is there any thing I can read up on doing this, I can't seem to find anything on the net about replacing the default images?
I was going to use the absolute layout, but see that it's been depreciated and I can't find anything to replace it.
Can anyone give me some code or advice on where to read up on what I need to do?
Thank you in advance
This really feels like something you should be doing with the Canvas and 2D graphics, rather than trying to twist the widget framework to fit.