Created
February 25, 2019 17:42
-
-
Save ryochack/b0366dc6418042f57d742edcc57798ea to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
#include <iostream> | |
#include <opencv2/core.hpp> | |
#include <opencv2/imgcodecs.hpp> | |
#include <opencv2/highgui.hpp> | |
int main() { | |
std::unique_ptr<uint8_t[]> bufl(new uint8_t[320 * 240]); | |
memset(bufl.get(), 0x00, 320*240/2*sizeof(uint8_t)); | |
memset(bufl.get()+320*240/2, 0x44, 320*240/2*sizeof(uint8_t)); | |
cv::Mat imgl = cv::Mat(cv::Size(160, 240), CV_8UC1, bufl.get(), 320); | |
cv::imshow("left", imgl); | |
std::unique_ptr<uint8_t[]> bufr(new uint8_t[320 * 240]); | |
memset(bufr.get(), 0x88, 320*240/2*sizeof(uint8_t)); | |
memset(bufr.get()+320*240/2, 0xcc, 320*240/2*sizeof(uint8_t)); | |
cv::Mat imgr = cv::Mat(cv::Size(160, 240), CV_8UC1, bufr.get(), 320); | |
cv::imshow("right", imgr); | |
std::vector<cv::Mat> imgs = { imgl, imgr }; | |
cv::Mat concated; | |
cv::hconcat(imgs, concated); | |
cv::imshow("concat", concated); | |
while (cv::waitKey(0) != 'q'); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment