jj2000.j2k.quantization.quantizer.Quantizer类的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(102)

本文整理了Java中jj2000.j2k.quantization.quantizer.Quantizer类的一些代码示例,展示了Quantizer类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Quantizer类的具体详情如下:
包路径:jj2000.j2k.quantization.quantizer.Quantizer
类名称:Quantizer

Quantizer介绍

[英]This abstract class provides the general interface for quantizers. The input of a quantizer is the output of a wavelet transform. The output of the quantizer is the set of quantized wavelet coefficients represented in sign-magnitude notation (see below).

This class provides default implementation for most of the methods (wherever it makes sense), under the assumption that the image, component dimensions, and the tiles, are not modifed by the quantizer. If it is not the case for a particular implementation, then the methods should be overriden.

Sign magnitude representation is used (instead of two's complement) for the output data. The most significant bit is used for the sign (0 if positive, 1 if negative). Then the magnitude of the quantized coefficient is stored in the next M most significat bits. The rest of the bits (least significant bits) can contain a fractional value of the quantized coefficient. This fractional value is not to be coded by the entropy coder. However, it can be used to compute rate-distortion measures with greater precision.

The value of M is determined for each subband as the sum of the number of guard bits G and the nominal range of quantized wavelet coefficients in the corresponding subband (Rq), minus 1:

M = G + Rq -1

The value of G should be the same for all subbands. The value of Rq depends on the quantization step size, the nominal range of the component before the wavelet transform and the analysis gain of the subband (see Subband).

The blocks of data that are requested should not cross subband boundaries.

NOTE: At the moment only quantizers that implement the 'CBlkQuantDataSrcEnc' interface are supported.
[中]这个抽象类为量化器提供了通用接口。量化器的输入是小波变换的输出。量化器的输出是用符号幅度表示法表示的一组量化小波系数(见下文)。
该类为大多数方法(只要有意义)提供了默认实现,前提是图像、组件维度和分幅不由量化器修改。如果特定的实现不是这样,那么应该重写这些方法。
输出数据使用符号大小表示(而不是二的补码)。最高有效位用于符号(0表示正,1表示负)。然后,量化系数的大小被存储在接下来的M个最高有效位中。其余的位(最低有效位)可以包含量化系数的分数。熵编码器不会对这个分数进行编码。然而,它可以用来更精确地计算率失真度量。
对于每个子带,M的值被确定为保护比特数G和相应子带(Rq)中量化小波系数的标称范围之和减去1:
M=G+Rq-1
所有子带的G值都应相同。Rq的值取决于量化步长、小波变换前分量的标称范围以及子带的分析增益(参见子带)。
请求的数据块不应跨越子带边界。
注意:目前只支持实现“CBlkQuantDataSrcEnc”接口的量化器。

代码示例

代码示例来源:origin: org.openmicroscopy/ome-jai

/**
 * Returns a reference to the subband tree structure representing the
 * subband decomposition for the specified tile-component.
 *
 * @param t The index of the tile.
 *
 * @param c The index of the component.
 *
 * @return The subband tree structure, see SubbandAn.
 *
 * @see SubbandAn
 *
 * @see Subband
 * */
public SubbandAn getAnSubbandTree(int t,int c) {
  return src.getAnSubbandTree(t,c);
}

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

/**
 * Returns the horizontal offset of the code-block partition. Allowable
 * values are 0 and 1, nothing else.
 * */
public int getCbULX() {
  return src.getCbULX();
}

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

/**
 * Returns the vertical offset of the code-block partition. Allowable
 * values are 0 and 1, nothing else.
 * */
public int getCbULY() {
  return src.getCbULY();
}

代码示例来源:origin: edu.ucar/jj2000

/**
   * Calculates the maximum amount of magnitude bits for each
   * tile-component, and stores it in the 'maxMagBits' array. This is called
   * by the constructor
   *
   * @param encSpec The encoder specifications for addition of roi specs
   * */
  private void calcMaxMagBits(EncoderSpecs encSpec) {
    int tmp;
  MaxShiftSpec rois = encSpec.rois;

    int nt =  src.getNumTiles();
    int nc = src.getNumComps();

    maxMagBits = new int[nt][nc];
    
    src.setTile(0,0);
    for (int t=0; t<nt; t++) {
      for (int c=nc-1; c>=0; c--) {
    tmp = src.getMaxMagBits(c);
        maxMagBits[t][c] = tmp;
    rois.setTileCompVal(t,c,new Integer(tmp));
      }
      if( t<nt-1 ) src.nextTile();
    }
    // Reset to current initial tile position
    src.setTile(0,0);
  }
}

代码示例来源:origin: edu.ucar/jj2000

if( (src.getImgWidth() != maskPGM.getImgWidth()) ||
  (src.getImgHeight() != maskPGM.getImgHeight()) )
  throw new IllegalArgumentException("Input image and"+
                    " ROI mask must "+
                    "have the same "+
                    "size");
x = src.getImgULX();
y = src.getImgULY();
lrx = x+src.getImgWidth()-1;
lry = y+src.getImgHeight()-1;
if( (x>tileulx+tilew) || (y>tileuly+tileh) ||

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

cblk = src.getNextCodeBlock(c,cblk);
  root = src.getAnSubbandTree(tIdx,c);
maxBits = maxMagBits[tIdx][c];
roiInTile = mg.getROIMask(mask,root,maxBits,c);

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

/**
 * Returns a reference to the subband tree structure representing the
 * subband decomposition for the specified tile-component.
 *
 * <P>This method gets the subband tree from the source and then
 * calculates the magnitude bits for each leaf using the method
 * calcSbParams().
 *
 * @param t The index of the tile.
 *
 * @param c The index of the component.
 *
 * @return The subband tree structure, see SubbandAn.
 *
 * @see SubbandAn
 *
 * @see Subband
 *
 * @see #calcSbParams
 * */
public SubbandAn getAnSubbandTree(int t,int c) {
  SubbandAn sbba;
  // Ask for the wavelet tree of the source
  sbba = src.getAnSubbandTree(t,c);
  // Calculate the stepWMSE
  calcSbParams(sbba,c);
  return sbba;
}

代码示例来源:origin: edu.ucar/jj2000

quant = Quantizer.createInstance(dwt,encSpec);
} catch(IllegalArgumentException e) {
  error("Could not instantiate quantizer"+

代码示例来源:origin: com.github.jai-imageio/jai-imageio-jpeg2000

/**
   * Calculates the maximum amount of magnitude bits for each
   * tile-component, and stores it in the 'maxMagBits' array. This is called
   * by the constructor
   *
   * @param encSpec The encoder specifications for addition of roi specs
   * */
  private void calcMaxMagBits(J2KImageWriteParamJava wp) {
    int tmp;
  MaxShiftSpec rois = wp.getROIs();

    int nt =  src.getNumTiles();
    int nc = src.getNumComps();

    maxMagBits = new int[nt][nc];

    src.setTile(0,0);
    for (int t=0; t<nt; t++) {
      for (int c=nc-1; c>=0; c--) {
    tmp = src.getMaxMagBits(c);
        maxMagBits[t][c] = tmp;
    rois.setTileCompVal(t,c,new Integer(tmp));
      }
      if( t<nt-1 ) src.nextTile();
    }
    // Reset to current initial tile position
    src.setTile(0,0);
  }
}

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

if( (src.getImgWidth() != maskPGM.getImgWidth()) ||
  (src.getImgHeight() != maskPGM.getImgHeight()) )
  throw new IllegalArgumentException("Input image and"+
                    " ROI mask must "+
                    "have the same "+
                    "size");
x = src.getImgULX();
y = src.getImgULY();
lrx = x+src.getImgWidth()-1;
lry = y+src.getImgHeight()-1;
if( (x>tileulx+tilew) || (y>tileuly+tileh) ||

代码示例来源:origin: com.github.jai-imageio/jai-imageio-jpeg2000

cblk = src.getNextCodeBlock(c,cblk);
  root = src.getAnSubbandTree(tIdx,c);
maxBits = maxMagBits[tIdx][c];
roiInTile = mg.getROIMask(mask,root,maxBits,c);

代码示例来源:origin: com.github.jai-imageio/jai-imageio-jpeg2000

/**
 * Returns a reference to the subband tree structure representing the
 * subband decomposition for the specified tile-component.
 *
 * <P>This method gets the subband tree from the source and then
 * calculates the magnitude bits for each leaf using the method
 * calcSbParams().
 *
 * @param t The index of the tile.
 *
 * @param c The index of the component.
 *
 * @return The subband tree structure, see SubbandAn.
 *
 * @see SubbandAn
 *
 * @see Subband
 *
 * @see #calcSbParams
 * */
public SubbandAn getAnSubbandTree(int t,int c) {
  SubbandAn sbba;
  // Ask for the wavelet tree of the source
  sbba = src.getAnSubbandTree(t,c);
  // Calculate the stepWMSE
  calcSbParams(sbba,c);
  return sbba;
}

代码示例来源:origin: com.github.jai-imageio/jai-imageio-jpeg2000

Quantizer quant = Quantizer.createInstance(dwt,j2kwparam);

代码示例来源:origin: net.java.dev.jai-imageio/jai-imageio-jpeg2000

/**
   * Calculates the maximum amount of magnitude bits for each
   * tile-component, and stores it in the 'maxMagBits' array. This is called
   * by the constructor
   *
   * @param encSpec The encoder specifications for addition of roi specs
   * */
  private void calcMaxMagBits(J2KImageWriteParamJava wp) {
    int tmp;
  MaxShiftSpec rois = wp.getROIs();

    int nt =  src.getNumTiles();
    int nc = src.getNumComps();

    maxMagBits = new int[nt][nc];

    src.setTile(0,0);
    for (int t=0; t<nt; t++) {
      for (int c=nc-1; c>=0; c--) {
    tmp = src.getMaxMagBits(c);
        maxMagBits[t][c] = tmp;
    rois.setTileCompVal(t,c,new Integer(tmp));
      }
      if( t<nt-1 ) src.nextTile();
    }
    // Reset to current initial tile position
    src.setTile(0,0);
  }
}

代码示例来源:origin: poreid/poreid

if( (src.getImgWidth() != maskPGM.getImgWidth()) ||
  (src.getImgHeight() != maskPGM.getImgHeight()) )
  throw new IllegalArgumentException("Input image and"+
                    " ROI mask must "+
                    "have the same "+
                    "size");
x = src.getImgULX();
y = src.getImgULY();
lrx = x+src.getImgWidth()-1;
lry = y+src.getImgHeight()-1;
if( (x>tileulx+tilew) || (y>tileuly+tileh) ||

代码示例来源:origin: org.openmicroscopy/ome-jai

cblk = src.getNextCodeBlock(c,cblk);
  root = src.getAnSubbandTree(tIdx,c);
maxBits = maxMagBits[tIdx][c];
roiInTile = mg.getROIMask(mask,root,maxBits,c);

代码示例来源:origin: org.openmicroscopy/ome-jai

/**
 * Returns the horizontal offset of the code-block partition. Allowable
 * values are 0 and 1, nothing else.
 * */
public int getCbULX() {
  return src.getCbULX();
}

代码示例来源:origin: poreid/poreid

/**
 * Returns the vertical offset of the code-block partition. Allowable
 * values are 0 and 1, nothing else.
 * */
public int getCbULY() {
  return src.getCbULY();
}

代码示例来源:origin: edu.ucar/jj2000

/**
 * Returns a reference to the subband tree structure representing the
 * subband decomposition for the specified tile-component.
 *
 * @param t The index of the tile.
 *
 * @param c The index of the component.
 *
 * @return The subband tree structure, see SubbandAn.
 *
 * @see SubbandAn
 *
 * @see Subband
 * */
public SubbandAn getAnSubbandTree(int t,int c) {
  return src.getAnSubbandTree(t,c);
}

代码示例来源:origin: org.openmicroscopy/ome-jai

/**
 * Returns a reference to the subband tree structure representing the
 * subband decomposition for the specified tile-component.
 *
 * <P>This method gets the subband tree from the source and then
 * calculates the magnitude bits for each leaf using the method
 * calcSbParams().
 *
 * @param t The index of the tile.
 *
 * @param c The index of the component.
 *
 * @return The subband tree structure, see SubbandAn.
 *
 * @see SubbandAn
 *
 * @see Subband
 *
 * @see #calcSbParams
 * */
public SubbandAn getAnSubbandTree(int t,int c) {
  SubbandAn sbba;
  // Ask for the wavelet tree of the source
  sbba = src.getAnSubbandTree(t,c);
  // Calculate the stepWMSE
  calcSbParams(sbba,c);
  return sbba;
}

相关文章