Chroma park1/13/2023 ![]() This will proportionally also add more CPU and network resources to the Lambda function. In this section, you will modify the memory and timeout settings for the Lambda function. OUTPUT_BUCKET_NAME: the value from step 2 above.Choose Edit.Įnter the three environment variables with the three values, as follows: Select the Configuration tab, then choose the Environment variables menu item on the left. Go back to the browser tab with the theme-park-photos-chromakey Lambda function open. In the terminal enter the following command to retrieve the value for OUTPUT_BUCKET_NAME:Īws s3 ls | grep theme-park-backend-processingbucket In this section, you will retrieve and configure these Environment Variables for the function. HSV_UPPER: A tuple representing upper HSV value for the green screen chroma key matching process.HSV_LOWER: A tuple representing lower HSV value for the green screen chroma key matching process.OUTPUT_BUCKET_NAME: the name of the bucket where the output object is stored.This function uses three environment variables: Select Deploy in the Code source card to save the changes.Copy the code from the file in Cloud9 by navigating to 3-photos/1-chromakey/app.py onto the clipboard and paste into the lambda_function.py tab in the Lambda function:.Back on the Lambda function page, select the Code tab to view the Code source card.In the Custom layers dropdown, choose python-opencv-37.Back on the Lambda function page, select the Code tab.Read the Recursive invocation warning, and select the checkbox to confirm that you have read and understood the warning.For Event Type select All object create events from the dropdown.In the Bucket dropdown, select the bucket name beginning with theme-park-backend-uploadbucket.In the Trigger configuration dropdown, select S3.In the Function overview panel, select + Add Trigger:.Click the Existing role drop-down, and enter ThemeParkLambdaRole until the filter matches a single available role beginning with theme-park-backend-ThemeParkLambdaRole*.Select the Use an existing role radio button.Open the Change default execution role section:.Ensure Python 3.7 is selected under Runtime.Įnsure you have selected Python 3.7 under Runtime to avoid an error.Enter theme-park-photos-chromakey for Function name.Go to the Lambda console - from the AWS Management Console, select Services then select Lambda under Compute. Upload the zipped code package to your S3 deployment bucket:Īws s3 cp opencv-python-37.zip s3://$s3_deploy_bucketĪws lambda publish-layer-version -layer-name python-opencv-37 -description "OpenCV for Python 3.7" -content S3Bucket=$s3_deploy_bucket,S3Key=opencv-python-37.zip -compatible-runtimes python3.7Īfter a few seconds, the JSON response in the terminal confirms the LayerArn and Version of the new layer.Ĭreating the Chromakey Lambda function Step-by-step instructions.In the terminal enter the following command to download the code for the layer: If you need to re-launch Cloud9, from the AWS Management Console, select Services then select Cloud9 under Developer Tools. Go back to your browser tab with Cloud9 running. More information on the services introduced in this section:Ĭreating the OpenCV Lambda layer Step-by-step instructions To simplify deployment, this was already created as a zip file for you to create a layer. The OpenCV library must be compiled using the target operating system, which for Lambda is Amazon Linux 2.This function is deployed using Python 3.7 while the other functions are written in Node. The chroma key processing function uses an open source Python library called OpenCV. This section shows how you can use different runtimes for different tasks. ![]() Lambda functions can be written in different runtimes and can also use pre-packaged libraries of code called Lambda layers. It takes an input image of a person against a green background, removes the green, and then saves the output image. This function implements chroma key processing, also commonly known as green screen. Creating the photo compositing Lambda functionĬonfigure the event bus and metrics dashboard
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |