コード例 #1
0
ファイル: particlefilter.py プロジェクト: misaelzapata/TFM
    def motionmodel(self):

        p = self.p
        y, x = p.shape

        a0 = np.floor(np.random.uniform(-15, 15, [y, 1]))
        a1 = np.floor(np.random.uniform(-15, 15, [y, 1]))
        a2 = np.floor(np.random.uniform(-3, 3, [y, 1]))
        a3 = np.floor(np.random.uniform(-3, 3, [y, 1]))

        p[:, 0] = p[:, 0] + a0[:, 0]
        p[:, 1] = p[:, 1] + a1[:, 0]
        p[:, 2] = p[:, 2] + a2[:, 0]
        p[:, 3] = p[:, 3] + a3[:, 0]

        self.p = p
コード例 #2
0
ファイル: particlefilter.py プロジェクト: gelansheshed/TFM
    def init_p(self):

        (x, y), (h, w), a = self.rb
        self.p = np.floor(
            np.random.multivariate_normal([x, y, h, w, 0, 0], self.cov,
                                          self.num_p))

        self.p_star = [x, y, h, w, 0, 0]
        """
コード例 #3
0
ファイル: particlefilter.py プロジェクト: misaelzapata/TFM
    def init_p(self):

        (x, y), (h, w), a = self.det
        self.p = np.floor(
            np.random.multivariate_normal(
                [x, y, h, w],
                self.cov,
                self.num_p
            )
        )
コード例 #4
0
ファイル: particlefilter.py プロジェクト: d-val/TFM
    def init_p(self):

        (x, y), (h, w), a = self.rb
        self.p = np.floor(
            np.random.multivariate_normal(
                [x, y, h, w, 0, 0],
                self.cov,
                self.num_p
            )
        )
        
        self.p_star = [x, y, h, w, 0, 0]

        """
コード例 #5
0
ファイル: particlefilter.py プロジェクト: misaelzapata/TFM
    def plikelihood(self):

        (x, y), (h, w), a = self.det
        det = np.floor(np.array([[x, y, h, w]]))
        yrep = np.ones((self.num_p, 4)) * det

        R2 = np.sum(np.power(self.p - yrep, 2), 1)
        width = 2 * (np.amax(np.sqrt(R2)) - np.amin(np.sqrt(R2)))
        prob = np.exp(-R2 / width)

        prob = prob / np.sum(prob)
        self.prob = prob

        self.sortprob()
コード例 #6
0
ファイル: particlefilter.py プロジェクト: d-val/TFM
    def plikelihood(self):

        if self.update:
            (x, y), (h, w), a = self.rb

            det = np.floor(np.array([[x, y, h, w, x - self.p_star[0], y - self.p_star[1]]]))
            yrep = np.ones((self.num_p, 6)) * det

            R2 = np.sum(np.power(self.p[:, 0:6] - yrep, 2), 1)
            width = 2 * (np.amax(np.sqrt(R2)) - np.amin(np.sqrt(R2)))
            prob = np.exp(- R2 / width)

            a = np.sum(prob)
            if a != 0.0:
                prob = prob / np.sum(prob)
            self.prob = prob

            self.sortprob()
        self.calculatepstar()
コード例 #7
0
ファイル: particlefilter.py プロジェクト: gelansheshed/TFM
    def plikelihood(self):

        if self.update:
            (x, y), (h, w), a = self.rb

            det = np.floor(
                np.array([[x, y, h, w, x - self.p_star[0],
                           y - self.p_star[1]]]))
            yrep = np.ones((self.num_p, 6)) * det

            R2 = np.sum(np.power(self.p[:, 0:6] - yrep, 2), 1)
            width = 2 * (np.amax(np.sqrt(R2)) - np.amin(np.sqrt(R2)))
            prob = np.exp(-R2 / width)

            a = np.sum(prob)
            if a != 0.0:
                prob = prob / np.sum(prob)
            self.prob = prob

            self.sortprob()
        self.calculatepstar()
コード例 #8
0
ファイル: particlefilter.py プロジェクト: d-val/TFM
    def plikelihood_new(self):

        if self.update:
            (x, y), (h, w), a = self.rb


            detectionExtended = np.floor(np.array([[x, y, h, w, x - self.p_star[0], y - self.p_star[1]]]))
            yrep = np.ones((self.num_p, 6)) * detectionExtended
            prob = gaussMixModelPDF(oneParticle,detectionExtended,p_star)


            R2 = np.sum(np.power(self.p[:, 0:6] - yrep, 2), 1)
            width = 2 * (np.amax(np.sqrt(R2)) - np.amin(np.sqrt(R2)))
            prob = np.exp(- R2 / width)

            a = np.sum(prob)

            if a != 0.0:
                prob = prob / np.sum(prob)
            self.prob = prob

            self.sortprob()
            self.calculatepstar()
コード例 #9
0
ファイル: particlefilter.py プロジェクト: gelansheshed/TFM
    def plikelihood_new(self):

        if self.update:
            (x, y), (h, w), a = self.rb

            detectionExtended = np.floor(
                np.array([[x, y, h, w, x - self.p_star[0],
                           y - self.p_star[1]]]))
            yrep = np.ones((self.num_p, 6)) * detectionExtended
            prob = gaussMixModelPDF(oneParticle, detectionExtended, p_star)

            R2 = np.sum(np.power(self.p[:, 0:6] - yrep, 2), 1)
            width = 2 * (np.amax(np.sqrt(R2)) - np.amin(np.sqrt(R2)))
            prob = np.exp(-R2 / width)

            a = np.sum(prob)

            if a != 0.0:
                prob = prob / np.sum(prob)
            self.prob = prob

            self.sortprob()
            self.calculatepstar()