contour

Using matplotlib.animate to animate a contour plot in python

五迷三道 提交于 2019-11-27 11:40:42
问题 I have a 3D array of data (2 spatial dimensions and 1 time dimension) and I'm trying to produce an animated contour plot using matplotlib.animate. I'm using this link as a basis: http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/ And here's my attempt: import numpy as np from matplotlib import pyplot as plt from matplotlib import animation from numpy import array, zeros, linspace, meshgrid from boutdata import collect # First collect data from files n = collect("n") #

Extract contours from ContourPlot in Mathematica

有些话、适合烂在心里 提交于 2019-11-27 11:20:22
问题 I have a function f(x,y) of two variables, of which I need to know the location of the curves at which it crosses zero. ContourPlot does that very efficiently (that is: it uses clever multi-grid methods, not just a brute force fine-grained scan) but just gives me a plot. I would like to have a set of values {x,y} (with some specified resolution) or perhaps some interpolating function which allows me to get access to the location of these contours. Have thought of extracting this from the

Scatterplot Contours In Matplotlib

一世执手 提交于 2019-11-27 09:48:54
问题 I have a massive scatterplot (~100,000 points) that I'm generating in matplotlib. Each point has a location in this x/y space, and I'd like to generate contours containing certain percentiles of the total number of points. Is there a function in matplotlib which will do this? I've looked into contour(), but I'd have to write my own function to work in this way. Thanks! 回答1: Basically, you're wanting a density estimate of some sort. There multiple ways to do this: Use a 2D histogram of some

What algorithm is implemented in OpenCV contour detection? [closed]

余生长醉 提交于 2019-11-27 08:13:35
问题 Does anyone know which algorithm is implemented in the OpenCV library to perform the contour detection? Can you possibly give me a reference too? Thanks. 回答1: From the documentation to cv::findContours: The function retrieves contours from the binary image using the algorithm [Suzuki85]. The contours are a useful tool for shape analysis and object detection and recognition. And: [Suzuki85] Satoshi Suzuki and others. Topological structural analysis of digitized binary images by border

Active Contour Models in OpenCV 3.0

自闭症网瘾萝莉.ら 提交于 2019-11-27 07:20:00
问题 I'm trying to implement an Active Contour Models algorithm with Opencv 3.0 in C++. This algorithm is based on a script I wrote for MatLab and is not working as it supposed to. This two images shows the result of the two algorithms running. The MatLab script: and the OpenCV one: In both of them I used the same values for all the ACM parameters, so they should be returning the same thing, the white circle contour. I'm suspecting the problem is my image energy function, since gradient operations

filled.contour in R 3.0.x throws error

社会主义新天地 提交于 2019-11-27 06:20:19
问题 I have a customized function for plotting filled contours which is heavily based on Carey McGilliard and Bridget Ferris work (http://wiki.cbr.washington.edu/qerm/sites/qerm/images/1/16/Filled.contour3.R) and http://wiki.cbr.washington.edu/qerm/index.php/R/Contour_Plots . the filled.contour3 function runs perfectly in R 2.15.3 but throws an error in R 3.0.x Error in .Internal(filledcontour(as.double(x), as.double(y), z, as.double(levels), : there is no .Internal function 'filledcontour' Could

Plotting Isolines/contours in matplotlib from (x, y, z) data set

半腔热情 提交于 2019-11-27 05:38:39
Hi I'm new to programming and I'm trying to do something that's probably really obvious but for the life of me I can't figure it out. I have a series of x, y, z data (in my case, corresponding to distance, depth, and pH). I would like to plot isolines of the z data (pH) on an xy (distance, depth) grid using matplotlib. Is there any way to do this? Thanks. The solution will depend on how the data is organized. Data on regular grid If the x and y data already define a grid, they can be easily reshaped to a quadrilateral grid. E.g. #x y z 4 1 3 6 1 8 8 1 -9 4 2 10 6 2 -1 8 2 -8 4 3 8 6 3 -9 8 3 0

How to crop away convexity defects?

折月煮酒 提交于 2019-11-27 04:17:46
I'm trying to detect and fine-locate some objects in images from contours. The contours that I get often include some noise (maybe form the background, I don't know). The objects should look similar to rectangles or squares like: I get very good results with shape matching ( cv::matchShapes ) to detect contours with those objects in them, with and without noise, but I have problems with the fine-location in case of noise. Noise looks like: or for example. My idea was to find convexity defects and if they become too strong, somehow crop away the part that leads to concavity. Detecting the

OpenCV closing a shape and filling it

末鹿安然 提交于 2019-11-27 02:43:44
问题 I want to output a blue-filled hand but get the incorrect output. I've included the input picture, incorrect output picture and code below. i think the code below does not fill the whole image because the image isn't closed yet at the right boundary. how do i close the shape and fill it with blue properly? #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> #include <stdio.h> #include <stdlib.h> using namespace cv;

Python matplotlib change default color for values exceeding colorbar range

末鹿安然 提交于 2019-11-27 01:48:38
问题 When filling a grid with color such as when using contourf in pyplot, I need to find a way to change the color that pyplot uses to fill data that exceed the specified range of the colorbar. I wish to have a static colorbar that does not automatically change its range to fit the max/min of the data, so having occasional extreme values that exceed its bounds is inevitable, and colors need to be specified for such values. The default color for values exceeding the bounds of the colorbar is white