bounding-box

Tight bounding box around PDF of MATLAB figure

倾然丶 夕夏残阳落幕 提交于 2019-12-05 10:19:26
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? 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*ratio; set(gcf, 'paperunits', 'centimeters'); set(gcf, 'papersize', [paperWidth paperHeight]); set(gcf,

zoom mapView to a certain bounding box on osmdroid

南楼画角 提交于 2019-12-05 08:07:06
I want to use the zoomToBoundingBox method to zoom a map to a specific bounding box. The method does nothing but display the map on zoom level 0. In the mapView.java source code I found this: /** * Zoom the map to enclose the specified bounding box, as closely as possible. * Must be called after display layout is complete, or screen dimensions are not known, and * will always zoom to center of zoom level 0. * Suggestion: Check getScreenRect(null).getHeight() > 0 */ I checked getScreenRect(null).getHeight() > 0 and it gives me false. How do you complete display layout programmatically? What can

Fill Bounding Boxes in 2D array

徘徊边缘 提交于 2019-12-04 17:04:10
问题 I have a 2D numpy array which looks like array([[0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 1., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 1., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.], [0., 0., 0., 0.

C++ bounding box triangle collision

落花浮王杯 提交于 2019-12-04 16:53:33
I need an algorithm for know if a bounding box axis align (like a cube but the sides are not equal) and a triangle intersect in a 3D space. I am doing the code in C++, if the solution is extremly long, better in C++ (if you can) :), if it is a few lines don't worry if it is another language. (Determine if a vertex of the triangle is inside the box is easy, but is not easy determine if if the box and the triangle intersects but all vertex are outside of the box and the triangle.) (An algorithm of an intersection between a rectangle and a triangle in a 3d space is good too, I can divide the

Is there a way to get bounding boxes from the Microsoft's custom vision object detection model.pb file?

情到浓时终转凉″ 提交于 2019-12-04 15:40:35
Is there a way to get bounding boxes of a particular object detected via Microsoft custom vision model.pb file? I know we can get that via API calls to the azure custom vision service. Say for example, we can get the bounding boxes from the ssd frozen inference graph.pb file as there are tensors present. Can we do the same for custom vision's model.pb file? This is the code that I am using the print out the operations for a tensorflow model and the output. detection_graph = tf.Graph() with detection_graph.as_default(): graph_def = tf.GraphDef() with tf.gfile.GFile('model.pb,'rb') as fid:

How to efficiently find the bounding box of a collection of points?

流过昼夜 提交于 2019-12-04 14:11:46
I have several points stored in an array. I need to find bounds of that points ie. the rectangle which bounds all the points. I know how to solve this in plain Python. I would like to know is there a better way than the naive max, min over the array or built-in method to solve the problem. points = [[1, 3], [2, 4], [4, 1], [3, 3], [1, 6]] b = bounds(points) # the function I am looking for # now b = [[1, 1], [4, 6]] My approach to getting performance is to push things down to C level whenever possible: def bounding_box(points): x_coordinates, y_coordinates = zip(*points) return [(min(x

D3: get the bounding box of a selected element

时光怂恿深爱的人放手 提交于 2019-12-04 12:14:27
I have several elements in a svg and I want to zoom on one of them. I'd like to do the same as this example but with non geo paths. Something like d3.select(myElement).bounds() that I can use to pan and zoom my svg I did not find anything with D3. did I miss something? Thanks The Answer to the original question, and the implied general point is that yes, D3 has a function to access the underlying DOM node, and that no, it doesnt bother to override those functions where not necessary: d3 has a function ".node()" which returns the the underlying DOM node of the first item in the d3 selection: d3

ZXing: Finding the bounding rectangle of Barcode

梦想与她 提交于 2019-12-04 07:43:41
I was experimenting with ResultPoints which returns the points related to the barcode in the image. For a QR Code, ResultPoints returns a set of 4 points which are the coordinates of the four boxes at each corner of the QR Code. When I experimented the same with a Barcode, it returns two points which denote the width of the barcode. How do I find the bounding rectangle of the barcode? Is there any way by which I can calculate the coordinates of the top left corner and bottom right corner of the barcode using the ResultPoints array? After a bit of research I found the class

How to calculate geography bounding box in iOS?

你离开我真会死。 提交于 2019-12-04 06:08:57
I'd like to make a Geographic Bounding box Calculation in iOS. It can be aprox. Input Parameters: Current Location (Example: 41.145495, −73.994901) Radius In Meters: (Example: 2000) Required Output: MinLong: (Example: 41.9995495) MinLat: (Example: −74.004901) MaxLong: (Example: 41.0005495) MaxLat: (Example: −73.004901) Requirement: No Network Call Any Ideas? Mapkit / CoreLocation does not seem to offer this type of thing? Any other Geographic SDK that i could use? Thanks I think you can use standard MapKit functions: MKCoordinateRegionMakeWithDistance , this will return a MKCoordinateRegion ,

SVG, text , font with fixed width/height

孤街醉人 提交于 2019-12-04 05:54:45
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="stroke:blue;fill:none;"/> </svg> What CSS selectors should I use for the 'text' element ? Note: I don't