LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

help,calculate irregular region

Heloo!
 
Need me help about calculate area irregular region who
draw on picture.vi..
For the first time work in LabView,an I have
problems with arrays....
Do you somebady have make such example in LabView 6.1 ?
0 Kudos
Message 1 of 7
(3,563 Views)
Hi 2134123,
 
I never know you could use numbers as a forum name. 🙂  I am not really sure what you are trying to say.  Are you taking an image, a shape, a object and finding the area?  What are your inputs and outputs to the end program?  Any extra information would really be helpful.
Maybe you could post the exact problem you are having with arrays.
Brian K.
0 Kudos
Message 2 of 7
(3,531 Views)

I once had to create a "fill" function for the picture control.  To do so, I first converted the picture to a 24-bit 2D array (picture to pixmap) and then determined the area I needed to fill based on the color values in the 2D array.  You could find the area of your irregular region by counting the number of elements in the 2D array whose values match the color of the region you're trying to fill.

I know your using an older version of LabVIEW...there are a few examples that you can download from the ni.com website that show you how to convert pictures to pixmaps, etc.  Unfortunately, I no longer have 6.1 so I don't have an example I can post for you.  There are also several "array" examples that ship with LabVIEW that might help you along.


Chris_Mitchell
Product Development Engineer
Certified LabVIEW Architect

0 Kudos
Message 3 of 7
(3,524 Views)

Hi Brian.

I am Bojan.

Mouse draw irregular region on picture.vi.

After then calculats area of that region.

Inputs: mouse down,mouse move,mouse up,clear pictue(on/off button).

Output :area (digital indicator).

Hi Chris.

Make next:

1.On one picture depict region.

2.Then on another picture this region is fill

3.This picture overfulfil in pixmap over Picture to Pixmap.

Pixmap is 8-bit ,256x256.

But now have proble when depict region,in pixmap all elements is zero.

What walk in input of Unflatten Pixmap.vi -> rather on depth ?

Do you 8 or ?

0 Kudos
Message 4 of 7
(3,487 Views)
Hi Bojan,
 
Unfortunatily, I do not have an example for you.  One way that I would calculate the area, is to make a 2D array out of the image (like you have).  Then I would take the 2D array row-by-row, and see how many points in my row have the line created by the user crossing it.  Then you sum the number of pixels in between the two points of intersection.  Effectivily you are summing the pixels in between points. 
 
Something like this.
 
A row of your 2D array (ones represent the crossing of a line through the row)
000010000000000000001000000100000010000000
If you fill you object it would look like this:
000011111111111111111000000111111110000000
Thus the area of your object in this row would be 17+8=25 pixels.  Then you go through all of your rows.
 
Wow, that is difficult to explain in a forum.  If you have any further questions (which you probably will) please ask.
Brian K.
0 Kudos
Message 5 of 7
(3,443 Views)
Hello Brian !
How draw screen (net lines) on irregular area ?
0 Kudos
Message 6 of 7
(3,399 Views)

Hi Bojan,

I'm not sure if you have any of our Vision toolkits or addons to LabVIEW (which would make it a lot easier), but check out this thread on how to draw a grid.

Thanks,

Stephanie

0 Kudos
Message 7 of 7
(3,351 Views)