Package jjil.core

Examples of jjil.core.Sequence


     */
  public boolean push(RgbImage rgb) throws jjil.core.Error {
    final int nReducedHeight = 300;
    final int nReducedWidth = 400;
    // build pipeline
    Sequence seq = new Sequence();
    seq.add(new RgbSubSample(nReducedWidth, nReducedHeight));
    seq.add(new RgbAvgGray());
    seq.add(new Gray8HistEq());
    seq.add(new Gray8HorizVertContrast(5, 2, -8, 3));
    seq.add(new Gray16Threshold(20));
    seq.push(rgb);
    Gray8ConnComp gcc = new Gray8ConnComp();
    Image imThresh = seq.getFront();
    Gray8Rgb g2r = new Gray8Rgb();
    g2r.push(imThresh);
    if (DetectBarcode.bDebug) {
      Debug debug = new Debug();
      debug.toFile((RgbImage)g2r.getFront(), "test.jpg");
View Full Code Here


            int cWidth,
            int cHeight) throws jjil.core.Error
    {
        /* Build an image pipeline to do the work.
         */
        Sequence seq = new Sequence();
        /* First convert the color image to black and white by selecting the
         * green channel. We use the green channel because it is the highest
         * resolution channel on the CCDs used in cellphones.
         */
        if (image instanceof RgbImage) {
            seq.add(new RgbSelectGray(RgbSelectGray.GREEN));
        }
        /* Now crop the gray image.
         */
        int dLeft = Math.max(0, dTopLeftX - cWidth / 12);
        int cWidthExp = Math.min(image.getWidth() - dLeft, cWidth * 7 / 6);
        seq.add(new Gray8Crop(dLeft, dTopLeftY, cWidthExp, cHeight));
        /* Apply the pipeline to get the cropped image.
         */
        seq.push(image);
        Image imageResult = seq.getFront();
        if (!(imageResult instanceof Gray8Image)) {
            throw new jjil.core.Error(
            jjil.core.Error.PACKAGE.ALGORITHM,
            jjil.algorithm.ErrorCodes.IMAGE_NOT_GRAY8IMAGE,
            imageResult.toString(),
View Full Code Here

        // so it is divisible by cHeightReduce, a power of 2
        int cCroppedHeight = cHeightReduce *
                (imageInput.getHeight() / cHeightReduce);
        int cTotalWidth = dRight - dLeft;
        Gray8Crop crop = new Gray8Crop(dLeft, 0, cTotalWidth, cCroppedHeight);
        Sequence seq = new Sequence(crop);
        seq.add(new Gray8Reduce(1,cHeightReduce));
        int cReducedHeight = cCroppedHeight / cHeightReduce;
        // we stretch the cropped image so cInputWidth becomes cTargetWidth. This means
        // cTotalWidth must become cTargetWidth * cTotalWidth / cInputWidth
        Gray8RectStretch stretch = new Gray8RectStretch(
                cTargetWidth * cTotalWidth / cInputWidth, cReducedHeight);
        seq.add(stretch);
        seq.add(new Gray8HistEq());
        seq.push(imageInput);
        return seq.getFront();
    }
View Full Code Here

     * @param nSigma the sigma of the window to blur over
     * @throws jjil.core.Error if nSigma is out of range.
     */
    public void setWidth(int nSigma) throws jjil.core.Error {
        this.nSigma = nSigma;
        this.seqR = new Sequence(new RgbSelectGray(RgbSelectGray.RED));
        this.seqR.add(new Gray8GaussSmoothVert(nSigma));
        this.seqG = new Sequence(new RgbSelectGray(RgbSelectGray.GREEN));
        this.seqG.add(new Gray8GaussSmoothVert(nSigma));
        this.seqB = new Sequence(new RgbSelectGray(RgbSelectGray.BLUE));
        this.seqB.add(new Gray8GaussSmoothVert(nSigma));
    }
View Full Code Here

    }
   
    private void setupPipeline() throws jjil.core.Error
    {
        RgbSelectGray sel = new RgbSelectGray(RgbSelectGray.RED);
        this.seqR = new Sequence(sel);
        Gray8RectStretch gs = new Gray8RectStretch(cWidth, cHeight);
        this.seqR.add(gs);
        sel = new RgbSelectGray(RgbSelectGray.GREEN);
        this.seqG = new Sequence(sel);
        gs = new Gray8RectStretch(cWidth, cHeight);
        this.seqG.add(gs);
        sel = new RgbSelectGray(RgbSelectGray.BLUE);
        this.seqB = new Sequence(sel);
        gs = new Gray8RectStretch(cWidth, cHeight);
        this.seqB.add(gs);
    }
View Full Code Here

     * @param nSigma the sigma of the window to blur over
     * @throws jjil.core.Error if sigma out of range
     */
    public void setSigma(int nSigma) throws jjil.core.Error {
        this.nSigma = nSigma;
        this.seqR = new Sequence(new RgbSelectGray(RgbSelectGray.RED));
        this.seqR.add(new Gray8GaussHoriz(nSigma));
        this.seqG = new Sequence(new RgbSelectGray(RgbSelectGray.GREEN));
        this.seqG.add(new Gray8GaussHoriz(nSigma));
        this.seqB = new Sequence(new RgbSelectGray(RgbSelectGray.BLUE));
        this.seqB.add(new Gray8GaussHoriz(nSigma));
    }
View Full Code Here

        }
        int nWidth = this.nColEnd - this.nColStart;
      int nHeight = Math.max(
                this.nRowBotStart - this.nRowTopStart,
                this.nRowBotEnd - this.nRowTopEnd);
        this.seqR = new Sequence(new RgbSelectGray(RgbSelectGray.RED));
        this.seqR.add(new Gray8VertTrapWarp(this.nColStart, this.nColEnd,
                this.nRowTopStart, this.nRowBotStart, this.nRowTopEnd,
                this.nRowBotEnd));
        this.seqG = new Sequence(new RgbSelectGray(RgbSelectGray.GREEN));
        this.seqG.add(new Gray8VertTrapWarp(this.nColStart, this.nColEnd,
                this.nRowTopStart, this.nRowBotStart, this.nRowTopEnd,
                this.nRowBotEnd));
        this.seqB = new Sequence(new RgbSelectGray(RgbSelectGray.BLUE));
        this.seqB.add(new Gray8VertTrapWarp(this.nColStart, this.nColEnd,
                this.nRowTopStart, this.nRowBotStart, this.nRowTopEnd,
                this.nRowBotEnd));
    }
View Full Code Here

    }
   
    private void setupPipeline() throws jjil.core.Error
    {
        RgbSelectGray sel = new RgbSelectGray(RgbSelectGray.RED);
        this.seqR = new Sequence(sel);
        Gray8Shrink gs = new Gray8Shrink(cWidth, cHeight);
        this.seqR.add(gs);
        sel = new RgbSelectGray(RgbSelectGray.GREEN);
        this.seqG = new Sequence(sel);
        gs = new Gray8Shrink(cWidth, cHeight);
        this.seqG.add(gs);
        sel = new RgbSelectGray(RgbSelectGray.BLUE);
        this.seqB = new Sequence(sel);
        gs = new Gray8Shrink(cWidth, cHeight);
        this.seqB.add(gs);
    }
View Full Code Here

TOP

Related Classes of jjil.core.Sequence

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.