render the scene using OpenCV

bool openVideo() {
 int width = viewer.core.viewport(2); int  height = viewer.core.viewport(3); //std::cout << "w*h = " << width << "*" << height << std::endl; bool isOpened = outputVideo.isOpened();
 if (!isOpened && width != 0 && height != 0) { std::string videoPath(TUTORIAL_SHARED_PATH "video.avi");
 outputVideo.open(videoPath, -1, 29, cv::Size(width, height), true); //std::cout << "video path: " << videoPath << std::endl; //std::cout << "isopen = " << outputVideo.isOpened() << std::endl; return true; } else if (isOpened) { return true; } else { return false; }}
void main(){
 if (!openVideo()) { std::cout << "error to open the video." << std::endl; std::cin.get(); }   // Allocate temporary buffers     Eigen::Matrix<unsigned char, Eigen::Dynamic, Eigen::Dynamic> R(height, width);     Eigen::Matrix<unsigned char, Eigen::Dynamic, Eigen::Dynamic> G(height, width);     Eigen::Matrix<unsigned char, Eigen::Dynamic, Eigen::Dynamic> B(height, width);     Eigen::Matrix<unsigned char, Eigen::Dynamic, Eigen::Dynamic> A(height, width);//(1280, 800)

 // Draw the scene in the buffers  cv::Mat cv_pixels( height, width, CV_8UC3 ); viewer.core.draw_buffer2(viewer.data, viewer.opengl, true, R, G, B, A, cv_pixels); //outputVideo << cv_pixels;   outputVideo.write(cv_pixels);}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s