本文整理汇总了C++中ImageGenerator::GetImageParams方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageGenerator::GetImageParams方法的具体用法?C++ ImageGenerator::GetImageParams怎么用?C++ ImageGenerator::GetImageParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageGenerator
的用法示例。
在下文中一共展示了ImageGenerator::GetImageParams方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
FramesTransmitter framesTransmitter;
ImageGenerator imageGenerator;
int imageWidth, imageHeight, imageBPP;
imageGenerator.GetImageParams(imageWidth, imageHeight, imageBPP);
framesTransmitter.Init("127.0.0.1", "5541", imageWidth, imageHeight, imageBPP);
//for (int i = 0; i < 100; ++i)
//{
// unsigned char * buff = imageGenerator.GenerateImage();
// framesTransmitter.Transmit(buff);
// // save image on HDD
// bitmap_image image(imageWidth, imageHeight);
// int sizeToCopy = sizeof(char) * imageWidth * imageHeight * imageBPP / 8;
// std::copy(buff, buff + sizeToCopy, image.data());
// char filePath[200];
// sprintf(filePath, "D:/eclipse_workspace/FramesTransmitter/FramesToSend/img%04d.bmp", i);
// image.save_image(filePath);
//}
int frameCounter = 0;
int channels = imageBPP / 8;
IplImage * image = cvCreateImage(cvSize(imageWidth, imageHeight), IPL_DEPTH_8U, channels);
while(cvWaitKey(40) != 113) // press 'q'
{
unsigned char * buff = imageGenerator.GenerateImage();
int sizeToCopy = sizeof(char) * imageWidth * imageHeight * channels;
std::copy(buff, buff + sizeToCopy, image -> imageData);
char str[100];
sprintf(str,"[%04d]", frameCounter++ );
CvFont font;
cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX, 1, 1, 0, 2, 8);
cvPutText(image, str, cvPoint(10,40), &font, cvScalar(255,255,255));
cvShowImage("Display window", image);
framesTransmitter.Transmit((unsigned char*) image -> imageData);
}
cvDestroyWindow("Display window");
cvReleaseImage(&image);
return 0;
}