|
XDMBandMask Class
|
입력 영상의 일부 지역을 벡터 객체를 이용하여 해당하는 지역을 추출하거나 삭제하는 기능이다.
Inheritance Hierarchy
Namespace: Pixoneer.NXDL.NRSAssembly: NXDLrs (in NXDLrs.dll) Version: 2.0.3.38
Syntaxpublic class XDMBandMask : XDMBand
The XDMBandMask type exposes the following members.
Constructors | Name | Description |
---|
 | XDMBandMask | XDMBandMask클래스의 기본 생성자로서, 멤버변수에 대하여 초기화를 수행한다. |
Top
Methods
Remarks
The Mask Area is used to set the masking area. Polygons can be created by NXImageView or by NXDLvc Objects
Example
입력 영상의 화소 단위 좌표 (100,100)~(300,300) 영역을 지우는 예제이다. 화소단위 좌표를 world 좌표로 변화하는 코드가 있으며, 영역을 지우기 위해서 MaskPolygonMode는 OutsideAnd로 설정한다.
using Pixoneer.NXDL;
using Pixoneer.NXDL.NRS;
using Pixoneer.NXDL.NIO;
using Pixoneer.NXDL.NVC;
XRasterIO RasterIO = new XRasterIO();
String strError = "";
if (RasterIO.Initialize(out strError) == false)
{
return;
}
String strFilePathLoad = "D:\\Sample\\IKONOS.xdm";
XRSLoadFile xrsFileInput = RasterIO.LoadFile(strFilePathLoad, out strError, false, eIOCreateXLDMode.All_NoMsg);
XvcPolygon polygon = new XvcPolygon();
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));
XBandParamMask InputParam = new XBandParamMask();
InputParam.SrcBand = xrsFileInput.GetBandAt(0);
InputParam.BorderSmoothWidth = 0;
InputParam.BlankValue = 0;
InputParam.MaskPolygonMode = eMaskPolygonMode.OutsideAnd;
InputParam.ListMaskPolygon.Add(polygon);
XDMBandMask bandProcess = new XDMBandMask();
if (!bandProcess.SetInputParam(ref InputParam))
{
return;
}
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);
}
XThread thd = null;
String strFilePathSave = "D:\\Sample\\Output_Mask.xdm";
if (!RasterIO.Export(ref fileSave, strFilePathSave, "XDM", out strError, thd))
{
return;
}
See Also