contour

OpenCV - Finding contour end points?

此生再无相见时 提交于 2019-12-19 11:24:23
问题 I'm looking for a way to get the end points of a thin contour extracted from a Canny edge detection. I was wondering is this is possible with some built-in way. I would plan on walking through the contour to find the two points with the largest distance from each other (moving only along the contour), but it would be much easier if a way already exists. I see that cvarcLength exists to get the perimeter of a contour, so it's possible there would be a built-in way to achieve this. Is it are

Program hangs when using “matplotlib.mlab.griddata”

本小妞迷上赌 提交于 2019-12-19 09:53:13
问题 I have written a script (Python 2.6) to grid data in x,y,z (.csv format), and display a contour plot of the data. The script works for some datasets but not others - even though both datasets were created using the same script. The datasets to be plotted are created by sub-sampling from a master dataset. Here is an example of every_4.csv (master dataset sub-sampled for every 4 rows). Easting Northing TMI_nT 526243.0 5254128.9 62278.8 526259.4 5254128.9 62352.3 526275.9 5254128.9 62303.3

Program hangs when using “matplotlib.mlab.griddata”

天大地大妈咪最大 提交于 2019-12-19 09:52:02
问题 I have written a script (Python 2.6) to grid data in x,y,z (.csv format), and display a contour plot of the data. The script works for some datasets but not others - even though both datasets were created using the same script. The datasets to be plotted are created by sub-sampling from a master dataset. Here is an example of every_4.csv (master dataset sub-sampled for every 4 rows). Easting Northing TMI_nT 526243.0 5254128.9 62278.8 526259.4 5254128.9 62352.3 526275.9 5254128.9 62303.3

Creating a trellised (faceted) thin-plate spline response surface

天大地大妈咪最大 提交于 2019-12-19 09:18:20
问题 I am trying to plot a bunch of thin-plate spline response surfaces for measurements related to two continuous variables plus one discrete variable. So far, I have been subsetting the data based on the discrete variable to generate pairs of plots, but it seems to me there should be a way to create some slick trellised plots instead. It seems like this could be done by faceting heatmaps in ggplot2 with geom_tile and geom_contour , but I am stuck on (1) how to reorganize the data (or interpret

R - Contour map

牧云@^-^@ 提交于 2019-12-19 09:07:19
问题 I have plotted a contour map but i need to make some improvements. This is the structure of the data that are used: str(lon_sst) # num [1:360(1d)] -179.5 -178.5 -177.5 -176.5 -175.5 ... str(lat_sst) # num [1:180(1d)] -89.5 -88.5 -87.5 -86.5 -85.5 -84.5 -83.5 -82.5 -81.5 -80.5 ... dim(cor_Houlgrave_SF_SST_JJA_try) # [1] 360 180 require(maps) maps::map(database="world", fill=TRUE, col="light blue") maps::map.axes() contour(x=lon_sst, y=lat_sst, z=cor_Houlgrave_SF_SST_JJA_try[c(181:360, 1:180),]

OpenCV C++/Obj-C: Connect nearby contours

旧街凉风 提交于 2019-12-18 17:08:29
问题 Is there a function to connect two (or more) nearby contours? Take a look at my in-/output and you'll see what I mean … My code: [... some processing ...] // getting contours std::vector<std::vector<cv::Point> > contours; findContours(input, contours, CV_RETR_EXTERNAL, CV_CHAIN_APPROX_SIMPLE); // approximate contours std::vector<std::vector<cv::Point> > contours_poly( contours.size() ); for( int i = 0; i < contours.size(); i++ ) { approxPolyDP(cv::Mat(contours[i]), contours_poly[i], 5, true )

Drawing an iso line of a 2D implicit scalar field

我的未来我决定 提交于 2019-12-18 16:59:26
问题 I have an implicit scalar field defined in 2D, for every point in 2D I can make it compute an exact scalar value but its a somewhat complex computation. I would like to draw an iso-line of that surface, say the line of the '0' value. The function itself is continuous but the '0' iso-line can have multiple continuous instances and it is not guaranteed that all of them are connected. Calculating the value for each pixel is not an option because that would take too much time - in the order of a

How can I calculate the area within a contour in Python using the Matplotlib?

自古美人都是妖i 提交于 2019-12-18 13:36:53
问题 I am trying to figure out a way to get the area inside a specific contour line? I use matplotlib.pyplot to create my contours. Does anyone have experience for this? Thanks a lot. 回答1: From the collections attribute of the contour collection, which is returned by the contour function, you can get the paths describing each contour. The paths' vertices attributes then contain the ordered vertices of the contour. Using the vertices you can approximate the contour integral 0.5*(x*dy-y*dx), which

OpenCV, how to use arrays of points for smoothing and sampling contours?

﹥>﹥吖頭↗ 提交于 2019-12-18 11:27:42
问题 I have a problem to get my head around smoothing and sampling contours in OpenCV (C++ API). Lets say I have got sequence of points retrieved from cv::findContours (for instance applied on this this image: Ultimately, I want To smooth a sequence of points using different kernels. To resize the sequence using different types of interpolations. After smoothing, I hope to have a result like : I also considered drawing my contour in a cv::Mat , filtering the Mat (using blur or morphological

Opencv match contour image

最后都变了- 提交于 2019-12-18 10:29:18
问题 I'd like to know what would be the best strategy to compare a group of contours, in fact are edges resulting of a canny edges detection, from two pictures, in order to know which pair is more alike. I have this image: http://i55.tinypic.com/10fe1y8.jpg And I would like to know how can I calculate which one of these fits best to it: http://i56.tinypic.com/zmxd13.jpg (it should be the one on the right) Is there anyway to compare the contours as a whole? I can easily rotate the images but I don