• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录

gisoracle

  • 博客园
  • 联系
  • 订阅
  • 管理

公告

View Post

如何去除栅格影像的黑边?

来自:http://zhihu.esrichina.com.cn/?/question/6725

朱新颖

【解决办法】:
可以通过设置背景值以及背景色解决此问题。
对于三波段进行RDB渲染的影像可以使用下面代码:
IRasterRenderer RR = RL.Renderer; 
IRasterRGBRenderer rasterRGBRenderer = null; 
if (RR is IRasterRGBRenderer) 
rasterRGBRenderer = RR as IRasterRGBRenderer; 
RR.Update(); 
rasterRGBRenderer.RedBandIndex = 0; 
rasterRGBRenderer.GreenBandIndex = 1; 
rasterRGBRenderer.BlueBandIndex = 2; 
IRgbColor rgb = new RgbColorClass(); 
rgb.NullColor = true; 
IRasterStretch2 RS = rasterRGBRenderer as IRasterStretch2; // IRasterStretch无法设置数组,需用2 
double background = 
{ 
0, 0, 0 
}; 
RS.Background = true; 
RS.BackgroundValue = background as object; 
RS.BackgroundColor = rgb as IColor; 
axMapControl1.Refresh();


对于单波段影像: 
单波段:
IRasterRenderer RR = RL.Renderer;
IRasterStretchColorRampRenderer RSC = null;
if (RR is IRasterStretchColorRampRenderer)
RSC = RR as IRasterStretchColorRampRenderer;
RR.Update();
RSC.BandIndex = 0;
IRgbColor rgb = new RgbColorClass(); 
rgb.NullColor = true; 
IRasterStretch RS = RSC as IRasterStretch;
RS.Background = true;
RS.set_BackgroundValues(0);
RS.BackgroundColor = rgb as IColor;
axMapControl1.Refresh();

posted on 2016-02-23 15:18  gisai  阅读(2567)  评论(0)    收藏  举报

刷新页面返回顶部
 
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3