Package jjil.core

Examples of jjil.core.RgbImage


   * @return RgbImage initialized with the image from the camera.
   */
    static public RgbImage toRgbImage(Bitmap bmp) {
      int nWidth = bmp.getWidth();
      int nHeight = bmp.getHeight();
      RgbImage rgb = new RgbImage(nWidth, nHeight);
      bmp.getPixels(rgb.getData(), 0, nWidth, 0, 0, nWidth, nHeight);
      return rgb;
    }
View Full Code Here


      @SuppressWarnings("unchecked")
      public void setProperties(Hashtable props) {
       
      }
      public  void setDimensions(int nWidth, int nHeight) {
        this.rgb = new RgbImage(nWidth, nHeight);
      }
      public void imageComplete(int status) {
        this.bComplete = true;
        this.ip.removeConsumer(this);
      }
View Full Code Here

                    GrayShrink gs = new GrayShrink(nTargetWidth, nTargetHeight);
                    gs.Push(imMask);
                    imMask = (Gray8Image) gs.Front();
                    // combine the gray image and the mask to make a displayable image
                    ApplyMaskRgb am = new ApplyMaskRgb();
                    RgbImage rgb = am.Push((RgbImage)rs.Front(), imMask);
                    g.drawARGB(0, 0, 255, 0); // green
                    g.drawBitmap(
                            RgbImageAndroid.toBitmap(rgb),
                            new Rect(0, 0, rgb.getWidth(), rgb.getHeight()),
                            new Rect(
                                (g.getBitmapWidth() - rgb.getWidth())/2,
                                (g.getBitmapHeight() - rgb.getHeight())/2,
                                rgb.getWidth(),
                                rgb.getHeight()),
                            new Paint());
                } else {
                    RgbImage rgb = (RgbImage) rs.Front();
                    g.drawARGB(0, 255, 0, 0); // red
                    g.drawBitmap(
                            RgbImageAndroid.toBitmap(rgb),
                            new Rect(0, 0, rgb.getWidth(), rgb.getHeight()),
                            new Rect(
                                (g.getBitmapWidth() - rgb.getWidth())/2,
                                (g.getBitmapHeight() - rgb.getHeight())/2,
                                rgb.getWidth(),
                                rgb.getHeight()),
                            new Paint());
                }
             }
        }
    }
View Full Code Here

                    GrayShrink gs = new GrayShrink(nTargetWidth, nTargetHeight);
                    gs.push(imMask);
                    imMask = (Gray8Image) gs.getFront();
                    // combine the gray image and the mask to make a displayable image
                    ApplyMaskRgb am = new ApplyMaskRgb();
                    RgbImage rgb = am.push((RgbImage)rs.getFront(), imMask);
                    g.setColor(0x0000FF00); // green
                    g.fillRect(
                            g.getClipX(),
                            g.getClipY(),
                            g.getClipWidth(),
                            g.getClipHeight());
                    g.drawImage(
                            RgbImageJ2me.toImage(rgb),
                            g.getClipX() + (g.getClipWidth() - rgb.getWidth())/2,
                            g.getClipY() + (g.getClipHeight() - rgb.getHeight())/2,
                            0);
                } else {
                    RgbImage rgb = (RgbImage) rs.getFront();
                    g.setColor(0x00FF0000); // red
                    g.fillRect(
                            g.getClipX(),
                            g.getClipY(),
                            g.getClipWidth(),
                            g.getClipHeight());
                    g.drawImage(
                            RgbImageJ2me.toImage(rgb),
                            g.getClipX() + (g.getClipWidth() - rgb.getWidth())/2,
                            g.getClipY() + (g.getClipHeight() - rgb.getHeight())/2,
                            0);
                }
             }
        }
    }
View Full Code Here

     * @param image the javax.microedition.lcdui.Image image
     * @return the RgbImage with the same contents as the javax.microedition.lcdui.Image.
     */
    static public RgbImage toRgbImage(javax.microedition.lcdui.Image image)
    {
        RgbImage rgb = new RgbImage(image.getWidth(), image.getHeight());
        image.getRGB(
                rgb.getData(),
                0,
                rgb.getWidth(),
                0,
                0,
                rgb.getWidth(),
                rgb.getHeight());
        return rgb;
    }
View Full Code Here

      @SuppressWarnings("unchecked")
      public void setProperties(Hashtable props) {
       
      }
      public  void setDimensions(int nWidth, int nHeight) {
        this.rgb = new RgbImage(nWidth, nHeight);
      }
View Full Code Here

                    null,
                    null,
                    null);

        } else {
            RgbImage rgbOutput = new RgbImage(
                    this.imLabeled.getWidth(),
                    this.imLabeled.getHeight());
            int[] rgbData = rgbOutput.getData();
            int nMaxLabel = EquivalenceClass.getLabels();
            short[] grayData = this.imLabeled.getData();
            int[] rgbLabels = new int[nMaxLabel + 1];
            for (int i = 0; i < rgbLabels.length; i++) {
                rgbLabels[i] = RgbVal.toRgb(
View Full Code Here

        this.grayWarp.push(this.selectGreen.getFront());
        Gray8OffsetImage warpedGreen = (Gray8OffsetImage) this.grayWarp.getFront();
        this.selectBlue.push(imageInput);
        this.grayWarp.push(this.selectBlue.getFront());
        Gray8OffsetImage warpedBlue = (Gray8OffsetImage) this.grayWarp.getFront();
        RgbImage rgb = Gray3Bands2Rgb.push(warpedRed, warpedGreen, warpedBlue);
        super.setOutput(new RgbOffsetImage(
                rgb,
                warpedRed.getXOffset(),
                warpedRed.getYOffset()));
    }
View Full Code Here

      if (keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
        this.mPreviewThread.interrupt();
        Bitmap bmp = Bitmap.createBitmap(1280, 1024, false);
        Canvas c = new Canvas(bmp);
        this.mCamera.capture(c);
        RgbImage inimg = RgbImageAndroid.toRgbImage(bmp);
        DetectBarcode db = new DetectBarcode(20000);
        if (!db.Push(inimg)) {
          /**
           * Couldn't find the barcode. Tell the user.
           */
 
View Full Code Here

        }
        this.imageCropped = (Gray8Image) imageResult;
        {   Debug debug = new Debug();
          Gray8Rgb g2r = new Gray8Rgb();
          g2r.push(this.imageCropped);
          RgbImage rgb = (RgbImage) g2r.getFront();
          debug.toFile(rgb, "cropped.png"); //$NON-NLS-1$
        }
        /* Then do edge detection. The cWidth of the Canny operator is set
         * based on the cropped cWidth, which is supposed to be the
         * barcode cWidth.
         */
        int cCannyWidth = cWidth / 6;
        Gray8CannyHoriz canny = new Gray8CannyHoriz(cCannyWidth);
        /* Now apply the edge detection to the cropped mage
         */
        canny.push(imageCropped.clone());
        /* And obtain the result
         */
        imageResult = canny.getFront();
        if (!(imageResult instanceof Gray8Image)) {
            throw new jjil.core.Error(
            jjil.core.Error.PACKAGE.ALGORITHM,
            jjil.algorithm.ErrorCodes.IMAGE_NOT_GRAY8IMAGE,
            imageResult.toString(),
            null,
            null);
        }
        this.imageEdge = (Gray8Image) imageResult;
        {  
          Debug debug = new Debug();
        Gray8Rgb g2r = new Gray8Rgb();
        g2r.push(this.imageEdge);
        RgbImage rgb = (RgbImage) g2r.getFront();
        debug.toFile(rgb, "edges.png"); //$NON-NLS-1$
      }
    }
View Full Code Here

TOP

Related Classes of jjil.core.RgbImage

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.