contour

contour plot of a custom function in R

こ雲淡風輕ζ 提交于 2019-12-03 12:28:04
问题 I'm working with some custom functions and I need to draw contours for them based on multiple values for the parameters. Here is an example function: I need to draw such a contour plot: Any idea? Thanks. 回答1: First you construct a function, fourvar that takes those four parameters as arguments. In this case you could have done it with 3 variables one of which was lambda_2 over lambda_1. Alpha1 is fixed at 2 so alpha_1/alpha_2 will vary over 0-10. fourvar <- function(a1,a2,l1,l2){ a1*

Creating your own contour in opencv using python

穿精又带淫゛_ 提交于 2019-12-03 12:17:42
I have a set of boundary points of an object. I want to draw it using opencv as contour. I have no idea that how to convert my points to contour representation. To the same contour representation which is obtained by following call contours,_ = cv2.findContours(image,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) Any ideas? Thanks By looking at the format of the contours I would think something like this should be sufficient: contours = [numpy.array([[1,1],[10,50],[50,50]], dtype=numpy.int32) , numpy.array([[99,99],[99,60],[60,99]], dtype=numpy.int32)] This small program gives an running example:

Python matplotlib contour plot logarithmic color scale

亡梦爱人 提交于 2019-12-03 12:08:46
I have problems with a contour-plot using logarithmic color scaling. I want to specify the levels by hand. Matplotlib, however, draws the color bar in a strange fashion -- the labels are not placed well and only one color appears. The idea is based on http://adversus.110mb.com/?cat=8 Is there anybody out there, who can help me? I use the latest git-repository matplotlib version, v1.1.0 (2011-04-21) import matplotlib.pyplot as plt import numpy as np from matplotlib.mlab import bivariate_normal from matplotlib.colors import LogNorm from matplotlib.backends.backend_pdf import PdfPages delta = 0.5

Find and draw the largest contour in opencv on a specific color (Python)

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:07:10
问题 Im trying to get the largest contour of a red book. I've got a little problem with the code because its getting the contours of the smallest objects (blobs) instead of the largest one and I can't seem to figure out why this is happening The code I use: camera = cv2.VideoCapture(0) kernel = np.ones((2,2),np.uint8) while True: #Loading Camera ret, frame = camera.read() blurred = cv2.pyrMeanShiftFiltering(frame, 3, 3) hsv = cv2.cvtColor(blurred, cv2.COLOR_BGR2HSV) lower_range = np.array([150, 10

How to draw anti aliased lines in OpenGL ES 2.0?

丶灬走出姿态 提交于 2019-12-03 10:58:38
问题 I am trying to draw some contours that I have stored as vertex arrays: typedef struct { float* vertices; int nrPoints; }VertexCurve; list<VertexCurve> CurveList; I am using some samples from an opengl es 2.0 book : http://opengles-book.com/ The drawing method looks like this: void Draw ( ESContext *esContext ) { UserData *userData = (UserData*)esContext->userData; // Set the viewport glViewport ( 0, 0, esContext->width, esContext->height ); // Clear the color buffer glClear ( GL_COLOR_BUFFER

matplotlib contour plot: proportional colorbar levels in logarithmic scale

吃可爱长大的小学妹 提交于 2019-12-03 10:10:25
问题 Would it be possible to have levels of the colorbar in log scale like in the image below? Here is some sample code where it could be implemented: import matplotlib.pyplot as plt import numpy as np from matplotlib.colors import LogNorm delta = 0.025 x = y = np.arange(0, 3.01, delta) X, Y = np.meshgrid(x, y) Z1 = plt.mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) Z2 = plt.mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) Z = 1e6 * (Z1* Z2) fig=plt.figure() ax1 = fig.add_subplot(111) lvls = np

Adding water flow arrows to Matplotlib Contour Plot

谁都会走 提交于 2019-12-03 10:03:06
问题 I am generating a groundwater elevation contour with Matplotlib. See below Here is what I have now; how can I add water flow arrows like the image below? I want to add arrows to make it look like this: If anyone has some ideas and/or code samples that would be greatly appreciated. 回答1: You'll need a recent (>= 1.2) version of matplotlib, but streamplot does this. You just need to take the negative gradient of your head (a.k.a. "water table" for surface aquifers) grid. As a quick example

Create Contour Plot from Pandas Groupby Dataframe

懵懂的女人 提交于 2019-12-03 09:38:18
问题 I have following Pandas Dataframe: In [66]: hdf.size() Out[66]: a b 0 0.0 21004 0.1 119903 0.2 186579 0.3 417349 0.4 202723 0.5 100906 0.6 56386 0.7 6080 0.8 3596 0.9 2391 1.0 1963 1.1 1730 1.2 1663 1.3 1614 1.4 1309 ... 186 0.2 15 0.3 9 0.4 21 0.5 4 187 0.2 3 0.3 10 0.4 22 0.5 10 188 0.0 11 0.1 19 0.2 20 0.3 13 0.4 7 0.5 5 0.6 1 Length: 4572, dtype: int64 You see, a from 0...188 and b in every group from some value to some value. And as the designated Z-value, the count of the occurence of

How to keep track of different contours in opencv python

≯℡__Kan透↙ 提交于 2019-12-03 09:14:40
I am trying to track objects with opencv in python from recorded video. I want to give a unique object nr to each visible object when it appears. For example, one object enters the screen and gets nr1, then a second joins the first and gets nr2, then the first object leaves the screen but the second is still visible and still gets object nr2 and not 1 (being the only object). I can't find any information on how to do this online. Any help (including code) is appreciated. The code I have written so far for getting the contours and drawing object numbers: cap = cv2.VideoCapture("video.mov")

.NET Open Source Contour Plotting

与世无争的帅哥 提交于 2019-12-03 04:58:14
I am looking for an Open Source .NET Library (or wrapper to a library) that will create contour plots from a set of values along a grid/mesh. ZedGraph is the closest thing I could find ( http://zedgraph.org/ ). It would also be great if it could export to EPS. With D3 you can plot contour lines (isolines) for WPF . I am not sure about contour surfaces. WPF has great printing capabilities so I think that printing to EPS would not be a problem. Edit: recently found this one WinForms example around a .dll which calculates isolines. The contour extraction routine ConRec worked very well (fast and