diff --git a/mediapipe_api/framework/formats/image_frame.cc b/mediapipe_api/framework/formats/image_frame.cc index cbd42f7..4cef65d 100644 --- a/mediapipe_api/framework/formats/image_frame.cc +++ b/mediapipe_api/framework/formats/image_frame.cc @@ -21,10 +21,14 @@ MpReturnCode mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int CATCH_ALL } -MpReturnCode mp_ImageFrame__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, Deleter* deleter, +MpReturnCode mp_ImageFrame__ui_i_i_i_Pui8(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, mediapipe::ImageFrame** image_frame_out) { TRY_ALL - *image_frame_out = new mediapipe::ImageFrame{format, width, height, width_step, pixel_data, deleter}; + // Copy pixel data + mediapipe::ImageFrame* output_frame = new mediapipe::ImageFrame{}; + output_frame->CopyPixelData(format, width, + height, width_step, pixel_data, mediapipe::ImageFrame::kDefaultAlignmentBoundary); + *image_frame_out = output_frame; RETURN_CODE(MpReturnCode::Success); CATCH_ALL } diff --git a/mediapipe_api/framework/formats/image_frame.h b/mediapipe_api/framework/formats/image_frame.h index 4d0b1ed..6016b61 100644 --- a/mediapipe_api/framework/formats/image_frame.h +++ b/mediapipe_api/framework/formats/image_frame.h @@ -24,8 +24,8 @@ typedef void(Deleter)(uint8*); MP_CAPI(MpReturnCode) mp_ImageFrame__(mediapipe::ImageFrame** image_frame_out); MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_ui(mediapipe::ImageFormat::Format format, int width, int height, uint32 alignment_boundary, mediapipe::ImageFrame** image_frame_out); -MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_i_Pui8_PF(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, - Deleter* deleter, mediapipe::ImageFrame** image_frame_out); +MP_CAPI(MpReturnCode) mp_ImageFrame__ui_i_i_i_Pui8(mediapipe::ImageFormat::Format format, int width, int height, int width_step, uint8* pixel_data, + mediapipe::ImageFrame** image_frame_out); MP_CAPI(void) mp_ImageFrame__delete(mediapipe::ImageFrame* image_frame); MP_CAPI(bool) mp_ImageFrame__IsEmpty(mediapipe::ImageFrame* image_frame); MP_CAPI(MpReturnCode) mp_ImageFrame__SetToZero(mediapipe::ImageFrame* image_frame);