question

PadraigMcGloin-3427 avatar image
0 Votes"
PadraigMcGloin-3427 asked JayaC-MSFT edited

Passing data to/from Azure Functions

I am working on my final year project using Python and VS Code.

This involves using the live depth data from a Kinect V2 which then gets processed to predict the motion of an object.

The steps the image shall go through include:
1. Background Subtraction
2. Object Detection
3. Object Motion Tracking
4. Object Motion Prediction

As I am using a Microsoft Surface Pro 4 (i7) even the background subtraction step makes my device chug (512*424 16bit images).

I am wondering can I use Azure Functions to offload the processing (e.g. send a frame to azure to compute then return the computed data) or is a Virtual Machine a better option?

Questions:
Can I use Azure Functions or should I use a VM for this?

If Azure Functions can be used:
Can an Azure Functions be passed data, such as an image frame/array?
Can an Azure Functions return data, such as an image frame/array?
How?

I have no real experience with Azure or VMs in general as I am used to running scripts locally.

Any help would be much appreciated, thanks.

azure-virtual-machinesazure-functions
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @PadraigMcGloin-3427 , Welcome to Microsoft QnA. Thank you for posting your query here. We will review and update at the earliest.

0 Votes 0 ·

1 Answer

JayaC-MSFT avatar image
0 Votes"
JayaC-MSFT answered JayaC-MSFT edited
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JayC-MSFT thanks for getting back to me.

Exactly what I am trying to do is this:

Python

def create_Mask(self, frameData, backgroundSubtractor): # send frame (kinect depth [16bit], 217088 values) and background subtractor(open cv KNN)
fgmask = backgroundSubtractor.apply(frameData) # apply subtractor to frame
flattenMask = [value for element in fgmask for value in element] # flatten mask
flattenMask = np.array(flattenMask) # transform into numpy array
frameMask = []
for val in np.nditer(flattenMask): #create mask of 1s and 0s
if val == 255:
frameMask.append(1)
else:
frameMask.append(0)
frameMask = np.array(frameMask) # tranform into numpy array
return frameMask # return mask (numpy array [1 or 0], 217088 values)

Taking this function and getting an Azure function to do this functions compute, is it even possible to do something like this using an Azure function?






0 Votes 0 ·
JayaC-MSFT avatar image JayaC-MSFT PadraigMcGloin-3427 ·

Hello @PadraigMcGloin-3427 , you can do that but from the performance point of view I would suggest to consider blob storage ( you may refer to the example I shared).

If this answer helped, please Accept the answer and Up-vote so that it helps others in the community.

0 Votes 0 ·