@@ -66,7 +66,6 @@ Module['imread'] = function(imageSource) {
6666 ctx = canvas . getContext ( '2d' ) ;
6767 } else {
6868 throw new Error ( 'Please input the valid canvas or img id.' ) ;
69- return ;
7069 }
7170
7271 var imgData = ctx . getImageData ( 0 , 0 , canvas . width , canvas . height ) ;
@@ -82,11 +81,9 @@ Module['imshow'] = function(canvasSource, mat) {
8281 }
8382 if ( ! ( canvas instanceof HTMLCanvasElement ) ) {
8483 throw new Error ( 'Please input the valid canvas element or id.' ) ;
85- return ;
8684 }
8785 if ( ! ( mat instanceof cv . Mat ) ) {
8886 throw new Error ( 'Please input the valid cv.Mat instance.' ) ;
89- return ;
9087 }
9188
9289 // convert the mat type to cv.CV_8U
@@ -108,7 +105,6 @@ Module['imshow'] = function(canvasSource, mat) {
108105 break ;
109106 default :
110107 throw new Error ( 'Bad number of channels (Source image must have 1, 3 or 4 channels)' ) ;
111- return ;
112108 }
113109 var imgData = new ImageData ( new Uint8ClampedArray ( img . data ) , img . cols , img . rows ) ;
114110 var ctx = canvas . getContext ( '2d' ) ;
@@ -128,7 +124,6 @@ Module['VideoCapture'] = function(videoSource) {
128124 }
129125 if ( ! ( video instanceof HTMLVideoElement ) ) {
130126 throw new Error ( 'Please input the valid video element or id.' ) ;
131- return ;
132127 }
133128 var canvas = document . createElement ( 'canvas' ) ;
134129 canvas . width = video . width ;
@@ -138,15 +133,12 @@ Module['VideoCapture'] = function(videoSource) {
138133 this . read = function ( frame ) {
139134 if ( ! ( frame instanceof cv . Mat ) ) {
140135 throw new Error ( 'Please input the valid cv.Mat instance.' ) ;
141- return ;
142136 }
143137 if ( frame . type ( ) !== cv . CV_8UC4 ) {
144138 throw new Error ( 'Bad type of input mat: the type should be cv.CV_8UC4.' ) ;
145- return ;
146139 }
147140 if ( frame . cols !== video . width || frame . rows !== video . height ) {
148141 throw new Error ( 'Bad size of input mat: the size should be same as the video.' ) ;
149- return ;
150142 }
151143 ctx . drawImage ( video , 0 , 0 , video . width , video . height ) ;
152144 frame . data . set ( ctx . getImageData ( 0 , 0 , video . width , video . height ) . data ) ;
@@ -263,7 +255,7 @@ function Scalar(v0, v1, v2, v3) {
263255Scalar . prototype = new Array ; // eslint-disable-line no-array-constructor
264256
265257Scalar . all = function ( v ) {
266- return new Scalar ( v , v , v , v ) ;
258+ return Scalar ( v , v , v , v ) ;
267259} ;
268260
269261Module [ 'Scalar' ] = Scalar ;
@@ -273,8 +265,8 @@ function MinMaxLoc() {
273265 case 0 : {
274266 this . minVal = 0 ;
275267 this . maxVal = 0 ;
276- this . minLoc = new Point ( ) ;
277- this . maxLoc = new Point ( ) ;
268+ this . minLoc = Point ( 0 , 0 ) ;
269+ this . maxLoc = Point ( 0 , 0 ) ;
278270 break ;
279271 }
280272 case 4 : {
@@ -295,7 +287,7 @@ Module['MinMaxLoc'] = MinMaxLoc;
295287function Circle ( ) {
296288 switch ( arguments . length ) {
297289 case 0 : {
298- this . center = new Point ( ) ;
290+ this . center = Point ( 0 , 0 ) ;
299291 this . radius = 0 ;
300292 break ;
301293 }
0 commit comments