We’re developing a cross-platform (i.e. iOS, Android) game, where characters are floating around in the screen on top of the user’s camera feed. There are also hud elements. In other words, we want to render corona DisplayObject on top of a camera feed on Android. The camera feed is simply used as a background, not gameplay. We don’t need augmented reality, edge detection nor any special image filters, just the live camera feed image shown in the background.
Displaying the camera feed is easy in ios using CoronaSDK Pro. The following code snippet works for us just fine, we can add other DisplaObject on top of the feed. No problem, except this feature of the SDK is only supported for iOS.
http://docs.coronalabs.com/api/type/Paint/index.html
local cameraImage = display.newRect(display.contentCenterX, display.contentCenterY, display.contentHeight, display.contentWidth)
cameraImage.fill = { type = “camera” }
– adjust for landscapeRight orientation
cameraImage.rotation = 270
We are using Corona Enterprise so it opens more options. Alas, we haven’t found any way to solve our problem with what CoronaSDK and Corona Enterprise seem to allow. We thought we could do it implementing the Camera.PreviewCallback in Java, but it doesn’t look like we can create an image in corona from the pixel data we get this way (the feed format doesn’t matter here, we can convert to rgba8888 if needs be).
http://developer.android.com/reference/android/hardware/Camera.PreviewCallback.html
Is there anything we might have overlooked? Is there really no way we can create a image from a pixel array? All I can see is creating image from filenames.
http://docs.coronalabs.com/api/library/display/newImage.html
Is there any way we can add new custom Paint types with Corona Enterprise?
Thanks,