This file contains 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
from IPython.display import display, clear_output | |
# Creating and Displaying button | |
button = widgets.Button(description="Button Text!") | |
display(button) | |
# Callback function with button parameter | |
def clicked(b): | |
clear_output() | |
print("Result of button click: ") |
This file contains 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 ipywidgets as widgets | |
# Import display function | |
from IPython.display import display | |
# Create costume widget | |
w = widgets.IntProgress(value = 50, description='Loading:') | |
# Display widget | |
display(w) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
def fourCornersSort(pts): | |
""" Sort corners: top-left, bot-left, bot-right, top-right """ | |
# Difference and sum of x and y value | |
# Inspired by http://www.pyimagesearch.com | |
diff = np.diff(pts, axis=1) | |
summ = pts.sum(axis=1) | |
# Top-left point has smallest sum... | |
# np.argmin() returns INDEX of min | |
return np.array([pts[np.argmin(summ)], |
This file contains 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
# Getting contours | |
im2, contours, hierarchy = cv2.findContours(edges, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) | |
# Finding contour of biggest rectangle | |
# Otherwise return corners of original image | |
# Don't forget on our 5px border! | |
height = edges.shape[0] | |
width = edges.shape[1] | |
MAX_COUNTOUR_AREA = (width - 10) * (height - 10) |
This file contains 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
def resize(img, height=800): | |
""" Resize image to given height """ | |
rat = height / img.shape[0] | |
return cv2.resize(img, (int(rat * img.shape[1]), height)) | |
# Resize and convert to grayscale | |
img = cv2.cvtColor(resize(image), cv2.COLOR_BGR2GRAY) | |
# Bilateral filter preserv edges | |
img = cv2.bilateralFilter(img, 9, 75, 75) |
This file contains 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 necessary libraries | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import cv2 | |
# Load image and convert it from BGR to RGB | |
image = cv2.cvtColor(cv2.imread("folder/imageName.jpg"), cv2.COLOR_BGR2RGB) |
This file contains 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
\documentclass{article} | |
\begin{document} | |
\title{Example Page} | |
\author{Breta} | |
\maketitle | |
\begin{abstract} | |
This is the example page. | |
\end{abstract} |
This file contains 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
"postinstall": "install-app-deps", | |
"dist": "npm run build && build --publish onTagOrDraft" |
This file contains 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
sudo: required | |
dist: trusty | |
language: c | |
matrix: | |
include: | |
- os: osx | |
- os: linux | |
env: CC=clang CXX=clang++ npm_config_clang=1 |