zoukankan      html  css  js  c++  java
  • 【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);
    
    

     

  • 相关阅读:
    java数据库连接池proxool介绍及mysql8小时断开连接问题的说明
    golang 做了个mutex与atomic性能测试
    Pcre 安装
    go err
    go if switch range
    Nginx 处理Http请求头部流程
    go 指针
    golang struct、interface详解
    go slice详解
    Linux基础
  • 原文地址:https://www.cnblogs.com/bjxqmy/p/12767713.html
Copyright © 2011-2022 走看看