I’m trying to recreate the following plot with Numpy and Matplotlib as part of a question, but I’m struggling to get the “random aspect” of the plot: I’ve already managed to create the two circles and plot them with this code: But I don’t know how to make them get this random scattering, like in the example image. I know
Tag: geometry
Non overlapping random shapes on 2D plane
Objective: I want to create random non-overlapping irregular rounded shapes (contours) on a 2D plane, similar to a sandstone microstructure as shown below, to perform an oil flooding experiment using computer vision. Approach: I have previously done a similar thing but with circular shapes instead of random shapes. The result is as below. Also, I am aware of the programming
How can you use RD coordinates instead of gps coordinates to plot traffic routes in a folium plot?
In want to show traffic routes on a folium map. These routes are in the Netherlands and the coordinates are in RD (EPSG:28992). I tried to map the routes using the following code: But this won’t work and this results in a random red line: However it does work whenever I transform the RD coordinates to GPS coordinates: This looks
How do I center an object on the canvas in Tkinter?
I want to center a circle on the canvas in Tkinter, but I want to combine whatever code does that with mine, without changing it up too much. My program: Is that possible with what I am using currently? Answer You can just draw your circle in the middle of the canvas like this:
Saving centroid of a (multi)polygon as point geometry in a model
I have two tables, one with multipolygon geometries, the other with a column for point geometries. I want the centroid of the selected polygon to be saved as the point geometry for the other table. To add a new site, an existing administrative unit must be associated with it and the center of it’s polygon should be used as the
find nested boxes from huge dataset with geopandas (or other tools)
Basically I have DataFrame with a huge amount of boxes which are defined with xmin ymin xmax ymax tuples. My task is to remove all nested boxes. (I.e. any box which is within another box has to be removed) My current method: construct GeoDataFrame with box geometry sort by box size (descending) iteratively find smaller boxes within a larger box.
Already updated my pip, still failed to add circle as a module
I have been searching for different methods for using a class method to create circles. At first, I was able to print ‘c1’, however, after updating my python, it said is not defined which confuses me. Is there any method that I can solve it or any recommended websites for such programming functions? Thank you. Answer There’s a few things
How to rasterize a batch of polygons in python
I have a batch of polygons which could be a NumPy array, torch tensor, or any other nd-array of shape (230_000, 3, 2). 230_000 is the number of polygons, 3 indicates it’s a triangle, 2 is its x and y coordinates. I also have a batch of features of shape (230_000, 3, 3) (last is the color), it’s best the
Given a image, a pixel point and a radious in pixels. How do I find the pixel coordenate of the circle border it creates
Given an image matrix, I want to find the pixel points coordinates of all points/pixels in the border of a given circle with center (x,y), where x and y are integers and radius r, where r is also an integer. Considering the border is 1 pixel thick. Ony this outer edge is what I need to find. I’m having trouble
how to convert normalized coordinates to pixel coordinates?
what is the most effective way to translate from normalized coordinates (x = 0,1) (y = 0,1) to pixel coordinates (x = 0, 1920) (x = 0, 1080) or is there even a way to do it inside python? i have no idea where to even start. cause im trying to get coordinates from mediapipe’s pose detection module, then tracking