Page 1 of 1

Image Filters

Posted: Mon Jul 18, 2011 5:09 am
by wilbert
OSX has a lot of built in image filters
http://developer.apple.com/library/mac/ ... rence.html

When targeting OSX 10.5, it's not very complicated to wrap some of them into a user library.
Would anyone be interested in this and if so, what do you think are the most useful filters ?

Re: Image Filters

Posted: Mon Jul 18, 2011 7:26 am
by J. Baker
wilbert wrote:OSX has a lot of built in image filters
http://developer.apple.com/library/mac/ ... rence.html

When targeting OSX 10.5, it's not very complicated to wrap some of them into a user library.
Would anyone be interested in this and if so, what do you think are the most useful filters ?
Hey WB, I hope you're making some good money with your programming skills. ;)

As for the filters, the noise reduction filter on there is pretty nice and kind of different. It seems it reduces the digital noise but creates an all over noise that seems to add detail to the image. Kind of like upscaling an image but without sharpening it.

The unsharpmask is always a nice sharpening filter. I prefer it over other sharpening filters anyway.

I haven't had a chance to read and view all of them yet but I'm sure there are some other nice ones choose from. ;)

Re: Image Filters

Posted: Mon Jul 18, 2011 5:09 pm
by wilbert
J. Baker wrote:Hey WB, I hope you're making some good money with your programming skills. ;)
I must be doing something wrong there :wink: ; learned last year that an iPhone app in the app store is not the way :(

As for the filters, try for yourself if you wish
The lib : http://www.w73.nl/pb/libPBMX.zip

I combined several things I did in one lib to keep things together a bit, everything starting with MX.
The image related functions are

Code: Select all

MX_Release (object) - Release an object.

Height = MXImage_Height (ImageID)
ImageID = MXImage_LoadFromURL (url.s)
Width = MXImage_Width (ImageID)

NewImageID = MXImageFilter_AffineTransform (imageID, m11.f, m12.f, m21.f, m22.f)
NewImageID = MXImageFilter_Crop (imageID, x.f, y.f, width.f, height.f)
NewImageID = MXImageFilter_ExposureAdjust (imageID, EV.f)
NewImageID = MXImageFilter_ComicEffect (imageID)
NewImageID = MXImageFilter_Grayscale (imageID)
NewImageID = MXImageFilter_NoiseReduction (imageID, noiseLevel.f, sharpness.f)
NewImageID = MXImageFilter_SharpenLuminance (imageID, sharpness.f)
NewImageID = MXImageFilter_UnsharpMask (imageID, radius.f, intensity.f)
The resulting image may not have the same size as the input image.
Other functions in the lib are related to speech and printing. Most likely I will post more on that in another thread.

An example of the image filters

Code: Select all

If OpenWindow(0, 0, 0, 245, 105, "MXImage Demo", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  img = MXImage_LoadFromURL("http://www.purebasic.com/images/box.png")
  If img
    img_t1 = MXImageFilter_Grayscale(img)
    img_t2 = MXImageFilter_AffineTransform (img_t1, -1.5, 0, 0, 0.5)
    ImageGadget(0,  10, 10, 100, 83, img)
    ImageGadget(1, 130, 10, 100, 83, img_t2)
    MX_Release(img_t2)
    MX_Release(img_t1)
    MX_Release(img)
  EndIf
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
  
EndIf

Re: Image Filters

Posted: Mon Jul 18, 2011 5:21 pm
by WilliamL
Most likely I will post more on that in another thread.
I'm looking forward to seeing a list of the functions included in your library!

If you feel like it, I'd like some instructions of how to put, access, and use the library. It's not something I've used before. :shock:

Maybe a thread just for your library that you can update, as necessary, with additions and fixes. (just an idea..)

Re: Image Filters

Posted: Mon Jul 18, 2011 5:42 pm
by wilbert
WilliamL wrote:Maybe a thread just for your library that you can update, as necessary, with additions and fixes. (just an idea..)
Good idea :)
http://www.purebasic.fr/english/viewtop ... 19&t=46937

Re: Image Filters

Posted: Tue Jul 19, 2011 6:56 am
by J. Baker
wilbert wrote:I must be doing something wrong there :wink: ; learned last year that an iPhone app in the app store is not the way :(

As for the filters, try for yourself if you wish
The lib : http://www.waterlijn.info/pb/libPBMX.zip
Games are the way to go with the iphone.

And thanks!