I have two different process each one plot 2d point, I want the two process plot in the same figure? - wxmathplot

I have two different process each one plot 2d point, I want the two process plot in the same figure ?

thanks
i want to plot in the same matplotlib figure with python code
using two process. the first one sleep(2) and the second one sleep(4)
thank you for help

Related

Can not draw multiple curves in a single graph based on conditons

I want to show multiple curves in a single graph of a webpage.
Like I want to show the values where value=4,these values will give a curve then in the same graph i want to draw the values where something's value=6..
How can I do this in Laravel??Can anyone give any tutorial of it or tell me the way??
Thanks in advance.

geopandas rasterize shpefile

I am looking for the very simplest way to rasterise a shpfile in geopandas - the equivalent to arcpy PolygonToRaster_conversion() which does things in one line.
I have found some relatively involved methods eg
https://snorfalorpagus.net/blog/2014/11/09/masking-rasterio-layers-with-vector-features/
is it this complicated? or is there a one line option like arcpy's PolygonToRaster_conversion()
I'm looking for the simplest starting point to get the idea
I've been exploring rasterio to do this, but perhaps there are other ways
I'm only just starting to use Geopandas and would appreciate any pointers
Are you trying to rasterize a set of polygons with unique values in one step? If so, you want to rasterize using that unique value for each polygon, but beware that the last polygon rasterized to a given pixel will "claim" it (i.e., multiple polygons may touch a pixel, but the last one in your list of features will be the value rasterized there).
Or do you want to rasterize each polygon independently (or all polygons at the same time, as if they were a single polygon), so that you can extract out statistics from the raster? Mask may work for this, in a loop over each feature.
The closest you are likely to get to a one-line operation is using rasterio's rio mask or rio rasterize operation. The reason that the example you link to is more involved is that you need to do a few extra things to extract a subset of your original raster. There are now a few extra methods in rasterio that make that a bit easier (docs).
From geopandas, your geometry is in a GeoSeries. I haven't tested this directly, but you may need to call the __geo_interface__ of the series to get back GeoJSON-like shapes that rasterio expects as input.

OpenCV detect tennis court lines behind net

I'm trying to implement a tennis court detector using video recorded from the phone. I filmed it from the far corner of the tennis court.
The original image is like this.
Using OpenCV Canny Edge Detection and Hough Lines transformation, I'm able to detect the lines in my own half, but not the ones behind the net. How can I improve this process and get the undetected court lines?
The processed image is as below.
Updated on 2016-08-25
Thanks guys. I understand it makes sense to derive the court lines by fitting the detected lines to the model lines. I am not going to try combinatorial search to find the best lines to fit models. Therefore, I have been trying to separate the horizontal/vertical lines in order to reduce the computational complexity. I tried RANSAC in order to find vanishing points (VP) that associate two different groups of lines, but failed probably because of detection error(?).
The scatter plot of the line parameters in polar coordinates is as below. It is basically to classify the points into two groups: the top points that form a horizontal line; the down left points that also form a line with deep slope. Is there anyway to do that? Thanks
You don't need to detect the lines behind the net. You know the ground is a flat plane, you know the dimensions of each side of the court are the same - so you only need to detect the nearby lines and you can calculate where the missing lines are.
In fact you really only need to detect a single corner if you know the characteristics of the camera+lens.
In addition to Martin's comments, you might try using some kind of blur on the image before running your edge/line detection. With some tuning, you should be able to remove the signal of the net and maintain the court lines.
Another approach would be to reduce the thick lines to a single pixel by scanning the image left to right (for example) to detect transitions from red/green to white and back to red/green again. When this occurs, you can estimate that the midpoint of those two transitions is the midpoint of a court line. This would give you data you could feed directly into your Hough transform. This of course requires you to classify individual pixels as either court or line, which it seems like you aren't currently doing. This process can also be performed top-to-bottom to produce a second set of midpoint estimates.
For blurring, try a Bilateral filter
Example input image:
cv2.bilateralFilter(img_gray,30,25,75)
output image:

Overlay images in MATLAB using predefined points

Basically what I'm trying to do is overlay two images using predefined points on each image.
The images will be of two different sizes probably or scaled differently, don't know this for sure yet. But the images are of the same thing. So what I want to do is say this spot on image one is the same as this spot on image 2. And do this for multiple spots and then have matlab resize or transform to get all those points lined up so that the two images can be overlayed. The thing thats confusing me is having matlab automatically adjust the images so that they can "fit" together.
I have no idea where to start on this, and was just hoping to get a general idea of what i may be able to do.
Just incase someone else knows how to do this I'll throw in what else I need to do. After the two images are on top of each other, one images will be a region map the other a real image. What I need matlab to do is count the amount of dots from the real image in each region of the map.
Thanks for any help.
What you are trying to do is called image registration which is a very common image processing task. You wont need to write much code because matlab has built in functions for this. You use the cp2tform to create a transform from the first to second image and can then apply the transform to the first image using imtransform function. The code will look something like this assuming x,y coordinates of the control points are in an m by 2 matrix called points1 for image1 and points2 for image2.
tform= cp2tform(points1, points2 , 'similarity');
imtransform(image1, tform);

Generate lines from photo/image

I would like to generate the outlines/lines of an image.- I know you can use a laplacian filter to generate the outline image but I need to take it one step further. I want to actually receive an array of lines (that can consist of multiple line segments) descibing the image. Are there existing algorithms to do that? Do you have any ideas to get there from an outline image?
Thanks
As long as the lines are straight (or can be parametrized in an adequate way), you might use hough transform.

Resources