本文介绍一个 iPhone 图像处理库,提供了边缘检测、直方图均衡等功能。

来源:互联网 发布:国外开源商城 java 编辑:程序博客网 时间:2024/04/29 16:59
简介

Chris Greening 开发了一个 iphone 图像处理库,该库基于 C++ 开发并提供了 Objective-C 封装,提供了边缘检测、直方图均衡等常用的图像处理功能。该图像库开源,遵循 BSD 协议。

该图像库的源代码中提供了一个 Xcode 实验床以便于用户体验该库的功能。在默认状态下,该实验床将图像转换成灰度模式 (grayscale),对图像做高斯模糊 (gaussian blur)操作,然后完成 Canny 边沿提取 (Canny edge extraction)。

simple iphone image processing:Provide a simple class for doing image processing on the iPhone。


使用方法

用户在使用该库时,通常是传入一个 UIImage 对象,该库将该对象转换成灰度图像,然后进行处理。

下面是一个代码样例:

    // convert to grey scale and shrink the image by 4 - this makes processing a lot faster!    ImageWrapper *greyScale=Image::createImage(srcImage, srcImage.size.width/4, srcImage.size.height/4);    // do a gaussian blur and then extract edges using the canny edge detector    // you can play around with the numbers to see how it effects the edge extraction    // typical numbers are  tlow 0.20-0.50, thigh 0.60-0.90    ImageWrapper *edges=greyScale.image->gaussianBlur().image->cannyEdgeExtract(0.3,0.7);    // show the results    resultImage.image=edges.image->toUIImage();


原创粉丝点击