opencv test
This commit is contained in:
@@ -87,36 +87,6 @@ void Rubiks::run() {
|
||||
static bool rolling = false;
|
||||
static int frames = 30 * 15;
|
||||
|
||||
if(rolling) {
|
||||
frames--;
|
||||
|
||||
rolling = frames > 0;
|
||||
|
||||
uint32_t rowStride = ((1920 + 63) & 0xFFFFFFC0) * sizeof(uint32_t);
|
||||
|
||||
long screenBufferSize = rowStride * 1080;
|
||||
|
||||
cv::Mat f(1080, 1920, CV_8UC3);
|
||||
|
||||
glReadPixels(0, 0, 1920, 1080, GL_BGR, GL_UNSIGNED_BYTE, f.data);
|
||||
|
||||
|
||||
cv::Mat cv_pixels( 1080, 1920, CV_8UC3 );
|
||||
|
||||
for( int y=0; y<1080; y++ ) for( int x=0; x<1920; x++ ) {
|
||||
|
||||
cv_pixels.at<cv::Vec3b>(y,x)[2] = f.at<cv::Vec3b>(1080-y-1,x)[0];
|
||||
cv_pixels.at<cv::Vec3b>(y,x)[1] = f.at<cv::Vec3b>(1080-y-1,x)[1];
|
||||
cv_pixels.at<cv::Vec3b>(y,x)[0] = f.at<cv::Vec3b>(1080-y-1,x)[2];
|
||||
}
|
||||
|
||||
video << cv_pixels;
|
||||
//video << f;
|
||||
|
||||
} else if(frames <= 0) {
|
||||
video.release();
|
||||
//UpdateVideoStatus(WM_VIDEO_STATUS_FILE_CLOSED);
|
||||
}
|
||||
|
||||
static float scale = 0.96f;
|
||||
//static float scalePrev = 1.0f;
|
||||
@@ -155,6 +125,36 @@ void Rubiks::run() {
|
||||
);
|
||||
}
|
||||
|
||||
if(rolling) {
|
||||
frames--;
|
||||
|
||||
rolling = frames > 0;
|
||||
|
||||
uint32_t rowStride = ((1920 + 63) & 0xFFFFFFC0) * sizeof(uint32_t);
|
||||
|
||||
long screenBufferSize = rowStride * 1080;
|
||||
|
||||
cv::Mat f(1080, 1920, CV_8UC3);
|
||||
|
||||
glReadPixels(0, 0, 1920, 1080, GL_RGB, GL_UNSIGNED_BYTE, f.data);
|
||||
|
||||
|
||||
cv::Mat cv_pixels( 1080, 1920, CV_8UC3 );
|
||||
|
||||
for( int y=0; y<1080; y++ ) for( int x=0; x<1920; x++ ) {
|
||||
|
||||
cv_pixels.at<cv::Vec3b>(y,x)[2] = f.at<cv::Vec3b>(1080-y-1,x)[0];
|
||||
cv_pixels.at<cv::Vec3b>(y,x)[1] = f.at<cv::Vec3b>(1080-y-1,x)[1];
|
||||
cv_pixels.at<cv::Vec3b>(y,x)[0] = f.at<cv::Vec3b>(1080-y-1,x)[2];
|
||||
}
|
||||
|
||||
video << cv_pixels;
|
||||
//video << f;
|
||||
|
||||
} else if(frames <= 0) {
|
||||
video.release();
|
||||
//UpdateVideoStatus(WM_VIDEO_STATUS_FILE_CLOSED);
|
||||
}
|
||||
|
||||
{
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
|
||||
Reference in New Issue
Block a user