{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import cv2\n", "from matplotlib import pyplot as plt" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "imgs = [cv2.imread(f'samples/series/{i}.png') for i in range(1, 10)]" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "gray = [cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) for im in imgs]\n", "gray = [np.float64(im) for im in gray]\n", "noise = np.random.randn(*gray[1].shape)*10\n", "noisy = [im + noise for im in gray]\n", "noisy = [np.uint8(np.clip(im, 0, 255)) for im in noisy]" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [], "source": [ "dst = cv2.fastNlMeansDenoisingMulti(noisy, 2, 5, None, 4, 7, 35)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }