LoginSignup
1
0

More than 1 year has passed since last update.

OpenCV C++ クロスを描画

Posted at

クロスの描画

write_cross.cpp
#include <opencv2/opencv.hpp>

using namespace cv;

int main(int argc, const char * argv[])
{
    //Mat img = imread( "image.jpg" );
    //単色画像の生成(参考:http://opencv.jp/cookbook/opencv_mat.html の 「cv::vecを使う」
    cv::Mat_<cv::Vec3b> img(300, 300, cv::Vec3b(0,200,0)); // 追加

    imshow("1", img );

    //参考: https://docs.opencv.org/3.4/d6/d6e/group__imgproc__draw.html
    //cv::drawMarker (Mat &img, Point position, const Scalar &color, int markerType=MARKER_CROSS, int markerSize=20, int thickness=1, int line_type=8)
    cv::drawMarker(img, cv::Point(100,100), cv::Vec3b(0,0,200), cv::MARKER_CROSS);
    imshow("2", img );
    imwrite("img.png",img);

    waitKey(0);

    return 0;
}

img.png

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0