opencv组件

  • Trackbar

手动调整Trackbar可以得到值,然后根据值进行高斯滤波。


void on_trackbar(int slideValue, void*) {
    Mat imFiltered;
    //要为奇数
    GaussianBlur(src, imFiltered, Size(slideValue/2*2+1, slideValue / 2 * 2 +1), 0);
    imshow(windowName,imFiltered);
}

int main() {
    int slideValue;
    src = imread("lena.jpg");
    namedWindow(windowName,WINDOW_FREERATIO);
    createTrackbar("myTrackBar",windowName, &slideValue, maxSlideValue, on_trackbar);
    on_trackbar(0, NULL);


END:
    waitKey(0);
    system("pause");
    return 0;
}

  • 定义Pixel
typedef Vec3b Pixel;
typedef Point_ Pixel;
typedef Point3_ Pixel;
  • Mat迭代器与const Mat迭代器
MatIterator_ rgb_first = rgb_image.begin();
MatIterator_ rgb_end = rgb_image.end();
MatConstIterator_ labes_first = labels.begin();

你可能感兴趣的:(opencv组件)