Forgive me if this is newb question, but I am new to this part of iOS programming and I'm a bit confused.
I am working on a demo that requires the iPhone to be held in portrait mode, and (as close to) perpendicular to the floor.
Simply making sure the phone is locked in portrait mode is not enough as I am doing image processing with the rear camera, and I need to make sure the image is captured with the phone held upright.
(i.e. screen may be portrait, but user could still be holding the phone sideways)
What's the best way to address this?
I understand that the on-board IMU will allow me to determine where the ground is (i.e. gravity), but how do I address rotation around a specific axis?
Related
I want to make a movable camera that tracks an opened hand (toward the floor). It just needs to track the opened hand but it has to also know the rotation (2d rotation).
This is what I searched for so far:
Contour- As the camera is movable, the background is unknown, even the lighting is not fixed. It's hard for me to get a clear hand
segment in real time.
Haar- It seems this just returns a rect and can't deal with rotation.
Feature detect- A hand doesn't have enough detail for this.
I am using the Opencv Unity plugin to do this.
EDIT
https://www.codeproject.com/Articles/826377/Rapid-Object-Detection-in-Csharp
I see another library can do something like this. Can OpenCV also do this?
I want to create a landscape iOS game with SpriteKit, which can be played both on iPhone and iPad. Because of the different aspect ratios I thought it would be usefull to have a fixed frame for the actual game. I would like to treat this game area like a separate container. The rest of the visible area should be filled with a ground, where the character is running on, and a ceiling. Depending on the device the ground and the ceiling will be more visible on the iPad and less on the iPhone.
The anchor point for the game as reference for all upcoming nodes should be in the lower left corner of the game area.
In the following picture I tried to draw my thoughts:
Can you tell me, what is the best way to proceed and which features of SpriteKit are worth to take a look at? I have never worked with scaleModes or something else like this before.
Thank you
I have programmed an Ipad application that has a behaviour that I would like to change if I put it in a wooden frame (any other material could be added). To simplify things, the background should change whenever is inside this frame, and there must be no tap-touch interaction, just putting the Ipad inside the frame.
Of course, we could program am specific gesture on the screen, like double tapping or swiping but it is not the searched solution.
Another thought has been to detect the lack of movement for a certain amount of time, but that would not assure that iPad is inside the frame.
I have thought about interacting with magnets (thinking about smartcovers) and the sleep sensor in the right side of the Ipad, but I don't know how to do it.
I cannot see any other useful sensor.
Any suggestion?
A combination of accelerometer and the camera seems like an idea worth trying out:
Scan the accelerometer data to detect a spike followed by a flat line (= putting the iPad into the frame, then resting).
After detecting the motion event, use the back camera (maybe combined with the flash) to detect a pattern image fixed inside of the frame for this purpose. It might be necessary to put the pattern into a little hole to create at least a blurry image.
The second step is there to distinguish the frame from any other surface the iPad might be placed upon.
I am trying to emulate 3D background in one of the application we are developing.
Check this video on what i am trying to do : http://www.youtube.com/watch?v=429kM-yXGz8
Here is what i am trying to do to emulate this 3D illusion in our
application for iPad.
I have a RootView with 3 rounded buttons centered on the screen which animates in circular motion.
On bottom screen i have some banners of size (600*200) which keeps rotating with flip animation.
I also have some graphical text that is part of the background which contains the "Welcome message"
All elements are individual graphics, and hence when the user moves the iPad we only move the background based on the position of iPad using x,y,z coordinates of accelerometer.
the background moves accordingly, however this is not enough to have 3D illusion, so we decided to add some shadows to graphical elements(buttons, banners, text) and move the shadow accordingly with the iPad's position.
However the result is not convincing, and accelerometer is not updating value if user moves iPad to left and right on stand up position facing iPad straight to the head.
I was wondering if anyone have tried to achieve something similar with success? or any resource to help on how to achieve this? i am just confused whether by using only accelerometer will work or should i go with gyroscope?
Using face detection for simulating a 3D effect already has been done (by me). You can download a complete sample from http://evict.nl/code/face-tracking See the video on that page for a quick demo.
You should definitely use both. accelerometer (movement) and gyroscope (device angle). But for a true 3d effect you probably need to use the camera + face detection.
I'm not sure how to set the null point of the iPhone in Xcode. I have an app that has a UIimage that moves around the screen and works well.
What I want to do is set it indefinitely so that when the iPhone is held as you would when reading a text (i.e 45 degree angle) it is level (e.g., image doesn't move). I don't need calibration options for the user to set I just need to set it in the code.