Would anyone out there be willing to share there implemention of some image proccessing code.
If you could include all 3 important steps that would be amazing
1. access raw RGBA image data
2. apply any image proccessing (edge detect, greyscale, contrast) What filter isn't as important since I intend to use my own once I have a framework to work from.
3. create a new UIImage etc from the modified data
As I said it's not about the filter implmentation. I have books on Image Proccessing. The issue is I can't seem to get it all to come togther on the iphone.
That's why I'd like the most basic example (like grayscale) so I have something to work from. I found articles on getting image data, and articles on creating images and all the pieces (though haven't seen any image proccessing code on here or elsewhere) but can't get the steps to play nicely togther.
I'd show you what I have so far but i'm at work and code is at home.
Dude, this is trivial stuff. Get a pointer to the raw image data, and then iterate trough the pixels. If you need to work on a matrix of pixels, use multiple pointers. There is nothing iPhone specific, this is easy stuff, but nobody is going to write the code for you. Go look in a book or use google, there is a massive amount of examples for image processing.
I guess I should have just posted my code and let you guys find the bug. since this code should be trivial as you say and I agree I thought someone would have have a simple example that they could copy and paste so I could find out there I went wrong.
Here is the code i've worked out for anyone else who would like to user it. if anyone sees any problems with the code please let me know.
I've included a few different basic image processing examples just comment/uncomment the one that you want to use. I haven't implemented any Matrix filters but will be working on that soon.
I used your code to increase/deccrese the contrast of my png image. It just makes the image black and white. i tried varying the angle of the slope of the contrast also but it makes every thing black or white. How to maintain the color components of the pixels. can you please guide me a little bit on this.
Here is the code i've worked out for anyone else who would like to user it. if anyone sees any problems with the code please let me know.
I've included a few different basic image processing examples just comment/uncomment the one that you want to use. I haven't implemented any Matrix filters but will be working on that soon.
Anyone using this this code for pixel manipulation?
The code that afastrunner posted many months ago actually works... The contrast adjustment (which was commented out) actually works well, but suffers from too much CPU action to pixel map values like this for very large images (10Meg+).
Has anyone done anything simular, but found a faster way to filter the pixels for contrast, brightness, etc.?
now i understand the problem, lol, initially i thinked that the problem was that code not working, after i uderstood that you want to make an image in grayscale .
However, good work!.
Yes ... but I've tryed your code WITHOUT Apply the GrayScale !
So I've tryed it on UIImage taken from camera and I don't know why but it doesn't work so good for me... colours tone change (for example a photo of a pizza swith to original to blue tone)...
Hi Rocotilos,
Thank you very much for your code.. but it give me a strange colors tone modification like explained above...
I don't know If I'm doing something wrong...
I'll do some other test and let's see how it will work!
Yes ... but I've tryed your code WITHOUT Apply the GrayScale !
So I've tryed it on UIImage taken from camera and I don't know why but it doesn't work so good for me... colours tone change (for example a photo of a pizza swith to original to blue tone)...
Hi Rocotilos,
Thank you very much for your code.. but it give me a strange colors tone modification like explained above...
I don't know If I'm doing something wrong...
I'll do some other test and let's see how it will work!
Dvdkite, I had this happen to me too when playing around with it.
You gotta be careful of which data you change.
data[0] = ALPHA CHANNEL
data[1] = RED CHANNEL
data[2] = GREEN CHANNEL
data[3] = BLUE CHANNEL.
I presume you are only modifying the 0 to 2, hence the blue channel remain (no change in blue, so when u reduce others, the image become blue). make sure you selecting the correct channel to modify their values.
EDIT: I took a look at your brightness code (in the other thread), and spot the problem there: