语言

Menu
Sites
Language
Is Native programming support camera preview data collection

Hi, 

I want to develop one native APP which need to get the camera preview data, but I don't find related API, anybody know how to do this? Thanks!

响应

5 回复
Alex Dem

Hi,
Maybe you mean how to get every frame of preview in callback, please look at this tutorial:
https://developer.tizen.org/dev-guide/2.3.0/org.tizen.tutorials/html/native/multimedia/camera_tutorial_n.htm
and find there 'Setting Callbacks for Camera Preview and Camera Focus'
Alexey.

Jean Yang

Hi Alex, 

Thanks for you answer, but seems the link you shared is just set the camera frame, what I want is the every frame image data in byte--every pixes RBG data for one frame image in preview state. 

For more, i have checked the below API, all not meet my requirement.

error_code = camera_attr_set_preview_fps(cam_data.g_camera, CAMERA_ATTR_FPS_AUTO);  -----this set the preview fps

int camera_attr_get_preview_fps (camera_h camera, camera_attr_fps_e *fps)----Gets the frames per second of a preview video stream

Alex Dem

Hi,
Unfortunatelly I did not face another way for preview. Only this approach with camera preview callback.
Alexey

dowan kim

Hi Jean Yang.

 

What you want is to get the RGB preview data.. right?

 

In Z1, if you use the camera_set_preview_cb CAPI, you can get the NV12 preview data for every preview frame.

But  unfortunately RGB preview data was not supported..

If you want RGB preview data , you have to convert from NV12 to RGB by using the IMAGE-UTIL CAPI.

 

The below is the step for using the IMAGE-UTIL CAPI.

image_util_transform_create

image_util_transform_set_colorspace

image_util_transform_run

image_util_transform_destroy

 

Thanks

BR

Dowan Kim

Jean Yang

Hi Kim,

Yes, I want the RGB data, As you mentioned, I found the the YUV frame data in camera_preview_data_s, thanks you.

 

 

typedef void(* camera_preview_cb)(camera_preview_data_s *frame, void *user_data)
Called to register for notifications about delivering a copy of the new preview frame when every preview frame is displayed.

Since :
2.3
Remarks:
This function is issued in the context of gstreamer so the UI update code should not be directly invoked.
If the camera is used as a recorder then this callback function won't be called.
Parameters:
[in]    frame    The reference pointer to preview stream data
[in]    user_data    The user data passed from the callback registration function