Android Open Source - scanNedit Enhance






From Project

Back to project page scanNedit.

License

The source code is released under:

MIT License

If you think the Android project scanNedit listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright (C) 2011 Google Inc./*  w w  w  . ja va 2s.  co m*/
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

package com.googlecode.leptonica.android;

/**
 * Image sharpening methods.
 *
 * @author alanv@google.com (Alan Viverette)
 */
public class Enhance {
    static {
        System.loadLibrary("lept");
    }

    /**
     * Performs unsharp masking (edge enhancement).
     * <p>
     * Notes:
     * <ul>
     * <li>We use symmetric smoothing filters of odd dimension, typically use
     * sizes of 3, 5, 7, etc. The <code>halfwidth</code> parameter for these is
     * (size - 1)/2; i.e., 1, 2, 3, etc.</li>
     * <li>The <code>fract</code> parameter is typically taken in the range: 0.2
     * &lt; <code>fract</code> &lt; 0.7</li>
     * </ul>
     *
     * @param halfwidth The half-width of the smoothing filter.
     * @param fraction The fraction of edge to be added back into the source
     *            image.
     * @return an edge-enhanced Pix image or copy if no enhancement requested
     */
    public static Pix unsharpMasking(Pix pixs, int halfwidth, float fraction) {
        if (pixs == null)
            throw new IllegalArgumentException("Source pix must be non-null");

        int nativePix = nativeUnsharpMasking(pixs.mNativePix, halfwidth, fraction);

        if (nativePix == 0) {
            throw new OutOfMemoryError();
        }

        return new Pix(nativePix);
    }

    // ***************
    // * NATIVE CODE *
    // ***************

    private static native int nativeUnsharpMasking(int nativePix, int halfwidth, float fract);
}




Java Source Code List

com.googlecode.leptonica.android.AdaptiveMap.java
com.googlecode.leptonica.android.Binarize.java
com.googlecode.leptonica.android.Box.java
com.googlecode.leptonica.android.Constants.java
com.googlecode.leptonica.android.Convert.java
com.googlecode.leptonica.android.Enhance.java
com.googlecode.leptonica.android.JpegIO.java
com.googlecode.leptonica.android.Pix.java
com.googlecode.leptonica.android.Pixa.java
com.googlecode.leptonica.android.ReadFile.java
com.googlecode.leptonica.android.Rotate.java
com.googlecode.leptonica.android.Scale.java
com.googlecode.leptonica.android.Skew.java
com.googlecode.leptonica.android.WriteFile.java
com.googlecode.tesseract.android.TessBaseAPI.java
com.markupartist.android.widget.ActionBar.java
com.markupartist.android.widget.ActionBar_three.java
com.markupartist.android.widget.ActionBar_two.java
com.markupartist.android.widget.ScrollingTextView.java
com.me.android.scanNedit.CameraActivity.java
com.me.android.scanNedit.CropOptionAdapter.java
com.me.android.scanNedit.CropOption.java
com.me.android.scanNedit.FileCache.java
com.me.android.scanNedit.GalleryActivity.java
com.me.android.scanNedit.HelpActivity.java
com.me.android.scanNedit.ImageLoader.java
com.me.android.scanNedit.LazyAdapter.java
com.me.android.scanNedit.MemoryCache.java
com.me.android.scanNedit.Picture.java
com.me.android.scanNedit.SampleActivity.java
com.me.android.scanNedit.StartActivity.java
com.me.android.scanNedit.TessBaseAPITest.java
com.me.android.scanNedit.Utils.java
com.me.android.scanNedit.XMLParser.java