public BufferedImage HistogramSpecification(ImageClass im2){ // Especificacion del histograma con otra imagen de muestra
        int[] imhisto = this.getAcumulativeValues();
        int[] imhisto2 = im2.getAcumulativeValues();
        
        double []imh1 = new double[256];
        double []imh2 = new double[256];
        
        for(int i=0;i<256;i++){
            imh1[i]=(double)imhisto[i];
            imh2[i]=(double)imhisto2[i];
        }
        int[] trans_table = new int[256];
        
        for (int i=0;i<256;i++){
            imh1[i]/=img_size;
            imh2[i]/=im2.img_size;
        }
        
        for (int i=0;i<256;i++){
            for (int j=0;j<256;j++){
                if (imh1[i] == imh2[j]){
                    trans_table[i] = j;
                    break;
                }
                else if (imh1[i] < imh2[j]){
                    if(j != 0 && j != 255){
                        double aux = Math.abs(imh1[i] - imh2[j]);
                        double aux2 = Math.abs(imh1[i] - imh2[j-1]);
                        if(aux < aux2){
                            trans_table[i] = j;
                            break;
                        }
                        else {
                            trans_table[i] = j-1;
                            break;
                        }
                    }
                    else{
                        trans_table[i] = j;       
                    }
                }
            }
        }
        return TRANSFORM(pixels, trans_table);
    }