2d

Accurately detect color regions in an image using K-means clustering

試著忘記壹切 提交于 2020-01-01 17:01:28
问题 I'm using K-means clustering in color-based image segmentation. I have a 2D image which has 3 colors, black, white, and green. Here is the image, I want K-means to produce 3 clusters, one represents the green color region, the second one represents the white region, and the last one represents the black region. Here is the code I used, %Clustering color regions in an image. %Step 1: read the image using imread, and show it using imshow. img = (imread('img.jpg')); figure, imshow(img), title('X

Optimal covering with non-uniform discs

喜夏-厌秋 提交于 2020-01-01 10:32:06
问题 What kind of algorithm can I use to search for an optimal (minimum area) covering of a limited region of the XY plane with n discs ( x j , y j , r j ) ? I've found many investigations on fixed radius discs, but nothing about variable radius. n is fixed but the discs can be placed freely (they're not in assigned positions and their centers are not required to be inside the region). The region is in general non-connected and non-simply connected (can be composed by multiple parts and can have

Corner Stitching Datastructure, Any Open Source Implementations? [closed]

时光毁灭记忆、已成空白 提交于 2020-01-01 07:20:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 4 years ago . I recall learning about the corner-stitched data structure a number of years ago and have been fascinated with it ever since. It originated with a paper by Ousterhout. I've searched and not been able to find a free/open implementations. I'd prefer a C++ implementation, but at this point would accept any pointers

android open gl really slower than canvas?

China☆狼群 提交于 2020-01-01 06:52:05
问题 im testing the android SpriteMethodTest and on default settings canvas is getting 58fps while open gl is between 50-55fps, and the gap just gets larger with more sprites. I was under the impression that opengl is faster than canvas so is this wrong? or is their something wrong with my phone (htc desire)? http://code.google.com/p/apps-for-android/source/browse/trunk/SpriteMethodTest/ 回答1: It should be noted that SpriteMethodTest is not using OpenGL at maximum efficiency. Each sprite is being

WPF 2d vector-graphics library

馋奶兔 提交于 2019-12-31 10:56:09
问题 I'm looking for a WPF library for 2d vector graphics. Required features API for: drawing shapes editing shapes highlighting shapes Optional features: possibility to save image to a binary file and to load image from such file (format doesn't matter) own editor which has UI for creating and editing shapes and which can be integrated in an application (WPF control or external application) Both free and commercial libraries are acceptable. P.S. In the last resort WinFroms libraries are

C++ Zoom into the centre of the screen in 2D coordinates

别说谁变了你拦得住时间么 提交于 2019-12-31 06:42:15
问题 I'm having difficulty working out the correct calculations in order to zoom into the centre of the screen in 2D coordinates whilst keeping everything in the correct scale. I have a vector which I use to handle moving around my map editor as follows: scroll = sf::Vector2<float>(-640.0f, -360.0f); It's set at -640.0f, -360.0f to make 0,0 the centre of the screen on initialising (based on my window being 1280x720). My zoom value ranges from 0.1f to 2.0f and it's increased or decreased in 0.05

Determine rotation direction /toward/ variable point on a circle

只谈情不闲聊 提交于 2019-12-31 06:27:08
问题 Given circle centre: vectorA and another Vector on the circle's perimeter:vectorB, how can you determine the shorter route for vectorB to translate to another point on the circle's perimeter that is variable:vectorC? Will the shorter route be clockwise or counter clockwise rotation? If it helps think of a clock. If the times is a random point on the clock's perimeter eg. 6, and the minute hand position is known, eg. 4. Does the hand need to rotate around the clock's centre point clockwise or

Get user input as int or str

丶灬走出姿态 提交于 2019-12-31 04:37:06
问题 I'm very new to python and believe me, I've searched endlessly for a solution to this but I just can't get it. I have a csv with a list of monitoring plots. With the code below, I have been able to display the 2dlist and get the user to enter a number to choose a particular plot (there's 11 of them), based on the list index. But when prompting the user to choose, I'd like to include an option '....or press 'q' to quit'. Now obviously raw_input is set to receive integers only but how can I

Perspective transform with WPF

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-31 04:29:05
问题 WPF allows to specify linear affine transform on graphical objects. With this you can do translation, rotation, scaling, skewing, or a combination of that. You can specify a 2x3 matrix. What I want to do is a perspective transform in 2D space, which requires a 3x3 matrix, and is known from Photoshop or GIMP, where you can drag all 4 corners of an image independently. I tried to use the 3D features of WPF, set up a Viewport3D , an OrthographicCamera and placed the (2D) objects onto the xy

Perspective transform with WPF

爱⌒轻易说出口 提交于 2019-12-31 04:27:08
问题 WPF allows to specify linear affine transform on graphical objects. With this you can do translation, rotation, scaling, skewing, or a combination of that. You can specify a 2x3 matrix. What I want to do is a perspective transform in 2D space, which requires a 3x3 matrix, and is known from Photoshop or GIMP, where you can drag all 4 corners of an image independently. I tried to use the 3D features of WPF, set up a Viewport3D , an OrthographicCamera and placed the (2D) objects onto the xy