LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

2d boxcar smoothing

Hi i have had a thought, is it possible to carry out a 2d boxcar smoothing?

as in is it possble to have a shifting average of a number of values around the current point?

for a 2d array with number of values x and y where the avarage is true over say x=y=3 say:

 

1 2 2 5 6 

1 8 6 4 3

2 6 7 3 9

2 2 3 4 6

1 1 9 9 0

 

so if you took the center point '7' it would be replaced with an approximated value from the numbers surounding it.

is that possible, also can the edges be acconted for? and the average modified for this situation?

 

I would post a VI but the principle will work if it can work for any 2d array.

help!!

0 Kudos
Message 1 of 10
(5,686 Views)
Yes, of course, it's possible; you just need to do some programming and it should work. What exactly are you looking for over here? Have you tried getting the concept to work? If so, post your VI and let us know what exact difficulty you are facing.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
Message 2 of 10
(5,671 Views)

I've not got a piece of code, i have no idea where to start, i'm guessing using shift registers, with a loop within a loop?

or i guess it could be made using mathscript.

 

Also i'm using lv 8.2, just incase!

0 Kudos
Message 3 of 10
(5,659 Views)

i've muddles something together that does a star one up and one down (badly)

but i think it can be done nearly as simply but better somehow.

Message 4 of 10
(5,651 Views)

Hi John,

you can use the "Array Subset" function combined with the "multiply array elements" function.

 

Mike

Message 5 of 10
(5,648 Views)

ah ha! great, one minor edit to your suggetion, it works better with 'add array elements'

also i've added a vi with the basic idea,

i think it could do with playing with. 

0 Kudos
Message 6 of 10
(5,641 Views)

Hi, i've got a better one, but i now suffer from the problem that it won't let me overlap on the starting edge, as in it defalts to row 0 or line 0, if i want it to start with that line.

so i can't get it to start on the top line,

if you run the VI you'll see what i mean, has anyone got any suggestions as it overlaps on the far edge happliy.

 

I've included the VI for peopel to look at and edit as they need to.

Help!

 

0 Kudos
Message 7 of 10
(5,608 Views)

http://forums.ni.com/ni/board/message?board.id=170&message.id=384559&query.id=131409#M384559

 

It's a slightly different problem, but very similar.

My second to last post in that thread is my solution.

 

The block diagram is here

http://forums.ni.com/ni/attachments/ni/170/386040/1/smooth.PNG

 

The mathscript node does the same computation as the rest of the code, but takes a lot longer so I rewrote it in LabVIEW.  that's what the rest is doing.

 

This VI takes a "circle" of points with radius 3.  I also have one that takes a radius of 2.

Message Edited by elset191 on 02-25-2009 11:46 AM
Message Edited by elset191 on 02-25-2009 11:48 AM
--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 8 of 10
(5,593 Views)

hmmm, if the promlem is only on the top and left edges, it 'could' possibly be solved by flipping the matrix top to bottom and left to right carrying out the averageing twice and then align the two results and then create one set of results?

Or is that going to cause more problems.....

I'm going to give it a try and report back.

0 Kudos
Message 9 of 10
(5,572 Views)

Yeah, that's similar to what I did.  I wanted two of the edges (left and right, say) to loop to each other.  The other two I didn't. 

How I solved this was by taking the last columns and copied them to the front.  I also took the first columns and put them on the end. For the sides I didn't want to loop, I simply copied them and padded the top and bottom.  This skews the data a little bit, but not very much, so I decided it was a fair trade.

--
Tim Elsey
Certified LabVIEW Architect
0 Kudos
Message 10 of 10
(5,562 Views)