相关疑难解决方法(0)

检测图像iOS中的黑色像素

到目前为止,我正在逐个搜索每个像素,检查颜色是否为黑色......如果不是,我会继续查看下一个像素.这是永远的,因为我只能检查约.每秒100像素(加速我的NSTimer冻结应用程序,因为它无法足够快地检查.)所以,无论如何我可以让Xcode返回所有黑色的像素并忽略其他所有因素我只需要检查这些像素而不是每个像素.我试图在我的图像上检测到最左边的黑色像素.

这是我目前的代码.

- (void)viewDidLoad {
    timer = [NSTimer scheduledTimerWithTimeInterval: 0.01
                                             target: self
                                           selector:@selector(onTick:)
                                           userInfo: nil repeats:YES];
    y1 = 0;
    x1 = 0;
    initialImage = 0;
    height1 = 0;
    width1 = 0;
}

-(void)onTick:(NSTimer *)timer {
    if (initialImage != 1) {
        /*
        IMAGE INITIALLY GETS SET HERE... "image2.image = [blah blah blah];" took this out for non disclosure reasons
        */
        initialImage = 1;
    }
    //image2 is the image I'm checking the pixels of.
    width1 = (int)image2.size.width;
    height1 = (int)image2.size.height;
    CFDataRef imageData …
Run Code Online (Sandbox Code Playgroud)

image pixel colors objective-c ios

2
推荐指数
1
解决办法
5333
查看次数

标签 统计

colors ×1

image ×1

ios ×1

objective-c ×1

pixel ×1