base.js 837 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. if (typeof window === 'undefined') {
  2. var cv = require("../opencv");
  3. if (cv instanceof Promise) {
  4. loadOpenCV();
  5. } else {
  6. cv.onRuntimeInitialized = perf;
  7. }
  8. }
  9. let gCvSize;
  10. function getCvSize() {
  11. if (gCvSize === undefined) {
  12. gCvSize = {
  13. szODD: new cv.Size(127, 61),
  14. szQVGA: new cv.Size(320, 240),
  15. szVGA: new cv.Size(640, 480),
  16. szSVGA: new cv.Size(800, 600),
  17. szqHD: new cv.Size(960, 540),
  18. szXGA: new cv.Size(1024, 768),
  19. sz720p: new cv.Size(1280, 720),
  20. szSXGA: new cv.Size(1280, 1024),
  21. sz1080p: new cv.Size(1920, 1080),
  22. sz130x60: new cv.Size(130, 60),
  23. sz213x120: new cv.Size(120 * 1280 / 720, 120),
  24. };
  25. }
  26. return gCvSize;
  27. }
  28. async function loadOpenCV() {
  29. cv = await cv;
  30. }
  31. if (typeof window === 'undefined') {
  32. exports.getCvSize = getCvSize;
  33. }