Hi ! I’m switching from C#9 to Python to write this down, so I avoid to search and write this from scratch again and again. My scenario includes very simple operations with dates, Tag a start date timeDo some process, I’ll fake it with random sleepTag a end date timeCalculate the different between themProcess and…… Continue reading #Python – Working with dates 📅, formats, and subtract for time difference. Timedelta type rocks!
Tag: Python
#OpenCV – Open a video file 🎥 and save each frame as a PNG 🖼 file to a folder 📂#Python
Hi ! This is a non-usual scenario, however I’m on a point where I need to extract all the frames from a video file. The reason: some of these frames will be used to train a Machine Learning model. There are tools that can do this, however it’s a nice moment to do some OpenCV…… Continue reading #OpenCV – Open a video file 🎥 and save each frame as a PNG 🖼 file to a folder 📂#Python
#Event – Resources used during the session “Hack a drone, hack the camera and use AI” at the Global AI Tour, Lahore Pakistan, 2020
Hi ! I had a great time early in the day with my Microsoft Student Partners from Lahore Pakistan, for the Global AI Tour. As usual, time for slides and code: Slides Code https://github.com/elbruno/events/tree/main/2020%2011%2030%20Global%20AI%20Tour%20Pakistan Resources DJI Tello Drone,https://www.amazon.com/Tello-CP-PT-00000252-01-Quadcopter-Drone/dp/B07BDHJJTHRyze Tello SDK, https://www.ryzerobotics.com/tello Viola Jones, Object Detection Framework,https://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework Cognitive Services Custom Vision, https://customvision.ai
#Python – Convert an #OpenCV frame to PIL image and viceversa
Hi ! It’s amazing how I can code and have fun for hours, and them suddenly spent 2 hours trying to manually do something, that it’s already resolved in all internet. Today’s challenge: Convert an OpenCV frame to PIL image And, why ? very simple, OpenCV follows the BGR convention and PIL follows RBG convention.…… Continue reading #Python – Convert an #OpenCV frame to PIL image and viceversa
#YoloV3 – Rapid Object detection with 5 lines of code ( @code and #Python for the win! )
Hi ! Sometime ago, I wrote a simple Python class a wrapper for YoloV3. This allows me to write 5 lines of code to analyze an image. Once I use this class, I only press F5 in Visual Studio Code and it’s magic: A sample usage will be similar to this one. The only required…… Continue reading #YoloV3 – Rapid Object detection with 5 lines of code ( @code and #Python for the win! )
#Coding4Fun – Sorting Arrays in #JavaScript, #Python and #CSharp … choose your own adventure
Hi ! Not my usual set of posts, however this keep me thinking a lot. It all started with this tweet; an usual joke about JavaScript, and how it works with types. https://twitter.com/frontenddude/status/1300420130346864641?s=20 I noticed that some responses focused on the “you need to know how the language works” before posting this. And it is…… Continue reading #Coding4Fun – Sorting Arrays in #JavaScript, #Python and #CSharp … choose your own adventure
#Python – Context Meny and Key Press with #PySimpleGUI
Hi ! After my base sample code for a GUI app, now it’s time to add some interaction features: Context MenuCapture Key Press In the following example, I’m adding a context menu with the following elements: This can be done as part of the window definition, in example right_click_menu = [‘Unused’, [‘&FPS’, ‘—‘, ‘Menu A’,…… Continue reading #Python – Context Meny and Key Press with #PySimpleGUI
#Python – Creating GUIs with #PySimpleGUI. 2 webcams view with 50 lines of code
Hi ! Working with Computer Vision is super fun. And there are some scenarios where display the step by step of the processing of an image is the best way to present this. In most of my scenarios I use OpenCV, however for a more detailed presentation I needed to search and learn a GUI…… Continue reading #Python – Creating GUIs with #PySimpleGUI. 2 webcams view with 50 lines of code
#Python – #FastAPI Webserver sharing information from values in a different thread
Hi ! After my yesterday post using Flask, I was sure that a FastAPI version will be needed, so here it goes: I have a common scenario which involves: A sensor collecting informationA web-server publishing the sensor information Read my previous posts to understand why I think this is the simple way to solve this:…… Continue reading #Python – #FastAPI Webserver sharing information from values in a different thread
#Python – Flask Webserver sharing information from values in a different thread
Hi ! I have a common scenario which involves: A sensor collecting informationA web-server publishing the sensor information This is simple, however the sensor does not support constants requests, and it may return a “too many requests” response when called directly. The idea to get the sensor information directly in the web-request was not valid…… Continue reading #Python – Flask Webserver sharing information from values in a different thread