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
//Parameters required to calculate threshold using OTSU Method | |
let prbn = 0.0 // First order cumulative | |
let meanitr = 0.0 // Second order cumulative | |
let meanglb = 0.0 // Global mean level | |
let OPT_THRESH_VAL = 0 // Optimum threshold value | |
let param1 | |
let param2 // Parameters required to work out OTSU threshold algorithm | |
let param3 = 0.0 | |
let hist_val = [] |
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
/** | |
* Greyscale, threshold and apply median noise removal to image data | |
* @param {number[]} data Raw pixel data | |
* @param {number} width Width fo image data | |
* @param {number} height Height of image data | |
* @returns {number[]} Pixel Data | |
*/ | |
function applyAdaptiveThreshold(data, width, height) { | |
const integralImage = new Array(width * height).fill(0) |
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
/** | |
* Threshold image data | |
* @param {number[]} data Raw pixel data | |
* @param {number} width Width fo image data | |
* @param {number} height Height of image data | |
* @returns {number[]} Pixel Data | |
*/ | |
// function applyMedianFilter(data, width, height) { | |
// const channels = data.length / (width * height) |
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
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", | |
"defaultProfile": "{c8312ac6-2aa2-4191-a6ff-5fcd63b22b8b}", | |
"keybindings": [], | |
"profiles": [ | |
{ | |
"acrylicOpacity": 0.85, | |
"backgroundImage": "E:\\Resources\\Wallpapers\\dark-smoke-abstract-4k-37.jpg", | |
"backgroundImageOpacity": 0.15, | |
"colorScheme": "Campbell", |
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
/(((?=\d{4})\d{4}|(?=[a-zA-Z]{3})[a-zA-Z]{3}|\d{2})((?=\/)(\/)|(-)|(\.)|(,))((?=[0-9]{2})[0-9]{2}|(?=[0-9]{1,2})[0-9]{1,2}|[a-zA-Z]{3})((?=\/)(\/)|(-)|(\.)|(,))((?=[0-9]{4})[0-9]{4}|(?=[0-9]{2})[0-9]{2}|[a-zA-Z]{3}))|([0-9]{1,2}(,)?( )?[a-z]{1,3}(,)?( )?[0-9]{2,4})/gim |
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
{ | |
"env": { | |
"NODE_ENV": "development" | |
}, | |
"exec": "ts-node --transpile-only src/tmp.ts", | |
"ext": "js,json,ts", | |
"ignore": ["dist", "*.test.ts", ".git", "node_modules/**/node_modules"], | |
"restartable": "rs", | |
"verbose": true, | |
"watch": ["src"] |
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
export function applyMedianFilter( | |
data: Uint8ClampedArray, | |
width: number, | |
height: number, | |
windowSize = 3 | |
): Uint8ClampedArray { | |
const channels = data.length / (width * height) | |
const filterWindow: number[][] = [] | |
const limit = (windowSize - 1) / 2 |
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
export function applySimpleThreshold( | |
data: Uint8ClampedArray, | |
width: number, | |
height: number | |
): Uint8ClampedArray { | |
const channels = data.length / (width * height) | |
for (let i = 0; i < data.length; i += channels) { | |
let average = Math.sqrt((data[i] ** 2 + data[i + 1] ** 2 + data[i + 2] ** 2) / 3) | |
average = average >= 127 ? 255 : 0 |
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
export function convolute( | |
data: Uint8ClampedArray, | |
width: number, | |
height: number, | |
filterWindow = [1, 1, 1, 1, 0, 1, 1, 1, 1] | |
): Uint8ClampedArray { | |
const channels = data.length / (width * height) | |
const windowSize = filterWindow.length | |
const halfWindowSide = Math.floor(windowSize / 2) | |
const src = data |
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
# The command finds the most recent tag that is reachable from a commit. | |
# If the tag points to the commit, then only the tag is shown. | |
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object | |
# and the abbreviated object name of the most recent commit. | |
git describe | |
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix: | |
git describe --abbrev=0 | |
# other examples |