Package javax.media.jai

Examples of javax.media.jai.LookupTableJAI


        ParameterBlock pb = new ParameterBlock();
        pb.addSource(img);
        String opName = null;
        if (isErrorDiffusion) {
            opName = "errordiffusion";
            LookupTableJAI lut = new LookupTableJAI(new byte[] {(byte)0x00, (byte)0xff});
            pb.add(lut);
            pb.add(KernelJAI.ERROR_FILTER_FLOYD_STEINBERG);
        } else {
            opName = "ordereddither";
            //Create the color cube.
View Full Code Here


        ParameterBlock pb = new ParameterBlock();
        pb.addSource(img);
        String opName = null;
        if (isErrorDiffusion) {
            opName = "errordiffusion";
            LookupTableJAI lut = new LookupTableJAI(new byte[] {(byte)0x00, (byte)0xff});
            pb.add(lut);
            pb.add(KernelJAI.ERROR_FILTER_FLOYD_STEINBERG);
        } else {
            opName = "ordereddither";
            //Create the color cube.
View Full Code Here

    /**
     * Called when the image colormap is changed
     */
    public void newColormap() {
        LookupTableJAI lutJAI = imageProcessor.getColorLookupTable();
        if (lutJAI != null) {
            lut = lutJAI.getByteData();
        } else {
            defaultColormap();
        }
        repaint();
    }
View Full Code Here

            loadRawImage();
            correctedImage = null;
        }
        if ( correctedImage == null ) {
            createGammaLut();
            LookupTableJAI jailut = new LookupTableJAI( gammaLut );
           
            // TODO: Why setting color model as a rendering hint produces black image???
            correctedImage  = LookupDescriptor.createRenderable( wbAdjustedRawImage, jailut, null );
           
            // Store the color model of the image
View Full Code Here

        }
    }
   
    private void applyGammaLut() {
        createGammaLut();
        LookupTableJAI jailut = new LookupTableJAI( gammaLut );
        if ( correctedImage != null ) {
            correctedImage.setParameter( jailut, 0 );
        }
    }
View Full Code Here

     */
    protected void applyColorMapping() {
        if ( channelMap == null || colorCorrected == null ) {
            return;
        }
        LookupTableJAI jailut = createColorMappingLUT();
        colorCorrected.setParameter( jailut, 0 );
        if ( saturatedIhsImage != null ) {
            saturatedIhsImage.setParameter( createSaturationMappingLUT() , 0 );
        }
       
View Full Code Here

        if ( valueCurve == null ) {
            // No color mapping found, use identity mapping
            valueCurve = new ColorCurve();
        }

        LookupTableJAI jailut = null;
        if ( componentSizes[0] == 8 ) {
            byte[][] lut = new byte[componentSizes.length][256];
            double dx = 1.0/256.0;
            for ( int band = 0 ; band < colorModel.getNumComponents() ; band++ ) {
                for ( int n = 0 ; n < lut[band].length; n++ ) {
                    double x = dx * n;
                    double val = x;
                    if ( band < componentCurves.length && componentCurves[band] != null ) {
                        val = componentCurves[band].getValue( val );
                    }
                    if ( band < applyValueCurve.length && applyValueCurve[band] ) {
                        val = valueCurve.getValue( val );
                    }
                    val = Math.max( 0.0, Math.min( val, 1.0 ) );
                    lut[band][n] = (byte) ((lut[band].length-1) * val);
                }
            }
            jailut = new LookupTableJAI( lut );
        } else if ( componentSizes[0] == 16 ) {
            short[][] lut = new short[componentSizes.length][0x10000];
            double dx = 1.0/65536.0;
            for ( int band = 0 ; band < colorModel.getNumComponents() ; band++ ) {
                for ( int n = 0 ; n < lut[band].length; n++ ) {
                    double x = dx * n;
                    double val = x;
                    if ( band < componentCurves.length && componentCurves[band] != null ) {
                        val = componentCurves[band].getValue( val );
                    }
                    if ( band < applyValueCurve.length && applyValueCurve[band] ) {
                        val = valueCurve.getValue( val );
                    }
                    val = Math.max( 0.0, Math.min( val, 1.0 ) );
                    lut[band][n] = (short) ((lut[band].length-1) * val);
                }
            }
            jailut = new LookupTableJAI( lut, true );
        } else {
            log.error( "Unsupported data type with with = " + componentSizes[0] );
        }
        return jailut;
    }
View Full Code Here

        }
        if ( satCurve == null ) {
            satCurve = new ColorCurve();
        }
       
        LookupTableJAI jailut = null;
        if ( componentSizes[0] == 8 ) {
            byte[][] lut = new byte[componentSizes.length][256];
            double dx = 1.0/256.0;
            for ( int band = 0 ; band < componentSizes.length ; band++ ) {
                // Saturation
                for ( int n = 0 ; n < lut[band].length; n++ ) {
                    double x = dx * n;
                    double val = x;
                    if ( band == 2 ) {
                        val = satCurve.getValue( val );
                    }
                    val = Math.max( 0.0, Math.min( val, 1.0 ) );
                    lut[band][n] = (byte) ((lut[band].length-1) * val);
                }
            }
           
            jailut = new LookupTableJAI( lut );
        } else if ( componentSizes[0] == 16 ) {
            short[][] lut = new short[componentSizes.length][0x10000];
            double dx = 1.0/65536.0;
            for ( int band = 0 ; band < componentSizes.length ; band++ ) {
                for ( int n = 0 ; n < lut[band].length; n++ ) {
                    double x = dx * n;
                    double val = x;
                    if ( band == 2 ) {
                        val = satCurve.getValue( val );
                    }
                    val = Math.max( 0.0, Math.min( val, 1.0 ) );
                    lut[band][n] = (short) ((lut[band].length-1) * val);
                }
            }
            jailut = new LookupTableJAI( lut, true );
        } else {
            log.error( "Unsupported data type with with = " + componentSizes[0] );
        }
        return jailut;
    }
View Full Code Here

     @param src Node to use as input for color correction.
     */
   
    protected RenderableOp getColorCorrected( RenderableOp src ) {
        // Initialize lookup table based on original image color model
        LookupTableJAI jailut = createColorMappingLUT();
        return LookupDescriptor.createRenderable( src, jailut, null );       
    }
View Full Code Here

        RenderableOp ihsImage  = JAI.createRenderable("colorconvert", pb );
        ihsImage.setProperty( "org.photovault.opname", "color_corrected_ihs_image" );

//        saturatedIhsImage =
//                MultiplyConstDescriptor.createRenderable( ihsImage, new double[] {1.0, 1.0, saturation}, null );
        LookupTableJAI jailut = createSaturationMappingLUT();
        saturatedIhsImage = LookupDescriptor.createRenderable( ihsImage, jailut, null );
       
        pb = new ParameterBlock();
        pb.addSource(saturatedIhsImage);
        ColorSpace sRGB = ColorSpace.getInstance( ColorSpace.CS_sRGB );
View Full Code Here

TOP

Related Classes of javax.media.jai.LookupTableJAI

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.