欢迎光临散文网 会员登陆 & 注册

当大学生学了C语言后

2023-02-27 02:11 作者:莫語浮生  | 我要投稿

#include <iostream>

#include <openCV2/opencv.hpp>

#include<easyx.h>

#include<mmsystem.h>

#pragma comment(lib,"winmm.lib")

using namespace std;

using namespace cv;

int main()

{

VideoCapture video("./aikun.mp4");

mciSendString("open aikun.mp3", 0, 0, 0);

Mat image;

Mat show;

string txt;

initgraph(video.get(CAP_PROP_FRAME_WIDTH) * 2, video.get(CAP_PROP_FRAME_HEIGHT) * 2);

BeginBatchDraw();

while (1)

{

video >> image;

if (image.empty())

{

break;

}

imshow("badapple", image);

resize(image, show, Size(),0.125*1,0.125*1);

cvtColor(show, show, COLOR_RGB2GRAY);

for (int i=0;i<show.rows;i++)

{

for (int j = 0; j < show.cols; j++)

{

if (show.at<uchar>(i,j)<= 128)

{

txt +="11";

}

else

{

txt += "00";

}

}

outtextxy(0, i*16, txt.c_str());

txt.clear();

}

FlushBatchDraw();

waitKey(1000 / video.get(CAP_PROP_FPS));

cleardevice();

mciSendString("play aikun.mp3", 0, 0, 0);

}

EndBatchDraw();

closegraph();

return 0;

}

当大学生学了C语言后的评论 (共 条)

分享到微博请遵守国家法律