Camera Feeds as Textures

I thought it would be useful to link here to the blog post on using the camera as a texture fill: http://www.coronalabs.com/blog/2013/12/19/holiday-surpril-time-effects/

The code snippet to set this up with a filter effect looks like the following:

local shape = display.newRect( 0, 0, 320, 480 ) shape.anchorX = 0 shape.anchorY = 0 shape.fill = { type="camera" } shape.fill.effect = "filter.sobel"  

Hi Bryan- any chance it’s going to be possible soon to feed the “camera” type into composites? Right now composites only take image files I believe. (For that matter, will we be able to feed snapshots or filtered images or even transformed images into composites?). 

Having a lot of fun with this feature right now- being able to use all the composite modes, not just the blend modes- will only increase that fun :slight_smile:

Ditto that! This is great fun and opens a lot of avenues. Something that was asked on the blog that might fall through the cracks… Is it possible to use the front facing camera instead? How can we select one or the other programmatically? Thanks!!!

We’re also interested in knowing if it’s possible to use the front-facing camera and what the code would be for that.  Anyone at Corona who can chime in?

We will take a look into supporting that in a future daily - at the moment it’s back facing camera only.

Great! Thanks for considering this. Appreciated.

Also, it appears camera feeds only work in portrait orientation.  Would love to see the feature work for landscape orientation as well!

It seems a crash happens when the shape with the camera fill is deleted or the fill is changed to another type. Is there any way to turn off the camera fill or any workaround to avoid the crash?

You may need to add some things to your build settings.  See this blog post:

http://www.coronalabs.com/blog/2013/11/05/tutorial-captureselect-photo-and-video/

Hi Rob, I inserted this into our build.settings file but the camera feed still displays in portrait mode even though my device is set to landscape orientation.

iphone = { plist = { CoronaUseIOS7IPadPhotoPickerLandscapeOnlyWorkaround = true, CoronaUseIOS6IPadPhotoPickerLandscapeOnlyWorkaround = true, CoronaUseIOS7LandscapeOnlyWorkaround = true, CoronaUseIOS6LandscapeOnlyWorkaround = true, }, }

The app I’m testing with is portrait only.

@davidjames At the moment portrait mode is the only supported orientation but we will add your request to our camera fill feature request list (along with front facing camera support).

@abiasi Can you post your sample code for changing/deleting the fill - we will use this to reproduce the issue.

Here’s the project attached. When I run it on my iPhone 5S, the camera only captures 1 image, is not real time and when it switches from scene1 to scene2 it crashes after a few seconds.

Hi Bryan- any chance it’s going to be possible soon to feed the “camera” type into composites? Right now composites only take image files I believe. (For that matter, will we be able to feed snapshots or filtered images or even transformed images into composites?). 

Having a lot of fun with this feature right now- being able to use all the composite modes, not just the blend modes- will only increase that fun :slight_smile:

Ditto that! This is great fun and opens a lot of avenues. Something that was asked on the blog that might fall through the cracks… Is it possible to use the front facing camera instead? How can we select one or the other programmatically? Thanks!!!

We’re also interested in knowing if it’s possible to use the front-facing camera and what the code would be for that.  Anyone at Corona who can chime in?

We will take a look into supporting that in a future daily - at the moment it’s back facing camera only.

Great! Thanks for considering this. Appreciated.

Also, it appears camera feeds only work in portrait orientation.  Would love to see the feature work for landscape orientation as well!

It seems a crash happens when the shape with the camera fill is deleted or the fill is changed to another type. Is there any way to turn off the camera fill or any workaround to avoid the crash?