I am using Amazon Face Detection, and they return me data that looks like this.
BoundingBoxHeight BoundingBoxLeft BoundingBoxTop BoundingBoxWidth
0.082051284611225000 0.602564096450806000 0.697435915470123000 0.061538461595774000
How do I pass this data to ImageMagick to create a thubnail of the face?
detect_faces resize
-
- Posts: 2
- Joined: 2018-06-11T19:26:41-07:00
- Authentication code: 1152
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: detect_faces resize
BoundingBoxHeight BoundingBoxLeft BoundingBoxTop BoundingBoxWidth
try using the values as
convert input -crop BoundingBoxWidthxBoundingBoxHeight+BoundingBoxLeft+BoundingBoxTop +repage output
try using the values as
convert input -crop BoundingBoxWidthxBoundingBoxHeight+BoundingBoxLeft+BoundingBoxTop +repage output
-
- Posts: 2
- Joined: 2018-06-11T19:26:41-07:00
- Authentication code: 1152
Re: detect_faces resize
That doesn't crop the photo
magick c:\image.jpg -crop 0.061538461595774000x0.082051284611225000+0.602564096450806000+0.697435915470123000 +repage c:\final.jpg
magick c:\image.jpg -crop 0.061538461595774000x0.082051284611225000+0.602564096450806000+0.697435915470123000 +repage c:\final.jpg
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: detect_faces resize
Your numbers are not in pixel units. What units are they? How are they measured? What are the pixel dimensions of the full image as width and height. Are these numbers in the range 0 to 1 relative to the pixel width and height of the input image? Are they in inches or centimeters? Please clarify the coordinate system for your measurements.
From https://docs.aws.amazon.com/rekognition ... ngBox.html, it looks like they are fractions of the width and height. So multiply your numbers by with width and height of the input in pixels and put those numbers in.
Or put your numbers in the following
where w,h will be determined from the input image automatically, so leave as w and h.
From https://docs.aws.amazon.com/rekognition ... ngBox.html, it looks like they are fractions of the width and height. So multiply your numbers by with width and height of the input in pixels and put those numbers in.
Or put your numbers in the following
Code: Select all
magick input.jpg -crop "%[fx:w*BoundingBoxWidth]x%[fx:h* BoundingBoxHeight]+%[fx:w*BoundingBoxLeft]+$[fx:h*BoundingBoxTop]" +repage output.jpg