How to crop face detection result using gcloud command line - google-cloud-platform

I have uploaded an image in my Google Cloud Storage inside a bucket. Then I open the gcloud command line and I run the following:
gcloud ml vision detect-faces gs://my-bucket/face.png
I can see the result in json format, so I understand that it returns the position of the face and some face features.
How can I save/export a cropped image containing just the face, using the gcloud command line?
In other words, in the below example, how can I export as a separate image the area within the larger green box?

Using face detection API, you get back a rectangle that identifies the found face. If what you now want is to create a new image (which could replace the old image if desired) containing just the face, you can use a tool like ImageMagick. This can be command line executed. This tool takes as input a source image, commands and generates a new image. One of the commands is -crop which will crop an image given an input rectangle (the face box).

Related

How to detect vertically stacked text with vision API

Basic text detection API (e.g. google) does not return anything for the following image. To try Google's vision API, save the image locally and run:
gcloud ml vision detect-text <local-path-to-image> | grep description
It may return gibberish. The text we want is RAW9405. Are there any existing models for this or does it require training?
What you can do is use craft-text-detector which is available opensource, you will get the bounding box coordinates for every single word and based on y-axis you can form a sentence than use tesseract for recognition.

add multiple images to a video using aws mediaconvert

I'm trying to add images to a video using mediaconvert. I used mediaconvert graphic overlay/ image inserter to perform this task. However, the image is overriding the given video in the output for the given duration. I want the image to be still at first and then start the video from the beginning if I add an image and similarly for the rest of the images. Can this be done by using aws-mediaconvert?
Overlays are normally used for things like watermarks and logos or simple sports scores/news tickers etc. Images you want to appear over the top of the video.
You could create a clip of blank video to insert into your output, then apply the overlay to just that?
Another option is to convert the image to a video yourself with ffmpeg and insert that into your output?

perl script which can upload image,crop it and make it clear throug imagemagick commands

i want to develop a Perl script on centos7 minimal which can easily get data(quadrants) of image from data base and according to those quadrant it can crop that image and save a new file of that cropped image.

Why would Computer Vision recognize more text when submitting a subset of the image?

So I am attempting to use Azure Computer Vision OCR to recognize text in a jpg image. The image is about 2000x3000 pixels and is a picture of a contract. I want to get all the text and the bounding boxes. The image DPI is over 300 and it's quality is very clear. I noticed that a lot of text was being skipped so I cropped a section of the image and submitted that instead. This time it recognized text that it did not recognize before. Why would it do this? If the quality of the image never changed and the image was within the bounds of the resolution requirements, why is it skipping texts?

How to set classification colors in GDAL output files

I am using the GDAL C++ library to reclassify raster map images and then create an output image of the new data. However when I create the new the new image and open it, the classification values don't seem to have a color defined, so I just get a black image. I can fix this by going into the image properties and setting a color for each of the 10 classification values I'm using, but that is extremely time consuming for the amount of maps and trials I am doing.
My question is, is there a way to set metadata info through the GDAL API to define a color for each classification value? Just the name of the right function would be great, I can figure it out from there.
I have tried this using ArcGIS and QuantumGIS, and both have the same problem. Also the file type I am using is Erdas Imagine (called "HFA" in GDAL).
You can use SetColorTable() method on your raster band. Easiest to do is to fetch one pre-existing raster using GetColorTable(), and pass it to your new raster.