ojos
Version:
High level API on top of Mirada (opencv.js) supporting bth browser and node.
54 lines • 2.08 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var mirada_1 = require("mirada");
var abstractOperation_1 = require("./abstractOperation");
var Bitwise = /** @class */ (function (_super) {
__extends(Bitwise, _super);
function Bitwise() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.name = "Bitwise";
_this.sameSizeAndType = true;
_this.noInPlace = true;
return _this;
}
Bitwise.prototype.validate = function (o) {
if (!o.type) {
return 'type option is required';
}
if (!o.src2 && ['add', 'or', 'xoe'].includes(o.type)) {
return 'src2 option is required';
}
};
Bitwise.prototype._exec = function (o) {
// TODO: check mask type and size
// TODO: check src2 size and type
if (o.type === 'not') {
cv.bitwise_not(o.src, o.dst, o.mask || mirada_1.noArray());
}
else if (o.type === 'and') {
cv.bitwise_and(o.src, o.src2, o.dst, o.mask || mirada_1.noArray());
}
else if (o.type === 'or') {
cv.bitwise_or(o.src, o.src2, o.dst, o.mask || mirada_1.noArray());
}
else if (o.type === 'xor') {
cv.bitwise_xor(o.src, o.src2, o.dst, o.mask || mirada_1.noArray());
}
};
return Bitwise;
}(abstractOperation_1.AbstractOperation));
exports.Bitwise = Bitwise;
//# sourceMappingURL=bitwise.js.map
;