contour

Contour levels corresponding to variable levels in ggplot2

最后都变了- 提交于 2019-12-05 02:02:00
I am trying to draw contour plot with ggplot2 and it is proving to be a little harder than I imagined. Using the iris dataset I am able to produce this plot: ggplot(iris, aes(x=Petal.Width, y=Petal.Length, fill=Sepal.Width)) + stat_density2d(geom="polygon", aes(fill=..level..)) My issue is that I can't seem to figure out how to display- rather than the density values -the raw Sepal.Width values. Here is what I've tried: ggplot(iris, aes(x=Petal.Width, y=Petal.Length, z=Sepal.Width)) + geom_tile(aes(fill=Sepal.Width))+ stat_contour(aes(colour=..level..)) This produces an especially odd error

OpenCV || contour similarity

旧时模样 提交于 2019-12-05 00:11:29
问题 As you can see in the image, I would like to compare these contours. I need my OpenCV program to return TRUE when of these contours are compared to each other. They all kind off look the same but as you can see they are not exactly the same. The result you see here is what I have returned from the function findContours. So I am looking for the right approach for similarity for these contours. Any help would be amazing. Thank you very much in advance. 回答1: Take a look at cvMatchShapes() (which

Creating a filled contour plot using data in lists

五迷三道 提交于 2019-12-04 23:58:02
问题 I have a data set that consists of 3 columns in a .csv file. The first 2 columns are map co-ordinates and the third is the percentage of zinc found in a borehole at the corresponding map co-ordinates. I would like to create a contour map to show the Zn concentration changes with distance. All of the examples of code I have been able to find use data in the form of a matrix, whereas mine are in lists. I have tried several different ways of plotting this which I have shown underneath, the

Is it possible to create a 3d contour plot without continuous data in R?

风格不统一 提交于 2019-12-04 22:54:44
问题 I want to create a contour of variable z with the x,y,z data. However, it seems like we need to provide the data in increasing order. I tried to use some code but it gave me the error. I tried the following code: Trial 1: age2100 <- read.table("temp.csv",header=TRUE,sep=",") x <- age2100$x y <- age2100$y z <- age2100$z contour(x,y,z,add=TRUE,col="black") I got the following error Error in contour.default(x, y, z, add = TRUE, col = "black") : increasing 'x' and 'y' values expected I then tried

Trying to segment characters and save it in order to image files. But contours are being drawn in a different order?

风格不统一 提交于 2019-12-04 20:38:01
This is the image input. Using python opencv. I did some pre-processing and found contours using contours,hierarchy = cv2.findContours(thresh,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE) then i did the following to save each character img1 = cv2.imread("test26.png") nu = 1 fin = "final" for cnt in contours: x,y,w,h = cv2.boundingRect(cnt) img2 = img1[y:y+h, x:x+w] img3 = Image.fromarray(img2) filename = fin + str(nu) + ".png" nu = nu + 1 img3.save(filename) But characters are saved in a tree like order. I don't understand the order. my intention is to get character by character and ocr it in order

Creating your own contour in opencv using python

試著忘記壹切 提交于 2019-12-04 18:11:34
问题 I have a set of boundary points of an object. I want to draw it using opencv as contour. I have no idea that how to convert my points to contour representation. To the same contour representation which is obtained by following call contours,_ = cv2.findContours(image,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE) Any ideas? Thanks 回答1: By looking at the format of the contours I would think something like this should be sufficient: contours = [numpy.array([[1,1],[10,50],[50,50]], dtype=numpy.int32) ,

Moving projected map on filled.contour plot

杀马特。学长 韩版系。学妹 提交于 2019-12-04 18:07:11
here is the code that produces the plot below: filled.contour(x,y,z, col=colors2, levels=breakpoints, plot.axes={axis(1); axis(2); map(add=TRUE, interior=FALSE)} ) A sample can be created using: z=matrix(rnorm(7008),nrow=96) x=seq(-176.25,180, by=3.75) y=seq(-90,90, by=2.5) filled.contour(x,y,z, plot.axes={axis(1); axis(2); map(add=TRUE, interior=FALSE)} ) However I can't seem to figure out how to crop/move the projected world map (from the 'maps' package) 3.75 degrees on/to the right side so it fits properly. This is equivalent to adding one more row onto the base of my original data matrix

Problems with finding contour in a video image using C++ FindContours

柔情痞子 提交于 2019-12-04 15:50:22
The program I'm working right now is almost done but I'm not very satisfy with the result. By using Canny algorithm, I managed to get a very clear of the object's contour but the program has some problem to recognize the contour and draw the contour with a red line. The program: void setwindowSettings(){ namedWindow("Contours", CV_WINDOW_AUTOSIZE); createTrackbar("LowerC", "Contours", &lowerC, 255, NULL); createTrackbar("UpperC", "Contours", &upperC, 255, NULL); } void wait(void) { long t=30000000; while(t--); } int main(void) { VideoCapture cap(0); // open the default camera if(!cap.isOpened(

How to keep track of different contours in opencv python

孤街醉人 提交于 2019-12-04 14:53:32
问题 I am trying to track objects with opencv in python from recorded video. I want to give a unique object nr to each visible object when it appears. For example, one object enters the screen and gets nr1, then a second joins the first and gets nr2, then the first object leaves the screen but the second is still visible and still gets object nr2 and not 1 (being the only object). I can't find any information on how to do this online. Any help (including code) is appreciated. The code I have

Android Bitmap contour

南楼画角 提交于 2019-12-04 14:39:42
问题 I'm trying to draw the contour of my drawable, I tried to use Blur, as in this page: How to make glow effect around a bitmap? Its effect is not what I want, I want a "solid" contour, not blurred. anyone knows how? 回答1: There is no outline type filter or mask that I can find, while blur and shadow mask are not very strong. Hence you could create your own effect by using color filter and scale. This example would create a red contour ColorFilter filter; filter = new PorterDuffColorFilter