Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions mats.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ import { CvType } from './constants';

export class Mat {
constructor(numRows, numCols, cvtype, scalarval) {
if (numRows && numCols && cvtype) {
if (numRows !== undefined && numCols !== undefined && cvtype !== undefined) {
this.rows = numRows
this.cols = numCols
this.CvType = cvtype
}
if (scalarval) {
if (scalarval !== undefined) {
this.CvScalar = scalarval
}
}

init = async() => {
let res
if (this.rows && this.cols && this.CvType && this.CvScalar) {
if (this.rows !== undefined && this.cols !== undefined && this.CvType !== undefined && this.CvScalar !== undefined) {
res = await RNOpencv3.MatWithScalar(this.rows, this.cols, this.CvType, this.CvScalar)
}
else if (this.rows && this.cols && this.CvType) {
else if (this.rows !== undefined && this.cols !== undefined && this.CvType !== undefined) {
res = await RNOpencv3.MatWithParams(this.rows, this.cols, this.CvType)
}
else {
res = await RNOpencv3.Mat()
}
}
res.setTo = this.setTo.bind(res)
res.get = this.get.bind(res)
res.put = this.put.bind(res)
Expand Down Expand Up @@ -64,12 +64,12 @@ export class MatOfInt {
}

init = async() => {
if (this.highintvalue && this.highintvalue != this.lowintvalue) {
if (this.highintvalue !== undefined && this.highintvalue !== this.lowintvalue) {
return await RNOpencv3.MatOfInt(this.lowintvalue, this.highintvalue)
}
else {
return await RNOpencv3.MatOfInt(this.lowintvalue, this.lowintvalue)
}
}
else {
return await RNOpencv3.MatOfInt(this.lowintvalue, this.lowintvalue)
}
}
}

Expand All @@ -80,7 +80,7 @@ export class MatOfFloat {
}

init = async() => {
if (this.highfloatvalue && this.highfloatvalue != this.lowfloatvalue) {
if (this.highfloatvalue !== undefined && this.highfloatvalue !== this.lowfloatvalue) {
return await RNOpencv3.MatOfFloat(this.lowfloatvalue, this.highfloatvalue)
}
else {
Expand Down