@@ -88,7 +88,6 @@ SmartCrop.crop = function(image, options, callback){
88
88
// -> don't pick crops that need upscaling
89
89
options . minScale = min ( options . maxScale || SmartCrop . DEFAULTS . maxScale , max ( 1 / scale , ( options . minScale || SmartCrop . DEFAULTS . minScale ) ) ) ;
90
90
}
91
- //console.log(options);
92
91
var smartCrop = new SmartCrop ( options ) ;
93
92
if ( options . width && options . height ) {
94
93
if ( options . prescale !== false ) {
@@ -163,8 +162,6 @@ SmartCrop.prototype = {
163
162
else {
164
163
od [ p ] = 0 ;
165
164
}
166
- //od[p] = lightness;
167
- //od[p+2] = lightness;
168
165
}
169
166
}
170
167
} ,
@@ -185,7 +182,6 @@ SmartCrop.prototype = {
185
182
else {
186
183
od [ p + 2 ] = 0 ;
187
184
}
188
- //od[p+2] = saturation > options.saturation ? 255 : saturation*127;
189
185
}
190
186
}
191
187
} ,
@@ -233,45 +229,12 @@ SmartCrop.prototype = {
233
229
score . skin += od [ p ] / 255 * ( detail + options . skinBias ) * importance ;
234
230
score . detail += detail * importance ;
235
231
score . saturation += od [ p + 2 ] / 255 * ( detail + options . saturationBias ) * importance ;
236
- //if(Number.isNaN(score.detail)) debugger;
237
- //if(Number.isNaN(score.saturation)) debugger;
238
- //if(Number.isNaN(score.skin)) debugger;
239
- //if(Number.isNaN(score.total)) debugger;
240
232
}
241
233
242
234
}
243
235
score . total = ( score . detail * options . detailWeight + score . skin * options . skinWeight + score . saturation * options . saturationWeight ) / crop . width / crop . height ;
244
- //console.log(score);
245
236
return score ;
246
237
} ,
247
- //_score: function(output, crop){
248
- //var score = {
249
- //detail: 0,
250
- //saturation: 0,
251
- //skin: 0,
252
- //total: 0
253
- //},
254
- //options = this.options,
255
- //downSample = options.scoreDownSample,
256
- //invDownSample = 1/downSample;
257
- //for(var y = crop.y; y < crop.y+crop.height; y+=downSample) {
258
- //for(var x = crop.x; x < crop.x+crop.width; x+=downSample) {
259
- //var p = (~~(y*invDownSample)*output.width+~~(x*invDownSample))*4;
260
- //score.detail += output.data[p+1]/255*this.importance((x-crop.x)/crop.width, (y-crop.y)/crop.height);
261
- //score.saturation += output.data[p+2]/255*this.importance((x-crop.x)/crop.width, (y-crop.y)/crop.height);
262
- //score.skin += output.data[p]/255*(output.data[p+1]/255+options.skinBias)*this.importance((x-crop.x)/crop.width, (y-crop.y)/crop.height);
263
- ////if(Number.isNaN(score.detail)) debugger;
264
- ////if(Number.isNaN(score.saturation)) debugger;
265
- ////if(Number.isNaN(score.skin)) debugger;
266
- ////if(Number.isNaN(score.total)) debugger;
267
- //}
268
-
269
- //}
270
- //score.total = (score.detail*options.detailWeight + score.skin*options.skinWeight + score.saturation*options.saturationWeight)/crop.width/crop.height;
271
- ////console.log(score);
272
- //return score;
273
- //},
274
-
275
238
importance : function ( crop , x , y ) {
276
239
var options = this . options ;
277
240
@@ -333,7 +296,6 @@ SmartCrop.prototype = {
333
296
334
297
}
335
298
336
- //console.log(crops);
337
299
result . crops = crops ;
338
300
result . topCrop = topCrop ;
339
301
@@ -352,8 +314,6 @@ SmartCrop.prototype = {
352
314
if ( importance < 0 ) {
353
315
output . data [ p ] += importance * - 64 ;
354
316
}
355
- //output.data[p+1] = this.skinColor(input.data[p], input.data[p+1], input.data[p+2], options)*255;
356
- //output.data[p+2] = 0;
357
317
output . data [ p + 3 ] = 255 ;
358
318
}
359
319
}
0 commit comments