I took time looking for ways to make a simple graph, only about showing a line that goes from one point to another point and curves along the way that will be the benchmarks, I've only found a way to make complex graphs with straight lines, would appreciate any reference or support, thanks
I leave a picture of what I want
http://i.stack.imgur.com/5DCRr.png
Quartz2D(Core Graphic Framework) is suggested.
You can draw straight line, rectangle, circle, ellipse, curve(of a circle), or Bezier curve.
Related
Edit: Upon further research, I've came across similar questions. I guess the process is not as trivial as using the WarpPerspective() function. Here is a similar question and an answer.
I'm using methods like thresholding and canny to extract a rectangular shape from books. Sometimes the rectangles (contours) are deformed like this (pages are not always flat):
As you can see the bottom line is not a straight line. I need to warp it into a rectangle to do further analysis of its inside contents.
Normally, I use WarpPerspective() using the 4 points I get from ApproxPolyDP() with a contour like this and it works fine:
But I can't figure out what to do with a curved rectangle. Here is what I get using the method I use on non-curved rectangles. It's close but not quite what I want:
I am trying to draw a chainsaw (just the blade) with ios core graphics, but getting stuck at a point, so far I've drawn something like this:
It looks ugly but I was just trying to see if I can draw one, and then do proper finishing later. The issue is that I can draw the teeth on the top and bottom flat sides but I have no idea how to draw the teeth around the curved corners. I've drawn the ellipse myself so I know where the coordinates are for the flat surfaces, but I don't know how to calculate the round corners. My questions are:
Is there an easy way to draw the teeth on the rounded corners ?
Is there a totally different and much better way to draw something like this in core graphics ?
The last question is regarding animating the chainsaw. I was hoping that if I can finish the drawing, then I can use a timer and redraw the teeth again with an offset, and then alternate between the two drawings to give a moving effect. Would that be the right way to go, or is it not worth doing such animation using core graphics and using something like an animated gif would be a better way ?
I am new to core graphics so don't know much details. I can imagine that there are multiple ways to achieve what I am doing, but what I mean when I say "is it the right way to do this" is it one of the right ways to do this, or I am going down a completely wrong path. Thanks !
(1) Drawing teeth around the rounded corner is a matter of identifying the points of the teeth. Consider that the inner-facing points of three teeth will fall along the rounded corner at angles: 1/8pi, 3/8pi, 5/8pi and 7/8pi.
The outer-facing points of those same three teeth will fall on a circle concentric to the rounded corner with a larger radius (larger by the height of a tooth). Those will fall at 1/4pi, 1/2pi and 3/4pi. The same idea can be reflected to the x<0 rounded corner on the left side. (or maybe not, maybe that side will be the chain saw's rectangular motor).
(2) I can't think of a totally different, much better way to do the drawing, except to point out that it could be done more realistically with an image (at least the static part).
(3) Probably wouldn't use a timer explicitly. I think the right way to go would be to place the chain on it's own CAShapeLayer. Have two (or more) chain paths (offset by some small phase shift in the placement of the teeth points). Add a repeating CABasicAnimation to the layer which alternates between the two paths.
I'm using LeapMotion with Processing.
I want to draw a triangle with my hands , and make these line straight .
and my data is all 2D point(x,y) per frame
The triangle what I draw absolutly not straight.
So first I use "linear Regression" to draw a straight line.
and my question is
What time the user turn when they draw a triangle?
(my opinion is to us "angle extremes" to detect what time its turn.)
Is there some image processing technology to use?
If you have the parametrized model of all 3 lines, what you need to do is find for each pair of lines the point that is the least distance from the two lines.
That is your corner.
For the lines, one linear regression would probably not do. Perhaps do some ransac to find the lines and K-means to cluster the points to their lines.
I will draw a curve similar to the red curve in the illustration below (can be a bezier or whatever is most convenient for my purposes I think). I would like to find points on the curve (blue dots in the illo). The points would most likely be divisions of equal parts of the length of the curve.
Can I find these points? I am not seeing a solution in the docs as of yet.
This answer covers segmentation of a Bezier curve using the de Casteljau algorithm. You already have your parameterized values along the curve for segmentation.
(If you follow the link referenced in the answer make sure you have java enabled in your browser, so you can view the example visualisations).
did somebody tried to find a pizzamarker like this one with "only" OpenCV so far?
I was trying to detect this one but couldn't get good results so far. I do not know where this marker is in picture (no ROI is possible), the marker will be somewhere in the room (different ligthning effects) and not faceing orthoonal towards us. What I want - the corners and later the orientation of this marker extracted with the corners but first of all only the 5Corners. (up, down, left, right, center)
I was trying so far: threshold, noiseclearing, find contours but nothing realy helped for a good result. Chessboards or square markers are normaly found because of their (parallel) lines- i guess this can't help me here...
What is an easy way to find those markers?
How would you start?
Use other colorformat like HSV?
A step-by-step idea or tutorial would be realy helpfull. Cause i couldn't find tuts at the net. Maybe this marker isn't called pizzamarker -> does somebody knows the real name?
thx for help
First - thank you for all of your help.
It seems that several methods are usefull. Some more or less time expansive.
For me it was the easiest with a template matching but not with the same marker.
I used only a small part of it...
this can be found 5 times(4 times negative and one positive) in this new marker:
now I use only the 4 most negatives Points and the most positive and got my 5 points that I finaly wanted. To make this more sure, I check if they are close to each other and will do a cornerSubPix().
If you need something which can operate in real-time I'd go down the edge detection route and look for intersecting lines like these guys did. Seems fast and robust to lighting changes.
Read up on the Hough Line Transform in openCV to get started.
Addendum:
Black to White is the strongest edge you can have. If you create a gradient image and use the strongest edges found in the scene (via histogram or other) you will be able to limit the detection to only the black/white edges. Look for intersections. This should give you a small number of center points to apply Hough ellipse detection (or alternate) to. You could rotate in a template as a further check if you wish.
BTW.. OpenCV has Edge Detection, Hough transform and FitEllipse if you do go down this route.
actually this 'pizza' pattern is one of the building blocks of the haar featured used in the
Viola–Jones object detection framework.
So what I would do is compute the summed area table, or integral image using cv::integral(img) and then run exhaustive search for this pattern, on various scales (size dependant).
In each window you are using only 9 points (top-left, top-center, ..., bottom left).
You can train and use cvHaarDetectObjects to detect the marker using VJ.
Probably not the fastest method but it should work.
You can find more info on object detection methods using OpenCV here: http://opencv.willowgarage.com/documentation/object_detection.html