Binarizer.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright 2009 ZXing authors
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. /**
  17. * This class hierarchy provides a set of methods to convert luminance data to 1 bit data.
  18. * It allows the algorithm to vary polymorphically, for example allowing a very expensive
  19. * thresholding technique for servers and a fast one for mobile. It also permits the implementation
  20. * to vary, e.g. a JNI version for Android and a Java fallback version for other platforms.
  21. *
  22. * @author dswitkin@google.com (Daniel Switkin)
  23. */
  24. class Binarizer {
  25. constructor(source) {
  26. this.source = source;
  27. }
  28. getLuminanceSource() {
  29. return this.source;
  30. }
  31. getWidth() {
  32. return this.source.getWidth();
  33. }
  34. getHeight() {
  35. return this.source.getHeight();
  36. }
  37. }
  38. export default Binarizer;