Skip to content

Instantly share code, notes, and snippets.

@j4p3
Created January 27, 2024 17:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j4p3/2963d6ab650ba2a468c326f1b074ce41 to your computer and use it in GitHub Desktop.
Save j4p3/2963d6ab650ba2a468c326f1b074ce41 to your computer and use it in GitHub Desktop.
sample nightshade img2img countermeasure
import numpy as np
import cv2
from cv2.ximgproc import guidedFilter
img = cv2.imread('input.png').astype(np.float32)
y = img.copy()
for _ in range(64):
y = cv2.bilateralFilter(y, 5, 8, 8)
for _ in range(4):
y = guidedFilter(img, y, 4, 16)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment