Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ~
- ~
- 1 #include "mrg/foundation/logging/FrameLogger.h"
- 2 #include "mrg/foundation/logging/ProtocolBufferLogFrame.h"
- 3 #include "mrg/foundation/image/ImageProtocolBufferAdaptor.h"
- 4 #include "mrg/foundation/image/ImageBase.h"
- 5 #include "mrg/foundation/image/ImageForward.h"
- 6 #include "mrg/foundation/image/ImageTypes.h"
- 7 #include "opencv2/opencv.hpp"
- 8 #include "mrg/adaptors/opencv/image/OpenCVImageAdaptor.h"
- 9 #include "cv.h"
- 10 #include "highgui.h"
- 11 #include "protobuf/image/pbImageArray.pb.h"
- 12 #include "cvaux.h"
- 13
- 14
- 15
- 16 int main(int argc, char* argv[]){
- 17
- 18 std::string videoOutput = "/Users/juliedequaire/data/logView/MyNewbieProject/bbmono/video.avi";
- 19 std::string loggingPath = "/Users/juliedequaire/data/logs/MyNewbieProject/bbmono/2014-07-28-11-25-47/bbee.monolithic" ;
- 20 mrg::foundation::logging::FrameLogger logger ;
- 21
- 22 logger.Open(loggingPath, mrg::foundation::logging::READ);
- 23
- 24 // opencv
- 25 int fourcc = CV_FOURCC('F','F','V','1');
- 26 double fps = 20;
- 27
- 28 cv::VideoWriter video;
- 29 video.open(videoOutput, fourcc, fps, cv::Size(480,640), false);
- 30 cv::Mat cvImg ;
- 31
- 32 // read monolithic file
- 33 mrg::datatypes::protobuf::image::pbImageArray pbImg ;
- 34 mrg::foundation::logging::ProtocolBufferLogFrame<mrg::datatypes::protobuf::image::pbImageArray> imArrPBFrame(pbImg);
- 35
- 36
- 37 while(!logger.ReachedEndOfLog()){
- 38 logger.Read(imArrPBFrame);
- 39 std::vector<mrg::foundation::image::ImageBaseSPtr_t> imgSPtr = mrg::foundation::image::ImageProtocolBufferAdaptor::ImageArrayFro mProtocolBuffer(pbImg);
- 40
- 41 for (unsigned int i=0; i < imgSPtr.size(); ++i){
- 42
- 43 cvImg = mrg::adaptors::opencv::image::OpenCVImageAdaptor::DeepAdaptImageToOpenCVImage(*imgSPtr[i], true);
- 44 cv::resize(cvImg, cvImg, cv::Size(480,640),0,0,cv::INTER_NEAREST);
- 45 std::cout << cvImg.type() << std::endl;
- 46 cv::imshow("mono pict", cvImg);
- 47 cv::waitKey(50);
- 48 video.write(cvImg);
- 49
- 50 }
- 51 }
- 52 video.release();
- 53
- 54
- 55 return 1;
- 56
- 57 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement