pa7 / nude.js

Nudity detection with JavaScript and HTMLCanvas
http://www.patrick-wied.at/static/nudejs/
2.35k stars 225 forks source link

Added Video Scanning Features #29

Open shashankrxj opened 4 months ago

shashankrxj commented 4 months ago

Index.html • I have added a new div for video input and a div upon I have shown scan result of video.

test.nude.js • Added functionality to track the last scan time to ensure scans occur at least 5 seconds apart. • Implemented an event listener for the 'play' event on the video element to trigger scanning. • Defined a scanFrame function to check if the video is playing and if sufficient time has elapsed since the last scan. • Within scanFrame, draws the current video frame onto a canvas and converts it to ImageData. • Utilized nude.scanVideo to scan the video frame for nudity, passing the ImageData. • Incremented the scanCount variable to keep track of the number of scans performed. • Updated the displayResultOnVideoContainer function to display the scan results on the webpage. • Set up a scan interval to execute scanFrame every second. • Implemented a 'ended' event listener on the video to stop scanning when the video ends.

nude.js • Added a scanVideo function to directly scan provided image data, enabling scanning without requiring a canvas element. • Implemented communication with a web worker (worker.nude.js) for parallel processing of image data. • Created a terminateWorker function to terminate the web worker after processing each image. • Enhanced the init function to append a script tag for noworker.nude.js if web workers are not supported, here I have replaced unescape by decodeURIComponent as unescape was depricated. •Updated the scanImage function to utilize the web worker for image processing, improving performance by offloading computation.

All other commits are made for changing compressed js file and I have also changed Readme file accordingly.