Package Jama

Examples of Jama.Matrix


        super(source, new ImageLayout(source), config, true);
        permitInPlaceOperation();
        this.angle = angle;

        ICC_ProfileRGB sRGB = (ICC_ProfileRGB) JAIContext.sRGBColorProfile;
        toSRGB = new Matrix(sRGB.getMatrix()).inverse().times(new Matrix(((ICC_ProfileRGB) JAIContext.linearProfile).getMatrix())).getArrayFloat();
        toLinearRGB = new Matrix(sRGB.getMatrix()).inverse().times(new Matrix(((ICC_ProfileRGB) JAIContext.linearProfile).getMatrix())).inverse().getArrayFloat();
    }
View Full Code Here


        this.transform = transform;

        saturationIncrease = transform[0][0] > 1;

        ICC_ProfileRGB linRGB = (ICC_ProfileRGB) ICC_Profile.getInstance(ColorSpace.CS_LINEAR_RGB);
        toLinearsRGB = new Matrix(linRGB.getMatrix()).inverse().times(new Matrix(((ICC_ProfileRGB) JAIContext.linearProfile).getMatrix())).getArrayFloat();
    }
View Full Code Here

        final DCRaw dcRaw = ((RawImageInfo)auxInfo).getDCRaw();
        return new Dimension( dcRaw.getImageWidth(), dcRaw.getImageHeight() );
    }

    static Matrix pseudoinverse(Matrix m) {
        Matrix t = m.transpose();
        return t.times(m).inverse().times(t).transpose();
    }
View Full Code Here

            for (int j = 0; j < 3; j++)
                cam_rgb[i][j] /= num;
            pre_mul[i] = (float) (1 / num);
        }

        float inverse[][] = new Matrix(cam_rgb).inverse().transpose().getArrayFloat();
        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                rgb_cam[i][j] = inverse[j][i];
    }
View Full Code Here

    public FilteredGrayscaleOpImage(RenderedImage source, float filter[], float angle, float strenght, Map config) {
        super(source, new ImageLayout(source), config, true);
        permitInPlaceOperation();
        ICC_ProfileRGB sRGB = (ICC_ProfileRGB) JAIContext.sRGBColorProfile;
        ICC_ProfileRGB linRGB = (ICC_ProfileRGB) JAIContext.linearProfile;
        toLinearsRGB = new Matrix(sRGB.getMatrix()).inverse().times(new Matrix(linRGB.getMatrix())).getArrayFloat();

        this.filter = filter.clone();
        this.angle = angle;
    }
View Full Code Here

                this.transform[i][j] = (int) (sMath_scale * transform[i][j]);

        saturationIncrease = transform[0][0] > 1;

        ICC_ProfileRGB linRGB = (ICC_ProfileRGB) ICC_Profile.getInstance(ColorSpace.CS_LINEAR_RGB);
        Matrix XYZtoLinsRGB = new Matrix(linRGB.getMatrix()).inverse();
        Matrix CIERGBtoXYZ = new Matrix(((ICC_ProfileRGB) JAIContext.linearProfile).getMatrix());
        double CIERGBtoLinsRGB[][] = XYZtoLinsRGB.times(CIERGBtoXYZ).getArray();

        for (int i = 0; i < 3; i++)
            for (int j = 0; j < 3; j++)
                toLinearsRGB[i][j] = (int) (sMath_scale * CIERGBtoLinsRGB[i][j]);
 
View Full Code Here

                for (int i = 0; i < 3; i++)
                    for (int j = 0; j < 3; j++)
                        cameraRGBWB[j][i] *= wb[i];

                Matrix B = new Matrix(ColorScience.chromaticAdaptation(daylightTemperature, originalTemperature, caMethod));
                Matrix combo = XYZtoRGB.times(B.times(RGBtoZYX));

                cameraRGBWB = combo.inverse().times(new Matrix(cameraRGBWB)).getArrayFloat();
            }
           
            cameraRGBCA = dcRaw.getCameraRGB();
            dcRaw.getDaylightMultipliers();

View Full Code Here

    static float neutralTemperature(float rgb[], float refT) {
        float sat = Float.MAX_VALUE;
        float minT = 0;
        for (int t = 1000; t < 40000; t+= (0.01 * t)) {
            Matrix B = new Matrix(ColorScience.chromaticAdaptation(t, refT, caMethod));
            Matrix combo = XYZtoRGB.times(B.times(RGBtoZYX));

            Matrix color = new Matrix(new double[][]{{rgb[0]}, {rgb[1]}, {rgb[2]}});

            color = combo.times(color);

            double r = color.get(0, 0);
            double g = color.get(1, 0);
            double b = color.get(2, 0);

            float tSat = (float) ColorScience.saturation(r, g, b);

            if (tSat < sat) {
                sat = tSat;
View Full Code Here

                    }
                }
            }

            // Chromatic adaptation matrix
            Matrix B = new Matrix(ColorScience.chromaticAdaptation(daylightTemperature, temperature, caMethod));
            Matrix CA = XYZtoRGB.times(B.times(RGBtoZYX));

            // Normalize the CA matrix to keep exposure constant
            Matrix m = CA.times(new Matrix(new double[][]{{1},{1},{1}}));
            double max = m.get(1, 0);
            if (max != 1)
                CA = CA.times(new Matrix(new double[][]{{1/max, 0, 0},{0, 1/max, 0},{0, 0, 1/max}}));

            float actualExposure = exposure;
            String thisCamera = metadata.getCameraMake(true);
            for (String camera : fakeISO100Cameras)
                if (thisCamera.equals(camera)) {
                    if (metadata.getISO() == 100) {
                        actualExposure -= 1;
                    }
                    break;
                }

            // The matrix taking into account the camera color space and its basic white balance and exposure
            float camMatrix[][] = new Matrix(cameraRGB(temperature)).times(Math.pow(2, actualExposure)).getArrayFloat();

            front = new HighlightRecoveryOpImage(front, preMul, camMatrix, CA.getArrayFloat(), null);

            if (tint != 0)
                front = WhiteBalanceV2.tintCast(front, tint, lightness);
View Full Code Here

        double sat = ColorScience.saturation(r, g, b);
        int minT = (int) source;
        double wbr = 0, wbg = 0, wbb = 0;

        for (int t = 1000; t < 40000; t+= 0.001 * t) {
            Matrix B = new Matrix(ColorScience.chromaticAdaptation(REF_T, t, caMethod));
            Matrix combo = XYZtoRGB.times(B.times(RGBtoZYX));

            Matrix color = new Matrix(new double[][]{{pixel[0]}, {pixel[1]}, {pixel[2]}});

            color = combo.times(color);

            r = color.get(0, 0);
            g = color.get(1, 0);
            b = color.get(2, 0);

            double tSat = ColorScience.saturation(r, g, b);

            if (tSat < sat) {
                sat = tSat;
View Full Code Here

TOP

Related Classes of Jama.Matrix

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.