contour

How to customize contour line labels?

痴心易碎 提交于 2019-12-11 05:27:05
问题 I would like to visualize a function of two variables in a contour plot using Octave, and to put customized line labels on it. Building on the Octave documentation, I wrote: clf; colormap ("default"); [x, y, z] = peaks (); subplot(2,1,1); contour (x, y, z,'showtext', 'on'); title ({"contour() plot, showtext on"; "Z = peaks()"}); subplot(2,1,2); [ctr, h] = contour (x, y, z); cll = clabel(ctr, h, 'backgroundcolor',[1 1 1]); title ({"contour() plot, using clabel()"; "Z = peaks()"}); Which

how to check if a contour is an ellipse?

半城伤御伤魂 提交于 2019-12-11 04:22:28
问题 I am trying to detect ellipse in an image using opencv. I find the contours which include ellipse and also some other ones. Any suggestions that how can I check which contours are ellipse? 回答1: if I understand you correctly, you have detected contours some of them are ellipses and some are not and you want to be able to decide which ones are. Is it right? If yes, I would suggest to use cv::fitEllipse() . The doc says that it fits an ellipse to a vector of points so that R-squared is minimal.

How can i know if a contour is open or closed in opencv?

流过昼夜 提交于 2019-12-11 03:44:28
问题 How can i know if a contour taken from 'find contour' function is open or closed in opencv? UPDATE I tried to apply isContourConvex to this image: https://docs.google.com/file/d/0ByS6Z5WRz-h2RXdzVGtXUTlPSGc/edit?usp=sharing i extractes contour with greatest area and return false. I change, maybe, contour extraction, dilating? nomeimg = 'Riscalate2/JPEG/e (5).jpg' img = cv2.imread(nomeimg) gray = cv2.imread(nomeimg,0)#convert grayscale adn binarize element = cv2.getStructuringElement(cv2.MORPH

Draw a curve line going through the blobs in OpenCV C++

夙愿已清 提交于 2019-12-11 03:37:21
问题 I am trying to draw a line that goes through the given blobs. The following is a given example I want a curve line that goes through multiple blobs in horizontal direction as shown below. 回答1: Just as example: import cv2 import numpy as np img = cv2.imread('image.jpg') gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) (_, contours, _) = cv2.findContours(gray, cv2.RETR_LIST, cv2.CHAIN_APPROX_SIMPLE) # biggest area target = max(contours, key=lambda x: cv2.contourArea(x)) cv2.drawContours(img,

How to overlay global map on filled contour in R language

耗尽温柔 提交于 2019-12-11 01:38:13
问题 I would like to plot some lat-lon data in a filled contour, and then overlay a map of the globe on top. I am trying something like this: filled.contour(lons, lats, glb.data, plot.axes={axis(1);axis(2);map(projection='rectangular',parameters=0,add=T)} ) The contour is plotted fine, and the map shows up, but only as a very tiny little black rectangle in a small area of the contour plot. Of course, I want the map to stretch over the entire area of the filled contour plot. I've also tried

Plotting contour lines that show percentage of particles

拈花ヽ惹草 提交于 2019-12-11 00:16:12
问题 What I am trying to produce is something similar to this plot: Which is a contour plot representing 68%, 95%, 99.7% of the particles comprised in two data sets. So far, I have tried to implement a gaussain KDE estimate, and plotting those particles gaussians on a contour. Files are added here https://www.dropbox.com/sh/86r9hf61wlzitvy/AABG2mbmmeokIiqXsZ8P76Swa?dl=0 from scipy.stats import gaussian_kde import matplotlib.pyplot as plt import numpy as np # My data x = RelDist y = RadVel # Peform

How can I overlay points and lines onto a contour plot with ggplot2?

痴心易碎 提交于 2019-12-10 23:27:16
问题 I want to annotate a contour plot with particular points that I want to highlight (where these points are stored in a different data set). When I try, I get an error: Error: Aesthetics must either be length one, or the same length as the dataProblems:z However, when I tried to make a reproducible example, I get a different error: Error in eval(expr, envir, enclos) : object 'z' not found The code for the reproducible example is below: library(mnormt) library(dplyr) library(ggplot2) f <-

Contour plot in MATLAB with constraints

一笑奈何 提交于 2019-12-10 22:48:06
问题 I'm completely new to MATLAB and have some problems. I need to make a contour plot of the following nonlinear optimization problem: In order to determine the feasible region for the function. I've tried searching on Mathworks, but haven't had any luck so far. I also have the following example: x = -5:0.005:5; y = -5:0.005:5; [X,Y] = meshgrid(x,y); F = (X.^2+Y-11).^2 + (X + Y.^2 - 7).^2; v = [0:2:10 10:10:100 100:20:200] [c,h]=contour(X,Y,F,v,'linewidth',2); colorbar yc1 = (x+2).^2; yc2 = (4*x

Smoothing geom_tile map in ggplot2 - Interpolating data

不羁岁月 提交于 2019-12-10 20:03:36
问题 I'm trying to plot an spatial map from a lon-lat data set. Following the example in https://stackoverflow.com/a/19339663/709777 I am able to almost get the desired result This is the code used (most of it from the previously cited question) library(rgdal) library(ggplot) # read province limits CV = readOGR(dsn=".", layer="poligonos_provincia_etrs89") CV.pr=subset(CV, CV$CODINE == "46" | CV$CODINE == "12" | CV$CODINE == "03" ) # convert object to data.frame CV2 <- fortify(CV.pr) # read spatial

Cut polygons using contour line beneath the polygon layers

偶尔善良 提交于 2019-12-10 02:49:58
问题 I would like to cut a polygon layer, according to the elevation, into two parts (upper and lower part). The polygon might convex or concave, and the position to cut might vary from each other. The contour line has an interval of 5m, which means I might need to generate a contour with much condensed contour lines, e.g, 1m interval. Any idea on how to do it, better in ArcGIS, or in R? Below is the running example for the Q: library(sp) library(raster) r<-raster(ncol=100,nrow=100) values(r)<-rep