コード例 #1
0
// return the number of channels for camera
int CvCaptureCAM_CMU::getNChannels()
{
    C1394Camera* cmucam = camera();	
    int format = cmucam->GetVideoFormat();
    int mode = cmucam->GetVideoMode();

    if( format==7 ){
        assert(0);
        return 1;
    }

    // irrelvant to nchannels 
    if( format > 1 )
        format = 1;

    switch(CV_CAP_IEEE1394_COLOR[format][mode]){
    case CV_CAP_IEEE1394_COLOR_RGB:
        return 3;
    case CV_CAP_IEEE1394_COLOR_MONO:
    case CV_CAP_IEEE1394_COLOR_MONO16:
        return 1;
    case CV_CAP_IEEE1394_COLOR_YUV422:
    case CV_CAP_IEEE1394_COLOR_YUV444:
    case CV_CAP_IEEE1394_COLOR_YUV411:
        return 3;
    default:
        ;
    }
    return -1;
}
コード例 #2
0
bool CvCaptureCAM_CMU::setFrameRate(int rate)
{
    int format, mode;
    C1394Camera* cmucam = camera();
    if( !cmucam )
        return false;
    mode = cmucam->GetVideoMode();
    format = cmucam->GetVideoFormat();
    if( rate < 0 || rate > 5 || !cmucam->HasVideoFrameRate(format, mode, rate) )
        return false;
    cmucam->StopImageAcquisition();
    cmucam->SetVideoFrameRate(rate);
    cmucam->StartImageAcquisition();
    return true;	
}
コード例 #3
0
double CvCaptureCAM_CMU::getProperty( int property_id )
{
    C1394Camera* cmucam = camera();
    if( !cmucam )
        return 0;
    switch( property_id )
    {
    case CV_CAP_PROP_FRAME_WIDTH:
        return image->width;
    case CV_CAP_PROP_FRAME_HEIGHT:
        return image->height;
    case CV_CAP_PROP_FPS:
        return cmucam->GetVideoFrameRate();
    case CV_CAP_PROP_MODE:
        return cmucam->GetVideoMode();
    case CV_CAP_PROP_FORMAT:
        return cmucam->GetVideoFormat();
    }
    return 0;
}
コード例 #4
0
// return the opencv depth flag corresponding to the camera format
int CvCaptureCAM_CMU::getDepth()
{
    C1394Camera* cmucam = camera();
    int format = cmucam->GetVideoFormat();
    int mode = cmucam->GetVideoMode();

    // TODO
    if( format==7 ) {
        assert(0);
        return 1;
    }
    // irrelvant to depth
    if( format > 1 )
        format = 1;

    if( CV_CAP_IEEE1394_COLOR[format][mode]==CV_CAP_IEEE1394_COLOR_MONO16 )
        return IPL_DEPTH_16S;

    return IPL_DEPTH_8U;
}