Turn pixels of a given colour range that are contiguous to a given point transparent in ios

StackOverflow https://stackoverflow.com/questions/22866188

سؤال

I'm writing an iOS app and want to do some image processing, and I'm not sure the best way to go about it.

I'm working with still images and I want to turn pixels of a given colour range that are contiguous to a given point transparent , something similar to the photoshop magic want tool with contiguous checked. I have succeeded in turning pixels of a given colour range transparent without being contiguous using both the CoreGraphics framework (with CGImageCreateWithMaskingColors) and the GPUImage framework (with the GPUImageChromaKeyFilter), but I'm not sure how to approach the contiguous part. One thought is to use GPUImage and write a custom GLSL shader, but I'm not familiar enough to know if this is possible.

Can anybody suggest any approach to accomplishing this? Would GPUImage with a custom shader be capable of this?

هل كانت مفيدة؟

المحلول

Flood Fill algorithm?

I don't think it will be that easy to use GLSL to do the contiguous part. I could be wrong though.

iOS implementation on Github

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top