• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ VideoMode类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中VideoMode的典型用法代码示例。如果您正苦于以下问题:C++ VideoMode类的具体用法?C++ VideoMode怎么用?C++ VideoMode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了VideoMode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: if

void XtionDepthDriverImpl::setDepthCameraResolution(const DepthResolution resolution)
{
  _stream.stop();

  VideoMode mode = _stream.getVideoMode();

  if(resolution == DEPTH_RESOLUTION_320_240) {
    mode.setResolution(320, 240);
  } else if(resolution == DEPTH_RESOLUTION_640_480) {
    mode.setResolution(640, 480);
  } else {
    _stream.start();
    throw Exception("Invalid resolution");
  }

  Status rc = _stream.setVideoMode(mode);
  if (rc != STATUS_OK) {
    _stream.start();
    throw Exception(std::string("Set the resolution failed with\n")
      + OpenNI::getExtendedError());
  }
  
  rc = _stream.start();
  if(rc != STATUS_OK) {
    // how handle this?!
    close();
    
    throw Exception("Unable to start the depth stream");
  }
}
开发者ID:Clemensius,项目名称:libkovan,代码行数:30,代码来源:xtion_depth_driver_impl_p.cpp


示例2: initializeVideo

void TouchTracking::initializeVideo()
{
    OpenNI::initialize();

    if (device.open(ANY_DEVICE) != STATUS_OK)
    {
        throw std::runtime_error("could not open any device!");
    }

    if (!device.hasSensor(SENSOR_DEPTH))
    {
        throw std::runtime_error("sensor cannot receive depth!");
    }

    auto info = device.getSensorInfo(SENSOR_DEPTH);
    auto& modes = info->getSupportedVideoModes();
    //std::cout << "depth sensor supported modes:\r\n";
    for (int i = 0; i < modes.getSize(); ++i)
    {
        m_videoModes.push_back(modes[i]);
        //std::cout << "pixel format: " << mode.getPixelFormat() << "\t with: " << mode.getResolutionX() << "x" << mode.getResolutionY() << "@" << mode.getFps() << " fps\r\n";
    }

    VideoMode mode;
    mode.setFps(60);
    mode.setPixelFormat(PIXEL_FORMAT_DEPTH_1_MM);
    mode.setResolution(320, 240);
    videoMode(mode);

    stream.setMirroringEnabled(false);
}
开发者ID:patrigg,项目名称:TouchTable,代码行数:31,代码来源:TouchTracking.cpp


示例3: printVideoMode

void DeviceController::printVideoMode(VideoMode mode)
{
	PixelFormat pixelFormat = mode.getPixelFormat();
	string pixelFormatName;
	switch (pixelFormat) 
	{
		case PIXEL_FORMAT_DEPTH_1_MM:
		{
			pixelFormatName = "PIXEL_FORMAT_DEPTH_1_MM";
			break;
		}
		case PIXEL_FORMAT_DEPTH_100_UM:
		{
			pixelFormatName = "PIXEL_FORMAT_DEPTH_100_UM";
			break;
		}
		case PIXEL_FORMAT_SHIFT_9_2:
		{
			pixelFormatName = "PIXEL_FORMAT_SHIFT_9_2";
			break;
		}
		case PIXEL_FORMAT_SHIFT_9_3:
		{
			pixelFormatName = "PIXEL_FORMAT_SHIFT_9_3";
			break;
		}
		case PIXEL_FORMAT_RGB888:
		{
			pixelFormatName = "PIXEL_FORMAT_RGB888";
			break;
		}
		case PIXEL_FORMAT_YUV422:
		{
			pixelFormatName = "PIXEL_FORMAT_YUV422";
			break;
		}
		case PIXEL_FORMAT_GRAY8:
		{
			pixelFormatName = "PIXEL_FORMAT_GRAY8";
			break;
		}
		case PIXEL_FORMAT_GRAY16:
		{
			pixelFormatName = "PIXEL_FORMAT_GRAY16";
			break;
		}
		case PIXEL_FORMAT_JPEG:
		{
			pixelFormatName = "PIXEL_FORMAT_JPEG";
			break;
		}
			
	}
	ofLogVerbose() << "PixelFormat: "	<< pixelFormatName;
	ofLogVerbose() << "ResolutionX: "	<< mode.getResolutionX();
	ofLogVerbose() << "ResolutionY: "	<< mode.getResolutionY();
	ofLogVerbose() << "FPS: "			<< mode.getFps();
}
开发者ID:RedRoosterMobile,项目名称:ofxOpenNI2Grabber,代码行数:58,代码来源:DeviceController.cpp


示例4: Exception

void XtionDepthDriverImpl::open()
{
  if(_device.isValid()) return;
  
  Status rc = _device.open(ANY_DEVICE);
  if(rc != STATUS_OK) {
    throw Exception(std::string("Open the device failed with\n")
      + OpenNI::getExtendedError());
  }
  _device.open(ANY_DEVICE);

  if(!_device.getSensorInfo(SENSOR_DEPTH)) {
    _device.close();
    throw Exception("Device has no depth sensor!");
  }

  rc = _stream.create(_device, SENSOR_DEPTH);
  if(rc != STATUS_OK) {
    _device.close();
    throw Exception(std::string("Create the depth stream failed with\n")
      + OpenNI::getExtendedError());
  }

  VideoMode mode = _stream.getVideoMode();
  mode.setPixelFormat(PIXEL_FORMAT_DEPTH_1_MM);

  rc = _stream.setVideoMode(mode);
  if(rc != STATUS_OK) {
      throw Exception(std::string("Set the pixel format to "
          "PIXEL_FORMAT_DEPTH_1_MM failed with\n")
          + OpenNI::getExtendedError());
  }

  rc = _stream.start();
  if(rc != STATUS_OK) {
    _stream.destroy();
    _device.close();

    throw Exception(std::string("Starting the depth stream failed with\n")
      + OpenNI::getExtendedError());
  }

  rc = _stream.addNewFrameListener(this);
  if(rc != STATUS_OK) {
    _stream.stop();
    _stream.destroy();
    _device.close();

    throw Exception(std::string("Adding the frame listener failed with\n")
      + OpenNI::getExtendedError());
  }
}
开发者ID:Clemensius,项目名称:libkovan,代码行数:52,代码来源:xtion_depth_driver_impl_p.cpp


示例5: depthCameraResolution

DepthResolution XtionDepthDriverImpl::depthCameraResolution() const
{
  const VideoMode mode = _stream.getVideoMode();

  int res_x = mode.getResolutionX();
  int res_y = mode.getResolutionY();

  if((res_x == 320) && (res_y = 240)) {
    return DEPTH_RESOLUTION_320_240;
  } else if((res_x == 640) && (res_y = 480)) {
    return DEPTH_RESOLUTION_640_480;
  }
  
  return DEPTH_INVALID_RESOLUTION;
}
开发者ID:Clemensius,项目名称:libkovan,代码行数:15,代码来源:xtion_depth_driver_impl_p.cpp


示例6: open

void AVForm::open(const QString &devName, const VideoMode &mode)
{
    QRect rect = mode.toRect();
    Settings::getInstance().setCamVideoRes(rect);
    Settings::getInstance().setCamVideoFPS(static_cast<quint16>(mode.FPS));
    camera.open(devName, mode);
}
开发者ID:Pik-9,项目名称:qTox,代码行数:7,代码来源:avform.cpp


示例7: currentThreadId

void Renderer::initialize(bool fs, int mode) {
  fullscreen = fs;
  if (!renderThreadId)
    renderThreadId = currentThreadId();
  else
    CHECK(currentThreadId() == *renderThreadId);
  CHECK(!getResolutions().empty()) << sf::VideoMode::getFullscreenModes().size() << " " << int(sf::VideoMode::getDesktopMode().bitsPerPixel);
  CHECK(mode >= 0 && mode < getResolutions().size()) << mode << " " << getResolutions().size();
  VideoMode vMode = getResolutions()[mode];
  CHECK(vMode.isValid()) << "Video mode invalid: " << int(vMode.width) << " " << int(vMode.height) << " " << int(vMode.bitsPerPixel) << " " << fs;
  if (fullscreen)
    display.create(vMode, "KeeperRL", sf::Style::Fullscreen);
  else
    display.create(sf::VideoMode::getDesktopMode(), "KeeperRL");
  sfView = new sf::View(display.getDefaultView());
  display.setVerticalSyncEnabled(true);
}
开发者ID:silidur,项目名称:keeperrl,代码行数:17,代码来源:renderer.cpp


示例8: Game

	Game() {
		getLog().addDevice( new StreamLogDevice(std::cout) );

		win_.reset		( new Window( *this ) );
		inp_.reset		( new Input( *this ) );
		scene_.reset	( new ChcSceneManager(*this) );
		asmg_.reset		( new AssetManager( *this ) );

		asmg_->addContentFactory< ImageContent >( "img" );
		auto vms = VideoMode::getAvailable();
		
		std::sort( vms.begin(), vms.end(),
			[]( VideoMode &a, VideoMode &b ) {
				return a.getWidth() < b.getWidth();
			}
		);
		VideoMode vm = vms.back();
		vm.setFullscreen( true );
		//vm.setSize( 1920, 800 );
		vm.setVSync(true);
		vm.setDecorated( true );
		vm.setBpp( 32 );
		
		win_->setVideoMode( vm );
		
		addTask( *win_ );
		addTask( *inp_ );

		win_->addTask( *scene_ );
		
		inp_->addInputListener(*this);

		setupGL();
		loadTexture();
		createCamera();
		createLevel();

		ctrl_.reset( new CameraControl( *this ) );
		ctrl_->connect();
		

		BlockPlacer *pl = new BlockPlacer( *world_ );
		
		inp_->addInputListener( *pl );
		scene_->getRoot().createChild().attachEntity( *pl );		
	}
开发者ID:cristicbz,项目名称:AdventureMiner,代码行数:46,代码来源:OnTheFly.cpp


示例9: assert

void AVForm::on_videoModescomboBox_currentIndexChanged(int index)
{
    assert(0 <= index && index < videoModes.size());
    int devIndex = videoDevCombobox->currentIndex();
    assert(0 <= devIndex && devIndex < videoDeviceList.size());

    QString devName = videoDeviceList[devIndex].first;
    VideoMode mode = videoModes[index];

    if (CameraDevice::isScreen(devName) && mode == VideoMode())
    {
        if (Settings::getInstance().getScreenGrabbed())
        {
            VideoMode mode(Settings::getInstance().getScreenRegion());
            open(devName, mode);
            return;
        }

        // note: grabber is self-managed and will destroy itself when done
        ScreenshotGrabber* screenshotGrabber = new ScreenshotGrabber;

        auto onGrabbed = [screenshotGrabber, devName, this] (QRect region)
        {
            VideoMode mode(region);
            mode.width = mode.width / 2 * 2;
            mode.height = mode.height / 2 * 2;

            // Needed, if the virtual screen origin is the top left corner of the primary screen
            QRect screen = QApplication::primaryScreen()->virtualGeometry();
            mode.x += screen.x();
            mode.y += screen.y();

            Settings::getInstance().setScreenRegion(mode.toRect());
            Settings::getInstance().setScreenGrabbed(true);

            open(devName, mode);
        };

        connect(screenshotGrabber, &ScreenshotGrabber::regionChosen, this, onGrabbed, Qt::QueuedConnection);
        screenshotGrabber->showGrabber();
        return;
    }

    Settings::getInstance().setScreenGrabbed(false);
    open(devName, mode);
}
开发者ID:Pik-9,项目名称:qTox,代码行数:46,代码来源:avform.cpp


示例10: close

void Window::create(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings)
{
    // Destroy the previous window implementation
    close();

    // Fullscreen style requires some tests
    if (style & Style::Fullscreen)
    {
        // Make sure there's not already a fullscreen window (only one is allowed)
        if (fullscreenWindow)
        {
            err() << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
            style &= ~Style::Fullscreen;
        }
        else
        {
            // Make sure that the chosen video mode is compatible
            if (!mode.isValid())
            {
                err() << "The requested video mode is not available, switching to a valid mode" << std::endl;
                mode = VideoMode::getFullscreenModes()[0];
            }

            // Update the fullscreen window
            fullscreenWindow = this;
        }
    }

    // Check validity of style according to the underlying platform
    #if defined(SFML_SYSTEM_IOS) || defined(SFML_SYSTEM_ANDROID)
        if (style & Style::Fullscreen)
            style &= ~Style::Titlebar;
        else
            style |= Style::Titlebar;
    #else
        if ((style & Style::Close) || (style & Style::Resize))
            style |= Style::Titlebar;
    #endif

    // Recreate the window implementation
    m_impl = priv::WindowImpl::create(mode, title, style, settings);

    // Recreate the context
    m_context = priv::GlContext::create(settings, m_impl, mode.bitsPerPixel);

    // Perform common initializations
    initialize();
}
开发者ID:42bottles,项目名称:SFML,代码行数:48,代码来源:Window.cpp


示例11: init

void CVideoSourceKinect::initPlayer(std::string& strPathFileName_){
	init();
	_nMode = PLAYING_BACK;

	PRINTSTR("Initialize OpenNI Player...");
	//inizialization 
	Status nRetVal = openni::OpenNI::initialize();
	printf("After initialization:\n%s\n", openni::OpenNI::getExtendedError());
	nRetVal = _device.open(strPathFileName_.c_str());		CHECK_RC_(nRetVal, "Open oni file");
	nRetVal = _depth.create(_device, openni::SENSOR_DEPTH); CHECK_RC_(nRetVal, "Initialize _cContext"); 
	nRetVal = _color.create(_device, openni::SENSOR_COLOR); CHECK_RC_(nRetVal, "Initialize _cContext"); 

	nRetVal = _depth.start(); CHECK_RC_(nRetVal, "Create depth video stream fail");
	nRetVal = _color.start(); CHECK_RC_(nRetVal, "Create color video stream fail"); 

	if (_depth.isValid() && _color.isValid())
	{
		VideoMode depthVideoMode = _depth.getVideoMode();
		VideoMode colorVideoMode = _color.getVideoMode();

		int depthWidth = depthVideoMode.getResolutionX();
		int depthHeight = depthVideoMode.getResolutionY();
		int colorWidth = colorVideoMode.getResolutionX();
		int colorHeight = colorVideoMode.getResolutionY();

		if (depthWidth != colorWidth || depthHeight != colorHeight)
		{
			printf("Warning - expect color and depth to be in same resolution: D: %dx%d, C: %dx%d\n",
				depthWidth, depthHeight,
				colorWidth, colorHeight);
			//return ;
		}
	}

	_streams = new VideoStream*[2];
	_streams[0] = &_depth;
	_streams[1] = &_color;

	// set as the highest resolution 0 for 480x640 
	//register the depth generator with the image generator
	if ( _nRawDataProcessingMethod == BIFILTER_IN_ORIGINAL || _nRawDataProcessingMethod == BIFILTER_IN_DISPARITY ){
		nRetVal = _device.setImageRegistrationMode(IMAGE_REGISTRATION_DEPTH_TO_COLOR);

		//nRetVal = _depth.GetAlternativeViewPointCap().getGLModelViewMatrixPoint ( _color );	CHECK_RC_ ( nRetVal, "Getting and setting AlternativeViewPoint failed: " ); 
		// Set Hole Filter
		_device.setDepthColorSyncEnabled(TRUE);
	}//if (_bUseNIRegistration)
	PRINTSTR(" Done.");

	return;
}//initPlayer()
开发者ID:flair2005,项目名称:rgbd_mapping_and_relocalisation,代码行数:51,代码来源:VideoSourceKinect.cpp


示例12: close

void Window::create(VideoMode mode, const String& title, Uint32 style, const ContextSettings& settings)
{
    // Destroy the previous window implementation
    close();

    // Fullscreen style requires some tests
    if (style & Style::Fullscreen)
    {
        // Make sure there's not already a fullscreen window (only one is allowed)
        if (fullscreenWindow)
        {
            err() << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
            style &= ~Style::Fullscreen;
        }
        else
        {
            // Make sure that the chosen video mode is compatible
            if (!mode.isValid())
            {
                err() << "The requested video mode is not available, switching to a valid mode" << std::endl;
                mode = VideoMode::getFullscreenModes()[0];
            }

            // Update the fullscreen window
            fullscreenWindow = this;
        }
    }

    // Check validity of style
    if ((style & Style::Close) || (style & Style::Resize))
        style |= Style::Titlebar;

    // Recreate the window implementation
    m_impl = priv::WindowImpl::create(mode, title, style);
    m_impl->onDragDrop.connect(sigc::mem_fun(this, &Window::RedirectDragDrop));

    // Recreate the context
    m_context = priv::GlContext::create(settings, m_impl, mode.bitsPerPixel);

    // Perform common initializations
    initialize();
}
开发者ID:GrimshawA,项目名称:Nephilim,代码行数:42,代码来源:SFMLWindow.cpp


示例13: Close

void Window::Create(VideoMode mode, const std::string& title, unsigned long style, const ContextSettings& settings)
{
    // Destroy the previous window implementation
    Close();

    // Fullscreen style requires some tests
    if (style & Style::Fullscreen)
    {
        // Make sure there's not already a fullscreen window (only one is allowed)
        if (fullscreenWindow)
        {
            Err() << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
            style &= ~Style::Fullscreen;
        }
        else
        {
            // Make sure that the chosen video mode is compatible
            if (!mode.IsValid())
            {
                Err() << "The requested video mode is not available, switching to a valid mode" << std::endl;
                mode = VideoMode::GetFullscreenModes()[0];
            }

            // Update the fullscreen window
            fullscreenWindow = this;
        }
    }

    // Check validity of style
    if ((style & Style::Close) || (style & Style::Resize))
        style |= Style::Titlebar;

    // Recreate the window implementation
    myWindow = priv::WindowImpl::New(mode, title, style);

    // Recreate the context
    myContext = priv::GlContext::New(myWindow, mode.BitsPerPixel, settings);

    // Perform common initializations
    Initialize();
}
开发者ID:vidjogamer,项目名称:ProjectTemplate,代码行数:41,代码来源:Window.cpp


示例14: close

void Window::create(VideoMode mode, const std::string& title, Uint32 style, const ContextSettings& settings)
{
    // Destroy the previous window implementation
    close();

    // Fullscreen style requires some tests
    if (style & Style::Fullscreen)
    {
        // Make sure there's not already a fullscreen window (only one is allowed)
        if (fullscreenWindow)
        {
            style &= ~Style::Fullscreen;
        }
        else
        {
            // Make sure that the chosen video mode is compatible
            if (!mode.isValid())
            {
                mode = VideoMode::getFullscreenModes()[0];
            }

            // Update the fullscreen window
            fullscreenWindow = this;
        }
    }

    // Check validity of style
    if ((style & Style::Close) || (style & Style::Resize))
        style |= Style::Titlebar;

    // Recreate the window implementation
	m_impl = priv::WindowImplWin32::create(mode, title, style, settings);

    // Recreate the context
    m_context = priv::GlContext::create(settings, m_impl, mode.bitsPerPixel);

    // Perform common initializations
    initialize();
}
开发者ID:MrShedman,项目名称:GL-Dev,代码行数:39,代码来源:Window.cpp


示例15: Close

////////////////////////////////////////////////////////////
/// Create the window
////////////////////////////////////////////////////////////
void Window::Create(VideoMode Mode, const std::string& Title, unsigned long WindowStyle, const WindowSettings& Params)
{
    // Destroy the previous window implementation
    Close();

    // Fullscreen style requires some tests
    if (WindowStyle & Style::Fullscreen)
    {
        // Make sure there's not already a fullscreen window (only one is allowed)
        if (FullscreenWindow)
        {
            std::cerr << "Creating two fullscreen windows is not allowed, switching to windowed mode" << std::endl;
            WindowStyle &= ~Style::Fullscreen;
        }
        else
        {
            // Make sure the chosen video mode is compatible
            if (!Mode.IsValid())
            {
                std::cerr << "The requested video mode is not available, switching to a valid mode" << std::endl;
                Mode = VideoMode::GetMode(0);
            }

            // Update the fullscreen window
            FullscreenWindow = this;
        }
    }

    // Check validity of style
    if ((WindowStyle & Style::Close) || (WindowStyle & Style::Resize))
        WindowStyle |= Style::Titlebar;

    // Activate the global context
    Context::GetGlobal().SetActive(true);

    mySettings = Params;
    Initialize(priv::WindowImpl::New(Mode, Title, WindowStyle, mySettings));
}
开发者ID:AwkwardDev,项目名称:MangosFX,代码行数:41,代码来源:Window.cpp


示例16: VideoModeNotSupportedException

	void Window::setVideoMode( const VideoMode& mode ) {
		log << "Setting video mode " << mode << ".\n";

		if(!mode.isValid()) {
			log << "VideoModeNotSupportedException raised.\n";
			throw VideoModeNotSupportedException();
		}

		if( mode == mode_ ) {
			log << "No changes detected. Not doing anything.\n";
			return;
		}

		bool opOk;
		int w = mode.getWidth();
		int h = mode.getHeight();
		int bpp = mode.getBpp();
		int flags = SDL_OPENGL;

		if( mode.isFullscreen() )
			flags |= SDL_FULLSCREEN;

		if( !mode.isDecorated() )
			flags |= SDL_NOFRAME;

		_putenv(_strdup("SDL_VIDEO_CENTERED=1")); 
		SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1);
		SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL,mode.hasVSync()?1:0);
		
		opOk = SDL_SetVideoMode(w,h,bpp,flags) != 0;
		if( !opOk ) {
			log << "Warning: Mode reported it was valid, but SDL_SetVideoMode() failed.\n";
			throw VideoModeNotSupportedException();
		}

		mode_ = mode;
		log << "Video mode set.\n";
	}
开发者ID:cristicbz,项目名称:AdventureMiner,代码行数:38,代码来源:Window.cpp


示例17: main


//.........这里部分代码省略.........
	{
		trainingData[i][0] = svmE[i+1];
		trainingData[i][1] = svmC[i+1];
		trainingData[i][2] = svmA[i+1];
		trainingData[i][3] = svmP[i+1];
	}
    Mat trainingDataMat(1000, 4, CV_32FC1, trainingData);

    // Set up SVM's parameters
    CvSVMParams params;
	params = SVMFinger.get_params();
    //params.svm_type    = CvSVM::C_SVC;
    //params.kernel_type = CvSVM::LINEAR;
    //params.term_crit   = cvTermCriteria(CV_TERMCRIT_ITER, 100, 1e-6);

    // Train the SVM
    SVMFinger.train_auto(trainingDataMat, labelsMat, Mat(), Mat(), params);

//	Mat sampleMat = (Mat_<float>(1,2) << 138.5, 57);
//	float response = SVMFinger.predict(sampleMat);

	waitKey();
	destroyWindow("Image");
	destroyWindow("Image2");

	//------------------------------------------
	OpenNI::initialize();

	Device devAnyDevice;
    devAnyDevice.open(ANY_DEVICE);

	//----------------[Define Video Settings]-------------------
	//Set Properties of Depth Stream
	VideoMode mModeDepth;
	mModeDepth.setResolution( 640, 480 );
	mModeDepth.setFps( 30 );
	mModeDepth.setPixelFormat( PIXEL_FORMAT_DEPTH_100_UM );

	//Set Properties of Color Stream
	VideoMode mModeColor;
    mModeColor.setResolution( 640, 480 );
    mModeColor.setFps( 30 );
    mModeColor.setPixelFormat( PIXEL_FORMAT_RGB888 );
	//----------------------------------------------------------
	//----------------------[Initial Streams]---------------------
	VideoStream streamInitDepth;
    streamInitDepth.create( devAnyDevice, SENSOR_DEPTH );

	VideoStream streamInitColor;
    streamInitColor.create( devAnyDevice, SENSOR_COLOR );

	streamInitDepth.setVideoMode( mModeDepth );
	streamInitColor.setVideoMode( mModeColor );

	namedWindow( "Depth Image (Init)",  CV_WINDOW_AUTOSIZE );
    namedWindow( "Color Image (Init)",  CV_WINDOW_AUTOSIZE );
	//namedWindow( "Thresholded Image (Init)", CV_WINDOW_AUTOSIZE );

	VideoFrameRef  frameDepthInit;
    VideoFrameRef  frameColorInit;

	streamInitDepth.start();
	streamInitColor.start();
	cv::Mat BackgroundFrame;

	int avgDist = 0;
开发者ID:AlDCheng,项目名称:Osus,代码行数:67,代码来源:KinectDepthSVM.cpp


示例18: qWarning

void AVForm::updateVideoModes(int curIndex)
{
    if (curIndex<0 || curIndex>=videoDeviceList.size())
    {
        qWarning() << "Invalid index";
        return;
    }
    QString devName = videoDeviceList[curIndex].first;
    QVector<VideoMode> allVideoModes = CameraDevice::getVideoModes(devName);
    std::sort(allVideoModes.begin(), allVideoModes.end(),
        [](const VideoMode& a, const VideoMode& b)
            {return a.width!=b.width ? a.width>b.width :
                    a.height!=b.height ? a.height>b.height :
                    a.FPS>b.FPS;});
    bool previouslyBlocked = bodyUI->videoModescomboBox->blockSignals(true);
    bodyUI->videoModescomboBox->clear();

    // Identify the best resolutions available for the supposed XXXXp resolutions.
    std::map<int, VideoMode> idealModes;
    idealModes[120] = {160,120,0,0};
    idealModes[240] = {460,240,0,0};
    idealModes[360] = {640,360,0,0};
    idealModes[480] = {854,480,0,0};
    idealModes[720] = {1280,720,0,0};
    idealModes[1080] = {1920,1080,0,0};
    std::map<int, int> bestModeInds;

    qDebug("available Modes:");
    for (int i=0; i<allVideoModes.size(); ++i)
    {
        VideoMode mode = allVideoModes[i];
        qDebug("width: %d, height: %d, FPS: %f, pixel format: %s", mode.width, mode.height, mode.FPS, CameraDevice::getPixelFormatString(mode.pixel_format).toStdString().c_str());

        // PS3-Cam protection, everything above 60fps makes no sense
        if(mode.FPS > 60)
            continue;

        for(auto iter = idealModes.begin(); iter != idealModes.end(); ++iter)
        {
            int res = iter->first;
            VideoMode idealMode = iter->second;
            // don't take approximately correct resolutions unless they really
            // are close
            if (mode.norm(idealMode) > 300)
                continue;

            if (bestModeInds.find(res) == bestModeInds.end())
            {
                bestModeInds[res] = i;
                continue;
            }
            int ind = bestModeInds[res];
            if (mode.norm(idealMode) < allVideoModes[ind].norm(idealMode))
            {
                bestModeInds[res] = i;
            }
            else if (mode.norm(idealMode) == allVideoModes[ind].norm(idealMode))
            {
                // prefer higher FPS and "better" pixel formats
                if (mode.FPS > allVideoModes[ind].FPS)
                {
                    bestModeInds[res] = i;
                }
                else if (mode.FPS == allVideoModes[ind].FPS &&
                        CameraDevice::betterPixelFormat(mode.pixel_format, allVideoModes[ind].pixel_format))
                {
                    bestModeInds[res] = i;
                }
            }
        }
    }
    qDebug("selected Modes:");
    int prefResIndex = -1;
    QSize prefRes = Settings::getInstance().getCamVideoRes();
    unsigned short prefFPS = Settings::getInstance().getCamVideoFPS();
    // Iterate backwards to show higest resolution first.
    videoModes.clear();
    for(auto iter = bestModeInds.rbegin(); iter != bestModeInds.rend(); ++iter)
    {
        int i = iter->second;
        VideoMode mode = allVideoModes[i];

        if (videoModes.contains(mode))
            continue;

        videoModes.append(mode);
        if (mode.width==prefRes.width() && mode.height==prefRes.height() && mode.FPS == prefFPS && prefResIndex==-1)
            prefResIndex = videoModes.size() - 1;
        QString str;
        qDebug("width: %d, height: %d, FPS: %f, pixel format: %s\n", mode.width, mode.height, mode.FPS, CameraDevice::getPixelFormatString(mode.pixel_format).toStdString().c_str());
        if (mode.height && mode.width)
            str += tr("%1p").arg(iter->first);
        else
            str += tr("Default resolution");
        bodyUI->videoModescomboBox->addItem(str);
    }
    if (videoModes.isEmpty())
        bodyUI->videoModescomboBox->addItem(tr("Default resolution"));
    bodyUI->videoModescomboBox->blockSignals(previouslyBlocked);
    if (prefResIndex != -1)
//.........这里部分代码省略.........
开发者ID:Artom-Kozincev,项目名称:qTox,代码行数:101,代码来源:avform.cpp


示例19: VideoMode

void AVForm::selectBestModes(QVector<VideoMode> &allVideoModes)
{
    // Identify the best resolutions available for the supposed XXXXp resolutions.
    std::map<int, VideoMode> idealModes;
    idealModes[120] = VideoMode(160, 120);
    idealModes[240] = VideoMode(430, 240);
    idealModes[360] = VideoMode(640, 360);
    idealModes[480] = VideoMode(854, 480);
    idealModes[720] = VideoMode(1280, 720);
    idealModes[1080] = VideoMode(1920, 1080);

    std::map<int, int> bestModeInds;
    for (int i = 0; i < allVideoModes.size(); ++i)
    {
        VideoMode mode = allVideoModes[i];

        // PS3-Cam protection, everything above 60fps makes no sense
        if (mode.FPS > 60)
            continue;

        for (auto iter = idealModes.begin(); iter != idealModes.end(); ++iter)
        {
            int res = iter->first;
            VideoMode idealMode = iter->second;
            // don't take approximately correct resolutions unless they really
            // are close
            if (mode.norm(idealMode) > 300)
                continue;

            if (bestModeInds.find(res) == bestModeInds.end())
            {
                bestModeInds[res] = i;
                continue;
            }

            int index = bestModeInds[res];
            VideoMode best = allVideoModes[index];
            if (mode.norm(idealMode) < best.norm(idealMode))
            {
                bestModeInds[res] = i;
                continue;
            }

            if (mode.norm(idealMode) == best.norm(idealMode))
            {
                // prefer higher FPS and "better" pixel formats
                if (mode.FPS > best.FPS)
                {
                    bestModeInds[res] = i;
                    continue;
                }

                bool better = CameraDevice::betterPixelFormat(mode.pixel_format, best.pixel_format);
                if (mode.FPS >= best.FPS && better)
                    bestModeInds[res] = i;
            }
        }
    }

    QVector<VideoMode> newVideoModes;
    for (auto it = bestModeInds.rbegin(); it != bestModeInds.rend(); ++it)
    {
        VideoMode mode = allVideoModes[it->second];

        if (newVideoModes.empty())
        {
            newVideoModes.push_back(mode);
        }
        else
        {
            int size = getModeSize(mode);
            auto result = std::find_if(newVideoModes.cbegin(), newVideoModes.cend(),
                                       [size](VideoMode mode) { return getModeSize(mode) == size; });

            if (result == newVideoModes.end())
                newVideoModes.push_back(mode);
        }
    }
    allVideoModes = newVideoModes;
}
开发者ID:Pik-9,项目名称:qTox,代码行数:80,代码来源:avform.cpp


示例20: setVideoMode

	void Window::setDecorated( bool decorated ) {
		log << "Decoration change to " << decorated << ".\n";
		VideoMode newMode = mode_;
		newMode.setDecorated(decorated);
		setVideoMode(newMode);
	}
开发者ID:cristicbz,项目名称:AdventureMiner,代码行数:6,代码来源:Window.cpp



注:本文中的VideoMode类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VideoOutput类代码示例发布时间:2022-05-31
下一篇:
C++ VideoMetadataListManager类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap