Giter Site home page Giter Site logo

huningxin / opencv Goto Github PK

View Code? Open in Web Editor NEW

This project forked from opencv/opencv

21.0 12.0 11.0 545.01 MB

Open Source Computer Vision Library

Home Page: opencv.org

License: Apache License 2.0

CMake 2.53% C++ 85.28% Cuda 0.82% Shell 0.06% C 4.05% TeX 0.01% Java 2.04% Python 2.38% Perl 0.04% Batchfile 0.01% Objective-C++ 0.99% Objective-C 0.26% PowerShell 0.04% JavaScript 0.61% HTML 0.11% Prolog 0.01% Dockerfile 0.01% Swift 0.76% Kotlin 0.01% AIDL 0.01%

opencv's Introduction

OpenCV: Open Source Computer Vision Library

Resources

Contributing

Please read the contribution guidelines before starting work on a pull request.

Summary of the guidelines:

  • One pull request per issue;
  • Choose the right base branch;
  • Include tests and documentation;
  • Clean up "oops" commits before submitting;
  • Follow the coding style guide.

opencv's People

Contributors

abak avatar akarsakov avatar alalek avatar albenoit avatar asmorkalov avatar berak avatar bitwangyaoyao avatar bloodaxe avatar catree avatar csukuangfj avatar cv3d avatar dkurt avatar edgarriba avatar ilya-lavrenov avatar l-bat avatar laurentberger avatar mshabunin avatar obilaniu avatar ozantonkal avatar paroj avatar phillab avatar pli2-intel avatar savuor avatar sovrasov avatar sturkmen72 avatar terfendail avatar tolyatalamanov avatar tomoaki0705 avatar vpisarev avatar yashassamaga avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opencv's Issues

Build warnings of no previous prototype for function

146 warnings of "no previous prototype for function" generated, e.g.:

/home/nhu/devel/opencv/build_js/modules/js/bindings.cpp:865:10: warning: no previous prototype for function 'CascadeClassifier_detectMultiScale_wrapper' [-Wmissing-prototypes]
    void CascadeClassifier_detectMultiScale_wrapper(cv::CascadeClassifier& arg0 , const cv::Mat& arg1, std::vector<Rect>& arg2, double arg3, int arg4, int arg5, Size arg6, Size arg7) {
         ^

OpenCV.JS API V2

We need a new API with modern JavaScript in mind. The existing API is tied to the original C++ API which is not ideal for JS world. Consider the following inspiring example taken from the tests.

  var aa = 1,
        source = new cv.MatVector(),
        channels = new cv.IntVector(),
        histSize = new cv.IntVector(),
        ranges = new cv.FloatVector();

  var vec1 = new cv.Mat.ones([20, 20], cv.CV_8UC1);
  source.push_back(vec1);
  channels.push_back(0);
  histSize.push_back(256);
  ranges.push_back(0); ranges.push_back(256);

  let hist = new cv.Mat();
  let mask = new cv.Mat();
  cv.calcHist(source, channels, mask, hist, histSize, ranges, false);

Looking at cv.calcHist function, we can observe several issues.

  1. It is based on C++ syntax. At the very least Python API is preferred, since I assume it is the most popular version. For comparison, here is the Python signature for calcHist function
cv2.calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) โ†’ hist
  1. Usage of std::Vector in JavaScript. So JS programmers are expected to know about C++ STL.
  2. Output parameters is being passed by reference which again is not too common in JS.
  3. Not supporting default parameters
  4. Using null variable instead of empty Mat object is preferred.

Using new API same code can be re-written as follows.

  var vec1 = new cv.Mat.ones([20, 20], cv.CV_8UC1),
        sources = [vec1],
        channels = [0, 1, 2], 
        histSize = [256, 256, 256],
        mask = new cv.Mat(),
        ranges = [0, 256];

  var hist = cv.calcHist(source, channels, mask, histSize, ranges);

Create utils.js for common functions used in different tutorials

Like

function loadImageToCanvas(url, cavansId) {
  let canvas = document.getElementById(cavansId);
  let ctx = canvas.getContext('2d');
  let img = new Image();
  img.crossOrigin = 'anonymous';
  img.onload = function() {
    canvas.width = img.width;
    canvas.height = img.height;
    ctx.drawImage(img, 0, 0, img.width, img.height);
  }
  img.src = url;
}

Put it into utils.js and different tutorial pages can share it.

cv::Mat clone() gives wrong value

While using clone(), it gives wrong value sometimes. For example, in featrues_2d.html line 179, change img to img.clone(), there will be some wrong value in the row 1 of the output image, just like the attach file.

new bitmap image

Introduce CV_WRAP_JS and annotate the functions exposing to JS

Paste @sajjadt 's original idea here. Please feel free to update.

"
I've also attached the list of important OpenCV functions that we want in our binding. This helps making the generated binary much smaller. We also want to cover only these functions in tutorials. To generate bindings for these functions, I suggest to define a new Macro e.g. CV_WRAP_JS and annotate the functions with it. Then binding generator can recognize these functions.
"

Implement inline interactive tutorials

We need interactive tutorials, which embed html elements and let people try the code in the tutorial pages .
But now, markdown doesn't support html5, including many html elements we need.

As a temporary solution, I will make independent interactive pages, and give the link in tutorial pages.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.