亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? imageprocessing.java

?? 基于java的3d開發(fā)庫。對坐java3d的朋友有很大的幫助。
?? JAVA
字號:
//===========================================================================//=-------------------------------------------------------------------------=//= Module history:                                                         =//= - May 30 2007 - Oscar Chavarro: Original base version                   =//===========================================================================package vsdk.toolkit.processing;import vsdk.toolkit.common.VSDK;import vsdk.toolkit.common.ColorRgb;import vsdk.toolkit.media.Image;import vsdk.toolkit.media.IndexedColorImage;import vsdk.toolkit.media.RGBImage;import vsdk.toolkit.media.RGBAImage;import vsdk.toolkit.media.RGBPixel;/**@todo Current implementation is not well designed. This class' design shouldbe checked to inforce:  - Interoperability with existing image processing toolkits/frameworks like    JAI, ITK, Khoros, OpenCV, Matlab+ImageToolbox, ImageMagick+JMagick, GIMP,    etc.  - Programmability of image processing operations using GPUs  - Filter graph approach*/public abstract class ImageProcessing extends ProcessingElement {    private static int    gammaCorrection8bits(int in, double gamma)    {        double a, b;        int out;        a = ((double)in) / 255.0;        b = Math.pow(a, 1.0/gamma);        out = (int)(b*255.0);        return out;    }    public static void    gammaCorrection(IndexedColorImage img, double gamma)    {        int x, y;        int val;        for ( x = 0; x < img.getXSize(); x++ ) {            for ( y = 0; y < img.getYSize(); y++ ) {                val = img.getPixel(x, y);                val = gammaCorrection8bits(val, gamma);                img.putPixel(x, y, VSDK.unsigned8BitInteger2signedByte(val));            }        }    }    /**    Given the `input` and `output` previously created images, fills in    `output`'s space the `this` image using bilinear interpolation.    @todo worked well only in the growing case. Must add the shrinking    case for area averaging.    */    public static void resize(Image input, Image output)    {        int xSizeIn = input.getXSize();        int ySizeIn = input.getYSize();         int xSizeOut = output.getXSize();        int ySizeOut = output.getYSize();        double u, v;        int x, y;        ColorRgb source;        RGBPixel target = new RGBPixel();        RGBPixel acum = new RGBPixel();        if ( xSizeOut == xSizeIn && ySizeOut == ySizeIn ) {            copy(input, output);        }        else if ( xSizeOut > xSizeIn && ySizeOut > ySizeIn ) {            for ( x = 0; x < xSizeOut; x++ ) {                for ( y = 0; y < ySizeOut; y++ ) {                    u = ((double)x)/((double)(xSizeOut));                    v = ((double)y)/((double)(ySizeOut));                    source = input.getColorRgbBiLinear(u, v);                    target.r = VSDK.unsigned8BitInteger2signedByte((int)(source.r*255));                    target.g = VSDK.unsigned8BitInteger2signedByte((int)(source.g*255));                    target.b = VSDK.unsigned8BitInteger2signedByte((int)(source.b*255));                    output.putPixelRgb(x, y, target);                }            }        }        else {            output.init(xSizeOut, ySizeOut);            double xf = (((double)xSizeIn) / ((double)xSizeOut));            double yf = (((double)ySizeIn) / ((double)ySizeOut));            int xfi = (int)xf + 1;            int yfi = (int)yf + 1;            double w = (xfi * yfi);            if ( w > 50 ) {                w /= 2;	    }            int xx, yy, x0, y0, x1, y1;            acum = new RGBPixel();            for ( xx = 0; xx < xSizeOut; xx++ ) {                for ( yy = 0; yy < ySizeOut; yy++ ) {                    acum.r = acum.g = acum.b = 0;                    x0 = (int)(((double)xx)*xf);                    x1 = x0 + xfi;;                    for ( x = x0; x < x1 && x < xSizeIn; x++ ) {                        y0 = (int)(((double)yy)*yf);                        y1 = y0 + yfi;                        for ( y = y0; y < y1 && y < ySizeIn; y++ ) {                            target = input.getPixelRgb(x, y);                            acum.r += VSDK.unsigned8BitInteger2signedByte((int)(((double)VSDK.signedByte2unsignedInteger(target.r)) / w));                            acum.g += VSDK.unsigned8BitInteger2signedByte((int)(((double)VSDK.signedByte2unsignedInteger(target.g)) / w));                            acum.b += VSDK.unsigned8BitInteger2signedByte((int)(((double)VSDK.signedByte2unsignedInteger(target.b)) / w));                        }                    }                    output.putPixelRgb(xx, yy, acum);                }            }        }    }    /**    Copies the contents from the `input` image to the `output` image. Note that    this method can serve also as a format conversion between different Image    formats (i.e. convert an RGBImage to an IndexedColorImage).    */    public static void copy(Image input, Image output)    {        int xSize = input.getXSize();        int ySize = input.getYSize();        int x, y;        RGBPixel target = new RGBPixel();        output.init(xSize, ySize);        for ( x = 0; x < xSize; x++ ) {            for ( y = 0; y < ySize; y++ ) {                target = input.getPixelRgb(x, y);                output.putPixelRgb(x, y, target);            }        }    }    /**    Takes the greater dimension of the input image, and uses it to create an    output square image of such dimension. Then copies the input image    centered in the output image.    */    public static void squareFill(Image input, Image output)    {        int xSize = input.getXSize();        int ySize = input.getYSize();        int x, y;        RGBPixel target = new RGBPixel();        int maxSize = xSize;        if ( ySize > maxSize ) {            maxSize = ySize;        }        output.init(maxSize, maxSize);        int dx, dy;        dx = (maxSize-xSize)/2;        dy = (maxSize-ySize)/2;        for ( x = 0; x < xSize; x++ ) {            for ( y = 0; y < ySize; y++ ) {                target = input.getPixelRgb(x, y);                output.putPixelRgb(x+dx, y+dy, target);            }        }    }    /**    Grows the input image copying the input in the center of a border of    `border` size.    */    public static void frame(Image input, Image output, int border)    {        int xSize = input.getXSize();        int ySize = input.getYSize();        int x, y;        RGBPixel target = new RGBPixel();        output.init(xSize+2*border, ySize+2*border);        int dx, dy;        for ( x = 0; x < xSize; x++ ) {            for ( y = 0; y < ySize; y++ ) {                target = input.getPixelRgb(x, y);                output.putPixelRgb(x+border, y+border, target);            }        }    }    /**    This method extracts a region of interest from source image rectangle    including points from <x0Roi, y0Roi> to <x1Roi, y1Roi>.    */    public static void extractRoi(Image source, Image roi,        int x0Roi, int y0Roi, int x1Roi, int y1Roi)    {        int tmp;        int dx, dy;        //-----------------------------------------------------------------        if ( x0Roi > x1Roi ) {            tmp = x0Roi;            x0Roi = x1Roi;            x1Roi = tmp;        }        if ( y0Roi > y1Roi ) {            tmp = y0Roi;            y0Roi = y1Roi;            y1Roi = tmp;        }        if ( x0Roi < 0 ) x0Roi = 0;        if ( y0Roi < 0 ) y0Roi = 0;        if ( x1Roi >= source.getXSize() ) x1Roi = source.getXSize()-1;        if ( y1Roi >= source.getYSize() ) y1Roi = source.getYSize()-1;        if ( x0Roi >= source.getXSize() ||             y0Roi >= source.getYSize()) {            return;        }        dx = x1Roi - x0Roi + 1;        dy = y1Roi - y0Roi + 1;        //-----------------------------------------------------------------        RGBPixel target = new RGBPixel();        int x, y;        roi.init(dx, dy);        for ( x = 0; x < dx; x++ ) {            for ( y = 0; y < dy; y++ ) {                target = source.getPixelRgb(x0Roi+x, y0Roi+y);                roi.putPixelRgb(x, y, target);            }        }    }    /**    A distance field is a scalar map where each pixel value correspond to the    nearest distance to an "inside" pixel.    Every pixel in the input image with a value greater or equal to `threshold`    will be noted as "inside", otherwise will be "outside".    This implements the naive, real, full, simple (direct) and non-optimized    version of the algorithm, which doesn't have extra memory requirements    and has the following complexity:       - Time: O(N^4)       - Space: O(2*N^2)    Where N is the size in pixels of a squared input image for the square    image case.    This version of the algorithm is provided for reference (comparison between    this algorithm results and optimized versions' results). Its use is not    recommended for applications' use. Use processDistanceFieldWithArray    instead.    */    public static boolean    processDistanceField(Image inInput, IndexedColorImage outOutput,        int threshold)    {        if ( inInput == null || outOutput == null ) {            return false;        }        int dx = inInput.getXSize();        int dy = inInput.getYSize();        if ( dx != outOutput.getXSize() || dy != outOutput.getYSize() ) {            return false;        }        int x, y, xx, yy;        RGBPixel p;        double dist2;        double maxdist2 = ((double)dx)*((double)dx) + ((double)dy)*((double)dy);        double mindist2;        double maxdist = Math.sqrt(maxdist2);        int val;        for ( x = 0; x < dx; x++ ) {            for ( y = 0; y < dy; y++ ) {                // Calculate the nearest distance to output (x, y)                mindist2 = maxdist2;                for ( xx = 0; xx < dx; xx++ ) {                    for ( yy = 0; yy < dy; yy++ ) {                        p = inInput.getPixelRgb(xx, yy);                        val = (VSDK.signedByte2unsignedInteger(p.r) +                               VSDK.signedByte2unsignedInteger(p.g) +                               VSDK.signedByte2unsignedInteger(p.b)) / 3;                                if ( val >= threshold ) {                            dist2 =                          ((double)xx - (double)x) * ((double)xx - (double)x) +                         ((double)yy - (double)y) * ((double)yy - (double)y);                            if ( dist2 < mindist2 ) {                                mindist2 = dist2;                            }                        }                    }                }                // Set output value to current mindistance                val = (int)((Math.sqrt(mindist2) / maxdist)*255.0);                outOutput.putPixel(x, y,                    VSDK.unsigned8BitInteger2signedByte(val));            }        }        return true;    }    /**    A distance field is a scalar map where each pixel value correspond to the    nearest distance to an "inside" pixel.    Every pixel in the input image with a value greater or equal to `threshold`    will be noted as "inside", otherwise will be "outside".    This implements an optimized version of the algorithm in method    `processDistanceField`. Current optimization was made using a dynamic    programming technique which requires an extra preprocessing step and    and array, which is of N^2 positions in the worst case.    Algorithm with optimization is bounded by       - Time: O(N^4)       - Space: O(3*N^2)    but falls to       - Time: O((2+K)*N^2)       - Space: O(2*N^2+K)    where K is usually N*0.06 in contour type images.    Where N is the size in pixels of a squared input image for the square    image case.    This version of the algorithm is provided for reference (comparison between    this algorithm results and optimized versions' results). Its use is not    recommended for applications' use. Use processDistanceFieldWithArray    instead.    */    public static boolean    processDistanceFieldWithArray(Image inInput, IndexedColorImage outOutput,        int threshold)    {        if ( inInput == null || outOutput == null ) {            return false;        }        int dx = inInput.getXSize();        int dy = inInput.getYSize();        if ( dx != outOutput.getXSize() || dy != outOutput.getYSize() ) {            return false;        }        int x, y;        int arrSize = 0;        RGBPixel p;        int val;        //- Preprocessing phase 1: determine number of zero distance pixels        for ( x = 0; x < dx; x++ ) {            for ( y = 0; y < dy; y++ ) {                p = inInput.getPixelRgb(x, y);                val = (VSDK.signedByte2unsignedInteger(p.r) +                       VSDK.signedByte2unsignedInteger(p.g) +                       VSDK.signedByte2unsignedInteger(p.b)) / 3;                if ( val >= threshold ) {                    arrSize++;                }            }        }        //- Preprocessing phase 2: fill array with 0-distance pixel coords.        int xcoords[];        int ycoords[];        int i = 0;        xcoords = new int[arrSize];        ycoords = new int[arrSize];        for ( x = 0; x < dx; x++ ) {            for ( y = 0; y < dy; y++ ) {                p = inInput.getPixelRgb(x, y);                val = (VSDK.signedByte2unsignedInteger(p.r) +                       VSDK.signedByte2unsignedInteger(p.g) +                       VSDK.signedByte2unsignedInteger(p.b)) / 3;                if ( val >= threshold ) {                    xcoords[i] = x;                    ycoords[i] = y;                    i++;                }            }        }        //- Optimized distance field algorithm ----------------------------        int xx, yy;        double dist2;        double maxdist2 = ((double)dx)*((double)dx) + ((double)dy)*((double)dy);        double mindist2;        double maxdist = Math.sqrt(maxdist2);        for ( x = 0; x < dx; x++ ) {            for ( y = 0; y < dy; y++ ) {                mindist2 = maxdist2;                for ( i = 0; i < arrSize; i++ ) {                    xx = xcoords[i];                    yy = ycoords[i];                    dist2 =                       ((double)xx - (double)x) * ((double)xx - (double)x) +                      ((double)yy - (double)y) * ((double)yy - (double)y);                    if ( dist2 < mindist2 ) {                        mindist2 = dist2;                    }                }                // Set output value to current mindistance                val = (int)((Math.sqrt(mindist2) / maxdist)*255.0);                outOutput.putPixel(x, y,                    VSDK.unsigned8BitInteger2signedByte(val));            }        }        return true;    }}//===========================================================================//= EOF                                                                     =//===========================================================================

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
丝袜美腿亚洲色图| 欧美a一区二区| 懂色av中文一区二区三区| 精品国产成人在线影院 | 国产乱码精品一区二区三| 欧美精品一区二区三区四区| 国产在线不卡一区| 国产精品久久久久久久裸模| 色婷婷综合久久久久中文一区二区| 亚洲黄色尤物视频| 欧美一区二区成人6969| 国产精品香蕉一区二区三区| 亚洲视频中文字幕| 777欧美精品| 国产精品一区二区男女羞羞无遮挡| 国产精品视频麻豆| 欧美亚洲动漫精品| 久久激情综合网| 中国色在线观看另类| 日本电影亚洲天堂一区| 久久精品二区亚洲w码| 国产精品入口麻豆原神| 欧美日韩日日骚| 国产制服丝袜一区| 亚洲一二三四区不卡| 精品国产区一区| 91麻豆6部合集magnet| 日本女优在线视频一区二区| 国产精品美女久久久久高潮| 欧美日韩五月天| 成人污视频在线观看| 午夜成人免费电影| 国产精品视频麻豆| 日韩欧美中文字幕一区| 99热99精品| 国产真实精品久久二三区| 亚洲理论在线观看| 久久九九久精品国产免费直播| 在线视频一区二区三区| 国产精品性做久久久久久| 亚洲v精品v日韩v欧美v专区| 国产精品区一区二区三区| 制服丝袜成人动漫| 欧美怡红院视频| 成人性生交大片免费看视频在线 | 国产精品羞羞答答xxdd| 三级亚洲高清视频| 亚洲欧美色一区| 久久色在线观看| 这里只有精品99re| 色吧成人激情小说| 99re这里只有精品6| 九色|91porny| 日韩成人一级片| 亚洲精品乱码久久久久久黑人| 国产欧美日韩在线| 精品久久一区二区| 一区二区三区视频在线看| 国产日本一区二区| www欧美成人18+| 日韩精品中文字幕在线不卡尤物| 欧美性猛交xxxx黑人交| 99视频精品全部免费在线| 国产成人aaaa| 国产一区啦啦啦在线观看| 日韩中文字幕亚洲一区二区va在线| 亚洲女女做受ⅹxx高潮| 一色桃子久久精品亚洲| 亚洲国产高清aⅴ视频| 久久精品视频在线看| www国产成人| 精品美女在线播放| 久久亚区不卡日本| 久久久久久97三级| 国产欧美一区二区精品性色超碰| 精品国产一区二区亚洲人成毛片| 日韩一区二区三区高清免费看看| 91精品国产色综合久久不卡电影| 欧美另类videos死尸| 7777女厕盗摄久久久| 日韩视频一区二区| 久久久久久黄色| 欧美国产一区在线| 成人免费在线观看入口| 亚洲美女在线国产| 亚洲一区精品在线| 日韩二区三区在线观看| 精品影院一区二区久久久| 国产呦萝稀缺另类资源| 国产成人免费在线观看| 91在线视频在线| 欧美色爱综合网| 9191精品国产综合久久久久久| 日韩亚洲欧美中文三级| 精品国产人成亚洲区| 国产精品免费aⅴ片在线观看| 国产精品福利一区| 亚洲成人自拍一区| 久久99国产精品免费| 丁香网亚洲国际| 色美美综合视频| 欧美视频在线不卡| 久久亚洲综合色| 亚洲婷婷综合色高清在线| 亚洲一区二区三区自拍| 另类小说综合欧美亚洲| 成人午夜av电影| 欧美日韩亚洲丝袜制服| 26uuu精品一区二区| 亚洲精品一二三四区| 另类小说欧美激情| 91蝌蚪国产九色| 91精品国产综合久久婷婷香蕉| 国产亚洲精久久久久久| 亚洲香肠在线观看| 精品亚洲免费视频| 色婷婷综合在线| 日韩精品在线看片z| 亚洲欧美日韩综合aⅴ视频| 天堂成人免费av电影一区| 国产另类ts人妖一区二区| 欧美视频中文字幕| 国产欧美一区二区精品性色| 亚洲电影中文字幕在线观看| 国产一区二区精品久久| 欧美亚洲一区二区三区四区| 日本va欧美va精品| 国产精品2024| 欧美影片第一页| 国产精品久久久久永久免费观看 | 午夜免费欧美电影| 成人污污视频在线观看| 欧美成人精品福利| 亚洲午夜久久久久久久久电影院| 国产成人av自拍| 日韩视频免费观看高清在线视频| 亚洲品质自拍视频| 国产高清在线精品| 日韩一级完整毛片| 亚洲成人激情社区| 99国产一区二区三精品乱码| 久久久久99精品一区| 日韩成人一级大片| 欧美日韩在线三区| 亚洲欧美电影一区二区| 国产成人aaaa| 久久久精品黄色| 蜜臀av性久久久久蜜臀aⅴ四虎| 日本高清成人免费播放| 亚洲欧洲色图综合| 国产成人精品三级麻豆| 精品久久久久久久久久久久久久久 | www.视频一区| 久久久亚洲国产美女国产盗摄| 五月婷婷激情综合网| 欧美色倩网站大全免费| 亚洲免费看黄网站| 成人黄色综合网站| 国产精品免费视频观看| 成人中文字幕在线| 日本一区二区三区视频视频| 国产很黄免费观看久久| 26uuu色噜噜精品一区二区| 国产一区二区三区在线看麻豆| 日韩视频免费观看高清完整版在线观看 | 26uuu欧美| 国产综合色视频| wwww国产精品欧美| 国产精品一级片在线观看| 久久九九99视频| 国产91对白在线观看九色| 国产亚洲短视频| 成人午夜电影小说| 亚洲人午夜精品天堂一二香蕉| 99视频国产精品| 一级精品视频在线观看宜春院| 欧洲另类一二三四区| 日韩经典中文字幕一区| 欧美一区二区啪啪| 国产麻豆精品久久一二三| 亚洲国产高清在线观看视频| 成人的网站免费观看| 一区二区三区不卡视频| 欧美日韩一区二区在线观看视频| 日本欧美一区二区三区乱码| 精品国产人成亚洲区| 成人短视频下载| 亚洲香肠在线观看| 精品日产卡一卡二卡麻豆| 国产精品 欧美精品| 国产精品久久久久久久久免费相片| 91浏览器打开| 日韩精品1区2区3区| 久久久国产精华| 色综合久久综合网欧美综合网| 午夜精品久久久久久久久 | 久久精品欧美日韩| 91丨九色porny丨蝌蚪| 奇米777欧美一区二区| 欧美激情中文不卡|