contour

Navigate through hierarchy of contours found by FindContours method?

僤鯓⒐⒋嵵緔 提交于 2019-12-30 06:42:47
问题 This must be simple for C++ developers using OpenCV directly. However what I'm using is Emgu (an OpenCV wrapper for .NET) and in the latest version we have the method CvInvoke.FindContours returning void, the output result is passed by parameter reference and is of type VectorOfVectorOfPoint . Here is a simple call: //outputResult is a VectorOfVectorOfPoint CvInvoke.FindContours(inputImage, outputResult, null, RetrType.Tree, ChainApproxMethod.ChainApproxSimple); For RetrType.List mode, we can

opencv countour area returns zero

半世苍凉 提交于 2019-12-25 02:55:41
问题 I'm learning opencv, by using the book with the same name. I'd like to calculate the area of a contour but it always return 0. The contours are painted as closed polygons, so this seems to be correct. There are some samples out there, but they are using vector<vector<Point>> contours . My code below is based on a book sample. The reference image which I'm using is a grayscale one. So my question is: What am I missing to get the area != 0? #include <opencv\cv.h> #include <opencv\highgui.h>

Creating contour or percentile lines in R

大憨熊 提交于 2019-12-25 01:22:13
问题 I am creating the following contour graph from this matrix. I would like to, however, have also a plot which displays chosen by me contour lines (without filled contour) representing values of 0.50 (in black) and 0.25 and 0.75 (in red). Help on the method will be much appreciated. B = matrix(c(0.158,0.182,0.306,0.46,0.601,0.77,0.796,0.832, 0.174,0.216,0.373,0.58,0.769,0.862,0.907,0.929, 0.164,0.262,0.442,0.73,0.886,0.93,0.949,0.976, 0.171,0.218,0.509,0.791,0.915,0.972,0.987,0.992, 0.174,0.288

Controlling scatterhist Marker Transparency

走远了吗. 提交于 2019-12-25 01:16:49
问题 I need to control the transparency of the markers in the figure produced with the scatterhist command in MATLAB. The following post is helpful in handling the color of the histograms: Controlling scatterhist bar colors. How can the transparency of the markers be modified? How can I add a contour plot on top of the markers? 回答1: tl;dr : In MATLAB R2019a, scatterhist can do contours but it is difficult (yet possible) to add marker transparency, and scatterhistogram can easily do transparency

How to increase the hatch density matplotlib?

与世无争的帅哥 提交于 2019-12-24 23:17:36
问题 I'm trying to increase the density of hatch marks I have for a map. This is how I'm currently doing it and I can't get anything to show up on my map when it should. I want to contour values less than 0.05 (sig p-valuea). And repeating the type of hashing I want doesn't help with the problem. levels = [spnewdata[:,:,1].min(), 0.05] cs1 = plt.contour(x, y, spnewdata[:,:,1],levels=levels, colors='none', hatch='X', alpha=0) Edit: Here's a little more complete form of the code I'm using to make

Overlapping contour labels?

回眸只為那壹抹淺笑 提交于 2019-12-24 12:07:47
问题 So I'm trying to do contour plotting with each contour representing an increment of 0.1 on a correlation map. [c2,h2] = contourm(GlobalCorrs,geoidrefvec, .2:.1:1,'k','LineWidth',1); ht2 = clabelm(c2,h2); The issue is.. when there are multiple closely-spaced contours, they tend to overlap, as shown in the top picture below. But if I zoom into the bottom picture here, I can see that the 0.4 label was covered by up the 0.2 and 0.3 labels. This is problematic since a correlation of 0.4 is a lot

How to create an ax.legend() method for contourf plots that doesn't require passing of legend handles from a user?

偶尔善良 提交于 2019-12-24 10:48:42
问题 Desired feature I would like to be able to call ax.legend() on an axis containing a contourf plot and automatically get the legend (see plot below for an example). More Detail I know how to create legend entries for contourf plots using proxies, see code below and which is already discussed in this Q&A. However, I would be interested in a solution where the final call to axes[0][-1].legend() does not require any handles being passed. The plot generation (more complex plots than in this

R ggplot2: how do I plot an implicit function (contour line at just one level)?

拜拜、爱过 提交于 2019-12-24 04:38:08
问题 Using R, I wanted to plot some datapoints and a curve over them (which is the decision boundary trained with neural network). First I did it with the normal plot functions, but now I want it to look more fancy using ggplot2 . This is what it looks like without ggplot (note the curve especially, the points are not too relevant): Plotting the points with ggplot is no problem, but now I want to add the curve as well, which is described by the following function: 1.91*(1/(1+exp(-(23.50+12.64*x-24

Obtain only external contours in image

為{幸葍}努か 提交于 2019-12-24 03:44:25
问题 I have this code, that draws contours in my image, but I need only the external contours: import cv2 import numpy as np camino= "C:/Users/Usuario/Documents/Deteccion de Objetos/123.jpg" img = cv2.imread("C:/Users/Usuario/Documents/Deteccion de Objetos/123.jpg") grises= cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) bordes= cv2.Canny(grises, 100, 250) ctns = cv2.findContours(bordes, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) ctns = ctns[0] if len(ctns)==2 else ctns[1] for c in ctns: cv2.drawContours

Contour plot is not been filled completely using ggplot

a 夏天 提交于 2019-12-23 20:09:46
问题 I'm trying to do my first ever filled contour plot using ggplot . With my data, I was specting something like: But my result was: a <- c(1, 1.1, 1, 1.3, 1.2, 2, 2.2, 2, 2.5, 2.1, 3, 3, 3, 3.1, 3.2) b <- c(rep(c(0, 5, 10, 15, 20), 3)) c <- seq(0, 1000, by = 1000/14) DF <- data.frame(a, b, c) ggplot(DF, aes(x = a, y = b, z = c)) + geom_raster(aes(fill = c)) + geom_contour() + scale_fill_gradientn(colours = rainbow(10)) What I'm doing wrong, and where I can find more datailed information about