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

C++ videoInput类代码示例

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

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



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

示例1: InitVideo

// запуск получения кадров с видеокамеры
void InitVideo()
{
	// int numDevices = videoInput::listDevices();
	VI.setUseCallback(true);
	VI.setupDevice(dev, ImageWidth, ImageHeight, VI_COMPOSITE); 
}
开发者ID:suratovvlad,项目名称:videostream,代码行数:7,代码来源:SampleVideo.cpp


示例2: UpdateTime

void UpdateTime(float dt)
{
	// проверяем наличие кадра
	if( VI.isFrameNew(dev) )	
	{
		// копируем содержимое кадра
		VI.getPixels(dev, CamImg, true);			
	}
}
开发者ID:suratovvlad,项目名称:videostream,代码行数:9,代码来源:SampleVideo.cpp


示例3: open

// Initialize camera input
bool CvCaptureCAM_DShow::open( int _index )
{
    close();
    VI.setupDevice(_index);
    if( !VI.isDeviceSetup(_index) )
        return false;
    index = _index;
    return true;
}
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:10,代码来源:cvcap_dshow.cpp


示例4: retrieveFrame

IplImage* CvCaptureCAM_DShow::retrieveFrame()
{
    if( !frame || VI.getWidth(index) != frame->width || VI.getHeight(index) != frame->height )
    {
        cvReleaseImage( &frame );
        int w = VI.getWidth(index), h = VI.getHeight(index);
        frame = cvCreateImage( cvSize(w,h), 8, 3 );
    }
    
    VI.getPixels( index, (uchar*)frame->imageData, false, true );
    return frame;
}
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:12,代码来源:cvcap_dshow.cpp


示例5: getProperty

double CvCaptureCAM_DShow::getProperty( int property_id )
{
    switch( property_id )
    {
    case CV_CAP_PROP_FRAME_WIDTH:
        return VI.getWidth(index);
    case CV_CAP_PROP_FRAME_HEIGHT:
        return VI.getHeight(index);
    case CV_CAP_PROP_FOURCC:
        return 0;
    }
    return 0;
}
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:13,代码来源:cvcap_dshow.cpp


示例6: close

void CvCaptureCAM_DShow::close()
{
    if( index >= 0 )
    {
        VI.stopDevice(index);
        index = -1;
        cvReleaseImage(&frame);
    }
}
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:9,代码来源:cvcap_dshow.cpp


示例7: open

// Initialize camera input
bool CvCaptureCAM_DShow::open( int _index )
{
	int try_index = _index;
	int devices = 0;

    close();
    devices = VI.listDevices(true);
    if (devices == 0)
    	return false;
    try_index = try_index < 0 ? 0 : (try_index > devices-1 ? devices-1 : try_index);

    if (OPENCV_FPS) {
        VI.setIdealFramerate(try_index, OPENCV_FPS);
    }

    VI.setupDevice(try_index);
    if( !VI.isDeviceSetup(try_index) )
        return false;
    index = try_index;
    return true;
}
开发者ID:marccodes,项目名称:lfl,代码行数:22,代码来源:cvcap_dshow.cpp


示例8: setProperty

bool CvCaptureCAM_DShow::setProperty( int property_id, double value )
{
    int width = 0, height = 0;
    
    switch( property_id )
    {
    case CV_CAP_PROP_FRAME_WIDTH:
        width = cvRound(value);
        height = width*3/4;
        break;
    case CV_CAP_PROP_FRAME_HEIGHT:
        height = cvRound(value);
        width = height*4/3;
    default:
        return false;
    }

    if( width != VI.getWidth(index) || height != VI.getHeight(index) )
    {
        VI.stopDevice(index);
        VI.setupDevice(index, width, height);
    }
    return VI.isDeviceSetup(index);
}
开发者ID:Barco-VCT,项目名称:VirtualClinicalTrials,代码行数:24,代码来源:cvcap_dshow.cpp


示例9: Render

//--------------------------------------------------------------------------------------
// Render a frame
//--------------------------------------------------------------------------------------
void Render()
{
    static DWORD dwTimeStart = GetTickCount();
    gCbOneFrame.time = ( GetTickCount() - dwTimeStart ) / 1000.0f;

    if (gIsCameraDevice && gVideoInput.isFrameNew(kDeviceId))
    {
        V(updateTextureFromCamera(0, kDeviceId));
    }

    gContext->ClearRenderTargetView( PingPong::RTVs[PingPong::frontBufferIdx], kBlackColor );

    ID3D11RenderTargetView* pRTVs[] = {PingPong::RTVs[PingPong::frontBufferIdx]};
    gContext->OMSetRenderTargets( _countof(pRTVs), pRTVs, NULL );

    gContext->UpdateSubresource( gCBOneFrame, 0, NULL, &gCbOneFrame, 0, 0 );

    ID3D11Buffer* pCBuffers[] = {gCBOneFrame};
    gContext->PSSetConstantBuffers( 0, _countof(pCBuffers), pCBuffers );

    if (!gTextureSRVs.empty())
        gContext->PSSetShaderResources( 0, gTextureSRVs.size(), &gTextureSRVs[0] );
    ID3D11ShaderResourceView* pSRVs[] = {PingPong::SRVs[PingPong::backBufferIdx]};
    gContext->PSSetShaderResources( 1, _countof(pSRVs), pSRVs );

    ID3D11SamplerState* pSamplers[] = {gSamplerSmooth, gSamplerBlocky, gSamplerMirror};
    gContext->PSSetSamplers( 0, _countof(pSamplers), pSamplers );

    gContext->Draw( 3, 0 );

    ID3D11ShaderResourceView* pZeroSRVs[8] = {NULL};
    gContext->PSSetShaderResources( 1, _countof(pZeroSRVs), pZeroSRVs );

    gContext->CopyResource(gBackbuffer, PingPong::TEXs[PingPong::frontBufferIdx]);

    gSwapChain->Present( 0, 0 );

    std::swap(PingPong::frontBufferIdx, PingPong::backBufferIdx);
}
开发者ID:w23,项目名称:shadertoy-dx11,代码行数:42,代码来源:Toy.cpp


示例10: updateTextureFromCamera

HRESULT updateTextureFromCamera( int textureIdx, int deviceId )
{
    hr = S_OK;

    bool isCreateTexture = false;
    if (gTextureSRVs[textureIdx] == NULL)
    {
       isCreateTexture = true;
    }

    if (isCreateTexture)
    {
        while (!gVideoInput.isFrameNew(kDeviceId))
        {
            ::Sleep(30);
        }
    }

    int srcWidth = gVideoInput.getWidth(deviceId);
    int srcHeight = gVideoInput.getHeight(deviceId);
    BYTE* srcPixels = gVideoInput.getPixels(kDeviceId, true, true);

    // texture size is smaller than camera frame size in order to fix the black border issue
    int dstWidth = srcWidth - 1;
    int dstHeight = srcHeight - 1;

    CComPtr<ID3D11Texture2D> tex;

    if (isCreateTexture)
    {
        CD3D11_TEXTURE2D_DESC desc(DXGI_FORMAT_R8G8B8A8_UNORM, dstWidth, dstHeight);
        desc.MipLevels = 1;
        desc.Usage = D3D11_USAGE_DYNAMIC;
        desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
        V_RETURN(gDevice->CreateTexture2D( &desc, NULL, &tex ));
        V_RETURN(gDevice->CreateShaderResourceView(tex, NULL, &gTextureSRVs[textureIdx]));
    }
    else
    {
        gTextureSRVs[textureIdx]->GetResource(reinterpret_cast<ID3D11Resource**>(&tex)); 
    }

    struct ColorRGB
    {
        BYTE r,g,b;
    };

    struct ColorRGBA
    {
        ColorRGB rgb;
        BYTE a;
    };

    D3D11_MAPPED_SUBRESOURCE mappedRes;
    V_RETURN(gContext->Map(tex, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedRes));
    ColorRGB* src = reinterpret_cast<ColorRGB*>(srcPixels);
    ColorRGBA* dest = reinterpret_cast<ColorRGBA*>(mappedRes.pData);
    UINT pitch = mappedRes.RowPitch / sizeof(ColorRGBA);
    for (int y = 0; y < dstHeight; y++)
    {
        for (int x = 0; x < dstWidth; x++)
        {
            dest[y * pitch + x].rgb = src[y * srcWidth + srcWidth - x];
            dest[y * pitch + x].a = 255;
        }
    }
    gContext->Unmap(tex, 0);

    return hr;
}
开发者ID:w23,项目名称:shadertoy-dx11,代码行数:70,代码来源:Toy.cpp


示例11: grabFrame

bool CvCaptureCAM_DShow::grabFrame()
{
    return VI.isFrameNew(index);
}
开发者ID:marccodes,项目名称:lfl,代码行数:4,代码来源:cvcap_dshow.cpp



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ viewer_media_t类代码示例发布时间:2022-05-31
下一篇:
C++ vi类代码示例发布时间: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