librealsense icon indicating copy to clipboard operation
librealsense copied to clipboard

Saving image as png using imwrite

Open hojunson opened this issue 7 years ago • 4 comments

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


Required Info
Camera Model D435i
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version Win10
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform PC.
SDK Version { legacy / 2.. }
Language {opencv }
Segment {Robot/Smartphone/VR/AR/others }

Issue Description

<Describe your issue / question / feature request / etc..> I am trying to save image streams and IMU using callback function. I am using threads with a blocking queue to save data without any loss. So when push data into queue there is a lock and pop from queue there is a lock too.

Interestingly, some of color images I got look like image

Some of them is good but I got weird images(above case there is unsynched area at the line) such like that when I saved data while moving.

Is there any suggestion? p.s. In the recorded Ros bag using viewer, there are no results like that.

hojunson avatar Oct 05 '19 05:10 hojunson

I haven't worked with the IMU and not sure what language you are working in, but #4934 has code to save the color frames as .png, depth as matrices, and to not have frame drops.

kjacks21 avatar Oct 07 '19 11:10 kjacks21

You can save depth frames as 16-bit png. Here is C++ code:

std::vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
compression_params.push_back(0); // lossless, the number is 0-9, the most data will be lost at 9 (lightest), none at 0 (heaviest)
 
std::string dateTime;
timeStamp(dateTime, "");
 
cv::imwrite(dateTime + ".png", image_full, compression_params); // save filename as date

g2-bernotas avatar Oct 07 '19 15:10 g2-bernotas


Hi @hojunson Do you have further question on this?

No. Closing is fine Thanks.

2019년 10월 28일 (월) 오후 11:19, RealSense Customer Support < [email protected]>님이 작성:


Hi @hojunson https://github.com/hojunson Do you have further question on this?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IntelRealSense/librealsense/issues/4982?email_source=notifications&email_token=AFY4LCJYMLH23FFI4TSN44TQQ6TU3A5CNFSM4I5WLUEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECPDEYQ#issuecomment-547238498, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFY4LCMD6JZ533LNGD2NNLLQQ6TU3ANCNFSM4I5WLUEA .

hojunson avatar Oct 30 '19 01:10 hojunson