我想使用CIColorCube CIFilter的CoreImage框架,我試圖任意3D Luts的圖像,我把三維的luts包裹到NSData之前作爲參數傳遞給CIColorCube CIFilter。但我得到EXC_BAD_ACCESS例外。 這是我的代碼:格式化數據CIColorCube
CIContext * context = [CIContext contextWithOptions:nil]; CIFilter * filter = [CIFilter filterWithName:@「CIColorCube」];
uint8_t color_cube_data[4096*4] = {
153, 255, 255, 1,
170, 255, 255, 1,
186, 255, 255, 1,
204, 255, 255, 1,
221, 255, 255, 1,
237, 255, 255, 1,
255, 255, 255, 1};
NSData * cube_data =[NSData dataWithBytes:color_cube_data length:4096*sizeof(float)*4];
[filter setValue:originalImage forKey:kCIInputImageKey];
[filter setValue:[NSNumber numberWithFloat:16] forKey:@"inputCubeDimension"];
[filter setValue:cube_data forKey:@"inputCubeData"];
CIImage *result = [filter valueForKey:kCIOutputImageKey];
CGImageRef cgImage =[context createCGImage:result fromRect:originalImage.extent];
imgVw_Result.image=[UIImage imageWithCGImage:cgImage];
難道我錯過了什麼,請幫助 感謝
[_colorCube的setValue:color_cube_data forKey:@ 「inputCubeData」]; – iPatel 2013-02-25 13:19:41
我想你是在談論[filter setValue:cube_data forKey:@「inputCubeData」];線,我認爲這不是一個問題 – 2013-02-26 06:04:12