contour

drawing 3d contour plot from 3d vector

给你一囗甜甜゛ 提交于 2019-12-18 09:40:06
问题 I want to draw a contour plot for 3D data. I have a force in x,y,z directions I want to plot the contour3 for that the dimensions of the Fx = 21x21X21 same for Fy and Fz I am finding force = f*vector(x,y,z) Then Fx(x,y,z) = force(1) Fy(x,y,z) = force(2) Fz(x,y,z) = force(3) I did the following but it is not working with me ?? why and how can I plot that FS = sqrt(Fx.^2 + Fy.^2 + Fz.^2); x = -10:1:10; [X,Y] = meshgrid(x); for i=1:length(FS) for j = 1:length(FS) for k=1:length(FS) contour3(X,Y

Calculate the area of an object with OpenCV

一笑奈何 提交于 2019-12-18 02:48:12
问题 I need to calculate the area of a blob/an object in a grayscale picture (loading it as Mat, not as IplImage) using OpenCV . I thought it would be a good idea to get the coordinates of the edges (number of edges change form object to object) or to get all coordinates of the contour and then use contourArea() to calculate the area of my object. I deleted all noise and got some nice and satisfying contours by using findContours() (programming in C++ ). findContours(InputOutputArray image,

How does one turn contour lines into filled contours?

有些话、适合烂在心里 提交于 2019-12-17 23:25:56
问题 Does anyone know of a way to turn the output of contourLines polygons in order to plot as filled contours, as with filled.contours . Is there an order to how the polygons must then be plotted in order to see all available levels? Here is an example snippet of code that doesn't work: #typical plot filled.contour(volcano, color.palette = terrain.colors) #try cont <- contourLines(volcano) fun <- function(x) x$level LEVS <- sort(unique(unlist(lapply(cont, fun)))) COLS <- terrain.colors(length

gnuplot contour line color: set style line and set linetype not working

故事扮演 提交于 2019-12-17 18:27:28
问题 I am plotting data as described in a previous Stackoverflow question: gnuplot 2D polar plot with heatmap from 3D dataset - possible? Mostly it is working well for me, and I am down to some small details. One of these is how to exert control over the contour line colors and linewidths. There are lots of posts on the web regarding using set style increment user followed by definition of user style via set style line 1 lc rgb "blue" lw 2 etc. In theory this was supposed to force splot to plot

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

雨燕双飞 提交于 2019-12-17 07:55:51
问题 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. 回答1: 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

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

蹲街弑〆低调 提交于 2019-12-17 07:54:27
问题 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. 回答1: 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

matplotlib - extracting data from contour lines

此生再无相见时 提交于 2019-12-17 07:09:53
问题 I would like to get data from a single contour of evenly spaced 2D data (an image-like data). Based on the example found in a similar question: How can I get the (x,y) values of the line that is ploted by a contour plot (matplotlib)? >>> import matplotlib.pyplot as plt >>> x = [1,2,3,4] >>> y = [1,2,3,4] >>> m = [[15,14,13,12],[14,12,10,8],[13,10,7,4],[12,8,4,0]] >>> cs = plt.contour(x,y,m, [9.5]) >>> cs.collections[0].get_paths() The result of this call into cs.collections[0].get_paths() is:

How to obtain boundary coordinates of binary mask with holes?

十年热恋 提交于 2019-12-14 01:53:01
问题 I have the following image: I would like to obtain a list with (x, y) -coordinates of the outer and inner contour for each blob (let's call them blob A and B). import cv2 from skimage import measure blob = cv2.imread('blob.png', 0) contours, hier = cv2.findContours(blob, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) labels = measure.label(blob) props = measure.regionprops(labels) for ii in range(0,len(props)) xy = props[ii].coords plt.figure(figsize=(18, 16)) plt.imshow(blob, cmap='gray') plt.plot

How to set as default matplotlib contour plot to always label contours

早过忘川 提交于 2019-12-14 00:34:50
问题 Perhaps I'm missing something obvious in the documentation, http://matplotlib.org/examples/pylab_examples/contour_demo.html but when I first create a contour plot, there are labels for each contour line. However, matplotlib does not do this by default. Using the plot given in the demo, I generate more contour lines between 0.00 and 3.00 : import numpy as np import matplotlib.mlab as mlab import matplotlib.pyplot as plt delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0,

boundingrect not working for a contour in opencv c++

a 夏天 提交于 2019-12-13 21:38:11
问题 { #include<opencv2\opencv.hpp> #include<iostream> #include<conio.h> using namespace std; using namespace cv; int main() { int a = 0; Mat frame, diffimage,back,frame_gray; VideoCapture cap("D:\\elance\\check\\Sent3.avi"); vector<vector<Point>> contours; BackgroundSubtractorMOG2 bg; vector<int> params; params.push_back(CV_IMWRITE_PNG_COMPRESSION); params.push_back(9); for (int i = 0; i < 200;i++) { cap >> frame; if (frame.empty()) break; bg(frame,back); } bg.getBackgroundImage(back); cap.set(CV