Visual recognition of a video [Help]

#1

Hi,
I’ve been working with node-red and Watson studio for about 2 weeks. Recently I’ve been trying to get Watson visual recognition to work with a live Youtube video (doesn’t have to be live you just need the embedded code) on my dashboard however the only method for screen capture I’ve found that actually works (I’ve also tried the Webshot node) also captures the surrounding dashboard which is what Watson focuses on. If anyone could give me a suggestion as to where I might look for a solution to focus in on the video i’d be very grateful.

Copy of my flow (sorry for the probably terrible formatting):

[{"id":"8290656d.d75d78","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"723a013a.06cb2","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"915ab36d.7844f","type":"ui_tab","z":"","name":"Video Recognition","icon":"dashboard"},{"id":"bdbe4b26.9268b8","type":"ui_group","z":"","name":"Search Parameters","tab":"915ab36d.7844f","order":4,"disp":true,"width":"4","collapse":false},{"id":"f33f4445.2790b8","type":"ui_group","z":"","name":"Video Feed","tab":"915ab36d.7844f","order":1,"disp":true,"width":"30","collapse":true},{"id":"783a48c6.2d7038","type":"ui_base","theme":{"name":"theme-dark","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","reset":false},"themeState":{"base-color":{"default":"#097479","value":"#097479","edited":false},"page-titlebar-backgroundColor":{"value":"#097479","edited":false},"page-backgroundColor":{"value":"#111111","edited":false},"page-sidebar-backgroundColor":{"value":"#000000","edited":false},"group-textColor":{"value":"#0eb8c0","edited":false},"group-borderColor":{"value":"#555555","edited":false},"group-backgroundColor":{"value":"#333333","edited":false},"widget-textColor":{"value":"#eeeeee","edited":false},"widget-backgroundColor":{"value":"#097479","edited":false},"widget-borderColor":{"value":"#333333","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","allowTempTheme":"true","dateFormat":"DD/MM/YYYY","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":5,"cy":4,"px":0,"py":0}}},{"id":"7d6dc604.7ecf48","type":"ui_group","z":"","name":"embedded code","tab":"915ab36d.7844f","order":2,"disp":true,"width":"4","collapse":false},{"id":"e3586b43.7b74d8","type":"ui_group","z":"","name":"Watson Analysis","tab":"915ab36d.7844f","order":3,"disp":true,"width":"4","collapse":false},{"id":"7382909.b432e7","type":"ui_group","z":"","name":"Node-Code","tab":"915ab36d.7844f","order":5,"disp":true,"width":"6","collapse":false},{"id":"b4303996.e59708","type":"ui_text_input","z":"8290656d.d75d78","name":"","label":"embeded code","group":"7d6dc604.7ecf48","order":0,"width":"4","height":"1","passthru":false,"mode":"text","delay":"0","topic":"","x":85,"y":470,"wires":[["1fd15629.6eaffa"]],"outputLabels":["{{msg.template}}"]},{"id":"cdd542dc.3fc7a","type":"ui_template","z":"8290656d.d75d78","group":"f33f4445.2790b8","name":"","order":0,"width":"30","height":"16","format":"<div ng-bind-html=\"msg.payload\"></div>","storeOutMessages":false,"fwdInMessages":false,"templateScope":"local","x":678,"y":389,"wires":[[]],"inputLabels":["{{msg.template}}"]},{"id":"8d06e9b2.1dfb88","type":"image","z":"8290656d.d75d78","name":"image","width":200,"x":1055,"y":543,"wires":[]},{"id":"ff466463.b23918","type":"screenshot-node","z":"8290656d.d75d78","name":"","x":893,"y":470,"wires":[["fb64ae14.8e878"]]},{"id":"5d2a5c06.e5f4b4","type":"trigger","z":"8290656d.d75d78","op1":"","op2":"0","op1type":"str","op2type":"str","duration":"-5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":698,"y":470,"wires":[["ff466463.b23918"]]},{"id":"fb64ae14.8e878","type":"base64","z":"8290656d.d75d78","name":"","action":"","property":"payload","x":1065,"y":470,"wires":[["8d06e9b2.1dfb88","176fcb2.6547f35"]]},{"id":"176fcb2.6547f35","type":"visual-recognition-v3","z":"8290656d.d75d78","name":"","apikey":"__PWRD__","vr-service-endpoint":"https://gateway.watsonplatform.net/visual-recognition/api","image-feature":"classifyImage","lang":"en","x":1099,"y":388,"wires":[["62d01fb2.893eb"]]},{"id":"63d6a4c7.d150fc","type":"ui_text_input","z":"8290656d.d75d78","name":"","label":"","group":"bdbe4b26.9268b8","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":66.33334350585938,"y":319.2222309112549,"wires":[["148da88.fa54a58"]]},{"id":"148da88.fa54a58","type":"function","z":"8290656d.d75d78","name":"Set SP1","func":"global.set(\"Search_Parameter_1\",msg.payload);","outputs":1,"noerr":0,"x":287,"y":319,"wires":[[]]},{"id":"8b92494d.c9bcb8","type":"function","z":"8290656d.d75d78","name":"Set Sp2","func":"global.set(\"Search_Parameter_2\",msg.payload);","outputs":1,"noerr":0,"x":289,"y":358,"wires":[[]]},{"id":"654efd8b.0dc0c4","type":"function","z":"8290656d.d75d78","name":"Set SP3","func":"global.set(\"Search_Parameter_3\",msg.payload);","outputs":1,"noerr":0,"x":290,"y":396,"wires":[[]]},{"id":"ce6773a3.d214b","type":"ui_text_input","z":"8290656d.d75d78","name":"","label":"","group":"bdbe4b26.9268b8","order":2,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":65,"y":358,"wires":[["8b92494d.c9bcb8"]]},{"id":"351737c.6488ac8","type":"ui_text_input","z":"8290656d.d75d78","name":"","label":"","group":"bdbe4b26.9268b8","order":3,"width":0,"height":0,"passthru":true,"mode":"text","delay":"0","topic":"","x":66.11114501953125,"y":396,"wires":[["654efd8b.0dc0c4"]]},{"id":"687ef082.768ac","type":"ui_toast","z":"8290656d.d75d78","position":"top left","displayTime":"3","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"note","x":1330,"y":469,"wires":[]},{"id":"62bd3689.ea1b98","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":637,"y":104,"wires":[]},{"id":"fbc7981c.8ba7f8","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":637,"y":176,"wires":[]},{"id":"31d13762.c5f798","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":634,"y":239,"wires":[]},{"id":"ed1d57a5.0aeba8","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":635,"y":302,"wires":[]},{"id":"652126da.c42cf8","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":632,"y":368,"wires":[]},{"id":"ae432375.11d11","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":630,"y":431,"wires":[]},{"id":"dd560528.670d88","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":628,"y":496,"wires":[]},{"id":"e3c3182f.794208","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":627,"y":559,"wires":[]},{"id":"e46897b7.2d59b8","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":629,"y":621,"wires":[]},{"id":"89674c46.ac791","type":"ui_text","z":"723a013a.06cb2","group":"e3586b43.7b74d8","order":0,"width":0,"height":0,"name":"","label":"","format":"{{msg.payload}}","layout":"col-center","x":629,"y":684,"wires":[]},{"id":"bd65a908.13ecf8","type":"function","z":"723a013a.06cb2","name":"F1","func":"var msgtext=msg.result.images[0].classifiers[0].classes[0].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":512,"y":102,"wires":[["62bd3689.ea1b98","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"9bd9fd75.761c","type":"function","z":"723a013a.06cb2","name":"F2","func":"var msgtext=msg.result.images[0].classifiers[0].classes[1].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":511,"y":176,"wires":[["fbc7981c.8ba7f8","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"37f6074f.65a8a8","type":"function","z":"723a013a.06cb2","name":"F3","func":"var msgtext=msg.result.images[0].classifiers[0].classes[2].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":507,"y":239,"wires":[["31d13762.c5f798","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"7ed241d7.5f6da","type":"function","z":"723a013a.06cb2","name":"F4","func":"var msgtext=msg.result.images[0].classifiers[0].classes[3].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":507,"y":302,"wires":[["ed1d57a5.0aeba8","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"20a2ea53.62eab6","type":"function","z":"723a013a.06cb2","name":"F5","func":"var msgtext=msg.result.images[0].classifiers[0].classes[4].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":507,"y":368,"wires":[["652126da.c42cf8","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"1713748d.016d1b","type":"function","z":"723a013a.06cb2","name":"F6","func":"var msgtext=msg.result.images[0].classifiers[0].classes[5].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":504,"y":431,"wires":[["ae432375.11d11","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"134e35be.f6c76a","type":"function","z":"723a013a.06cb2","name":"F7","func":"var msgtext=msg.result.images[0].classifiers[0].classes[6].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":505,"y":496,"wires":[["dd560528.670d88","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"211acdba.b62242","type":"function","z":"723a013a.06cb2","name":"F8","func":"var msgtext=msg.result.images[0].classifiers[0].classes[7].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":507,"y":560,"wires":[["e3c3182f.794208","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"b4e591.76053a7","type":"function","z":"723a013a.06cb2","name":"F9","func":"var msgtext=msg.result.images[0].classifiers[0].classes[8].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":508,"y":622,"wires":[["e46897b7.2d59b8","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"fb2a07bf.e0c608","type":"function","z":"723a013a.06cb2","name":"F10","func":"var msgtext=msg.result.images[0].classifiers[0].classes[9].class;\nmsg.payload = msgtext;\nreturn msg;","outputs":1,"noerr":0,"x":508,"y":685,"wires":[["89674c46.ac791","4a67ccdf.5718a4","6f086de3.f53874","eb544e72.e65be"]]},{"id":"4a67ccdf.5718a4","type":"function","z":"723a013a.06cb2","name":"SP1","func":"var Search_Parameter_1 = global.get(\"Search_Parameter_1\");\nif (msg.payload==Search_Parameter_1){\n    msg.payload += \": search result found\";\n    return msg;\n}","outputs":1,"noerr":0,"x":1001.2222900390625,"y":97,"wires":[["d215f9f1.625ce8"]]},{"id":"6f086de3.f53874","type":"function","z":"723a013a.06cb2","name":"SP2","func":"var Search_Parameter_2 = global.get(\"Search_Parameter_2\");\nif (msg.payload==Search_Parameter_2){\n    msg.payload += \": search result found\";\n    return msg;\n}","outputs":1,"noerr":0,"x":1023.2222290039062,"y":414.22222900390625,"wires":[["d215f9f1.625ce8"]]},{"id":"eb544e72.e65be","type":"function","z":"723a013a.06cb2","name":"SP3","func":"var Search_Parameter_3 = global.get(\"Search_Parameter_3\");\nif (msg.payload==Search_Parameter_3){\n    msg.payload += \": search result found\";\n    return msg;\n}","outputs":1,"noerr":0,"x":1017.22216796875,"y":687.2222290039062,"wires":[["d215f9f1.625ce8"]]},{"id":"9d334243.17103","type":"comment","z":"723a013a.06cb2","name":"Each F Function connects to all of the SP functions and its respective text box","info":"","x":438,"y":44,"wires":[]},{"id":"7ce35fc6.f3dfe","type":"link in","z":"723a013a.06cb2","name":"link 1 out","links":["62d01fb2.893eb"],"x":193,"y":401,"wires":[["bd65a908.13ecf8","9bd9fd75.761c","37f6074f.65a8a8","7ed241d7.5f6da","20a2ea53.62eab6","1713748d.016d1b","134e35be.f6c76a","211acdba.b62242","b4e591.76053a7","fb2a07bf.e0c608"]]},{"id":"d215f9f1.625ce8","type":"link out","z":"723a013a.06cb2","name":"link 2 in","links":["45c24940.8a9838"],"x":1238,"y":413,"wires":[]},{"id":"45c24940.8a9838","type":"link in","z":"8290656d.d75d78","name":"link 2 out","links":["d215f9f1.625ce8"],"x":1245,"y":469,"wires":[["687ef082.768ac"]]},{"id":"62d01fb2.893eb","type":"link out","z":"8290656d.d75d78","name":"link 1 in","links":["7ce35fc6.f3dfe"],"x":1249,"y":387,"wires":[]},{"id":"32d65271.370d8e","type":"catch","z":"723a013a.06cb2","name":"","scope":null,"x":67,"y":400,"wires":[[]]},{"id":"fac667ea.db5d68","type":"change","z":"8290656d.d75d78","name":"","rules":[{"t":"set","p":"template","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":482,"y":470,"wires":[["5d2a5c06.e5f4b4","cdd542dc.3fc7a"]]},{"id":"1fd15629.6eaffa","type":"function","z":"8290656d.d75d78","name":"Enlarge","func":"\n\nmessage1 = {};\nmessage2 = {};\nmessage3 = {};\nmessage4 = {};\nmessage5 = {};\nmessage6 = {};\nmessage7 = {};\nmessage8 = {};\n\nmsg.string = msg.payload.split(\" \");\n\nmessage1.payload=msg.string[0];\nmessage2.payload=msg.string[1];\nmessage3.payload=msg.string[2];\nmessage4.payload=msg.string[3];\nmessage5.payload=msg.string[4];\nmessage6.payload=msg.string[5];\nmessage7.payload=msg.string[6];\nmessage8.payload=msg.string[7];\nmessage8.payload= \"allowfullscreen></iframe>\";\n\nvar width = message2.payload;\nvar width_value = width.substr(8,3);\nvar new_width = \"1554\";\nvar append_width= width.substr(0,7).concat(new_width).concat(width.substr(6,1));\nmessage2.payload=append_width;\n\nvar height = message3.payload;\nvar height_value = height.substr(9,3);\nvar new_height = \"810\";\nvar append_height= height.substr(0,8).concat(new_height).concat(height.substr(7,1));\nmessage3.payload= append_height;\n\nmsg.payload = message1.payload + \" \" + message2.payload + \" \" + message3.payload + \" \" + message4.payload + \" \" + message5.payload + \" \" + message6.payload + \" \" + message7.payload+ \" \" + message8.payload;\nreturn msg;\n","outputs":1,"noerr":0,"x":286,"y":470,"wires":[["fac667ea.db5d68"]]}]

(edited by DCJ to fix formatting)

0 Likes

#2

Edit your post and put three backtick’s before and after your code. It will keep formating proper.

0 Likes