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 | |
import cv2 as cv | |
def medianFilter(x, k): | |
""" | |
Apply a length-k median filter to a 1D array x. | |
Boundaries are extended by repeating endpoints. | |
this is the equivalent of opencv Median for 2D array | |
""" | |
if k == 1 : |
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 <iostream> | |
#include <string> | |
#include <vector> | |
using namespace std; | |
vector<string> split (const string &s, const string &delimiter); | |
int main() { | |
string myString = "We_try_to_split_string"; |
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 "treeClass.hpp" | |
ostream& operator<<(ostream& os, const vector<int>& myVector){ | |
os << "{ "; | |
for (int i = 0; i < myVector.size(); i++){ | |
if (i!=0) | |
os << ", " ; | |
os << myVector[i] << " " ; | |
} | |
os << "}"; |
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 <iostream> | |
#include <vector> | |
using namespace std; | |
/** Method 1 - Using friend operator in struct or class with public attributes **/ | |
struct vec2D_1 { | |
public: vector<vector<int>> v; | |
vec2D_1(vector<vector<int>> v_){ |
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
this is a script to create keyboard shortcut to clear cmd and windows_terminal and vscode_terminal in Windows |
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 intersect2D(Array_A, Array_B): | |
""" | |
Find row intersection between 2D numpy arrays, a and b. | |
""" | |
# ''' Using Tuple ''' # | |
intersectionList = np.asarray([x for x in Array_A for y in Array_B if(tuple(x) == tuple(y))]) | |
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 intersect2D(Array_A, Array_B): | |
""" | |
Find row intersection between 2D numpy arrays, a and b. | |
Returns another numpy array with shared rows and index of items in A & B arrays | |
""" | |
# [[IDX], [IDY], [value]] where Equal | |
# ''' Using Tuple ''' # | |
IndexEqual = np.asarray([(i, j, x) for i,x in enumerate(Array_A) for j, y in enumerate (Array_B) if(tuple(x) == tuple(y))]).T |