<i id='wImbG'><tr id='wImbG'><dt id='wImbG'><q id='wImbG'><span id='wImbG'><b id='wImbG'><form id='wImbG'><ins id='wImbG'></ins><ul id='wImbG'></ul><sub id='wImbG'></sub></form><legend id='wImbG'></legend><bdo id='wImbG'><pre id='wImbG'><center id='wImbG'></center></pre></bdo></b><th id='wImbG'></th></span></q></dt></tr></i><div id='wImbG'><tfoot id='wImbG'></tfoot><dl id='wImbG'><fieldset id='wImbG'></fieldset></dl></div>

    <small id='wImbG'></small><noframes id='wImbG'>

      <bdo id='wImbG'></bdo><ul id='wImbG'></ul>

      <tfoot id='wImbG'></tfoot>
    1. <legend id='wImbG'><style id='wImbG'><dir id='wImbG'><q id='wImbG'></q></dir></style></legend>

        如何在 iOS 上使用 OpenCV 对 CGImage 进行二值化?

        时间:2023-05-30

          <i id='r43Pr'><tr id='r43Pr'><dt id='r43Pr'><q id='r43Pr'><span id='r43Pr'><b id='r43Pr'><form id='r43Pr'><ins id='r43Pr'></ins><ul id='r43Pr'></ul><sub id='r43Pr'></sub></form><legend id='r43Pr'></legend><bdo id='r43Pr'><pre id='r43Pr'><center id='r43Pr'></center></pre></bdo></b><th id='r43Pr'></th></span></q></dt></tr></i><div id='r43Pr'><tfoot id='r43Pr'></tfoot><dl id='r43Pr'><fieldset id='r43Pr'></fieldset></dl></div>
            <tbody id='r43Pr'></tbody>

              1. <tfoot id='r43Pr'></tfoot>

                <small id='r43Pr'></small><noframes id='r43Pr'>

                  <bdo id='r43Pr'></bdo><ul id='r43Pr'></ul>

                • <legend id='r43Pr'><style id='r43Pr'><dir id='r43Pr'><q id='r43Pr'></q></dir></style></legend>
                  本文介绍了如何在 iOS 上使用 OpenCV 对 CGImage 进行二值化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  在我的 iOS 项目中,我有一个 RGB 格式的 CGImage,我想对其进行二值化(转换为黑白).我想使用 OpenCV 来做到这一点,但我是 OpenCV 的新手.我找到了一本关于 OpenCV 的书,但它不适用于 iPhone.

                  In my iOS project, I have a CGImage in RGB that I'd like to binarize (convert to black and white). I would like to use OpenCV to do this, but I'm new to OpenCV. I found a book on OpenCV, but it was not for iPhone.

                  如何在 iOS 上使用 OpenCV 对这样的图像进行二值化?

                  How can I binarize such an image using OpenCV on iOS?

                  推荐答案

                  如果你不想在你的 iOS 项目中设置 OpenCV,我的开源 GPUImage 框架内部有两个阈值过滤器,用于图像的二值化,一个简单阈值和一个基于像素附近局部亮度的自适应阈值.

                  If you don't want to set up OpenCV in your iOS project, my open source GPUImage framework has two threshold filters within it for binarization of images, a simple threshold and an adaptive one based on local luminance near a pixel.

                  您可以对图像应用一个简单的阈值,然后使用如下代码提取生成的二值化 UIImage:

                  You can apply a simple threshold to an image and then extract a resulting binarized UIImage using code like the following:

                  UIImage *inputImage = [UIImage imageNamed:@"inputimage.png"];    
                  GPUImageLuminanceThresholdFilter *thresholdFilter = [[GPUImageLuminanceThresholdFilter alloc] init];
                  thresholdFilter.threshold = 0.5;
                  UIImage *thresholdFilter = [thresholdFilter imageByFilteringImage:inputImage];
                  

                  (如果您的应用程序中不使用 ARC,请释放上述过滤器)

                  (release the above filter if not using ARC in your application)

                  如果您希望将此图像显示到屏幕上,可以将阈值输出发送到 GPUImageView.如果您愿意,您还可以使用这些过滤器处理实时视频,因为它们完全在 GPU 上运行.

                  If you wish to display this image to the screen instead, you can send the thresholded output to a GPUImageView. You can also process live video with these filters, if you wish, because they are run entirely on the GPU.

                  这篇关于如何在 iOS 上使用 OpenCV 对 CGImage 进行二值化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:ios5 上的dismissViewControllerAnimated 崩溃 下一篇:使用 HTML5 在 UIWebView 中播放嵌入的视频

                  相关文章

                  最新文章

                • <small id='KatpI'></small><noframes id='KatpI'>

                • <legend id='KatpI'><style id='KatpI'><dir id='KatpI'><q id='KatpI'></q></dir></style></legend>

                        <bdo id='KatpI'></bdo><ul id='KatpI'></ul>

                      <i id='KatpI'><tr id='KatpI'><dt id='KatpI'><q id='KatpI'><span id='KatpI'><b id='KatpI'><form id='KatpI'><ins id='KatpI'></ins><ul id='KatpI'></ul><sub id='KatpI'></sub></form><legend id='KatpI'></legend><bdo id='KatpI'><pre id='KatpI'><center id='KatpI'></center></pre></bdo></b><th id='KatpI'></th></span></q></dt></tr></i><div id='KatpI'><tfoot id='KatpI'></tfoot><dl id='KatpI'><fieldset id='KatpI'></fieldset></dl></div>
                    1. <tfoot id='KatpI'></tfoot>