bounding-box

How to crop multi images use list bounding box position in the file (python)?

泪湿孤枕 提交于 2019-12-11 13:18:43
问题 I have a dataset of images.jpg and a file csv has values bounding box position is top, left, right, bottom. I use ubuntu OS and the python language. 回答1: Something like this should work. It assumes a few things: that the separator in your CSV is a semi-colon, i.e. ; that your CSV file is called images.csv that you want the cropped images output to a sub-directory called output that you have PIL/Pillow installed, though it could easily be adapted to use pyvips , OpenCV , skimage #!/usr/bin/env

2D BoundingRectangle rotation in XNA 4.0

梦想与她 提交于 2019-12-11 04:38:11
问题 I'm having trouble working out what I need to do in order to have a 2D BoundingRectangle for a sprite object in my game rotate and update position depending on which way the user wants the sprite to travel. I draw out the sprite with it's rotation and scale values like so: spriteBatch.Draw(texture, position, null, Color.White, rotation, origin, scale, SpriteEffects.None, 1f); My current setup for getting the BoundingRectangle is: public Rectangle BoundingRectangle { get { return new Rectangle

How to crop pdf using Ghostscript (without entering manually Bounding Box)

烈酒焚心 提交于 2019-12-11 02:56:48
问题 I need to crop a pdf-file to its Bounding Box. First I calculate actual Bounding Box: gswin64c.exe ^ -o nul ^ -sDEVICE=bbox ^ input.pdf the result %% HiResBoundingBox: 156.350019 391.521011 445.919963 446.259010 I substitute into the gswin64c.exe ^ -o output.pdf ^ -sDEVICE=pdfwrite ^ -dUseCropBox=true ^ -c "[/CropBox [156.350019 391.521011 445.919963 446.259010] /PAGES pdfmark" ^ -f input.pdf is there a way to substitute the Bounding Box automatically? thank you. 回答1: What you need is called

OpenCV minimum upright bounding rect of a RotatedRect

妖精的绣舞 提交于 2019-12-10 19:54:57
问题 I'm trying to determin minimum bouding rect of a rotated rectangle. I tried a couple of samples like this from RotatedRect reference or from this tutorial about ellipses and bounding boxes. Nothing with satisfactory results. On the image bellow, yellow rectangle is the desired result. Example data for my test: Image: Width: 1500 Height: 843 RotatedRect: Center: X: 783.490417 Y: 433.673492 Size: Width: 810.946899 Height: 841.796997 Angle: 95.4092407 Sample code: cv::RotatedRect r(cv::Point2f

What is the “center” of a Three.js object?

China☆狼群 提交于 2019-12-10 19:12:19
问题 When I use Blender to model an object, I am able to explicitly define its center position from which translations and rotations occur. When working with Three.js objects, I don't seem to find an equivalent. Does a Three.js object have a property that defines its "center" position? If not, how is the the center of the object determined? 回答1: In three.js, an object's "center" is the origin in the object's local coordinate system. If your object is not rotating around the point you want, then

SVG, text , font with fixed width/height

只谈情不闲聊 提交于 2019-12-09 16:49:15
问题 I'm trying to get a SVG 'text' element fitting inside of a svg 'rect' element. e.g. In the example below, I used a monospace text of 5 chars with a font-size of 100px and I expected to have a bounding rectangle close to the text. But there is a blank gap at the right of the text. <svg xmlns="http://www.w3.org/2000/svg" height="200" width="1000"> <text x="10px" y="110px" style="font-family:monospace;font-size:100px;">HELLO</text> <rect x="10px" y="10px" width="500px" height="100px" style=

Cut a bounding box using numpy meshgrid python

回眸只為那壹抹淺笑 提交于 2019-12-08 04:55:37
问题 I want to create a bounding box out of the following dimensions using meshgrid but just not able to get the right box. My parent dimensions are x = 0 to 19541 and y = 0 to 14394 . Out of that, I want to cut a box from x' = 4692 to 12720 and y' = 4273 to 10117 . However, I am not getting the right bounds. Could someone please help me here? from matplotlib.path import Path xmin, xmax = 4692, 12720 ymin, ymax = 4273, 10117 sar_ver = [(4692, 10117), (12720, 10117), (12658, 4274), (4769, 4273),

Customizing TF Object Detection bounding box thickness & label font size

心不动则不痛 提交于 2019-12-07 23:27:40
问题 Running predictions with https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb. OS Platform and Distribution (e.g., Linux Ubuntu 16.04) : Linux Ubuntu 16.04 Would like to customize label font size & bounding box thickness as my label text & bbox are too thick in image detections. Thank you for any help! If you have done this yourself please pass along your learnings! :) 回答1: You can change the bounding boxes thickness by changing the line

Changing SKSpriteNode Frame? Isometric challenges

感情迁移 提交于 2019-12-07 10:12:39
问题 I hope we can figure out how to get around this interesting challenge with a game we are designing in an isometric style. Any help would be so awesome! QUESTION Is there a way to change the bounding box frame from a square to another shape? Maybe using a mask? PROBLEM Our problem is that we need our node's tappable area NOT to be square. Since we are tiling the nodes, their bounding boxes overlap each other, and we cannot accurately tap on the tile that we want. Hopefully our graphic below

Tight bounding box around PDF of MATLAB figure

送分小仙女□ 提交于 2019-12-07 04:48:38
问题 When creating a simple figure in MATLAB and saving it as PDF, the resulting PDF file will have a luxurious bounding box. plot(1,1,'x') print(gcf, '-dpdf', 'test.pdf'); (From the ratio of the output it seems they always put in on an A page.) Is there a simple way to get a tight bounding box around the PDF? 回答1: You can format the bounding box as follows figure(1) hold on; plot(1,1,'x') ps = get(gcf, 'Position'); ratio = (ps(4)-ps(2)) / (ps(3)-ps(1)) paperWidth = 10; paperHeight = paperWidth