shape

Converting an open curve to a list of ordered pixels: a Python test code with numpy

两盒软妹~` 提交于 2019-12-06 11:17:39
I have the image of an open curve in a numpy array and I need to build a list of points coordinates ordered according to their position on the curve. I wrote a draft script using numpy and mahotas. It may not be optimal. I know that OpenCV can do this for a closed curve. Can OpenCV do the same (faster) with an open curve? For example, if the original curve is: [[0 0 0 0 0 0 0] [0 1 0 0 1 0 0] [0 0 1 0 0 1 0] [0 0 0 1 1 0 0] [0 0 0 0 0 0 0]] Using np.where(myarray==1) , I can get the indices of the pixels: (array([1, 1, 2, 2, 3, 3]), array([1, 4, 2, 5, 3, 4])) But this not what I need. My

Create a plane mesh, with points defining colors

南楼画角 提交于 2019-12-06 08:47:17
I've created ~2500 meshes and use an algorithm defining the color of each mesh. The algorithm goes through all meshes and adds a value depending on the distance it has to each "red-start" point. The value then decides what the color should be. This is the result: It is lagging and the corners aren't smooth. I want to recreate the same color result in some other way but can't figure out how. How can you do it with THREE.Shape and FragmentShader? Final Goal Description: Using one, for increase in FPS, mesh (THREE.Shape) that defines the area which is to be colored. Be able to insert X amount of

Triangulation of 3D points with K vertices per face

随声附和 提交于 2019-12-06 03:42:54
问题 I'm working with Three.js. I have a collection of 3D points (x, y, z) and a collection of faces. One face is composed of K points . It can be as well convex as concave. I found nothing that could help me in the Three.js documentation. One solution could be to triangulate those shapes, but so far I haven't found any simple 3D triangulation algorithm. The other solution would be doing something like that : var pointsGeometry = new THREE.Geometry(); pointsGeometry.vertices.push(new THREE.Vector3

Mask layout with rounded corner xml shape

笑着哭i 提交于 2019-12-06 03:20:28
I have this LinearLayout: <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"> <ImageView android:layout_width="100dp" android:layout_height="70dp" android:src="@drawable/ic_launcher" android:scaleType="centerCrop"/> <TextView android:layout_width="100dp" android:layout_height="30dp" android:background="#FFD800" android:textColor="@android:color/black" android:gravity="center" android:text="Text View"/> </LinearLayout> And I want to mask it with rounded corner, like this: I tried to put it in a FrameLayout with another layout

how to detect known objects in OpenCV?

僤鯓⒐⒋嵵緔 提交于 2019-12-06 02:29:34
问题 I am try to draw shapes in the window in real time. The shapes are like tangle ,rectangle ,circle , half or circle and "Z" in the screen using yellow color. The size and the shape may not be same to the original image. But Program know all the original shapes. Because they are predefined. I want to know how i can identify the correct shape. as an example, is there possible way to do this? can I use template matching for this? Please help me with this.. 回答1: You can use different methods to

Android rectangle shape with two different color

孤街浪徒 提交于 2019-12-06 00:36:07
how can I create rectangle shape by using two different colors with shadow? like above image. Please create a drawable file and put the below code in it. <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" > <item> <shape android:shape="rectangle" > <size android:height="20dp" /> <solid android:color="#F66D08" /> </shape> </item> <item android:top="50dp"> <shape android:shape="rectangle" > <gradient android:endColor="#AD1B1D" android:startColor="#E2360A" android:angle="270" /> </shape> </item> </layer-list> layer-list can be used to

Android - Multiple colors & size in drawable shape style

为君一笑 提交于 2019-12-05 22:39:36
I'm trying to have a circle background for my TextView, so I created a shape style as below. But I need to have multiple colors with multiple sizes (while the textSize stays constant), so I need to set the width/height in the style. From my understanding.. Layer List puts all the shapes on top of one another? Because I need to call it 12 times at different places, so it seems quite cumbersome to have 12 shape style xmls. Is there a better way to have all the different shape/size combinations inside one XML? Shape Style: <shape xmlns:android="http://schemas.android.com/apk/res/android" android

How to move circle with mouse in delphi?

守給你的承諾、 提交于 2019-12-05 20:03:30
How to move circle with mouse in delphi? circle:Shape; Be sure to convert the Mouse X,Y client coordinates that you get from MouseMove on your Control to the Parent's client using ClientToScreen and ScreenToClient . The following procedure moves the center of a Control to the point (X,Y) in it's client coordinates: procedure MoveControl(AControl: TControl; const X, Y: Integer); var lPoint: TPoint; begin lPoint := AControl.Parent.ScreenToClient(AControl.ClientToScreen(Point(X, Y))); AControl.Left := lPoint.X - AControl.Width div 2; AControl.Top := lPoint.Y - AControl.Height div 2; end; Now to

A lightweight templateable WPF shape

◇◆丶佛笑我妖孽 提交于 2019-12-05 19:43:32
I'm using ellipses and other shapes as onscreen markers, I would like others to be able to change these visuals using templates. However, as shape doesn't support templating I'm forced to create a basic UserControl, which defaults to show an ellipse, and then use that instead of the basic shape. Has anyone got a neater solution? I'm a little concerned if I create 1000's of these onscreen that performance/memory will be a bit of an overhead. UserControl derives from ContentControl . It doesn't sounds as though you need content (the ability to host additional controls inside your shape), so I'd

How to mask out a simple region when painting in Android?

北城余情 提交于 2019-12-05 16:07:01
Here is a simplified description: Imagine that I'm given a View class that draws a picture of a wall and I want to draw it with a window cut out. Assume that I extend that View class and override its dispatchDraw() method to do the following. First draw the background if any to be seen through the window. Next I want to mask out the rectangular window region somehow and then call super.dispatchDraw(). Finally I want to remove the mask and draw a person standing at the window so that they are painted over both the background and the wall. How can I do this? Here is some code that seems close to