AR.js distorted perspective: How to use a personalized camera calibration file `camera_para.dat` so that the "floor" plane is horizontal? - artoolkit

I'm looking into AR.js for an augmented reality use case where 3D objects do not appear directly on the hiro marker, but somewhere around the marker.
When I view my AR scene through my iPhone 7 from the top, everything looks fine, but when I tilt my camera to get more perspective, AR.js doesn't apply the same perspective to the AR world so that distant virtual objects appear as if they were located on an inclined plane.
I created an example page to illustrate this behaviour: When viewed from above, the grids match perfectly, but when viewed from the side, the planes mismatch.
Are there any settings I can apply to configure AR.js (or ARToolKit, which it depends on)? Maybe there's a way to define the field of view of my webcam there?
[EDIT] One week later, I would reword my question to: How can I use a device-specific camera_para.dat ARToolkit camera calibration file in AR.js without generating side effects such as a distorted rendering?

Updating the intrinsic optical characteristics of the camera, also known as calibration, might help!
The artoolkitx-calibration app is made for calibrating cameras. Unfortunately, the app is not available on the App Store currently. You can, however, deploy it to your development device using Xcode.
Alternatively, the ARToolKitX calibration server might contain camera calibration results for your smartphone - Unfortunately, it returns 204 (no content) for the iPhone 7 (a.k.a. apple/iPhone/iPhone9,3, camera 0, aspect ratio 16:9).
By the way,
camera_para.dat for several older iOS devices can be found on GitHub:
iPad 2: 0,7 MP
iPad Air 2: 8 MP, f/2.4
iPad Mini 3: 5 MP, f/2.4
iPhone 4: 5 MP, f/2.8
iPhone 4s: 8 MP, f/2.4
iPhone 5: 8 MP, f/2.4
iPhone 5s: 8 MP, f/2.2 (similar to iPhone 6, iPhone 6 Plus)
iPhone 6s Plus: 12 MP, f/2.2 (similar to iPhone SE, iPhone 6s)
Unfortunately, newer iPhone cameras have different specs (e.g. iPhone 7 or iPhone 8: 12 MP, f/1.8) so I doubt that any of these camera calibration settings would fit perfectly for them...

Related

What are the FPS of the FaceTime Camera for the iPhone 6S vs 7+ vs X vs iPad Pro?

We are capturing video from iOS devices and processing it using OpenGL but are encountering a FPS difference between the devices when trying to set them at their maximum rate.
The iPhone 6S and iPad Pro FaceTime cameras are maxing at 60 fps.
The 7+ and iPhone X however are maxing at 30 fps.
It seems unusual that the FPS would decrease with later versions of Apple's hardware. We are trying to figure out if this is a software issue or simply the technical specifications for the frame rate for the FaceTime camera.
We looked on Apple's technical specifications page but the frame rates of the FaceTime cameras aren't listed (though the rear cameras are.) For example:
https://www.apple.com/iphone-6s/specs/
https://www.apple.com/iphone-x/specs/
What are the FPS of the FaceTime Camera for the iPhone 6S vs 7+ vs X vs iPad Pro?
It looks like you’re correct. According to Apple’s iOS Device Compatibility Reference...
iPhone 6s series front camera does up to 60 FPS (all formats)
iPhone 7 series front camera does up to 30 FPS
iPhone 8 series / X front camera does up to 60 FPS, but only in binned formats (so you probably need to set the device’s activeFormat, not just choose a preset)
iPad Pro info is also in the tables at that link.

png files displaying as different colors on iPad w/ retina display vs iPad Pro

Is there an efficient or programmatic way to force .png files to display as the same color regardless of whether they are viewed on an iPad Pro or an iPad with a retina display (for my purposes, iPads 3 and higher that aren't a Pro)
My iPad app contains a large set of art that is basically just red and blue lines all saved as .png files. They are meant to be viewed with the most commonly available red/blue 3D glasses on the market. We can't change the physical glasses that people use to look at the app to get that pop out 3D effect.
The tolerance between all of the iPads with retina displays has been fine for our purposes. But once we run the app on an iPad Pro, the blue is no longer the same color blue as on the retina display.
This is with the iPad Pro brightness at max, and True Tone either on or off and Night Shift off (also tried it with Night Shift on but it is just a different blue)
Is the best solution to have all of the art re-created and use a UIDevice call to display one set for an iPad with retina display and another set of art for an iPad Pro?
The app is written entirely in Objective C and is for iPad only.

Cocosd2d and body.m_radius depend on device type

I'm little bit confused by points in cocos2d.
I have universal game and when I set possition of body in points, it works well over all devices (iPhone, iPhone HD, iPad, iPad HD). I made textures in 4 sizes with cocos2d suffix and it works well too.
But I have body (b2CircleShape) and i need to set m_radius of this circle.
I have this lines:
b2CircleShape myDynamicBody;
myDynamicBody.m_radius=0.48;
Value 0.48 is optimized for iPhone HD and it works well on both iPhone (iPhone and iPhone HD) but on iPad and iPad HD devices it is very small. What should I do? Check type of device and when I find iPad multiply it in 1.33 (when I tried to multiply it in 1.33 it worked fine on both iPads).
Or is there any better (or recomended) way, how to solve this problem?
Thank you for advices
You should adjust your points-to-meter (PTM_RATIO) on iPad.
The reason for 'points', is that Box2d is tuned to run physics simulations for bodies between 0.1 and 10 meters, with a typical body being about 1x1 meter. It will still work for bodies outside of these sizes, but will be less reliable.
On the other hand, you've got a screen with either ~320x480 or 1024x768 points of resolution. Therefore we need a way to convert the sprite representation to a size that is suitable for Box2d. For this we use the 'points-to-meter' ration (PTM).
If your typical sprite is 64x64 you should choose a PTM ratio of 64. This will make box2d see you 64x64 sprite as 1x1, which is an ideal size to run simulations on it.
Having explained that, the reason that the PTM_RATIO varies between phone and pad form factors is now obvious: Its because they have different resolutions. A sprite that is 64x64 on iPhone would be approx 128x128 on tablet.
So to get your PTM_RATIO on ipad, choose a sprite on iPhone and look at the corresponding size on iPad. Now multiply the iPhone PTM by the ratio of the sizes beteen those two images.

Poor OpenGL graphics Quality on First Generation iPad

I am using NinevehGL graphics library for rendering 3D models for an iOS application.
The rendering is quite good on the simulator and works well on iPhone 4S, iPad 2 and other recent devices.
But the quality is not as good on first generation iPad.
see the images
iPad(First Gen) As well as iPhone 3GS:
iPhone 4S:
Basically the gradient effect on iPad is very poor.. I am not worried about the antialiasing at the moment,, but I am worried about the clear difference in the gradient change of color.. in the first image one can clearly see the dark and bright regions.. but in the second image such regions are not so distinct.
Is this a device specific thing or are there any build settings that I can change to get better graphics for this version of iPad?

How to target both iPhone and iPad resolution on Flash CS6

I am building a small game for iOS on Flash CS6 and I want to target both iPad and iPhone resolutions, also supporting retina display if possible. I've played with the movie properties and the Air for iOS settings, but I am still in confusion about the screen resolutions. I want to make a HD (retina-enabled) game, and I want to target the non-retina models too. Which resolution should I use? (I'll be having only landscape) Should I go with 2048x1536 (iPad Retina), 1024x768 (iPad non-retina), 960x640 (iPhone/iPod touch retina), or 480x320 pixels (iPhone/iPod touch non-retina)? I've set the resolution to High in Air for iOS settings, left the default resolution (960x640) unchanged, but when I tested it on iPad 3, the resolution wasn't HD, even though my graphics were vector (made in Flash). There was also background color visible around the corners, compensating for the aspect ratio difference of iPhone and iPad. Why can be the App rendering in non-retina resolution even though I've checked it at the settings for iOS? And more importantly, what is the best approach for targeting both screen resolutions in a single app?
Thanks,
Can.
Despite iOS being a resolution dependent OS, stage resolution doesn't matter. It will look the same if the stage resolution was 240x160 or 1920x1280. The device will render the game to it's native resolution. This is why you need to set the resolution in the publish settings: so that flash knows to add support for those resolutions for iOS. Setting the stage to 960x640 should be fine for the iPhone. When it publishes for iPad on the other hand, it will be built to it's native screen resolution, but because the iPhone and iPad have different aspect ratios, the iPad will have more space on the side. Since the game will be in landscape mode, it should be ok to simply put to thick black rectangles on the top and bottom of the stage.
As for the new iPad resolution, Flash isn't powerful enough to support that resolution, it will export to the standard iPad resolution of 1024x768 even if the resolution is set to high in the publish settings.
So pick the stage resolution based off of what device you favor, if you want the app to look best on the iPad's format, go for 1024x768, but the iPhone will have extra space on the sides in landscape mode. The same goes for the iPhone resolution I explained earlier. Although, if you'd like to fully support both, you can try many methods used to position GUI elements on the vast sea of Android Screens based off the Capabilities.screenResolutionX and Capabilities.ScreenResolutionY methods in flash.

Resources