ENVI 监督分类Max stdev from Mean 参数IDL中的设置

通过设置class_doit 的参数 std_mult=3.0 即可。
完整代码如下:
参考引用:http://hi.baidu.com/dyqwrp/item/c8318cea9cec732c5a7cfbab

pro Parallelpiped_method
    COMPILE_OPT idl2
    ;恢复ENVI_SAVE文件
     ENVI,/restore_base_save_files
    ;开始批处理模式
     ENVI_BATCH_INIT,log_file='batch.log'
    ;编写批处理过程
    ;选择文件
   
      inputfile=   'E:\海二相关\掩膜\jpproject.img'
   
     CATCH, Error_status
     errorshow = 'Sorry to see the error,'+ $
     ' please send the error Information to "myyouthlife@163.com"'
     IF Error_status NE 0 THEN BEGIN
     tmp = DIALOG_MESSAGE(errorshow+STRING(13b)+$
     !ERROR_STATE.MSG,/error,title = '错误提示!')
     return
     ENDIF
     ;输入数据预处理
     ENVI_OPEN_FILE, inputfile, r_fid=fid
     IF (fid EQ -1) THEN BEGIN
     RETURN
     ENDIF
     ;获取输入文件信息
     ENVI_FILE_QUERY, fid, dims=dims, nb=nb
     pos  = LINDGEN(nb)
;     输出分类图像名称
     outputfile='d:\result.img'
     out_name = outputfile
     ;-平行六面体分类  0
      ENVI_RESTORE_ROIS, 'E:\海二相关\掩膜\11.roi'
;      获取感兴趣区文件信息
      roi_ids = ENVI_GET_ROI_IDS(fid=fid, $
      roi_colors=roi_colors, roi_names=class_names)
      class_names = ['Unclassified', class_names]
      num_classes = N_ELEMENTS(roi_ids)
      ; Set the unclassified class to black and use roi colors
      lookup = BYTARR(3,num_classes+1)
      lookup[0,1] = roi_colors
      ; 计算类ROI的基本统计信息
      mean = FLTARR(N_ELEMENTS(pos), num_classes)
      stdv = FLTARR(N_ELEMENTS(pos), num_classes)
      cov = FLTARR(N_ELEMENTS(pos),N_ELEMENTS(pos),num_classes)
      FOR j=0, num_classes-1 DO BEGIN
        ;
        roi_dims=[ENVI_GET_ROI_DIMS_PTR(roi_ids[j]),0,0,0,0]
        ENVI_DOIT, 'envi_stats_doit', fid=fid, pos=pos, $
          dims=roi_dims, comp_flag=4, mean=c_mean, $
          stdv=c_stdv, cov=c_cov
        MEAN[0,j] = c_mean
        stdv[0,j] = c_stdv
        cov[0,0,j] = c_cov
      ENDFOR
      ;设定阈值
      thresh=REPLICATE(0.1,num_classes)
      out_bname = 'parallelepiped'
;      分类
      ENVI_DOIT, 'class_doit', fid=fid, pos=pos, dims=dims, $
        out_bname=out_bname, out_name=out_name, method=0, $
        mean=mean, stdv=stdv, std_mult=3.0, $
        lookup=lookup, class_names=class_names, $
        r_fid=r_fid,in_memory=0
   
; 
      
;      退出批处理模式
    ;envi_batch_exit
end
posted @ 2012-07-16 14:08  suwenjiang  阅读(1472)  评论(2编辑  收藏  举报