Open andrewagain opened 12 years ago
Sure, go right ahead. I didn't write the tone curve filter or the ACV input, so I rely on others to verify their functionality.
@ahfarmer That would be a fantastic addition. Thanks for tackling it.
Cool! I made a pull request: https://github.com/BradLarson/GPUImage/pull/428
Having some trouble with ACV curves, and I think it might be related? I'm getting strange results that don't look like what I get in Photoshop. Perhaps these pictures will help.
Here's the original photo: https://www.dropbox.com/s/otsdr4pfglnw4i1/1%20original.png
Here's what I get in Photoshop, which is more or less what I expect to get back: https://www.dropbox.com/s/t2qzphtjvujh2v3/2%20correct-from-photoshop.png
But here's what I get back after using GPUImageToneCurveFilter: https://www.dropbox.com/s/luu2hc2u59uvllq/3%20wrong-via-GPUImageToneCurveFilter.jpg
Apart from all the weird artifacts, it's close but the overall tone still seems wrong.
Here's the ACV file: https://www.dropbox.com/s/j11j7ymgj87rmh2/Curve.acv
If it helps, I'm using code that is based loosely on https://github.com/gobackspaces/DLCImagePickerController (everything but the UI code).
My install of GPUImage includes the @ahfarmer's fix.
Any thoughts? I've run out of things to try.
FWIW, when I say "I think it might be related", I mean that I tried overriding this line:
[self setRgbCompositeControlPoints:curve.rgbCompositeCurvePoints];
with:
NSArray *defaultCurve = [NSArray arrayWithObjects:[NSValue valueWithCGPoint:CGPointMake(0.0, 0.0)], [NSValue valueWithCGPoint:CGPointMake(0.5, 0.5)], [NSValue valueWithCGPoint:CGPointMake(1.0, 1.0)], nil];
[self setRgbCompositeControlPoints:defaultCurve];
in - initWithACV: just to see what would happen. While the filter effect doesn't look the same as it does in Photoshop, there are no artifacts.
@s5 I'm working on correcting a few issues I've uncovered with GPUImageToneCurveFilter. Your dropbox links have gone 404. Could you re-post your files. I would like to see if the behavior you are seeing is the same as me.
@bradsmithinc Whoops, they should be again working now. My designer reshuffled our Dropbox around. :)
BACKGROUND: In the Photoshop curves tool there are 4 channels: Red, Green, Blue and a composite "RGB" channel. All 4 channels are combined to affect the output of the image.
PROBLEM: The
GPUImageToneCurveFilter
class internally maintains only 3 channels: Red, Green, and Blue. TheinitWithACV
andsetPointsWithACV
methods ignore the composite RGB channel that is present in the ACV file.Some things to note:
GPUImageToneCurveFilter
has a misleadingsetRGBControlPoints
method, which does not set the control points for the composite 'RGB' channel, but in fact sets the control points for the separate R, G, and B channels. (And sets them all to the same value).GPUImageACVFile
helper class is already reading in the 'rgbComposite' channel from the Photoshop ACV file, but it is not used byGPUImageToneCurveFilter
'sinitWithACV
orsetPointsWithACV
methods.I have fixed this issue so that when using all 4 channels the resulting images look very similar to the resulting images from Photoshop. Should I send a pull request?