Finally got mask working for white! (it also detects the background but that's not a problem)
Got mask working for orange
Got mask working for red
Got mask working for green
Got mask working for blue!!
Got mask working for yellow!!!
Show original image at start of script
Created getNameForColor function in the color-functions module
Show the color name as the frame window title
Loop through color constants and show the calculated mask for each one
Made a getImageMaskForColor function
Created a getMaskRangesForColor function which returns the threshold ranges for a color constant
Created a getImageMaskForRanges function which can handle multiple threshold ranges eg. red has two ranges because it wraps around from 179 to 0
Created a getImageMaskForRange which takes in an image, lower array and upper array and outputs a mask
Created a multiChannelApplyMask function based on a nice solution I found in a GitHub issue
Convert input image from BGR to HSV
Wait 1 second if loading image from camera so it has time to adjust to lighting
Read image from camera or file
Had a play around with color thresholding in opencv4nodejs using example code
Added a "detect" npm script which runs cube-detection.js
Created a cube-detection.js file
Installed opencv4nodejs
Super happy with my progress today!!! I honestly thought getting to this point would take weeks, but it's only taken one (intense and mind-warping) day to do it all!!!
That's quite awesome! I'll try this with the real one later. Mind sharing me some resources/references for looking into this (aside your code, of course)? :)