How to connect lines using angle? - image-processing

Working in Julia, I've a set of lines on an image. Each line has a separate label assigned to it. The following image shows Note that these lines are not straight always, for instance,
I've used the solution here. I'm working on the result of this statement labels = label_components(thinned, trues(3,3)). So I'm not sure how to get angle per label. I was thinking some PROTOTYPE like
for label in labels
getangle_per_label(label)
end
then
interpolate labels with similar angles
I'm not sure how to implement it, any ideas?

Related

How can I get the CIAttributedTextGenerator filter to break onto multiple lines?

I'm working on an app that overlays text onto an image. We want to be able to constrain the width of the text and have it break onto multiple lines, much in the same way that UILabel does when we set numberOfLines = 0. In my mind, this should be possible by constraining the extent that the filter has to work within somehow, or by chaining it with a clamp (since the output bitmap is generated lazily.) Unfortunately, nothing I've run into seems to do the trick:
The CIClamp approach generates a nil outputImage when provided a CIVector(cgRect:) argument
There doesn't seem to be a way to specify a CIFilterShape to draw the text within when using the bundled filters
You can provide a CIFilterShape when invoking CIKernel.apply but a) I don't have a custom CIKernel (and am hoping not to write one) and b) I don't have a way to extract the kernel from the CIAttributedTextGenerator filter
I'm resigning myself to manually computing line breaks but it really seems like Core Image ought to be able to handle this use case. Am I just missing something?

Is it possible to simulate a erase action without having to create an extra shape in KonvaJS?

I am following this guide which contains a brush and eraser functionality. The guide's code sets the "globalCompositeOperation" to "destination-out" and basically ends up creating another line that will cover whatever you have drawn before with the brush.
This would work pretty well in some cases, but if I made my "destination-out" lines not-draggable and the "source-over" lines draggable, then if I drag the "source-over" lines around the canvas these lines would still be intact and it would not look like as if they were erased.
In a better attempt to explain my problem, I provide you this example: If I were to create two parallel lines, line1(x1,y1) and line2(x2,y2), and then I decide to draw a "destination-out" line in the middle of both, is there a way I can keep that "erased" part in the middle of line1 and line2 if I were to move one of the lines away from the "destination-out" line?
I'm sure it is not like this, but is it possible to change certain points inside the line as "destination-out" while the rest of the points are "source-over" If not, how can we simulate this action without having to create a long static extra "destination-out" line?

howto draw a text with alignment centered in simpliest way. (ios , swift)

I would like to draw a text in my custom view at point X,Y with center allignment. In case the text would be "SUGUS", I expect to have the Character G at Point X,Y.
I tried several things with NSString.drawinRect(), where I have to provide the width of the text, which has to be measured first depending on the Fonttype. It worked, but for me thats not a straightforward solution.
I purposely did not add code here, because a first try with code was misleading and I hope someone can help me with a clean simple solution ?

Coreplot: Axis Labels Fixed Location

I'm trying to customize a Coreplot graph in many ways I can and the next thing I would like to do is place the X Axis Labels (one that is custom as well) at the bottom of the graph, independent of the X axis' position (whether it's scrolled up or down).
To make it clear, it is similar to giving the labels an offset value of something like 50.0. But offset is not the property I'm looking for since it fixes the labels location relative to the X axis.
Any way this can be done? Or do I have to skip the axisLabels property and place and layer or something manually at the bottom of the graph?
EDIT: Alright, I managed to place an axis on the bottom with CPTConstraints. But it's not on the bottommost. If a plot point is on those levels, the plot line overlaps the labels. I tired padding of the graph but of course, it moves the whole graph, hence the issue persists.
Thanks in advance
Make a second x-axis. Have the first one draw the axis line, tick marks, etc., as normal but no labels. Label the second one and set all of the line style properties to nil so it doesn't draw any of the lines.
Turns out that aside from the graph, the plotAreaFrame property of the CPTGrpah also has paddings. If you give more paddings to plotAreaFrame than that of the graph, the plot will be drawn in a smaller frame and the rest of the graph area will be for you to add what you want (i.e., a second Axis).
Big thanks to #Eric, for trying to answer Every single CorePlot question as soon as possible.
CorePlot does have a lot of customisation than I thought.

How can I make Core Plot to show an x-axis label for each point in time?

Apart from the issue I am trying to fix atm, I would like to know how I can make the x-axis labels to draw wherever there is a point drawn. As you can see on the screenshot there are three points in time. So instead of the label "1/10/54' (yes that is year 54) floating nowhere, I want three labels, one below each point.
(Note the 3 points are only for illustration, needs to be expandable.)
If the spacing between the labels will be irregular like your sample screenshot, you'll want to change the axis labeling policy to CPTAxisLabelingPolicyNone or CPTAxisLabelingPolicyLocationsProvided. Both policies require you to provide the tick locations. The first policy also requires you to make custom labels that don't have to be at the same locations as the tick marks while the second will automatically make labels at each tick location using the standard label formatter.

Resources