Camera support?

I sure hope it’s possible. After checking the docs I can’t find anything at this time that gives any indication that a hi-res version can be acquired via the current camera API.

wow… I absolutely did not anticipate this. lol…
[import]uid: 8045 topic_id: 5943 reply_id: 21314[/import]

BeyondtheTech, have you heard anything from Carlos regarding the camera resolution? [import]uid: 8045 topic_id: 5943 reply_id: 21500[/import]

Yes, a case number and ticket have been opened. Hopefully a quick resolution will fix the … resolution. [import]uid: 6084 topic_id: 5943 reply_id: 21501[/import]

Thanks :smiley:
[import]uid: 8045 topic_id: 5943 reply_id: 21503[/import]

1)the following code works fine with iOS simulator to save but
it fails to save on iOS device. Is it bug? It is a blocking issue.
please help me.

> local onCameraShot = function(event)
> local p = event.target
> p.x = display.contentWidth / 2; p.y = display.contentHeight / 2
> display.save(p, “photo.jpg”, system.DocumentsDirectory)
> end
> media.show(media.Camera, onCameraShot)

  1. do you know how to avoid camera image being resized?
    this behavior happens with 243 build.
    Black line appears on the edges of right and the bottom.
    it works fine with the simulator

2A)with 268 build,?camera image is reseized and all black.
it works fine with the simulator

  1. with 280 build, it works fine with the simulator but fails the device(iphone4) to load camera libary

it fails the following error.
> Fri Feb 11 23:46:20 unknown MobileStorageMounter[11186] : (0x3eaf3898) platform_supports_camera_import: Platform is NOT configured for camera import
> Fri Feb 11 23:46:21 unknown kernel[0] : AppleKeyStore:cp_key_store_action(1)
> Fri Feb 11 23:46:21 unknown kernel[0] : AppleKeyStore:Sending lock change
> Fri Feb 11 23:46:30 unknown MobileStorageMounter[11186] : (0x3eaf3898) idle_timer_callback: Exiting after idle timeout
http://developer.anscamobile.com/forum/2011/02/04/camera-access-and-manipulating-output
[import]uid: 190 topic_id: 5943 reply_id: 22168[/import]

some trial&error, the following code enables to save a camera image.
In order to save an image, it seems to display correctly beforehand.

> p.x = display.contentWidth / 2; p.y = display.contentHeight / 2
> display.contentWidth = 2000; display.contentHeight = 2000
> p:scale(4, 4)
> display.save(p, “photo2.jpg”, system.DocumentsDirectory)

now it works on iphone4. [import]uid: 190 topic_id: 5943 reply_id: 22292[/import]

That sounds great, I can’t wait to try it!

Let me ask you, does it also work for the previous iPhones?

And, not to get off the subject, but how does one go about detecting whether or not the device has a camera, like the iPad?

Has anyone tried to use media.Camera on an iPad and what did it do? [import]uid: 6084 topic_id: 5943 reply_id: 22295[/import]

@ ymmtny

I’m not sure but if you scale the image I think it doesn’t keep the resolution. I seem to remember trying that one time.

Either way, I’ll try it out and see what happens. Thanks for your input. Every bit helps. [import]uid: 8045 topic_id: 5943 reply_id: 22298[/import]

I’m fairly new to Corona as well, and I’ve been having issues with the camera function and display.save. Besides the poor resolution, I can’t seem to get rid of the scaling issues.

ymmtny’s scaling technique doesn’t seem to be working for me. Whenever I scale things the image that gets displayed becomes a tiny section of an extremely zoomed in image.

Without any scaling, display.save seems to work (with poor resolution) on an iPhone 3G, but on the 4G, it just displays the top left quarter of the screen. This must be due to the 0.5 scaling on the high resolution screen. Scaling can also be effected by the code in your config.lua file… lots of people use “letterbox”, “zoomStretch” or “zoomEven” to adjust to the varying android screen sizes.

for iPhone3G the scale is 1,1
for iPhone4G the scale is 0.5, 0.5
for iPad the scale is 0.46875, 0.46875

Hypothetically, it would be possible to make the necessary scaling adjustments for each device separately. But my code above still doesn’t change anything when using the iPhone 4G device.

I hope this stuff helps somebody.

I do know that you can check to see scaling your device is using by entering these functions:

[lua] local scaleX, scaleY = display.contentScaleX, display.contentScaleY
print("scaleX, scaleY: ", scaleX, scaleY)
if scaleX ==.5 and scaleY == .5 then
print(“this is displaying on a retina display… iPhone 4G”)
t.xScale = display.viewableContentWidth/t.width
t.yScale = display.viewableContentHeight/t.height
end
–centering image
t.x = display.viewableContentWidth/2
t.y = display.viewableContentHeight/2

[import]uid: 12578 topic_id: 5943 reply_id: 22826[/import]

The lores problem is being addressed by Ansca.

Maybe the next build? [import]uid: 8045 topic_id: 5943 reply_id: 22887[/import]

I was delightfully surprised when Carlos contacted me this evening to work regarding this issue, and it will be addressed in an upcoming daily build:

The JPEG compression and resolution will be done at the highest setting, with possibly options to set the rate in the future.

The display.save command seems to have been bound to the values set in config.lua. By running the “Screen Capture to File” sample code with adjusted settings 640x960 on public build 268, it worked perfectly on my iPhone 4, while it captured only the upper-left quadrant in the Simulator.

Seriously, I gotta hand it to these guys, the gears are constantly turning behind the scenes, and my game will soon be able to be submitted with this bonus feature. [import]uid: 6084 topic_id: 5943 reply_id: 22899[/import]

I *hearts* Carlos.

Next build when?

lol…

…sip…
[import]uid: 8045 topic_id: 5943 reply_id: 22901[/import]

The new build is up!

http://developer.anscamobile.com/forum/2011/02/04/camera-access-and-manipulating-output#comment-23319 [import]uid: 12578 topic_id: 5943 reply_id: 23324[/import]