• 【opencv.js】经常使用的几种数据结构(Point、Scalar、Size、Circle、Rect、RotatedRect)


    相关内容详细介绍请移步官网:【https://docs.opencv.org/3.3.1/d5/df1/tutorial_js_some_data_structures.html

     

    Point 

    // The first way
    let point = new cv.Point(x, y);
    
    // The second way
    let point = {x: x, y: y};

     

    Scalar

    // The first way
    let scalar = new cv.Scalar(R, G, B, Alpha);
    
    // The second way
    let scalar = [R, G, B, Alpha];

     

    Size

    // The first way
    let size = new cv.Size(width, height);
    
    // The second way
    let size = {width : width, height : height};

     

    Circle

    // The first way
    let circle = new cv.Circle(center, radius);
    
    // The second way
    let circle = {center : center, radius : radius};

     

    Rect

    // The first way
    let rect = new cv.Rect(x, y, width, height);
    
    // The second way
    let rect = {x : x, y : y, width : width, height : height};

     

    RotatedRect

    // The first way
    let rotatedRect = new cv.RotatedRect(center, size, angle);
    
    // The second way
    let rotatedRect = {center : center, size : size, angle : angle};
    
    //获取 rotatedRect 四个点的位置信息
    let vertices = cv.RotatedRect.points(rotatedRect);
    let point1 = vertices[0];
    let point2 = vertices[1];
    let point3 = vertices[2];
    let point4 = vertices[3];
    
    //获取 rotatedRect 的最小包围矩阵
    let boundingRect = cv.RotatedRect.boundingRect(rotatedRect);
    
    

     

  • 相关阅读:
    120.三角形最短路径(leetcode)
    Python Pycharm中灵活运用debugger
    POJ 1284
    POJ 2407
    POJ 1811
    HDU 1164
    HDU 4228
    HDU 2521
    HDU 4133
    ZOJ 2562 反素数
  • 原文地址:https://www.cnblogs.com/bjxqmy/p/12767713.html
Copyright © 2020-2023  润新知