03-22-2022 11:19 AM
03-23-2022 11:59 AM
do you know how?
to put every black pixel's position (x,y) to a 2d array ?
example :
(0,0 starts from left bottom)
1,1
2,2
3,3
4,4
4,5
5,6
etc until the end of the line
03-23-2022 01:22 PM
Here's something to get you started:
(initialize an array of the desired datatype and size and keep it in a shift register. repeatedly use "replace array subset" with the desired xy positions, taking care that you want 0,0 in the bottom left, and go from there.)
03-24-2022 11:00 PM
To better understand Altenbach's logic as it applies to your goal, put a Wait function with, say, 1000 wired to the delay (to make the loop run once a second) and see the line being drawn ...
Bob Schor
03-25-2022 04:37 AM - edited 03-25-2022 04:40 AM
@PULSE.Wannabe wrote:
but can I obtain which position / where did I start my drawing ?for example : I start drawing a straight line from bottom left paper, then I make a star shape, then from the last point, I make a zigzag line until it reach the end of the top right corner paper
Of course not.
How would a computer be able to tell where you started? There's no distinction between the start and the end of a line.
To determine time order, you'd need multiple frames.
Unless of course the computer knows you start in the bottom left corner. But then the question:
@PULSE.Wannabe wrote: can I obtain which position / where did I start my drawing ?
is pretty easy to answer: in the bottom left corner 😁.
In all seriousness, this isn't easy. It's stuff dozens of people study for years.
You need a good plan, and you probably want to search the internet for one.
For instance:
(PDF) Adaptive Vectorization of Line Drawing Images (researchgate.net)
I've seen studies about neural networks, fuzzy logic, fuzzy neural networks, dynamic programming algorithms to do this. Again, it's not easy.
Of course it can be easy if you limit the problem, to for instance 1 continuous line. Usually the more you limit the problem, the easier it gets.
03-25-2022 04:49 AM - edited 03-25-2022 04:53 AM
@Bob_Schor wrote:
To better understand Altenbach's logic as it applies to your goal, put a Wait function with, say, 1000 wired to the delay (to make the loop run once a second) and see the line being drawn ...
Bob Schor
It seems to me OP is trying to do the opposite.
There is an array with 0's and 1's (the image) and (s)he wants to get a list of all coordinates that are 1.
That's also pretty easy:
But connecting the coordinates to form a line is tricky.
You could simply connect each coordinate to the nearest coordinate. That would even work when there are gaps.
But it won't work if lines get thicker (e.g. 2 pixels). You can dilate the image to prevent that, or do a skeleton operation.
The other big problem is crossings. If a coordinate is next to more then 1 coordinate, you need to choose. Obviously, you want to choose the opposite coordinate, but in the digital world, it's not that easy.
For example
There's one point that has 3 lines crossing it. That will be a mess, and processing it correctly will be a challenge.
03-25-2022 01:07 PM
@Bob_Schor wrote:
To better understand Altenbach's logic as it applies to your goal, put a Wait function with, say, 1000 wired to the delay (to make the loop run once a second) and see the line being drawn ...
In that case, the indicator would need to go inside the loop of course.
03-28-2022 03:53 AM
Yes I also thought about multiple frames , but it needs to be : 1 pixel / frame to be accurately 1 position updating every wait (ms) , but the problem is to set accurately
Yeah this is hard , I will study more stuff then , thx for the reply !
03-28-2022 03:55 AM
thx guys for replying, It's a good reference for me in the future , I will study more then
03-28-2022 09:55 AM
All you need to do is set the dimensions of the initialized array to your camera resolution, watch for changed pixels and replace the elements accordingly. A 2D array indicator gets too big here, so display it in an intensity graph instead.