001/*******************************************************************************
002 * This software is provided as a supplement to the authors' textbooks on digital
003 *  image processing published by Springer-Verlag in various languages and editions.
004 * Permission to use and distribute this software is granted under the BSD 2-Clause 
005 * "Simplified" License (see http://opensource.org/licenses/BSD-2-Clause). 
006 * Copyright (c) 2006-2016 Wilhelm Burger, Mark J. Burge. All rights reserved. 
007 * Visit http://imagingbook.com for additional details.
008 *******************************************************************************/
009
010package imagingbook.pub.sift.scalespace;
011
012public class GaussianOctave extends ScaleOctave {
013        
014        GaussianOctave(int p, int Q, ScaleLevel Gbot, int botIndex, int topIndex, double sigma_0) {
015                super(p, Q, Gbot, botIndex, topIndex);  // initialize the bottom level (botIndex) of this octave with Gbot
016                this.sigma_0 = sigma_0;                                 // reference scale at level 0 of this octave
017                double sigmaA_bot = getAbsoluteScale(p, botIndex);
018                Gbot.setAbsoluteScale(sigmaA_bot);
019                
020                // create octave levels q = botIndex + 1,...,topIndex
021                for (int q = botIndex + 1; q <= topIndex; q++) {
022                        double sigmaA_q = getAbsoluteScale(p, q);       // absolute scale of level q
023//                      double sigmaR_q = Math.sqrt(sigmaA_q * sigmaA_q - sigmaA_bot * sigmaA_bot) / Math.pow(2, p);  // relative scale from bottom level (-1)
024                        double sigmaR_q = sigma_0 * Math.sqrt(Math.pow(2, 2.0 * q / Q) - Math.pow(2, -2.0 / Q)); // relative scale from bottom level (-1)
025                        ScaleLevel G_pq = Gbot.duplicate();
026                        G_pq.filterGaussian(sigmaR_q);
027                        G_pq.setAbsoluteScale(sigmaA_q);
028                        this.setLevel(q, G_pq);
029                }
030        }
031        
032}