How to use the plenopticam.misc.create_gauss_kernel function in plenopticam

To help you get started, we’ve selected a few plenopticam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hahnec / plenopticam / plenopticam / lfp_calibrator / pitch_estimator.py View on Github external
def _crop_img(self, CR=1):

        # crop image (for computational speed-up and smaller region of interest)
        S = self._img.shape[0]//2
        self._top_img = self._img[S-S//CR:S+S//CR-1, S-S//CR:S+S//CR-1].copy().astype(np.float64)

        # darken image edges to exclude micro images at border
        self._top_img *= create_gauss_kernel(length=S // CR * 2 - 1, sigma=S // CR // 2)

        return True
github hahnec / plenopticam / plenopticam / lfp_calibrator / pitch_estimator.py View on Github external
def create_scale_space(self):

        # create Gaussian kernels with sigma=1 and sigma=sqrt(2)
        sig_one_kernel = create_gauss_kernel(length=9, sigma=1.)
        sig_sqrt_kernel = 1 * create_gauss_kernel(length=9, sigma=np.sqrt(2))

        # initialize scale space variables
        self._scale_space = []
        img_scale = scipy.signal.convolve2d(self._top_img, sig_one_kernel, 'same')   # initial scale

        # compute scale space by Gaussian filtering and down-sampling
        while (img_scale.shape[0] or img_scale.shape[1]) >= 3:

            # filter scaled image by Gaussian kernel with sigma=1
            gauss_img_one = (scipy.signal.convolve2d(img_scale, sig_one_kernel, 'same'))

            # append scaled image to pyramid
            self._scale_space.append(-(gauss_img_one-img_scale))  # negative for maximum detection

            # filter scaled image by Gaussian kernel with sigma=sqrt(2)
            gauss_img_two = (scipy.signal.convolve2d(gauss_img_one, sig_sqrt_kernel, 'same'))
github hahnec / plenopticam / plenopticam / lfp_calibrator / pitch_estimator.py View on Github external
def create_scale_space(self):

        # create Gaussian kernels with sigma=1 and sigma=sqrt(2)
        sig_one_kernel = create_gauss_kernel(length=9, sigma=1.)
        sig_sqrt_kernel = 1 * create_gauss_kernel(length=9, sigma=np.sqrt(2))

        # initialize scale space variables
        self._scale_space = []
        img_scale = scipy.signal.convolve2d(self._top_img, sig_one_kernel, 'same')   # initial scale

        # compute scale space by Gaussian filtering and down-sampling
        while (img_scale.shape[0] or img_scale.shape[1]) >= 3:

            # filter scaled image by Gaussian kernel with sigma=1
            gauss_img_one = (scipy.signal.convolve2d(img_scale, sig_one_kernel, 'same'))

            # append scaled image to pyramid
            self._scale_space.append(-(gauss_img_one-img_scale))  # negative for maximum detection

            # filter scaled image by Gaussian kernel with sigma=sqrt(2)
github hahnec / plenopticam / plenopticam / lfp_aligner / lfp_devignetter.py View on Github external
def _estimate_noise_level(self):
        """ estimate white image noise level """

        # print status
        self.sta.status_msg('Estimate white image noise level', self.cfg.params[self.cfg.opt_prnt])
        self.sta.progress(None, self.cfg.params[self.cfg.opt_prnt])

        M = np.mean(self.cfg.calibs[self.cfg.ptc_mean])
        lp_kernel = misc.create_gauss_kernel(length=M)
        if len(self._wht_img.shape) == 3:
            bw_img = rgb2gry(self._wht_img)[..., 0] if self._wht_img.shape[2] == 3 else self._wht_img[..., 0]
        else:
            bw_img = self._wht_img
        flt_img = convolve2d(bw_img, lp_kernel, 'same')

        self.sta.progress(100, self.cfg.params[self.cfg.opt_prnt])

        return np.std(bw_img-flt_img)
github hahnec / plenopticam / plenopticam / lfp_calibrator / centroid_extractor.py View on Github external
def compute_log(self):
        """ compute Laplacian of Gaussian (LoG) """

        # print status
        self.sta.status_msg('Compute LoG', self.cfg.params[self.cfg.opt_prnt])

        # Gaussian sigma
        sig = int(self._M/4)/1.18

        # convolutions
        laplace_kernel = np.array([[0, 1, 0], [1, -4, 1], [0, 1, 0]])
        gauss_kernel = create_gauss_kernel(int(sig*6), sig)
        mexican_hat = -scipy.signal.convolve2d(gauss_kernel, laplace_kernel, 'same')
        self._peak_img = scipy.signal.convolve2d(self._img, mexican_hat, 'same')

        # print progress
        self.sta.progress(100, self.cfg.params[self.cfg.opt_prnt])

        return True