edge detection - CIImage(IOS): Adding 3x3 convolution after a monochrome filter somehow restores color -


I, monochrome'm converting ciimage CICrop with clipping and bottom edges using running detecting section #if Sobel To display the results,

  CIIE * CI = [[CIMAZ ALOOC] INIT WITCHIGIIMAGE: ui image. CGImage]; CIImage * Gray = [CIFilter filterWithName: @ "CIColorMonochrome" keysAndValues: @ "inputImage", CI, @ "inputColor", [[CIColor alloc] initWithColor: [UIColor whiteColor]], minus] .outputImage; CGRCT Rect = [CI extent]; Rect.origin = CGPEx; CGT CropList Lift = CGRactMake (0, 0, Rectate. EyesWith * 0.2, Rink Eyes. Hight); CIVector * cropRect = [CIVector vectorWithX: rect.origin.x Y: rect.origin.y Z: rect.size.width * 0.2 W: rect.size.height]; CIImage * left = [Gray Image BackcropTarget: Croppy Left]; Seafield * crop filter = [cif filter filter: @ "cecof"]; [CropFilter setValue: for left for: @ "input image"]; [Crop Fielder Set Value: For Crop Cut Key: @ "InputContext"]; // Sobel Kandoloutian will produce an image that is 0.5,0.5,0.5,0.5, resulting image is flat / will be in the image at the edges, including the values ​​that are to be deterred by the power and control of banks Direction of the double g / direction = 1. Const CGFLot weight [] = {1 * G, 0, -1 * G, 2 * G, 0, -2 * G, 1 * G, 0, -1 * G}; Left = [CIFilter filterWithName: @ "CIConvolution3X3" keysAndValues: @ "inputImage", cropFilter.outputImage, @ "inputWeights", [CIVector vectorWithValues: Weight count: 9], @ "inputBias", @ 0.5, zero] .outputImage; #define VISUALHELP 1 #if VISUALHELP CGImageRef imageRefLeft = [gcicontext createCGImage: fromRect left: cropRectLeft]; CGContextDrawImage (Reference, Cropfect Left, ImagerFalft); CGImageRelease (imageRefLeft); For #endif   

Now that is not part of ciimage pipeline 3x3 Rocker image part I find the edge on show gray, but when CIConvolution3X3 postfix color processing pipeline It's no matter if part of the magically appear back if I use Cicollore monochrome or CIPOFF mono prefix to remove the color. Any idea how to keep the paint all the way down the pipeline? TNX

UPD: Surprisingly, this is not a raw custom monochrome kernel as it is a

  kernel vec4 gray (sampler image) {vec4 s = sample ( Image, sample clip (image)); Float R = (SR * .299 + CG * .587 + SB * 0.114) * SA; S = vec4 (R, R, R, 1); Return s; }  

Since 3x3 is a part of my CI pipeline since then, instead of using the standard mono filter with the exact same problem with the color coming from

The issue is that all CI cross-loading operations (like CIConvolution3X3, Ciconvolution5X5 and CIGaussianBlur) all on four channels of the input image Do the work. That means, in your code example, the resulting alpha channel will be 0.5, where you probably want to be 1.0. To set up Alpha 1, try adding a simple kernel after convolution.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -