OpenCV笔记

imread参数设置:
CV_LOAD_IMAGE_UNCHANGED -1 原始图像
CV_LOAD_IMAGE_GRAYSCALE 0 灰度图像
CV_LOAD_IMAGE_COLOR 1 彩色(默认值)
CV_LOAD_IMAGE_ANYDEPTH 2 任何彩度
CV_LOAD_IMAGE_ANYCOLOR 4 任何彩色

imwrite参数设置: Format-specific save parameters encoded as pairs paramId, paramValue

For JPEG, it can be a quality ( CV_IMWRITE_JPEG_QUALITY ) from 0 to 100 (the higher is the better). Default value is 95.

For PNG, it can be the compression level ( CV_IMWRITE_PNG_COMPRESSION ) from 0 to 9. A higher value means a smaller size and longer compression time. Default value is 3.

For PPM, PGM, or PBM, it can be a binary format flag ( CV_IMWRITE_PXM_BINARY ), 0 or 1. Default value is 1.

Note:
The function imwrite saves the image to the specified file. The image format is chosen based on the filename extension (see imread() for the list of extensions). Only 8-bit (or 16-bit unsigned (CV_16U) in case of PNG, JPEG 2000, and TIFF) single-channel or 3-channel (with ‘BGR’ channel order) images can be saved using this function. If the format, depth or channel order is different, use Mat::convertTo() , and cvtColor() to convert it before saving. Or, use the universal FileStorage I/O functions to save the image to XML or YAML format.

OpenCV多版本安装(放弃了,各种问题):

查看opencv版本:
pkg-config --modversion opencv

安装OpenCV2.4.9

使用apt-get install libopencv-dev安装的默认为2.4.9(Ubuntu16.04)

OpenCV画好看的圈圈(关键点):

std::for_each(keypoints.begin(), keypoints.end(), [&](cv::KeyPoint i){
    cv::RNG& random_rng = cv::theRNG();
    cv::Scalar random_color = cv::Scalar(random_rng(256), random_rng(256), random_rng(256));
    cv::circle(img_fast_opencv, cv::Point2f(i.pt.x, i.pt.y), 3, random_color, 1, cv::LINE_AA, 0);
    });

 

 

posted on 2018-03-18 10:59  萝卜丶爱  阅读(137)  评论(0编辑  收藏  举报

导航