public void Compute()
        {
            using (var model = ColorMomentHash.Create())
                using (var img = Image("lenna.png"))
                    using (var hash = new MatOfDouble())
                    {
                        model.Compute(img, hash);
                        Assert.Equal(1, hash.Rows);
                        Assert.Equal(42, hash.Cols);
                        Assert.Equal(MatType.CV_64FC1, hash.Type());

                        var hashArray = hash.ToArray();
                        Assert.Equal(
                            new double[]
                        {
                            0.00168799895166844, 9.73548985026306E-09, 7.12008515499876E-12, 1.58206172228354E-10,
                            5.28813826840171E-21, 1.29337857065483E-14, 4.79075399951684E-22, 0.00128609224067447,
                            9.52599959124291E-10, 3.93698021400622E-12, 7.14400696815386E-12, 3.78255159833954E-23,
                            1.97733914733847E-16, 2.16399836659832E-24, 0.000922260536104536, 3.65830493343832E-09,
                            7.661707706699E-13, 1.19445875901408E-12, -1.12767845932483E-24, -5.93217692337658E-17,
                            -1.84467412783745E-25, 0.00132500752122349, 9.11756797244743E-09, 3.34535518270916E-12,
                            9.874171040899E-12, 1.58987320234562E-25, -9.15629498603106E-16, 5.67505900918754E-23,
                            0.000996616840904085, 1.90986702741479E-10, 1.81929041195046E-13, 1.60689960736751E-13,
                            -2.7254690880086E-26, 1.04487497633728E-18, -3.47059704207128E-27, 0.00139981947147226,
                            2.27201044977745E-09, 4.41887540236722E-13, 7.28673251542401E-13, -4.09431968883588E-25,
                            3.10909057900972E-17, -5.77204894690052E-26
                        },
                            hashArray, new DoubleEqualityComparer(1E-12));
                    }
        }
Exemple #2
0
        public void Compute()
        {
            using (var model = ColorMomentHash.Create())
                using (var img = Image("lenna.png"))
                    using (var hash = new MatOfDouble())
                    {
                        model.Compute(img, hash);
                        Assert.Equal(1, hash.Rows);
                        Assert.Equal(42, hash.Cols);
                        Assert.Equal(MatType.CV_64FC1, hash.Type());

                        var hashArray = hash.ToArray();
                        Assert.Equal(
                            new double[] {
                            0.00168819565895133, 9.69274323413482E-09, 7.15987637898653E-12, 1.58221230845821E-10, 5.30132640226369E-21, 1.29174445409783E-14,
                            5.05488594422795E-22, 0.00128582879665923, 9.54461083144018E-10, 3.93406825147193E-12, 7.14101055135503E-12, 3.77862605260528E-23,
                            1.97867503074794E-16, 2.18751322086428E-24, 0.000922420923231133, 3.66078199965787E-09, 7.66904362623121E-13, 1.19544776529889E-12,
                            -1.12961325893555E-24, -5.93904771577414E-17, -1.84824480251793E-25, 0.00132532781142086, 9.1266053151516E-09, 3.35010536084133E-12,
                            9.88703855128973E-12, 1.52916239933584E-25, -9.17283073278845E-16, 5.69019311750733E-23, 0.00099662162473446, 1.90988729313945E-10,
                            1.81949836361996E-13, 1.60681443129224E-13, -2.72531646791605E-26, 1.04472248518881E-18, -3.4777107678675E-27, 0.00139982088736603,
                            2.27107975098039E-09, 4.41840703628873E-13, 7.2892000615472E-13, -4.0962177932807E-25, 3.10975156243194E-17, -5.77217024628191E-26
                        },
                            hashArray, new DoubleEqualityComparer(1E-12));
                    }
        }