gpt4 book ai didi

c - 使用opencv增加帧的某些部分的强度

转载 作者:行者123 更新时间:2023-11-30 14:27:02 25 4
gpt4 key购买 nike

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

最佳答案

正如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);

希望对您有帮助!

关于c - 使用opencv增加帧的某些部分的强度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8252337/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com