Skip to content

Instantly share code, notes, and snippets.

View mgautam98's full-sized avatar
🎯
Vibing

Gautam Mishra mgautam98

🎯
Vibing
View GitHub Profile
@mgautam98
mgautam98 / index.html
Last active July 9, 2021 18:08
Reproduce fetch error
<!DOCTYPE html>
<html lang="en">
<head>
<!-- File loc: static/index.html -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
@mgautam98
mgautam98 / pyproject.toml
Created June 28, 2021 01:59
poetry pydantic
[tool.poetry]
name = "pydantic"
version = "0.1.0"
description = ""
authors = ["Gautam Mishra <mishragautam96@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.9"
[tool.poetry.dev-dependencies]
# https://en.wikipedia.org/wiki/Floyd%E2%80%93Steinberg_dithering
function dither(img::AbstractArray{<:Colorant})
n,m = size(img)
for i in 2:n-1
for j in 2:m-1
old_pixel = img[i,j]
new_pixel = round(old_pixel*256)/256
img[i,j] = new_pixel
using FileIO, ImageQualityIndexes
img1 = load("fabio_gray_512.png"); # https://i.imgur.com/jGM4euO.png
img2 = load("lena_gray_512.png"); # https://i.imgur.com/LHqmBwZ.png
assess_ssim(img1, img2)
# 0.34505006577497543
assess_msssim(img1, img2)
Iref = imread('lena_gray_512.png'); % https://i.imgur.com/LHqmBwZ.png
I = imread('fabio_gray_512.png'); % https://i.imgur.com/jGM4euO.png
figure;
montage({Iref,I});
score = multissim(I,Iref)
# 0.3701
[ssimval,ssimmap] = ssim(I,Iref);
ssimval
function radon(img::AbstractArray, theta=range(0,stop=pi,length=minimum(size(img))))
ilength, iwidth = size(img)
idiag = sqrt(ilength^2 + iwidth^2)
length_pad = ceil(idiag-ilength) + 2
width_pad = ceil(idiag-iwidth) + 2
# Make enough padding so we don't loose anything on rotation
pad_image = zeros(Int(ilength+length_pad), Int(iwidth+width_pad))
pad_image[Int(ceil(length_pad/2)):Int(ceil(length_pad/2)+ilength-1),
Int(ceil(width_pad/2)):Int(ceil(width_pad/2)+iwidth-1)] = img;
@mgautam98
mgautam98 / Install NVIDIA Driver and CUDA.md
Created July 20, 2018 16:58 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@mgautam98
mgautam98 / webdev_online_resources.md
Created July 18, 2018 19:18 — forked from bradtraversy/webdev_online_resources.md
Online Resources For Web Developers (No Downloading)