bounding-box

Getting the bounding box of a vector of points?

二次信任 提交于 2019-11-29 14:53:00
问题 I have a vector of points stored in a std::vector instance. I want to calculate the bounding box of these points. I've tried with this code: bool _compare1(ofPoint const &p1, ofPoint const &p2) { return p1.x < p2.x && p1.y < p2.y; } bool _compare4(ofPoint const &p1, ofPoint const &p2) { return p1.x > p2.x && p1.y > p2.y; } vector<ofPoint> points; // ... if(points.size()>1) { ofPoint p_min = *std::min_element(points.begin(), points.end(), &_compare1); ofPoint p_max = *std::min_element(points

OpenGL clipping

情到浓时终转凉″ 提交于 2019-11-29 07:36:14
I have been reading articles about clipping now for hours now but I dont seem to find a solution for my problem. This is my scenario: Within an OpenGL ES environment (IOS,Android) I am having a 2D scene graph consisting of drawable objects, forming a tree. Each tree node has its own spatial room with it's own transformation matrix, and each node inherits its coordinate space to its children. Each node has a rectangular bounding box, but these bounding boxes are not axis aligned. This setup works perfect to render a 2D scene graph, iterating through the tree, rendering each object and then it's

Given a latitude and longitude, and distance, I want to find a bounding box

社会主义新天地 提交于 2019-11-29 02:27:47
Given a latitude and longitude, and distance, I want to find a bounding box where the distances are less than the given distance. This questions was asked here: How to calculate the bounding box for a given lat/lng location? I donot want this partcularly accurate, so I have modified and simplified it to def boundingBox(latitudeInDegrees, longitudeInDegrees, halfSideInKm): lat = math.radians(latitudeInDegrees) lon = math.radians(longitudeInDegrees) halfSide = 1000*halfSideInKm RADIUS_OF_EARTH = 6371 # Radius of the parallel at given latitude pradius = radius*math.cos(lat) latMin = lat -

How to get a rectangular subimage from regionprops(Image,'BoundingBox') in Matlab?

微笑、不失礼 提交于 2019-11-29 01:12:05
问题 I have some particles that I've identified in a larger image, and need to parse into smaller images for each particle. I've used the regionprops 'BoundingBox' function, but haven't been successful yet. How can I now make a rectangular subimage of image I using BoundingBox? I can use BoundingBox to draw a rectangle on the original image, but the parameters returned by BoundingBox seem not to be of pixel dimension (x,y, width, height), (x1, y1, x2, y2), etc, which I would expect a bounding box

Calculating percentage of Bounding box overlap, for image detector evaluation

谁都会走 提交于 2019-11-29 00:02:57
In testing an object detection algorithm in large images, we check our detected bounding boxes against the coordinates given for the ground truth rectangles. According to the Pascal VOC challenges, there's this: A predicted bounding box is considered correct if it overlaps more than 50% with a ground-truth bounding box, otherwise the bounding box is considered a false positive detection. Multiple detections are penalized. If a system predicts several bounding boxes that overlap with a single ground-truth bounding box, only one prediction is considered correct, the others are considered false

MYSQL Geo Search having distance performance

时光总嘲笑我的痴心妄想 提交于 2019-11-28 20:56:04
I have a mysql select statement for a search on my website which is having performance problems when the site gets really busy. The query below searches for adverts from a table with over 100k records, within 25 miles of the given lat and lon and sorts by distance. The number of miles can differ as it is selected by the user. The problem is that I think it is slow because it does the calculations for all records in the table rather than ones that are within 25 miles of the lat and lon. Is it possible to amend this query so that where clause selects only adverts within 25 miles? Ive read about

How much do two rectangles overlap?

放肆的年华 提交于 2019-11-28 16:12:01
I have two rectangles a and b with their sides parallel to the axes of the coordinate system. I have their co-ordinates as x1,y1,x2,y2. I'm trying to determine, not only do they overlap, but HOW MUCH do they overlap? I'm trying to figure out if they're really the same rectangle give or take a bit of wiggle room. So is their area 95% the same? Any help in calculating the % of overlap? Yves Daoust Compute the area of the intersection, which is a rectangle too: SI = Max(0, Min(XA2, XB2) - Max(XA1, XB1)) * Max(0, Min(YA2, YB2) - Max(YA1, YB1)) From there you compute the area of the union: SU = SA

Get dimension of a path in SVG

不羁岁月 提交于 2019-11-28 08:12:10
I need to get the dimension on the screen of a <path> in a SVG from JavaScript. I do not have any "transformation" or "scaling" (transform, scale) on my SVG. The only thing changed is the viewBox, which will change the size of all the elements in the SVG. I have been using myPath.getBBox(), the width returned stays the same even though I change my viewBox. So I'm wondering what is the relation with this viewBox and size of a path. Maybe there is a function to compute the width? You can call getBoundingClientRect() method on your path to get dimensions. It will return a ClientRect object: var w

Extract all bounding boxes using OpenCV Python

眉间皱痕 提交于 2019-11-28 06:04:21
I have an image that contains more than one bounding box. I need to extract everything that has bounding boxes in them. So far, from this site I've gotten this answer: y = img[by:by+bh, bx:bx+bw] cv2.imwrite(string + '.png', y) It works, however, it only gets one. How should I modify the code? I tried putting it in the loop for contours but it still spews out one image instead of multiple ones. Thank you so much in advance. Zaw Lin there you go: import cv2 im = cv2.imread('c:/data/ph.jpg') gray=cv2.cvtColor(im,cv2.COLOR_BGR2GRAY) contours, hierarchy = cv2.findContours(gray,cv2.RETR_LIST,cv2

Calculating percentage of Bounding box overlap, for image detector evaluation

好久不见. 提交于 2019-11-27 21:22:42
问题 In testing an object detection algorithm in large images, we check our detected bounding boxes against the coordinates given for the ground truth rectangles. According to the Pascal VOC challenges, there's this: A predicted bounding box is considered correct if it overlaps more than 50% with a ground-truth bounding box, otherwise the bounding box is considered a false positive detection. Multiple detections are penalized. If a system predicts several bounding boxes that overlap with a single