This commit is contained in:
Ivan
2022-06-24 09:54:00 +03:00
parent f97644b75c
commit bc01769799
4 changed files with 3 additions and 3 deletions

View File

@@ -77,9 +77,9 @@ int main(int argc, char* argv[])
std::cout << std::endl; std::cout << std::endl;
// cv::Mat frame(video_frame.yres, video_frame.xres, CV_8UC4, video_frame.p_data); // cv::Mat frame(video_frame.yres, video_frame.xres, CV_8UC4, video_frame.p_data);
cv::Mat frame = cv::Mat::zeros(cv::Size(video_frame.xres, video_frame.yres), CV_8UC4); cv::Mat frame = cv::Mat::zeros(cv::Size(video_frame.xres-1, video_frame.yres), CV_8UC4);
std::cout << std::endl; std::cout << std::endl;
memcpy(frame.data, video_frame.p_data, video_frame.xres * video_frame.yres * 4); memcpy(frame.data, video_frame.p_data, (double)video_frame.xres * (double)video_frame.yres * (double)4);
for (int i = 0; i < 100; i++){ for (int i = 0; i < 100; i++){
std::cout << frame.at<cv::Vec4b>(0, i) << " "; std::cout << frame.at<cv::Vec4b>(0, i) << " ";
} }

View File

@@ -160,7 +160,7 @@ int main(int argc, char* argv[])
// Fill in the buffer. It is likely that you would do something much smarter than this. // Fill in the buffer. It is likely that you would do something much smarter than this.
// memset((void*)NDI_video_frame.p_data, (idx & 1) ? 255 : 0, NDI_video_frame.xres*NDI_video_frame.yres * 4 * sizeof(uint8_t)); // memset((void*)NDI_video_frame.p_data, (idx & 1) ? 255 : 0, NDI_video_frame.xres*NDI_video_frame.yres * 4 * sizeof(uint8_t));
// Why used void* the guy in GitHub? // Why used void* the guy in GitHub?
memcpy((void*)NDI_video_frame.p_data, imLeft.ptr(0, 0), NDI_video_frame.xres * NDI_video_frame.yres * 3); memcpy((void*)NDI_video_frame.p_data, imLeft.ptr(0, 0), (double)NDI_video_frame.xres * (double)NDI_video_frame.yres * (double)3);
std::cout << std::endl << "From the video_frame.p_data array first elements of the rows: " << std::endl; std::cout << std::endl << "From the video_frame.p_data array first elements of the rows: " << std::endl;
for (int i = 0; i < 100; i++){ for (int i = 0; i < 100; i++){

Binary file not shown.

Binary file not shown.