【问题标题】:Increase the intensity of certain part of frame using opencv使用opencv增加帧的某些部分的强度
【发布时间】:2012-01-05 08:15:27
【问题描述】:

假设有一个带有一些图像的框架。我只想显示像素强度高于 120 或 130 的那些部分。如何使用 OpenCv 做到这一点?有什么命令可以这样做吗? 然后我需要将这些部分设置为 190 的某个强度。

【问题讨论】:

    标签: c image image-processing opencv


    【解决方案1】:

    正如 astay13 所说,您可以像这样使用threshold 函数:

    Mat image = imread("someimage.jpg", 0); // flag == 0 means read as grayscale
    Mat mask;
    
    // this tells you where locations >= 120 pixel intensity are
    threshold(image, mask, 120.0, 255.0, THRESH_BINARY); 
    
    // this sets those locations to 190 based on the mask you just created
    image.setTo(Scalar(190, 0, 0), mask);
    imshow("image", image);
    

    希望对您有所帮助!

    【讨论】:

      【解决方案2】:

      你可以试试cvThreshold 函数。对于第二部分,cvFloodFill 可能是您需要的。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-10-02
        • 2021-09-05
        • 1970-01-01
        • 1970-01-01
        • 2020-11-25
        • 2010-09-23
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多