This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import cv2 | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # create a simple image | |
| image = np.kron([[1, 0] * 4, [0, 1] * 4] * 4, np.ones((50, 50))).astype(np.uint8) * 255 | |
| # test opencv | |
| cv2.imshow('checkboard',image) | |
| cv2.waitKey(0) | |
| # test matplotlib |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # this is a python reimplementation of edgetaper introduced here: https://docs.opencv.org/4.x/d1/dfd/tutorial_motion_deblur_filter.html | |
| def edgetaper(img, gamma=5, beta=0.2): | |
| width,height = img.shape[:2] | |
| dx = 2 * np.pi / width | |
| dy = 2 * np.pi / height | |
| # subtract dx and dy to match original function's range | |
| x = np.linspace(-np.pi, np.pi-dx, width) | |
| y = np.linspace(-np.pi, np.pi-dy, height) | |
| w1 = 0.5 * (np.tanh((x + gamma / 2) / beta) - np.tanh((x - gamma / 2) / beta)) | |
| w2 = 0.5 * (np.tanh((y + gamma / 2) / beta) - np.tanh((y - gamma / 2) / beta)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {"0": ["n01440764", "tench"], "1": ["n01443537", "goldfish"], "2": ["n01484850", "great_white_shark"], "3": ["n01491361", "tiger_shark"], "4": ["n01494475", "hammerhead"], "5": ["n01496331", "electric_ray"], "6": ["n01498041", "stingray"], "7": ["n01514668", "cock"], "8": ["n01514859", "hen"], "9": ["n01518878", "ostrich"], "10": ["n01530575", "brambling"], "11": ["n01531178", "goldfinch"], "12": ["n01532829", "house_finch"], "13": ["n01534433", "junco"], "14": ["n01537544", "indigo_bunting"], "15": ["n01558993", "robin"], "16": ["n01560419", "bulbul"], "17": ["n01580077", "jay"], "18": ["n01582220", "magpie"], "19": ["n01592084", "chickadee"], "20": ["n01601694", "water_ouzel"], "21": ["n01608432", "kite"], "22": ["n01614925", "bald_eagle"], "23": ["n01616318", "vulture"], "24": ["n01622779", "great_grey_owl"], "25": ["n01629819", "European_fire_salamander"], "26": ["n01630670", "common_newt"], "27": ["n01631663", "eft"], "28": ["n01632458", "spotted_salamander"], "29": ["n01632777", "axolotl"], "30": ["n016 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| goldfish | |
| European_fire_salamander | |
| bullfrog | |
| tailed_frog | |
| American_alligator | |
| boa_constrictor | |
| trilobite | |
| scorpion | |
| black_widow | |
| tarantula |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import json | |
| import requests | |
| def download_file(url, path): | |
| if not os.path.exists(path): | |
| response = requests.get(url) | |
| # if download failed raise exception | |
| response.raise_for_status() | |
| with open(path, 'w', encoding='utf-8') as file: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| n01443537 | |
| n01629819 | |
| n01641577 | |
| n01644900 | |
| n01698640 | |
| n01742172 | |
| n01768244 | |
| n01770393 | |
| n01774384 | |
| n01774750 |
OlderNewer