Can't figure out how to segment overlapped digits from captcha - opencv

i'm writing an application for solving captcha. Original captcha looks like this:
Original captcha
After I apply erosion+dilation it looks like this:
erosion+dilation applied
Finally I find contours for further segmentation. Obviously, I can cut "1" from the image as it's not connected with other digits. But how can I separate 5 from 7, and 7 from 8, and two zeros on the right in this case? On the first link I see that 5 and 7 are not overlapped, this way i can somehow remember it and use after applying erosion+dilation. Maybe drawing white vertical line. But still i have problems with 7 and 8.
Any help and advises are appreciated!

What you need is a technique called skeletonization, https://en.wikipedia.org/wiki/Topological_skeleton
It will help in this specific case.

Related

Highcharts Gantt / X labels disappear randomly

Sorry to bother "again", we have a couple of important questions, we noticed that some of the X labels disappear randomly, my understanding is that sometimes, when we don't have space, labels should hide but this behavior is happening even if there's space, we have version 10.3.1 of Gantt, please check the following for better understanding:
and also...
Now we would like to ask if there's a solution for this? or an update? also would like to ask something related... as you can see in the images, we have divided the X into 3 lines, years, quarters and months, is there a way to have the months 3 letters as shown when there's enough space and show only the month initial when the space is reduced?
Thank you for any help you may bring!
You may try setting the padding to 0 or to set allowOverlap=true
https://api.highcharts.com/highcharts/plotOptions.series.dataLabels.allowOverlap

using excel to show Increase, Decrease and no change in Multiple colours

Looking for some help or to be pointed in the right direction. Been stuck on this for a while and the main issue is I don't even know where to start. I am sure there is a solution but my brain will not see it.
To use as an example I have a table that shows monthly results for multiple different areas:
What I want to do is in the gap along side each number is show an increase, decrease or no change, using up arrow down arrow and square. That I can do using conditional formatting my issue comes with the fact that I also want it to be multiple Colours. So it will take into account increase and decrease and whether they are in target.See below:
Atm I am copying and pasting each month. But having it automated would be amazing. The outcome would hopefully look like this:
I am hoping there is a way that I can do two things compare to the previous month and then check it against my table to see where it sits then display the appropriate symbol.
Thank you in advance for any help or a place to start.
So extremely easy to figure out once I looked at it in a simplistic way.
Firstly, I used: =IF(-SIGN(E26-G26)= 0, "n", IF(-SIGN(E26-G26)=1, "é", IF(-SIGN(E26-G26)=-1, "ê","")))
To compare the current number to the previous number and get a 1, 0 or -1 depending on if it had gone up down or stayed the same, using this it either displays é, n or ê. I then set the font on these cells to Wingdings. so they become up arrow, down arrow and a square.
Then I use conditional formatting to colour it based on the adjacent cells value.
No need for a long, complex formula
=IF(A2>A1,"t",IF(A2<A1,"u","v")) - set the font to Marlett

Changing text adjustment in UIView using swift

I've been trying to create my app and something is bugging me very much,
I have images of what I am trying to achieve:
1)
2 )
number 1 shows what I am trying to do, the letters are "squeezed" together making the text appear tighter with a short width even though the letter sizing is big.
number 2 shows my attempt to achieve this, I tried multiple different ways to get that same look but failed for hours, does anyone have any suggestions or know how to make the text look like that in the first picture?
I appreciate any help, thank you!
The only way how to do it AFAIK is to use transform on UILabel, like this:
let widthTransform = 0.8 // Shrink label to 80% of its width
label.layer.transform = CATransform3DMakeScale(widthTransform, 1.0, 1.0);
Hope it helps!
Note* that transform work for about 30% of decrease (even less imo), then it just starts to look very bad. You can also change text spacing, but if you calculate it dynamically, you could end up with negative one and that looks terrible. The easiest way really is then just change of the design :)
Options:
You can decrease character spacing like in this answer
and increase font size.
Having fun with transformation on layer is really awful idea, as later you won't be able to get the height of text etc -> just everything will be working wrong.
You can also just use different font.

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 ?

Find available grid position

I'm building a color box connecting game with objective-C and trying to figure out how to find the correct position when a block of boxes is placed incorrectly over another block of boxes.
See the attach image. In the image, you only need to move the left box one step to the right in order to connect the boxes and win.
However, if you place the left box on top of the other box (Image 2), I want to move it to the closest available free grid position.
This would be easy if the box was a simple square (a 1x1 grid, 2x2 grid, etc), but since the boxes can be complex, It's harder. There might also be a lot of boxes on the grid.
Any suggestions would be very appreciated.
If you're new to heuristics like this, just take the KISS approach.
It couldn't be easier...
The user tries the object at x,y ok?
It does not "fit" there.
So, simply "spiral" outwards, trying it in other possible places.
Just keep trying until you find one where it fits.
234
915
876
so that's like "radius 1", you see? then try "radius 2"
and so on.
It's that easy. Just keep trying until you find one that "does work".
Work from the start position outwards, so that, you find the closest one.

Resources