test_photo.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. // //////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
  4. //
  5. // By downloading, copying, installing or using the software you agree to this license.
  6. // If you do not agree to this license, do not download, install,
  7. // copy or use the software.
  8. //
  9. //
  10. // License Agreement
  11. // For Open Source Computer Vision Library
  12. //
  13. // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
  14. // Third party copyrights are property of their respective owners.
  15. //
  16. // Redistribution and use in source and binary forms, with or without modification,
  17. // are permitted provided that the following conditions are met:
  18. //
  19. // * Redistribution's of source code must retain the above copyright notice,
  20. // this list of conditions and the following disclaimer.
  21. //
  22. // * Redistribution's in binary form must reproduce the above copyright notice,
  23. // this list of conditions and the following disclaimer in the documentation
  24. // and/or other materials provided with the distribution.
  25. //
  26. // * The name of the copyright holders may not be used to endorse or promote products
  27. // derived from this software without specific prior written permission.
  28. //
  29. // This software is provided by the copyright holders and contributors "as is" and
  30. // any express or implied warranties, including, but not limited to, the implied
  31. // warranties of merchantability and fitness for a particular purpose are disclaimed.
  32. // In no event shall the Intel Corporation or contributors be liable for any direct,
  33. // indirect, incidental, special, exemplary, or consequential damages
  34. // (including, but not limited to, procurement of substitute goods or services;
  35. // loss of use, data, or profits; or business interruption) however caused
  36. // and on any theory of liability, whether in contract, strict liability,
  37. // or tort (including negligence or otherwise) arising in any way out of
  38. // the use of this software, even if advised of the possibility of such damage.
  39. //
  40. // Author : Rijubrata Bhaumik, Intel Corporation. rijubrata.bhaumik[at]intel[dot]com
  41. if (typeof module !== 'undefined' && module.exports) {
  42. // The environment is Node.js
  43. var cv = require('./opencv.js'); // eslint-disable-line no-var
  44. }
  45. QUnit.module('Photo', {});
  46. QUnit.test('test_photo', function(assert) {
  47. // CalibrateDebevec
  48. {
  49. let calibration = new cv.CalibrateDebevec();
  50. assert.ok(true, calibration);
  51. //let response = calibration.process(images, exposures);
  52. }
  53. // CalibrateRobertson
  54. {
  55. let calibration = new cv.CalibrateRobertson();
  56. assert.ok(true, calibration);
  57. //let response = calibration.process(images, exposures);
  58. }
  59. // MergeDebevec
  60. {
  61. let merge = new cv.MergeDebevec();
  62. assert.ok(true, merge);
  63. //let hdr = merge.process(images, exposures, response);
  64. }
  65. // MergeMertens
  66. {
  67. let merge = new cv.MergeMertens();
  68. assert.ok(true, merge);
  69. //let hdr = merge.process(images, exposures, response);
  70. }
  71. // MergeRobertson
  72. {
  73. let merge = new cv.MergeRobertson();
  74. assert.ok(true, merge);
  75. //let hdr = merge.process(images, exposures, response);
  76. }
  77. // TonemapDrago
  78. {
  79. let tonemap = new cv.TonemapDrago();
  80. assert.ok(true, tonemap);
  81. // let ldr = new cv.Mat();
  82. // let retval = tonemap.process(hdr, ldr);
  83. }
  84. // TonemapMantiuk
  85. {
  86. let tonemap = new cv.TonemapMantiuk();
  87. assert.ok(true, tonemap);
  88. // let ldr = new cv.Mat();
  89. // let retval = tonemap.process(hdr, ldr);
  90. }
  91. // TonemapReinhard
  92. {
  93. let tonemap = new cv.TonemapReinhard();
  94. assert.ok(true, tonemap);
  95. // let ldr = new cv.Mat();
  96. // let retval = tonemap.process(hdr, ldr);
  97. }
  98. // Inpaint
  99. {
  100. let src = new cv.Mat(100, 100, cv.CV_8UC3, new cv.Scalar(127, 127, 127, 255));
  101. let mask = new cv.Mat(100, 100, cv.CV_8UC1, new cv.Scalar(0, 0, 0, 0));
  102. let dst = new cv.Mat();
  103. cv.line(mask, new cv.Point(10, 50), new cv.Point(90, 50), new cv.Scalar(255, 255, 255, 255),5);
  104. cv.inpaint(src, mask, dst, 3, cv.INPAINT_TELEA);
  105. assert.equal(dst.rows, 100);
  106. assert.equal(dst.cols, 100);
  107. assert.equal(dst.channels(), 3);
  108. }
  109. });