Copy and Paste to PowerPoint with AI

Build a simple app to copy and paste your surroundings to Microsoft PowerPoint

I was inspired by the idea of AR Copy Paste to build the app to cut and paste the object to PowerPoint and to mention is without AR :)

This app can only be run in Windows system. I have tested on Windows 10 Enterprise 64 Bit with PowerPoint for Office 365 MSO 64 Bit.

There are three major modules we will build:

  • The Background Removal Server
  • The Local Server
  • The PPT Server
  • An UI App

Most of the codes here are taken from https://github.com/cyrildiagne with little modification to meet our needs.

The Background Removal Server

The background removal server is responsible to remove the background image.

Download basnet.pth from https://github.com/NathanUA/BASNet and copy to BASNet/saved_models/basnet_bsi:

Setup the server by executing the following commands:

virtualenv -p python3.7 venv
source venv/bin/activate
pip install -r requirements.txt

Run the server:

python main.py

The Local Server

The local server is responsible to preprocess and postprocess the image. Setup the local server by executing the following commands:

virtualenv -p python3.7 venv
source venv/bin/activate
pip install -r requirements.txt

Replace the basnet_service_ip with the background removal server IP address and run the server:

python server.py \
--basnet_service_ip="http://X.X.X.X:8080"

The PPT Server

This server is responsible to send the image to the local server and get the result from there and copy the image to the clipboard using PowerShell script. I tried with Python win32clipboard, but unable to maintain the image (PNG) transparency.

Run the server with the below command:

node server.js <http_address_of_local_server>example:
node server.js http://X.X.X.X

Take note that the temporary image file result.png is created and follow by executing the PowerShell script fcopy.bat to copy the image to Clipboard. This is the trick that I have done to maintain the transparency while copying the PNG image to clipboard. Any better idea, please drop in the comment.

An UI App

An UI app is responsible to capture the image and send it via a Socket.IO to the PPT server. Since I don’t have any experience in ReactJS or other sophisticated UI development, I created the UI based on the SAPUI5. Any development on UI is more than welcome and appreciate.

UI app based on SAPUI5

Edit /controller/Home.controller.js and replace http_ip_addr_of_PPT_server with the PPT Server IP address.

socket = io('<http_ip_addr_of_PPT_server>', { transport : [‘websocket’] });

Host the app in a simple web server like Apache and run it in the browser:

http://localhost/openui5-camera-master/test/demo/index.html

Demo Video

References