Click or drag to resize
XDL

XDMBandMask Class

입력 영상의 일부 지역을 벡터 객체를 이용하여 해당하는 지역을 추출하거나 삭제하는 기능이다.
Inheritance Hierarchy

Namespace:  Pixoneer.NXDL.NRS
Assembly:  NXDLrs (in NXDLrs.dll) Version: 1.2.817.72
Syntax
C#
public class XDMBandMask : XDMBand

The XDMBandMask type exposes the following members.

Constructors
  NameDescription
Public methodXDMBandMask
XDMBandMask클래스의 기본 생성자로서, 멤버변수에 대하여 초기화를 수행한다.
Top
Methods
  NameDescription
Public methodGetInputParam
영상 마스킹 처리에 대한 입력 파라미터를 얻는다.
Public methodSetInputParam
영상 마스킹 처리를 위한 입력 파라미터를 설정한다.
Top
Remarks

The Mask Area is used to set the masking area. Polygons can be created by NXMapView or by NXDLvc Objects

Examples
입력 영상의 화소 단위 좌표 (100,100)~(300,300) 영역을 지우는 예제이다. 화소단위 좌표를 world 좌표로 변화하는 코드가 있으며, 영역을 지우기 위해서 MaskPolygonMode는 OutsideAnd로 설정한다.
using Pixoneer.NXDL;
using Pixoneer.NXDL.NRS;
using Pixoneer.NXDL.NIO;
using Pixoneer.NXDL.NVC;

// IO initialize to load image file
XRasterIO RasterIO = new XRasterIO();
String strError = "";
if (RasterIO.Initialize(out strError) == false)
{
    return;
}

// Image load
String strFilePathLoad = "D:\\Sample\\IKONOS.xdm";
XRSLoadFile xrsFileInput = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg);

// Create mask polygon
XvcPolygon polygon = new XvcPolygon();

// 영상 마스킹에 사용하는 벡터 객체는 world 좌표로 이루어져야 함.
double x, y;
XDMBand band = xrsFileInput.GetBandAt(0);
x = 100; y = 100;
band.PixelToSpace(ref x, ref y);
polygon.Add(new XVertex3d(x, y, 0));
x = 300; y = 100;
band.PixelToSpace(ref x, ref y);
polygon.Add(new XVertex3d(x, y, 0));
x = 300; y = 300;
band.PixelToSpace(ref x, ref y);
polygon.Add(new XVertex3d(x, y, 0));
x = 100; y = 300;
band.PixelToSpace(ref x, ref y);
polygon.Add(new XVertex3d(x, y, 0));

// Set input param
XBandParamMask InputParam = new XBandParamMask();
InputParam.SrcBand = xrsFileInput.GetBandAt(0);

InputParam.BorderSmoothWidth = 0;
InputParam.BlankValue = 0;
InputParam.MaskPolygonMode = eMaskPolygonMode.OutsideAnd;
InputParam.ListMaskPolygon.Add(polygon);

// Create New process band and set input param
XDMBandMask bandProcess = new XDMBandMask();
if (!bandProcess.SetInputParam(ref InputParam))
{
    return;
}

// create XRSSaveFile to save realtime band(XDMBandXXXX)
// load another file to protect thread lock(it is stable and faster).
XRSLoadFile fileLoad = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg);
XRSSaveFile fileSave = new XRSSaveFile();
for (int i = 0; i < fileLoad.NumBand; i++)
{
    XDMBand bandRaw = fileLoad.GetBandAt(i);
    XBandParamMask param = new XBandParamMask(ref InputParam);
    param.SrcBand = bandRaw;

    XDMBandMask bandTmp = new XDMBandMask();
    bandTmp.BandName = bandRaw.BandName;
    bandTmp.SetInputParam(ref param);

    XDMBand bandCast = (XDMBand)bandTmp;

    fileSave.AddBand(ref bandCast);
}

// Save output file
XThread thd = null;
String strFilePathSave = "D:\\Sample\\Output_Mask.xdm";
if (!RasterIO.Export(ref fileSave, strFilePathSave, "XDM", out strError, thd))
{
    return;
}
See Also