Skip to content

Instantly share code, notes, and snippets.

View jewelcai's full-sized avatar
🎯
Focusing

Cai Zhuo jewelcai

🎯
Focusing
View GitHub Profile
@supriya-gdptl
supriya-gdptl / Attention_In_CV_n_NLP.md
Last active June 30, 2019 19:21
Using Attention Module in CNN and RNN(LSTM)
@odats
odats / merging_line_segments.py
Created August 10, 2017 12:41
Implementation of merging line segments by TAVARES and PADILHA
# TAVARES and PADILHA approach
def merge_line_segments(line_i, line_j, use_log=False):
# line distance
line_i_length = math.hypot(line_i[1][0] - line_i[0][0], line_i[1][1] - line_i[0][1])
line_j_length = math.hypot(line_j[1][0] - line_j[0][0], line_j[1][1] - line_j[0][1])
# centroids
Xg = line_i_length*(line_i[0][0]+line_i[1][0]) + line_j_length*(line_j[0][0]+line_j[1][0])
Xg /= 2 * (line_i_length + line_j_length)
@orangle
orangle / random_weight.py
Created October 11, 2014 09:43
基于权重的随机数2种实现方式
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#python2.7x
#random_weight.py
#author: orangleliu@gmail.com 2014-10-11
'''
每个元素都有权重,然后根据权重随机取值
输入 {"A":2, "B":2, "C":4, "D":10, "E": 20}
import cv2
import numpy as np
canny = rho = threshold = minLen = maxGap = None
def draw():
lines = cv2.HoughLinesP(canny, rho, np.pi / 180,
threshold, None, minLen, maxGap)
dst = cv2.cvtColor(canny, cv2.COLOR_GRAY2BGR)