• opencv------->>>>>>打印点


    #include<iostream>
    using namespace std;
    #include <opencv2/highgui/highgui.hpp>
    #include<opencv2/core/core.hpp>
    #include <opencv2/imgproc.hpp>

    int main()
    {

    cv::Mat srcImage;
    srcImage = cv::imread("C:/Users/94048/Desktop/A.jpg", 1);
    string array[88] = { "0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20" ,
    "21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40",
    "41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60",
    "61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87", };

    std::vector<float> point_x;
    std::vector<float> point_y;


    //float point[10] = { 8.095, 218.6407, 346.8092, 4.4748,554.8118, 7.2849,22.7169, 538.089 };
    // float point[] = { 1.095,99.6407,366.8092,5.4748,539.8118,3.2849,538.7169,24.089,5.4748,654.7819 };

    float point[] = { 1.095,99.6407,
    366.8092,5.4748,
    538.7169,24.089,
    5.4748,654.7819,
    783.9863, 20.8041,
    1271.2404, 243.0796,
    1266.8606, 20.8041,
    939.4696, 3.2849 };

    int num=sizeof(point) / sizeof(point[0]);
    for (int i = 0; i < num; i++)
    {
    float temp_x = point[2 * i];
    float temp_y = point[2 * i + 1];


    cv::putText(srcImage, array[i], cv::Point(temp_x, temp_y), cv::FONT_HERSHEY_SIMPLEX, 0.8, cv::Scalar(0, 255, 0), 2);


    }


    imshow("srcImage", srcImage);
    cv::waitKey(0);

    cout << "hello word!" << endl;
    }

    cv::Mat srcImage;
    srcImage = cv::imread("/home/sripis/duchao/AlgorithmModule/src33.jpg", 1);
    //std::vector<cv::Rect>& baggagesRects
    std::cout<<"baggagesRects[0].size() ="<<baggagesRects.size()<<std::endl;
    for(int i=0;i<baggagesRects.size();i++)
    {
    cv::rectangle(srcImage, baggagesRects[i], cv::Scalar(255, 0, 0), 1, cv::LINE_8, 0);

    }

    std::string array[88] = { "0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20" ,
    "21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40",
    "41","42","43","44","45","46","47","48","49","50","51","52","53","54","55","56","57","58","59","60",
    "61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87", };
    int count=0;
    //std::vector<std::vector<cv::Point2f>> keybaggageAreas;
    for(int j=0;j<keybaggageAreas.size();j++)
    {
    for(int k=0;k<keybaggageAreas[j].size();k++){

    cv::putText(srcImage, array[count], keybaggageAreas[j][k], cv::FONT_HERSHEY_SIMPLEX, 0.8, cv::Scalar(0, 255, 0), 2);
    count++;
    }

    }


    cv::imwrite("/home/sripis/duchao/AlgorithmModule/result.jpg", srcImage);

  • 相关阅读:
    Hibernate_一对多映射_2
    Hibernate框架_1 单表映射 _2
    JS
    Hibernate框架_1 单表映射
    Spring_1
    Javabean
    JAVA注解(JDK1.5开始)
    JAVA方法的反射
    JAVA-Reflect(反射)1
    Android初学:Gradle 'HelloWorld' project refresh failed
  • 原文地址:https://www.cnblogs.com/shuimuqingyang/p/14075580.html
Copyright © 2020-2023  润新知