Skip to content

Instantly share code, notes, and snippets.

View VladimirGl's full-sized avatar

Glazachev Vladimir VladimirGl

  • Saint-Petersburg State University
  • Saint Petersburg
View GitHub Profile
@VladimirGl
VladimirGl / scrap.sh
Last active April 3, 2020 16:49
parser_history
#!/bin/bash
apt update;
apt-install -y wget zip;
mkdir -p results;
cd results;
rm links.txt
touch links.txt
def wiener_deconv_filter(img, kernel, K = 10):
h, w = img.shape
kh, kw = kernel.shape
temp = np.copy(img)
kernel = np.pad(kernel, [(0, h - kh), (0, w - kw)], 'constant')
temp = fft2(temp)
kernel = fft2(kernel)
import numpy as np
from numpy.fft import fft2, ifft2
def wiener_denoising_filter(img, sigma, K = 10):
h, w = img.shape
temp = fft2(img)
kernel = (np.abs(temp) ** 2) / (h * w)
kernel = kernel / (kernel + sigma * sigma)
@VladimirGl
VladimirGl / shit.py
Created February 25, 2017 18:31
phase+mag
F_mag = np.fft.fft2(im_magnutide[:,:,0])
F_ph = np.fft.fft2(im_phase)
mag = np.absolute(F_mag)
phase = np.arctan2(F_ph.imag, F_ph.real)
re = np.multiply(mag, np.cos(phase))
im = np.multiply(mag, np.sin(phase))
res = re + 1j * im
@VladimirGl
VladimirGl / callgraph.png
Last active August 29, 2015 14:27
valgrind
callgraph.png
@VladimirGl
VladimirGl / sqr
Created July 28, 2015 23:39
cyclosqr13
(-a_7^2+2*a_6*a_7+2*a_4*a_7-a_10^2-a_11^2+2*a_5*a_8-2*a_6*a_8+2*a_3*a_9-2*a_5*a_9+2*a_2*a_10-2*a_3*a_10+2*a_1*a_11-2*a_2*a_11-2*a_9*a_11+4*a_10*a_11+2*a_0*l-2*a_1*l-2*a_8*l+4*a_9*l-2*a_10*l-2*a_8*a_4)*x^11*+(a_6^2-2*a_8*a_6+2*a_4*a_6-a_7^2+a_10^2-a_11^2+a_4^2+2*a_5*a_7+2*a_3*a_8+2*a_2*a_9-2*a_5*a_9+2*a_1*a_10-2*a_3*a_10-2*a_9*a_10+2*a_0*a_11-2*a_2*a_11-2*a_8*a_11+2*a_9*a_11+2*a_10*a_11-2*a_1*l-2*a_7*l+2*a_8*l+2*a_9*l-2*a_10*l-2*a_8*a_4)*x^10+(-a_7^2+2*a_3*a_7-2*a_11*a_7+2*l*a_7-a_9^2-a_11^2+l^2+2*a_5*a_6+2*a_2*a_8-2*a_6*a_8+2*a_1*a_9-2*a_5*a_9+2*a_0*a_10-2*a_3*a_10-2*a_8*a_10+2*a_9*a_10-2*a_2*a_11+2*a_8*a_11+2*a_10*a_11-2*a_1*l-2*a_6*l+2*a_9*l-2*a_10*l+2*a_5*a_4-2*a_8*a_4-2*l*a_4)*x^9+(a_5^2-2*a_9*a_5-2*l*a_5-a_7^2+a_9^2-a_11^2+l^2+2*a_3*a_6+2*a_2*a_7+2*a_1*a_8-2*a_6*a_8+2*a_0*a_9-2*a_8*a_9-2*a_3*a_10-2*a_7*a_10+2*a_8*a_10-2*a_2*a_11-2*a_6*a_11+2*a_7*a_11+2*a_10*a_11-2*a_1*l+2*a_6*l+2*a_9*l-2*a_10*l+2*a_11*l+2*a_3*a_4-2*a_8*a_4-2*a_11*a_4+2*l*a_4)*x^8+(-a_7^2+2*a_1*a_7-2*a_9*a_7+2*a_10*a_7-a_8^2-2*l^2+2*a_3*a
@VladimirGl
VladimirGl / new100.png
Last active August 29, 2015 14:25
valgrint21jul
new100.png
@VladimirGl
VladimirGl / table100.png
Last active August 29, 2015 14:23
power function images
table100.png
@VladimirGl
VladimirGl / call100.png
Last active August 29, 2015 14:23
calgrind
call100.png
@VladimirGl
VladimirGl / intrinsic.c
Created March 16, 2015 15:35
intrinsics power
#include <iostream>
#include <cstdlib>
#include <xmmintrin.h>
#include <ctime>
float *construct(size_t W, size_t H) {
float *arr = new float[W * H];
for (size_t i = 0; i < H; ++i) {
for (size_t j = 0; j < W; ++j) {
arr[i * W + j] = static_cast<float>(std::rand());