Mean Shift Image Filters?

Blitz3D Forums/Blitz3D Programming/Mean Shift Image Filters?

CopperCircle(Posted 2006) [#1]
Hi, does anyone have any experience with mean shift filters? or anything they have created in Blitz?

Thanks.


big10p(Posted 2006) [#2]
Well, blitz gives you pixel access to images so any type of filter can be coded, in theory. What does a 'mean shift' filter do, exactly?


DJWoodgate(Posted 2006) [#3]
I think it is used in pattern recognition. No reason it could not be done in Blitz of course (other than the fact you would probably want to do it in C - http://www.caip.rutgers.edu/riul/research/robust.html ), but I can not find anything on the subject which does not give me a headache :)

This paper puportedly provides a fast algorithm
http://www.cs.ust.hk/~twinsen/PID69719.pdf

There may be someone here with a degree in image analysis who can make sense of it.


sswift(Posted 2006) [#4]
Mathworld says the "mean" of a set of values is the average.

From what I can tell from looking at the pretty pictures in that PDF, it seems like the idea is something like color reduction. If you plot all the colors in 3D space, then you want the points to move closer together to form clusters and lines?

In simpler terms I think if you have an image which has a bunch of dark colors and a bunch of light colors, then it is trying to converge them so that you end up with just two colors and then all the colors in the image are set to those?

Seems simple enough without all that 4d hypercube crap. :-)


sswift(Posted 2006) [#5]
As I suspected, color reduction in photoshop gets you very similar results. Interestingly though, the algorithm in this papaer appears to do a better job at color reduction than any of the photoshop methods. Even if I first correct the contrast of the photoshop image (since the starting image of the house is low contrast and the ones later are clearly not) I still can't keep those windows white with anything less than 14 colors, yet photoshop deperately wants to keep much lower contrast reds in the bricks of the building rather than making that wall one flat color. I'm not sure why it would choose to keep two reds which are close to eachother rather than keep white which is much more different in color, unless it is weighting by the number of pixels in the image or something in all three color reduction modes and there's just not enough white pixels compared to red, green, or blue pixels to consider keeping them.


sswift(Posted 2006) [#6]
I wish I could get a job researching/inventing interesting image algorithms like this. I think I'd have fun working on vision systems and AI for robotics or something. Might even be worth getting back into coding in C or VB for that.


CopperCircle(Posted 2006) [#7]
That paper is interesting but over my head!, I want to create a mean shift filter to reduce colors for the purpose of turning a real world image into a cartoon.


DJWoodgate(Posted 2006) [#8]
I don't know if he uses a mean filter, but this guy has done something along those lines. It is freeware and includes source so it might be worth a look.

http://freshmeat.net/projects/cartoon/


jfk EO-11110(Posted 2006) [#9]
reducing colors may be as simple as ANDing RGB to some values, eg.
red=red and %11100000


Shifty Geezer(Posted 2006) [#10]
That should produce a Posterize effect, which is different to this Mean Shift thingy.


jfk EO-11110(Posted 2006) [#11]
Yeah, I probably misunderstood it when I was reading "color reduction". Still no idea that mean shift means, but it sounds pretty mean, i mean ehrm ..cough..


big10p(Posted 2006) [#12]
If this 'mean shift' filter does what I imagine it does (i.e. 'cartoonizes' an image), then I've had an idea about how to do this. If I get time, I'll code something up tomorrow (busy bug hunting at the moment). Of course, my idea may turn out to be crap, so don't hold your breath. :P


CopperCircle(Posted 2006) [#13]
Look forward to seeing what you come up with big10p.

There is an article on the processes involved here:
http://research.microsoft.com/~cohen/VideoTooningFinal.pdf


Shifty Geezer(Posted 2006) [#14]
The term Mean Shift isn't one I've heard of before. The files linked to so far have been very interesting and quite impressive.