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
clc; close all; clear all; | |
% Generate data | |
org = zeros(200,200,3); | |
org(100:198,100:198,:) = 255; | |
I = org(:,:,1); | |
imshow(I) | |
tic | |
% % |
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
Iteration : 1 | |
Zeroth moment : 1020 | |
First moments : 102510,102510 | |
Center : 101,101 | |
Location : 52,52,98,98 | |
Iteration : 2 | |
Zeroth moment : 689520 | |
First moments : 86534760,86534760 | |
Center : 126,126 | |
Location : 77,77,98,98 |
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
#include "fastcv.h" | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <iostream> | |
using namespace cv; | |
using namespace std; | |
int main() | |
{ |
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
#include "fastcv.h" | |
#include <opencv2/core/core.hpp> | |
#include <opencv2/highgui/highgui.hpp> | |
#include <iostream> | |
using namespace cv; | |
using namespace std; | |
int main() | |
{ |
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
imageExt = '.png'; | |
imagefiles = dir(['*' imageExt]); | |
outfilename = 'gifname.gif'; | |
for n = 1:length(imagefiles) | |
im = imread(imagefiles(n).name); | |
[imind,cm] = rgb2ind(im,256); | |
% DelayTime in seconds | |
if n == 1 | |
imwrite(imind,cm,outfilename,'gif','Loopcount',inf,'DelayTime',0.7); |
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 numpy as np | |
def kmeans(data, numofclasses, options=None): | |
""" | |
Calculates the clusters using k-means algorithm and returns cluster labels and centroids | |
:param data: Data to cluster structured as [Number of observations x Data dimensions(variables)] | |
:param numofclasses: Number of classes you want to cluster the data into. | |
:param options: Optional data in dictionary form to overwrite the defaults | |
max_iterations - int: Maximum number of iterations |
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
clc; clear all; close all; | |
% Data Generation | |
x = 0:10:2000; | |
y = sigmf(x,[0.1 1000]); | |
n = rand(1,201)/40 - 0.0125; | |
f = y;% + n; | |
fig = figure; | |
set(fig, 'PaperUnits', 'inches'); | |
set(fig, 'PaperPosition', [0 0 8 2]); |
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
""" | |
Script contains functions to process the lines in polar coordinate system | |
returned by the HoughLines function in OpenCV | |
Line equation from polar to cartesian coordinates | |
x = rho * cos(theta) | |
y = rho * sin(theta) | |
x, y are at a distance of rho from 0,0 at an angle of theta |
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
# Load the Pandas libraries with alias 'pd' | |
import pandas as pd | |
# Read csv to dataframe | |
df = pd.read_csv("data.csv") | |
# Set column types | |
df['Submission Date'] = pd.to_datetime(df['Submission Date'], format="%Y-%m-%d %H:%M") | |
print(df) |
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
> python redact.py -h | |
usage: redact.py [-h] -i INPUT -o OUTPUT -p PATTERNS [-r REPLACE] [-c COLOR] | |
optional arguments: | |
-h, --help show this help message and exit | |
-i INPUT, --input INPUT | |
Path to the document to be redacted | |
-o OUTPUT, --output OUTPUT | |
Path to save the redacted document | |
-p PATTERNS, --patterns PATTERNS |
OlderNewer