0
我想在directshow中创建一个过滤器,将o/p视频剪裁到某个感兴趣的区域。 [GetMediaType(int iPosition,CMediaType * pMediaType)“]我通过使用[DIBSIZE]更改[biWidth,biHeight和biSizeImage]指定指针指向pMediatype的视频标题,详情如下:directshow视频裁剪过滤器
// pvih is a pointer to pMediaType->pbFormat of type videoheader
//pInVh is a pointer to CurrentMediaType().pbFormat of the i/p of type videoheader
pvih->rcSource = pInVh->rcSource;
pvih->rcTarget = pInVh->rcTarget;
//bitmap settings
pvih->bmiHeader.biWidth = _Width;//width of region of interest
pvih->bmiHeader.biHeight = _Height;// height of region of interest
m_Width=pInVh->bmiHeader.biWidth;
m_Height=pInVh->bmiHeader.biHeight;
pvih->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
pvih->bmiHeader.biPlanes = 1; //1 image plane
pvih->bmiHeader.biBitCount = 24; //24bit
pvih->bmiHeader.biCompression = BI_RGB; //simply three values
pvih->bmiHeader.biSizeImage = DIBSIZE(pvih->bmiHeader);
//mediatype settings
pMediaType->majortype = MEDIATYPE_Video; //a video stream
pMediaType->subtype = MEDIASUBTYPE_RGB24; //24bit rgb samples
pMediaType->bFixedSizeSamples = true; //no varying size
pMediaType->bTemporalCompression = false; //no compression
pMediaType->formattype = FORMAT_VideoInfo; //VIDEOINFOHEADER
pMediaType->lSampleSize = pvih->bmiHeader.biWidth * pvih->bmiHeader.biHeight * pvih- >bmiHeader.biBitCount/8; //size of one sample in bytes
pMediaType->cbFormat = sizeof(VIDEOINFOHEADER); //additiona format setting
但是当我用原始帧的样本填充裁剪框架时,o/p视频是垃圾,我也试着用常量颜色填充它,o/p不正确,不知道如何解决这个问题?
我已经下载了那个,没有源代码,它只有dll文件。我不能在滤镜中使用它。 – Karam 2012-04-27 14:21:11
抱歉,认为它说有SVN访问 – Pete 2012-04-27 20:37:41