LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to make a 2d array of an abstract shape drawing image

Solved!
Go to solution

@PULSE.Wannabe wrote:

but can labview do that? 


Yes, of course!

0 Kudos
Message 11 of 20
(1,283 Views)

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

 

0 Kudos
Message 12 of 20
(1,266 Views)

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.)

 

altenbach_0-1648059609192.png

 

0 Kudos
Message 13 of 20
(1,262 Views)

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

0 Kudos
Message 14 of 20
(1,251 Views)
Solution
Accepted by topic author PULSE.Wannabe

@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: 

line-net.pdf (hkust.edu.hk).

(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.

0 Kudos
Message 15 of 20
(1,248 Views)
Solution
Accepted by topic author PULSE.Wannabe

@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:

wiebeCARYA_0-1648201493597.png

 

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

 

exThere's one point that has 3 lines crossing it. That will be a mess, and processing it correctly will be a challenge.

0 Kudos
Message 16 of 20
(1,238 Views)
Solution
Accepted by topic author PULSE.Wannabe

@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.

0 Kudos
Message 17 of 20
(1,227 Views)

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 !

0 Kudos
Message 18 of 20
(1,216 Views)

thx guys for replying, It's a good reference for me in the future , I will study more then

0 Kudos
Message 19 of 20
(1,214 Views)
Solution
Accepted by topic author PULSE.Wannabe

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.

0 Kudos
Message 20 of 20
(1,201 Views)