Camera Feeds as Textures

By the way I used this to update the camera fill and it works fine:

 local crate = display.newRect(centerX, centerY, 320, 480 )

 crate.fill = { type=“camera” }

  

    local function updateCamera()

        crate.fill = { type=“camera” }

    end

 Runtime:addEventListener(“enterFrame”, updateCamera)

Does anybody have crash after removing display object with camera feed?

I don’t how to remove camera feed.

Regarding the landscape issue, can someone provide a better description of what happens when you rotate the camera to landscape mode?  Perhaps a diagram of what should happen?

Thanks

Rob

It is very strange, it appears the axis don’t get rotated on the landscape… like,  if you move the camera to the LEFT, what you see inside the feed goes DOWN (or UP, I don’t remember) and vice-versa. And the image from the feed appears to be distorted.

There is a work-around for that problem (someone posted it in the forum and I am using it and it works fine). The work-around is basically to invert width with height and rotates -90.

The code that I use on my bar code reader is:

 local cameraShapeW = params.width     local cameraShapeH = params.height     local cameraShape     local shapeRotation = 0          local isLandscape = display.contentWidth \> display.contentHeight         if isLandscape and params.fill.type == "camera" then         local t = cameraShapeW         cameraShapeW = cameraShapeH         cameraShapeH = t             shapeRotation = -90     end         cameraShape = display.newRect(params.x, params.y, cameraShapeW, cameraShapeH )     cameraShape.anchorX = 0.5     cameraShape.fill = params.fill     cameraShape.rotation = shapeRotation  

I need a good description to give engineering or a filed bug report with a sample project so they can see what’s going on.

Rob

Just tell them to create a landscape app with a rectangle that uses a camera fill.

I’d really like to get Engineering to fix this, but we need a test case.

Rob

For gits and shiggles, I added this to my game and it’s rather cool, but I’d really like to get front-camera support as well.  I’ll see if there’s a crash when trying to remove it, but I figure maybe just change the fill before deleting the display object?

What do you do to keep the live feed updated? I heard someone say they add a pixel and move it some. Can you show me what you do?

Thanks!

It just so happens that my background image was constantly moving with the accelerometer, and i had a game loop that performed this every 100ms, so I never had a problem with getting a live feed.

transition.cancel( skyGroup.trans ) skyGroup.trans = transition.to( skyGroup, { time = 100, x = 50 \* ( 0.5 - accel.xGravity ), y = 50 \* ( 0.5 - accel.yGravity ) } )

Regarding the landscape issue, can someone provide a better description of what happens when you rotate the camera to landscape mode?  Perhaps a diagram of what should happen?

Thanks

Rob

It is very strange, it appears the axis don’t get rotated on the landscape… like,  if you move the camera to the LEFT, what you see inside the feed goes DOWN (or UP, I don’t remember) and vice-versa. And the image from the feed appears to be distorted.

There is a work-around for that problem (someone posted it in the forum and I am using it and it works fine). The work-around is basically to invert width with height and rotates -90.

The code that I use on my bar code reader is:

 local cameraShapeW = params.width     local cameraShapeH = params.height     local cameraShape     local shapeRotation = 0          local isLandscape = display.contentWidth \> display.contentHeight         if isLandscape and params.fill.type == "camera" then         local t = cameraShapeW         cameraShapeW = cameraShapeH         cameraShapeH = t             shapeRotation = -90     end         cameraShape = display.newRect(params.x, params.y, cameraShapeW, cameraShapeH )     cameraShape.anchorX = 0.5     cameraShape.fill = params.fill     cameraShape.rotation = shapeRotation  

I need a good description to give engineering or a filed bug report with a sample project so they can see what’s going on.

Rob

Just tell them to create a landscape app with a rectangle that uses a camera fill.

I’d really like to get Engineering to fix this, but we need a test case.

Rob

Is landscape camera feed supported yet?

Can you just rotate the object by 90 degrees in your app? Or do that for everything else on the screen. I did that before when I wrote a game in landscape but the rest of the app was portrait.

Warren

We definitely could do that, but if landscape is supported, Id rather not…

Ok did a test run in portrait… I should be able to make this work, but it is going to be a big pain to work with a sideways simulator…

So even in portrait mode I am getting distortion… the y axis appears stretched… what can I do about this?

Your shape (that you fill using Camera Feed) needs to be in the same aspect ratio of the camera, otherwise it will be stretched. The iOS cameras use a 4:3 ratio.

About the landscape, the code that I posted before works fine for landscape mode.