curve

laser curved line detection using opencv and python

此生再无相见时 提交于 2019-12-06 12:36:18
I have taken out the laser curve of this image : (source: hostingpics.net ) And now, I'm trying to obtain a set of points (the more, the better), which are in the middle of this curve. I have tried to split the image into vertical stripes, and then to detect the centroid. But it doesn't calculate lots of points, and it's not satisfactory at all ! img = cv2.Canny(img,50,150,apertureSize = 3) sub = 100 step=int(img.shape[1]/sub) centroid=[] for i in range(sub): x0= i*step x1=(i+1)*step-1 temp = img[:,x0:x1] hierarchy,contours,_ = cv2.findContours(temp, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE)

Akima interpolation algorithm [duplicate]

风格不统一 提交于 2019-12-06 11:35:43
This question already has answers here : Closed 8 years ago . Possible Duplicate: Akima interpolation of an array of doubles I'm searching for an algorithm for Akima interpolation, but I can't find one after googling for a while. I write my application in Objective-C, but the programming language doesn't matter. It would be very kind if you can provide any code or links. Thanks Handcraftsman edit: see this SO answer for an updated version of the list below. original answer: Akima's original paper http://student.ndhu.edu.tw/~u9111023/akima.pdf C# implementation https://github.com/mathnet

do.call and curve can not plot a function inside another function environment

匆匆过客 提交于 2019-12-06 11:20:13
问题 I am facing a strange problem about do.call and curve : func1 <- function (m, n) { charac <- paste ("func2 <- function(x)", m, "*x^", n, sep = "") eval(parse(text = charac)) return(func2) } func3 <- function (m, n) { my.func <- func1 (m, n) do.call("curve",list(expr = substitute(my.func))) } func1 constructs func2 and func3 plots the constructed func2 . But when I run func3 , following error would be displayed: > func3 (3, 6) Error in curve(expr = function (x) : 'expr' must be a function, or

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

CGPath adding a curve between points

只谈情不闲聊 提交于 2019-12-06 04:34:27
问题 So I have a function which randomly generates some CGPoints I then create a CGPath from these points. I use this path in a keyframe animation to animate a view around the screen. The path is generated using the code below: - (CGMutablePathRef)generatePathFromCoordinates:(NSArray *)coordinates { CGMutablePathRef path = CGPathCreateMutable(); CGPoint point = [(NSValue *)[coordinates objectAtIndex:0] CGPointValue]; CGPathMoveToPoint(path, nil, point.x, point.y); for (int i=1; i < coordinates

Using cubiccurve in OpenLayers 2?

ε祈祈猫儿з 提交于 2019-12-06 02:01:09
问题 I want to use cubiccurve in openlayers 2.13, And I have added the necessary files, But when drawing the line is drawn instead of the curve. Files are available on the website: http://trac.osgeo.org/openlayers/ticket/1715#no1 Drawing curve is very important for us and I no way I could control my curve. Can one help me? 回答1: <html> <head> <script src="http://dev.openlayers.org/OpenLayers.js" type="text/javascript"></script> <title>Ya Mahdi</title> <style> html,body { height: 99%; width: 99%; }

.animate with a curve

删除回忆录丶 提交于 2019-12-06 01:39:44
问题 First take a look: The cat needs to move to the x in a curve . (see the arrow) When the cat hits the x, it should stay 10 seconds, and after that the cat should go back to o, again in a curve, and repeat. I tried it with this code: function curve() { $('#cat').delay(10000).animate({top: '-=20',left: '-=20'}, 500, function() { $('#cat').delay(10000).animate({top: '+=20', left: '+=20'}, 500, function() { curve(); }); }); } curve(); But the cat is moving like this: Is there a way to get the cat

How to create a faceted line-graph using ggplot?

元气小坏坏 提交于 2019-12-05 09:34:32
问题 I have a data frame created with this code: require(reshape2) foo <- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.8),rnorm(3, mean=.9),rnorm(3, mean=1)))) qux <- data.frame( abs( cbind(rnorm(3),rnorm(3, mean=.3),rnorm(3, mean=.4),rnorm(1, mean=2)))) bar <- data.frame( abs( cbind(rnorm(3,mean=.4),rnorm(3, mean=.3),rnorm(3, mean=.9),rnorm(3, mean=1)))) colnames(foo) <- c("w","x","y","z") colnames(qux) <- c("w","x","y","z") colnames(bar) <- c("w","x","y","z") rownames(foo) <- c("n","q","r")

Terrain curve to array of points

喜欢而已 提交于 2019-12-05 05:28:25
In my 2D game I'm using graphic tools to create nice, smooth terrain represented by black color: Simple algorithm written in java looks for black color every 15 pixels, creating following set of lines (gray): As you can see, there's some places that are mapped very bad, some are pretty good. In other case it would be not necessary to sample every 15 pixels, eg. if terrain is flat. What's the best way to covert this curve to set of points [lines], using as little points as possible? Sampling every 15 pixels = 55 FPS, 10 pixels = 40 FPS Following algorithm is doing that job, sampling from right

Point addition using Elliptic Curve calculations on Java Card

耗尽温柔 提交于 2019-12-05 04:57:01
问题 I have a smart card which supports JavaCard 2.2.2 and I would like to develop a signature with tickets on elliptic curve. To do that, I need to compute the sum of 2 points on an elliptic curve. I've read the JavaCard's API and I don't think it is possible, in fact there are things about elliptic curves but only for algorithms that are already developed (ECPrivateKey for ECDSA for example ...) But when you want to create an ECPrivateKey, you have to give the parameters which define the