Skip to content

Example of interacting with the camera through native extensions

Notifications You must be signed in to change notification settings

SergioGracia/extension-camera

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

extension-camera

Example of interacting with the camera through native extensions.

Disclaimer

Although we aim to provide good example functionality in this example, we cannot guarantee the quality/stability at all times. Please regard it as just that, an example, and don't rely on this as a dependency for your production code.

Known issues

The currently supported platforms are: OSX + iOS

FAQ

How do I use this extension?

Add the package link (https://github.com/defold/extension-camera/archive/master.zip) to the project setting project.dependencies, and you should be good to go.

See the manual for further info.

Lua API

Type constants

Describes what camera should be used

camera.CAMERA_TYPE_FRONT -- Selfie
camera.CAMERA_TYPE_BACK

Quality constants

camera.CAPTURE_QUALITY_HIGH
camera.CAPTURE_QUALITY_MEDIUM
camera.CAPTURE_QUALITY_LOW

camera.start_capture(type, quality)

Returns true if the capture starts well

if camera.start_capture(camera.CAMERA_TYPE_BACK, camera.CAPTURE_QUALITY_HIGH) then
    -- do stuff
end

camera.stop_capture()

Stops a previously started capture session

camera.get_info()

Gets the info from the current capture session

local info = camera.get_info()
print("width", info.width)
print("height", info.height)

camera.get_frame()

Retrieves the camera pixel buffer This buffer has one stream named "rgb", and is of type buffer.VALUE_TYPE_UINT8 and has the value count of 1

self.cameraframe = camera.get_frame()

About

Example of interacting with the camera through native extensions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C++ 73.5%
  • C++ 23.8%
  • C 2.7%