Questions tagged [contour]

A contour line for a function of two variables is a curve connecting points where the function has the same particular value.

From wiki,

a contour line for a function of two variables is a curve connecting points where the function has the same particular value. The gradient of the function is always perpendicular to the contour lines. When the lines are close together the magnitude of the gradient is large: the variation is steep. A level set is a generalization of a contour line for functions of any number of variables.

Contour lines are curved or straight lines on a map describing the intersection of a real or hypothetical surface with one or more horizontal planes. The configuration of these contours allows to infer relative gradient of a parameter and estimate that parameter at specific places. Contour lines may be either traced on a visible three-dimensional model of the surface, as when viewing a stereo-model plots elevation contours, or interpolated from estimated surface elevations, as when a computer program threads contours through a network of observation points of area centroids. In the latter case, the method of interpolation affects the reliability of individual isolines and their portrayal of slope, pits and peaks.

2744 questions
29
votes
4 answers

Hide contour linestroke on pyplot.contourf to get only fills

I have a pet project to create images of maps, where I draw the roads and other stuff over a contour plot of the terrain elevation. It is intended to plan mountain bike routes (I have made some vectorial drawings by hand, in the past, and they work…
heltonbiker
  • 26,657
  • 28
  • 137
  • 252
28
votes
6 answers

Contour/imshow plot for irregular X Y Z data

I have data in X, Y, Z format where all are 1D arrays, and Z is the amplitude of the measurement at coordinate (X,Y). I'd like to show this data as a contour or 'imshow' plot where the contours/color represent the the value Z (amplitude). The grid…
Scientist
  • 371
  • 2
  • 4
  • 5
26
votes
2 answers

How does cv2.boundingRect() function of OpenCV work?

I need the explanation on boundingRect of OpenCV. I have used it, it works great. Is there any reference where this function is fully explained please?
vashish doolooa
  • 269
  • 1
  • 3
  • 4
26
votes
1 answer

Python matplotlib change default color for values exceeding colorbar range

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…
Levi Cowan
  • 789
  • 2
  • 9
  • 13
25
votes
4 answers

Python: find contour lines from matplotlib.pyplot.contour()

I'm trying to find (but not draw!) contour lines for some data: from pprint import pprint import matplotlib.pyplot z = [[0.350087, 0.0590954, 0.002165], [0.144522, 0.885409, 0.378515], [0.027956, 0.777996, 0.602663], [0.138367, 0.182499,…
Barry Carter
  • 456
  • 1
  • 4
  • 9
25
votes
7 answers

Using matplotlib.animate to animate a contour plot in python

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: …
Luke
  • 361
  • 1
  • 3
  • 6
25
votes
4 answers

Creating your own contour in opencv using python

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,_ =…
Shan
  • 18,563
  • 39
  • 97
  • 132
24
votes
3 answers

Create random shape/contour using matplotlib

I am trying to generate an image of a random contour using python but I couldn't find an easy way to do it. Here is an example sort of what I want: Initially I tought of doing it using matplotlib and gaussian functions, but I could not even get…
klaus
  • 1,187
  • 2
  • 9
  • 19
24
votes
5 answers

How to create ternary contour plot in Python?

I have a data set as follows (in Python): import numpy as np A = np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 0, 0.1, 0.2, 0.3, 0.4, 0.2, 0.2, 0.05, 0.1]) B = np.array([0.9, 0.7, 0.5, 0.3, 0.1, 0.2, 0.1, 0.15, 0, 0.1, 0.2, 0.3, 0.4, 0.5,…
Tom Kurushingal
  • 6,086
  • 20
  • 54
  • 86
23
votes
1 answer

Dealing with contours and bounding rectangle in OpenCV 2.4 - python 2.7

I am working with openCv and python and I am dealing with Structural Analysis and Shape Descriptors. I have found this blog: http://opencvpython.blogspot.it/2012/06/contours-2-brotherhood.html that's very helpful and I have tried with a black and…
Gianfra
  • 1,119
  • 4
  • 17
  • 33
21
votes
3 answers

How to remove a contour inside contour in Python OpenCV?

OpenCV in Python provides the following code: regions, hierarchy = cv2.findContours(binary_image, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) for region in regions: x, y, w, h = cv2.boundingRect(region) cv2.rectangle(image, (x, y), (x + w, y…
Python1c
  • 221
  • 1
  • 2
  • 10
21
votes
2 answers

Matplotlib Contour Clabel Location

I would like to control the location of matplotlib clabels on a contour plot, but without utilizing the manual=True flag in clabel. For example, I would like to specify an x-coordinate, and have labels created at the points that pass through this…
21
votes
3 answers

stat_contour not able to generate contour lines

I need to add lines via stat_contour() to my ggplot/ggplot2-plot. Unfortunately, I can not give you the real data from which point values should be evaluated. However, another easily repreducably example behaves the same: testPts <-…
Florian R. Klein
  • 1,375
  • 2
  • 15
  • 32
21
votes
2 answers

Python OpenCV Contour Tree Hierarchy Structure

I am trying to implement the algorithm found here in python with OpenCV. I am trying to implement the part of the algorithm that remove irrelevant edge boundaries based on the number of interior boundaries that they have. If the current edge…
jasonlfunk
  • 5,159
  • 4
  • 29
  • 39
20
votes
3 answers

Access pixel values within a contour boundary using OpenCV in Python

I'm using OpenCV 3.0.0 on Python 2.7.9. I'm trying to track an object in a video with a still background, and estimate some of its properties. Since there can be multiple moving objects in an image, I want to be able to differentiate between them…
Kaya311
  • 545
  • 2
  • 9
  • 21