Image processing - Music note blocks detection - image-processing

I have a music note sheet (like this for example)
, I want to detect the position of each block in it and then detect the vertical lines that split it, To be like this.
Can you help me how can I do this ?
Thanks in advance

You can use a Hough transform to detect lines in the image. For horizontal ones this should give you five at a time which are the staves and vertical ones may need a bit more processing to figure out what are stems and what are bar lines.

Related

How do I arc iOS elements?

I would like UIButtons to arc around a center point.
The image below shows the end result I would like, where all of the grey elements are buttons. Optimally, I would like math that supports an arbitrary amount of buttons arced around the same center, and distribute space evenly.
Can this be done with standard elements? Do I need to create a single custom shape and use as a button? Or will I need a custom shape for each of the buttons below?
You can use CAShapeLayers, each having a path that's constructed out of concentric arcs, with a fillColor. You can achieve the gap by incrementing the angle by a delta amount for each sector.
Edit: Alternatively you can create just one path, and apply a rotation transform on copies of it around the center.
Checkout this Github - https://github.com/Planet1107/CustomShapedButtons/. I think it demonstrates exactly what you need.

Shape changing blobs

Ok, I'm not quite sure if this is something I can ask here so no need to shoot me down. Just tell me and i'll delete the question :)
I had this idea of making my own clock using a touch screen and program it myself.
While thinking about this I thought of all these different styles to show the current time.
Of all the styles I came up with there was one that I found the most fun which is a clock displaying the time Rorschach style. And no not just a random smudge and guess what time it is but more like Rorschach in watchmen.
He has a mask with inkblots that constantly change shape (really cool if you ask me).
So what I had in mind is inkblots that change shape according to the digit it represents.
When the time changes
12:49:58 -> 12:49:59 the 2nd second digit will transform from 8 -> 9.
So now back to the original problem:
Before attempting to get this type of clock running I want to try to give a blob a certain shape and make it transform into another shape.
I searched on google but without any luck so I was hoping there was someone here that could point me in the right direction for making a random blob and transform it into another shape in an animation.
For example:
Draw square -> animate to circle
Any tips and tricks are welcome :)
In order to get the most simpliest animation of digit transformation you could store all posible digits in one image (verticaly) and then only partially show that image in your component. So when you want to do transformation between one digit to another you simply slide the image up and down.
Now if you are using FireMonkey you could create a 3D viewport and inside it create a cylindical object onto which will you render your texture with digits. So now you only rotate the cilinder in order to show the corect digit.

Square Cash Label Animation

Does anyone know how Square Cash animates their label?
The label does two things, appears to resize to fit the numbers on screen like SizeToFit might, but I don't believe that you can animate based on SizeToFit.
Secondly, numbers that disappear seem to animate downwards and disappear. Numbers that are entered animate down from above. That doesn't seem too tricky, but the comma does it too when we go from 4 digits to 5 digits!
I coded something similar and yes, it is very tricky to make it perfect.
It may help you to know that I used collection views. Then you can customise cell/layout transitions.
Hope this helps.
It would be helpful if you posted a short video so we could see the animation you are talking about.
Based on your description, I'm guessing that they build the full number themselves by putting a single digit/symbol on a layer (or view) and then animating each character separately.
If you have a separate tile for each symbol it is pretty easy to change the size of the previous tiles to make room for a new tile, and animate a new number tile down at the same time. You could do the animation with UIView animation or with a set of coordinated CABasicAnimations.
I know the answer is late but may be help to some other,
I developed demo screen similar to square cash you can check here

Trim and find position of result with rmagick

I'm working on a jigsaw puzzle webapp, and one of the requirements is automatically generating puzzle pieces from any image. I'm using RMagick for the image processing. I've got some sets of blank puzzle pieces to use as masks, and I can handle that part, but then I need to trim the whitespace (er, transparentspace) out of the resulting images.
Now, I know I can use trim for this - I might have to put a one-pixel border on it to make sure all four corners are the right color, but that's easy and I can just subtract one pixel from the final number. The only problem is that I also need to record the position of the piece. According to the documentation on trim, the function will "retain the offset information", which sounds like exactly what I need. But I can't find anything about how to retrieve the offset information! Does anyone know how to do that?
If worst comes to worst, I suppose I could always just look through pixel-by-pixel, find the boundaries myself, and use crop to trim the picture, but that wouldn't exactly be good for performance.
Aha, found it. image.page.x and image.page.y give the upper left corner, and then image.rows and image.columns have the height and width.

Can glscissor clip multiple area?

i am stucked in a problem and looking for help here.
I want to clip the screen, only part of the screen can be displayed. I used glscissor and met a problem. It seems like glscissor can only difine ONE rectangle on the screen, but i hava to display multiple areas at the same time, can anyone tell me how to do?
thanks.
forgive my poor english
The scrissor is limited to one rectangle, indeed. If you want to clip to multiple rectangles, you can either draw everything once per clip-rectangle, or use the stencil buffer to mask the different areas.

Resources