contour

How can I contour plot a custom function?

安稳与你 提交于 2019-12-23 16:27:25
问题 I have a custom function which returns either 0 or 1 depending on two given inputs: function val = myFunction(val1, val2) % logic to determine if val=1 or val=0 end How can I create a contour plot of the function over the x,y coordinates generated by the following meshgrid? meshgrid(0:.5:3, 0:.5:3); This plot will just simply display where the function is 0 or 1 on the contour map. 回答1: If your function myFunction is not designed to handle matrix inputs, then you can use the function ARRAYFUN

Find contour of the set of points in OpenCV

点点圈 提交于 2019-12-23 15:29:52
问题 I try to find objects on image by MSER-detection from OpenCV. But function cvExtractMSER return not contours, but set of points ( CvSeq ), that create figure: (1, 4), (2, 3), (2, 4), (3, 2), (3, 3), (3, 4), (4, 1), (4, 2), (4, 3), (4, 4), ... But I needs only points of contour: (1, 4), (8, 4), (8, 1), (4, 1) How I can find this contour? I think, that simplest (but not fastest) way is: draw b/w image with all points (how? point-by-point?) use findContours for find contours on new image 回答1:

Equally spaced points in a contour

不想你离开。 提交于 2019-12-23 12:56:13
问题 I have a set of 2D points (not ordered) forming a closed contour, and I would like to resample them to 14 equally spaced points. It is a contour of a kidney on an image. Any ideas? 回答1: One intuitive approach (IMO) is to create an independent variable for both x and y . Base it on arc length, and interpolate on it. % close the contour, temporarily xc = [x(:); x(1)]; yc = [y(:); y(1)]; % current spacing may not be equally spaced dx = diff(xc); dy = diff(yc); % distances between consecutive

Equally spaced points in a contour

混江龙づ霸主 提交于 2019-12-23 12:55:28
问题 I have a set of 2D points (not ordered) forming a closed contour, and I would like to resample them to 14 equally spaced points. It is a contour of a kidney on an image. Any ideas? 回答1: One intuitive approach (IMO) is to create an independent variable for both x and y . Base it on arc length, and interpolate on it. % close the contour, temporarily xc = [x(:); x(1)]; yc = [y(:); y(1)]; % current spacing may not be equally spaced dx = diff(xc); dy = diff(yc); % distances between consecutive

How do I plot 3 contours in 3D in matplotlib

谁说我不能喝 提交于 2019-12-23 05:15:14
问题 I have 3 contours, generated by the following: import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from scipy import stats mean0 = [ 3.1627717, 2.74815376] cov0 = [[0.44675818, -0.04885433], [-0.04885433, 0.52484173]] mean1 = [ 6.63373967, 6.82700035] cov1 = [[ 0.46269969, 0.11528141], [0.11528141, 0.50237073]] mean2 = [ 7.20726944, 2.61513787] cov2 = [[ 0.38486096, -0.13042758], [-0.13042758, 0.40928813]] x = np.linspace(0, 10, 100) y = np.linspace(0,

PHP Imagick outline/contour and sketch

谁都会走 提交于 2019-12-23 04:26:49
问题 I have a problem with getting fine contour of the image . How to do it with PHP Imagick? Input image: Imagick wizard Plan #1 Outline Get image with (more/less) clear, consistent background (for example: white, red or transparent) Remove background if it is set Add outline (specific color) Remove image inside Result: http://i57.tinypic.com/2wg91qx.png Plan #2 Sketch Get image with (more/less) clear, consistent background (for example: white, red or transparent) Remove background if it is set

Draw heat map (or similar) of 2D population distribution

╄→гoц情女王★ 提交于 2019-12-23 02:34:41
问题 I am wondering how I can draw an image of the population proportion (pop.prop) at these locations (x and y) so that I can see the population distribution clearly? The data is shown below: pts.pr = pts.cent[pts.cent$PIDS==3, ] pop = rnorm(nrow(pts.pr), 0, 1) pop.prop = exp(pop)/sum(exp(pop)) pts.pr.data = as.data.frame(cbind(pts.pr@coords, cbind(pop.prop))) x y pop.prop 3633 106.3077 38.90931 0.070022855 3634 106.8077 38.90931 0.012173106 3756 106.3077 38.40931 0.039693085 3878 105.8077 37

Overlapping polar countourf and scatter plot

我的未来我决定 提交于 2019-12-22 18:37:46
问题 Thanks to this very helpful post, I finally figured out how to make a polar filled-contour plot. However, when I moved to the next step and tried to add a scatter point to the same plot, I ran in some problems. Here is the original script: import numpy as np import matplotlib.pyplot as plt #-- Generate Data ----------------------------------------- # Using linspace so that the endpoint of 360 is included... azimuths = np.radians(np.linspace(0, 360, 20)) zeniths = np.arange(0, 70, 10) r, theta

How to filter small segments from image in OpenCV?

怎甘沉沦 提交于 2019-12-22 10:55:17
问题 I am printing the Contours in the following way: std::vector<std::vector<cv::Point> > contours; std::vector<cv::Vec4i> hierarchy; cv::findContours( mask, contours, hierarchy, cv::RETR_CCOMP, cv::CHAIN_APPROX_TC89_KCOS); for ( size_t i=0; i<contours.size(); ++i ) { cv::drawContours( img, contours, i, Scalar(200,0,0), 1, 8, hierarchy, 0, Point() ); cv::Rect brect = cv::boundingRect(contours[i]); cv::rectangle(img, brect, Scalar(255,0,0)); } Once I have a binnary image, I want to eliminate the

A good way to identify cars at night in a video

浪子不回头ぞ 提交于 2019-12-22 10:28:37
问题 I'm trying to identify car contours at night in a video ( Video Link is the link and you can download it from HERE ). I know that object detection based on R-CNN or YOLO can do this job. However, I want something more simple and more faster beacause all I want is to identify moving cars in real-time . (And I don't have a decent GPU.) I can do it pretty well in the day time using the background subtruction method to find the contours of cars: Because the light condition in the day time is