示例:DetectSubregions
分段筛选器对传递到 DetectSubregions 方法的流 (pImageStream) 执行区域检测。 有关此示例中使用的 CreateSegmentationFilter 函数的信息,请参阅Microsoft Windows SDK文档中的 IWiaItem2::GetExtension 方法。
HRESULT
DetectSubregions(
IN IStream *pImageStream,
IN IWiaItem2 *pWiaItem2)
{
HRESULT hr = S_OK;
IWiaSegmentationFilter* pSegmentationFilter = NULL;
if (!pWiaItem2 || !pImageStream)
{
hr = E_INVALIDARG;
}
if (SUCCEEDED(hr))
{
hr = CreateSegmentationFilter(pWiaItem2, &pSegmentationFilter);
}
if (SUCCEEDED(hr))
{
hr = pSegmentationFilter->DetectRegions(pImageStream, pWiaItem2);
}
if (pSegmentationFilter)
{
pSegmentationFilter->Release();
pSegmentationFilter = NULL;
}
return hr;
}