Click or drag to resize
XDL

XDMBandResize Class

Resize Image 기능은 영상의 공간 해상도를 바꾸거나 영상의 영역 일부만을 다른 영상 파일로 저장하는 기능을 제공한다.
Inheritance Hierarchy

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

The XDMBandResize type exposes the following members.

Constructors
  NameDescription
Public methodXDMBandResize
XDMBandResize 클래스의 기본 생성자로서, 멤버변수에 대하여 초기화를 수행한다.
Top
Methods
  NameDescription
Public methodGetInputParam
Resize를 위한 입력 파라미터를 반환한다.
Public methodSetInputParam
Resize를 위한 입력 파라미터를 설정한다.
Top
Remarks

보통 2장 이상의 영상으로 작업을 하려는 경우 센서의 종류가 다르거나 이미지 종류가 다르다면 동일한 해상도로 수정해 주어야 할 필요가 있다. 특히 DEM의 경우가 그러하며 동일한 해상도로 수정할 때 사용된다.

Pixel Size는 공간 해상도 단위에 따르는데, 좌표계에 맞는 적절한 값을 입력해야 한다.

  • Pixel Size Unit가 Pixel인 경우: 입력된 영상의 좌표계를 무시하고 입력된 영상의 공간 해상도를 1로 가정하여 이에 대한 배율을 적용시킨다. 예를 들어 입력된 값이 2인 경우 Pixel Size가 2가 되어 출력될 영상의 해상도는 2배로 떨어지게 된다.
  • Pixel Size Unit가 meter인 경우: 위경도 좌표계를 제외한 모든 좌표계에 대한 영상에 적용할 수 있다.
  • Pixel Size Unit가 degree인 경우: 위경도 좌표계에 해당하며 단위는 degree 값으로 입력해야 한다.

만일 Sub 영역이 입력된 Band의 범위를 벗어나는 경우 존재하지 않은 화소들에 대해 지정된 Blank Value로 채우게 된다.

Examples
아래의 예제는 입력 영상을 읽어 영상의 화소좌표 (100,100)~(300,300) 영역을 새로운 파일로 저장한다. 이때, 공간 해상도는 2.0으로 설정하고 Bilinear로 영상을 재배열한다.
using Pixoneer.NXDL;
using Pixoneer.NXDL.NRS;
using Pixoneer.NXDL.NIO;

// 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);

// Set input param
XBandParamResize InputParam = new XBandParamResize();
InputParam.SrcBand = xrsFileInput.GetBandAt(0);
InputParam.ptLL.X =  100;    // Pixel Coord
InputParam.ptUR.X =  300;    // Pixel Coord
InputParam.ptLL.Y =  100;    // Pixel Coord
InputParam.ptUR.Y =  300;    // Pixel Coord

InputParam.PixelSizeX = 2.0; // Meter
InputParam.PixelSizeY = 2.0; // Meter

InputParam.ResampleMethod = eResampleMethod.BiLinear; // Set resample method 

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

// Create XRSSaveFile to save real time 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);
    XBandParamResize param = new XBandParamResize(ref InputParam);
    param.SrcBand = bandRaw;

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

    XDMBand bandCast = (XDMBand)bandTmp;

    fileSave.AddBand(ref bandCast);
}

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