blurring a float matrix?

Feb 24, 2012 at 1:20am

blurring a float matrix?

okay, so I may be losing my marbles completely here, but… how on earth do you blur a float32 matrix?

jit.fastblur is char only, and the closest thing I’ve found is jit.avg4, which isn’t really it either.

My matrix is “mymatrixname 3 float32 100 100″, so it’s rather small, and I can afford to throw some processing at it, but I *cant* do shaders, since I need this in matrix-land still.

any pointers? I reckon there might be a simple jit.pix hack I could do? I don’t mind quirky blurs, either.

#61944
Feb 24, 2012 at 2:08am

One way is simply to downsample and then re-upsample with interpolation, but the more sophisticated way is convolution with jit.convolve, I think.

– Pasted Max Patch, click to expand. –
#223710
Feb 25, 2012 at 12:03am

thanks. I love how jit.convolve’s help file AND reference assume that the jitter users know what convolving two matrices with each other entails. ;)

I’ll be using this, but damn, it ain’t pretty.

#223711
Feb 26, 2012 at 4:30pm

jit.gl.slab.gauss6x works pretty well also with float32 matrices, and it’s great! :)

#223712
Feb 26, 2012 at 10:46pm

i would use jit.gl.slab.gauss6x, and then go back from openGL to CPU…

#223713
Feb 26, 2012 at 11:24pm

slab processing for a small matrix which is just a tiny bit of a larger whole? Am I completely nuts for thinking that that is too convoluted? (pardon the pun)

#223714
Feb 27, 2012 at 12:13am

well it depends what kind of blurring you’re after

#223715
Feb 27, 2012 at 2:02am

well, I reckon what I’d really like is something like jit.gl.slab.gauss6x, but in matrix-land.

Do any of you have this wrapped up in an abstraction that handles the back-and-forth from- and to- matrices internally?

#223716
Feb 27, 2012 at 9:00am

it’s not an abstraction but i hope it will help you anyway…

PS: the rendering context is made with jit.window, which is a bit annoying – there is a “useless” window floating. for some unknown reasons, my Max crashes if i make the rendering context with jit.matrix…? anyway, all you have to do is to adjust the dimensions…

– Pasted Max Patch, click to expand. –
#223717
Feb 27, 2012 at 10:14am
– Pasted Max Patch, click to expand. –

?

#223718
Feb 27, 2012 at 4:32pm

@napentro: Thanks, that is even sexyer solution! I removed also the videoplane and changed the “jit.pwindow @name maax” with “jit.matrix maax”, to remove the unnecessary processing.

PS: Creating rendering context with jit.matrix seems to work for smaller matrices. I remember I had problems with larger ones…my Max always crashed. And even few moments ago that happened with 320×240 matrix. I don’t know what is the reason for that dodgy behavior…

– Pasted Max Patch, click to expand. –
#223719
Feb 27, 2012 at 4:58pm

I played a little bit more with the patch and it seems that if creating rendering context with matrix, patch works slow and dodgy. Can anyone explain that?

#223720
Feb 27, 2012 at 9:23pm

i think, that videoplane is nessesary. there is jitter tutorial 31RenderDestinations, that allows you to change the destination of opengl objects, but in my case when trying render to matrix pops up “jit.gl: invalid extension called” – maybe it is some kind of bug.

anyway i think, that videoplane is nessesary to send the context of renderer anywhere.

it is a modyfied version of the tutorial with “jit.gl: invalid extension called” error:

– Pasted Max Patch, click to expand. –

if it would work the patch with rendering gl.slab to matrix should looks like that:

– Pasted Max Patch, click to expand. –

or maybe i’am missing something @:)
after all sorry for my english :)

#223721
Mar 1, 2012 at 8:26pm

i don’t get any errors in your first patch. also the last patch i posted (without videoplane) works. but as i said, it is dodgy. now, for instance, when i tested it again, it first didn’t work, then my Max crashed, but after i restarted it, it started to work.

i would expect that when i make the rendering context with matrix instead of window or pwindow, that the patch would run faster, since there is nothing (necessary) to display. but as i said, things start to crash, behave dodgy, works slow…???

#223722

You must be logged in to reply to this topic.