Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Getting RGB (not ARGB) pixels from Camera #3048

Open
itlancer opened this issue Feb 1, 2024 · 0 comments
Open

[Feature Request] Getting RGB (not ARGB) pixels from Camera #3048

itlancer opened this issue Feb 1, 2024 · 0 comments
Labels

Comments

@itlancer
Copy link

itlancer commented Feb 1, 2024

Feature Description

AIR should support to get RGB (not ARGB) pixels from Camera.
First of all, images from classical RGB cameras cannot return alpha channel by itself. So alpha channel is useless for RGB cameras.
Moreover it consumes extra bytes volume (in terms of storage/transferring).
And a lot of image processing/computer vision/OpenCV algorithms wait on processing input formats like:

  • [R, G, B, R, G, B....] (channel value per index)
  • [RGB, RGB....] (pixel color value per index)
  • or [BGR, BGR....] and something like that
    no alpha channel.

So if you need to use some image processing algorithms - you need to convert [ARGB, ARGB....] byte arrays to another format. And if you need to use processing in "real time" - it should be done for every frame. Its too heavy extra processing which I wish to avoid. Especially for Android: #1980

Right now by Camera::copyToByteArray() https://airsdk.dev/reference/actionscript/3.0/flash/media/Camera.html#copyToByteArray() or by Camera::copyToVector() https://airsdk.dev/reference/actionscript/3.0/flash/media/Camera.html#copyToVector() you will get "32-bit unmultiplied pixel values" (ARGB).
The same if you try to use BitmapData::copyPixelsToByteArray() https://airsdk.dev/reference/actionscript/3.0/flash/display/BitmapData.html#copyPixelsToByteArray()

It will be great to have some method to get ByteArray from camera image only with necessary channels and in requested format. For example: ARGB, BGRA, RGB, BGR, .... unmultiplied or premultiplied. Also will be great the same feature for any BitmapData (not from camera image).

Related issues:
#2029
#1344
#305

Known Workarounds

  • Write own native extension for camera usage.
  • Convert each frame bytes to necessary format (overhead).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant