IWiaSegmentationFilter::DetectRegions method

The IWiaSegmentationFilter::DetectRegions method determines the subregions of an image laid out on the flatbed platen so that each subregion can be acquired into a separate image item.


HRESULT DetectRegions(
  LONG      lFlags,
  IStream   *pInputStream,
  IWiaItem2 *pWiaItem2



Currently unused. Should be set to zero.


Specifies a pointer to the IStream preview image.


Specifies a pointer to the IWiaItem2 item for which pInputStream was acquired. The segmentation filter creates child items for this item.

Return value

Returns S_OK if successful, or a standard COM error value otherwise.


This method determines the subregions of the image represented by pInputStream. For each subregion that it detects, it creates a child item for the IWiaItem2 item pointed to by the pWiaItem2 parameter. For each child item, the segmentation filter must set values for the bounding rectangle of the area to scan, using the following WIA scanner item properties:





A more advanced filter might also require other scanner item properties, such as WIA_IPS_DESKEW_X and WIA_IPS_DESKEW_Y, if the driver supports deskewing.

If an application calls IWiaSegmentationFilter::DetectRegions more than once, the application must first delete the child items created by the last call to the IWiaSegmentationFilter::DetectRegions method.

If an application changes any properties into pWiaItem2, between acquiring the image into pInputStream and its call to IWiaSegmentationFilter::DetectRegions, the original property settings (the property settings the item had when the stream was acquired) must be restored. This can be done using IWiaPropertyStorage::GetPropertyStream and IWiaPropertyStorage::SetPropertyStream.

The application must reset the IStream preview if its call passes the same stream into the segmentation filter more than once. The application must also reset the stream after the initial download and before calling IWiaSegmentationFilter::DetectRegions.

The IStream,IWiaItem2 and IWiaPropertyStorage interfaces are described in the Microsoft Windows SDK documentation.


Target Platform Desktop
Header wia_lh.h