Hi I am trying to implement a polygon with a color gradient based on the color of each corner (the polygon is an overlay for a map). Up until now I have been using MKPolygon. Any Guidance will be appreciated.
Thanks,
To Achieve my result I wrote a for loop that iterated through all the points, which had a for loop inside that subtracted a value from the other points to make the polygon smaller and created a polygon this was done until the polygon was small enough for the view. This gave it a nice gradient and doing it for the other cornea with different colors gave the desired gradient of colors.
Related
I'm working on a project which locates the Machine Readable Zone on ID cards.
For this I need to do some pre processing to extract the ID card from a scanned image which typically are randomly disposed on a white page. I'm able to locate the majority of the cards by using a Histogram equalization with CLAHE before a contour detection. But in some cases the border around the MRZ is totally invisible (white on white) as shown on the attached image.
I'd like to detect rectangle of a predefined shape as I know the shape of the ID card will be always the same but so far I wasn't able to find a way do do something like this with OpenCV.
Basically what I need is to find two rectangle of a fixed ratio that best match the 2 cards on the scan.
I'm wondering if I need to try OpenCV matchers or if there is a simpler way to accomplish this kind of detection.
The solution to you problem is likely going to be matrix transformations. The concept is to pinpoint 4 coordinates on the card that can be easily detected using opencv, such as the the rectangle colored in blue & cyan.
Have coordinates of the card with the predefined shape stored in an array, where a corner of the card is at the 0, 0. Also store the coordinates of the blue * cyan rectangle in an array. With the two arrays you can find the perspective transform of the two arrays using the cv2.getPerspectiveTransform method.
Using the perspective transform found, you can detect the coordinates of the whole card every time you detect the coordinates of the blue & cyan rectangle.
I am wondering if there is a way to draw a polygon on top of a MKMapView where each vertex in the polygon could potentially have a different color. The triangles of the polygon would correctly blend the colors together when rendered.
I know I can do this with OpenGL, but I would like to try to use CoreGraphics or a drawing function of MapKit first, as I don't know how well OpenGL works on top of a MKMapView.
I know there is support to fill a polyline with a gradient. Is there a similar way to fill a polygon/triangle with multiple gradients to achieve the desired effect?
I managed to draw this circle with segments using core graphics.
The circle is drawn using CGContextFillEllipseInRect and I added lines on top of it using CGContextStrokePath.
Is it possible to add interactivity to this circle segments to identify which segment area was touched by the user?
How Can I change the behaviour of each segments in the circle, for example Color, image & title for each segments?
If you know the centre of the circle and you know the touch position it is fairly easy to calculate the angle that the touch is at.
Then it's just a case of separating the angles into different sections and reacting to the touch accordingly.
I need some help to create borders like in the pic below.
how can I create borders like this?
Some clues
Draw two ellipse with same center,one large A and other small B
Get the points at regular intervals on an ellipse
These points will be the starting and ending point and draw small arc ,Mathematically calculate the values and implement it
This is an excellent tutorial to help you drawing arcs and some basic calculation
I need to draw shape filled with special color in Corona SDK.
I'm trying draw vector map, where shapes will be as buildings.
The problem is object retuned by display.newLine() don't have setFillColor() method.
So, vector shape is empty (I see background through it), only stroke color can be changed via line:setColor().
How can I fill polygon shape with color?
Thanks.
There are a few polygon fill algorithms.
Have a read here :
http://alienryderflex.com/polygon_fill/
http://www.siggraph.org/education/materials/HyperGraph/scanline/outprims/polygon6.htm
And there is a nice implementation in Code Exchange!
http://developer.anscamobile.com/code/polygon-fill-and-point-polygon-detection