-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.js
34 lines (29 loc) · 1.35 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
let Jimp = require('jimp')
let GLRLM = require('./src/glrlm/glrlm.js')
let jimpToPixels = require('./src/prepare/from-jimp-to-pixels.js')
let shortRunEmphasis = require('./src/glrlm/short-run-emphasis.js')
let longRunEmphasis = require('./src/glrlm/long-run-emphasis.js')
let greyLevelNonUniformity = require('./src/glrlm/grey-level-non-uniformity.js')
let runLengthNonUniformity = require('./src/glrlm/run-length-non-uniformity.js')
let runPercentage = require('./src/glrlm/run-percentage.js')
let lowGreyLevelRunEmphasis = require('./src/glrlm/low-grey-level-run-emphasis.js')
let highGreyLevelRunEmphasis = require('./src/glrlm/high-grey-level-run-emphasis.js')
Jimp.read('./images/resized-removeobjects.jpg').then(image => {
let pixels = jimpToPixels.getGreyscale(image)
let glrlm = new GLRLM(pixels)
glrlm.buildMatrix()
let sre = shortRunEmphasis.compute(glrlm)
let lre = longRunEmphasis.compute(glrlm)
let gln = greyLevelNonUniformity.compute(glrlm)
let rln = runLengthNonUniformity.compute(glrlm)
let rp = runPercentage.compute(glrlm)
let lglre = lowGreyLevelRunEmphasis.compute(glrlm)
let hglre = highGreyLevelRunEmphasis.compute(glrlm)
console.log(`SRE: ${sre}`)
console.log(`LRE: ${lre}`)
console.log(`GLN: ${gln}`)
console.log(`RLN: ${rln}`)
console.log(`RP: ${rp}`)
console.log(`LGLRE: ${lglre}`)
console.log(`HGLRE: ${hglre}`)
})