Zero false notes in empty gaps
Resolution: 1100×440 px
Leading (+) & Trailing (-) Canny edges paired
Bundle value matches target
OpenCV Canny + Probabilistic Hough Transform (`HoughLinesP`) Inspector
Pairs each sheet's Leading Canny Edge (Dark→Bright) with its Trailing Canny Edge (Bright→Dark) so empty spaces between notes are never counted.
OpenCV Canny Edge Pairs & Sheet Luminance Profile (Along A → M → B)
Each banknote is verified only where a Rising Canny Edge (+) and Falling Canny Edge (-) enclose an actual bright sheet above the absolute hysteresis floor. Empty spaces stay flat at zero.
OpenCV Canny & Hough Parameters
Merges double Canny edges inside a single thick banknote so 1 note is never counted twice.
Requires each detected edge to form a true sheet line across multiple bands, rejecting random specks.
Thickness Anomaly Audit Queue
0 itemsIn large bundles (>15 notes), if two banknotes stick together without a Canny edge between them, the wide gap (>1.65x median pitch) is flagged here:
Why the Previous Method Counted 3 Notes as 13 — And How OpenCV Canny + HoughLinesP Fixes It
The earlier approach divided pixel brightness by the local standard deviation (`(I - mean) / std`). When you tested **3 banknotes** with empty space between them (or wide paper surfaces), the standard deviation in the empty spaces was tiny—so dividing by `std` amplified microscopic background noise and paper texture into 10 fake banknote peaks (`3 → 13`).
In **v4.0**, we replaced local variance normalization with the **OpenCV Canny Edge Detector (`cv.Canny`) + Probabilistic Hough Line Transform (`cv.HoughLinesP`) + Leading/Trailing Edge Pairing**:
5×5 Gaussian Denoising
Smooths out paper grain and sensor noise inside the banknote surface and in empty background gaps before computing Sobel gradients.
OpenCV Canny Hysteresis
Uses absolute Sobel gradient thresholds (`lowThreshold`, `highThreshold`) with 4-direction Non-Maximum Suppression. Empty spaces between banknotes have zero Canny edges.
Probabilistic Hough (`HoughLinesP`)
Extracts continuous sheet-edge line segments that exceed `minLineLength` and filters out stray background lines that don't match the stack's sheet orientation.
Leading/Trailing Edge Pairing
A single thick banknote has two Canny boundaries: a dark-to-bright rising edge (`+`) and a bright-to-dark falling edge (`-`). Pairing `(+,-)` across each bright sheet ensures 1 thick note is counted as 1, not 2.
Plesk Node 23 + `@techstark/opencv-js` Setup
Configured for ninetynine.kerosenetech.com
1. Upload banknote_counter_nodejs.zip to /ninetynine.kerosenetech.com in Plesk File Manager 2. Click "Extract Files" (check "Replace existing files") 3. In Plesk -> Node.js utility: - Click "NPM Install" (installs @techstark/opencv-js 4.9.0) - Click "Restart App"
Why `@techstark/opencv-js` Works Cleanly on Plesk Node 23:
- Standard C++
opencv4nodejsrequirescmakeand 2GB+ RAM to compile from source, which fails on Plesk shared/VPS Node 23 environments. @techstark/opencv-jspackages official OpenCV 4.9.0 as precompiled WebAssembly (`cv.Canny`, `cv.HoughLinesP`, `cv.GaussianBlur`), installing in seconds via Plesk's NPM Install button with zero native build errors.
Live OpenCV API Payload (`POST /api/v1/count-notes`)
Includes Canny hysteresis thresholds, HoughLinesP segments, and paired sheet contours.