jwagner / smartcrop.js

Content aware image cropping

Home Page:http://29a.ch/2014/04/03/smartcrop-content-aware-image-cropping

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't find best crop

dclause opened this issue · comments

Hi !
Thanks for this amazing library. I use it to smart crop some thumbnails and a user of mine tried it to with the following image:
image

The purpose is to have it cropped to width: 450px, height 150px.
When using this tool: https://29a.ch/sandbox/2014/smartcrop/examples/testbed.html
I can see the preview works fine with a crop starting at 0x24. Notice the third one is a crop starting at 0x241.

In code though, all returned crops are:

{"x":0,"y":0,"width":1159,"height":383,"score":{"detail":-104.11501867093101,"saturation":-5.999802129457631,"skin":1.9283703323221526,"boost":0,"total":-0.00036810854144012653}} 
{"x":0,"y":24,"width":1159,"height":383,"score":{"detail":-56.16525565183794,"saturation":-3.0477126789318594,"skin":2.461430895582579,"boost":0,"total":-0.00014573586749942855}} 
{"x":0,"y":48,"width":1159,"height":383,"score":{"detail":-57.2293816730845,"saturation":0.463251345437012,"skin":1.153528922878493,"boost":0,"total":-0.0001911745230251786}} 
{"x":0,"y":72,"width":1159,"height":383,"score":{"detail":-58.87187541531654,"saturation":4.535271644237246,"skin":-2.7804263678364567,"boost":0,"total":-0.0003347608140736796}} 
{"x":0,"y":96,"width":1159,"height":383,"score":{"detail":-56.39788774743743,"saturation":8.004081548989408,"skin":-3.175305768719252,"boost":0,"total":-0.00033207676710718506}} 
{"x":0,"y":120,"width":1159,"height":383,"score":{"detail":-52.75468313226228,"saturation":9.522417640144617,"skin":-3.5841913718215026,"boost":0,"total":-0.00032911415952503075}} 
{"x":0,"y":144,"width":1159,"height":383,"score":{"detail":-52.34772009001673,"saturation":9.851516265132997,"skin":-5.311134061195629,"boost":0,"total":-0.00039051086166425075}} 
{"x":0,"y":169,"width":1159,"height":383,"score":{"detail":-47.24157938791536,"saturation":12.106789364775224,"skin":-5.726827636896237,"boost":0,"total":-0.0003802888510400012}} 
{"x":0,"y":193,"width":1159,"height":383,"score":{"detail":-38.91701515478981,"saturation":14.817643748754207,"skin":-4.613893562808923,"boost":0,"total":-0.00029951294023004024}} 
{"x":0,"y":217,"width":1159,"height":383,"score":{"detail":-28.532768978099767,"saturation":15.29444837078221,"skin":-1.967200582733591,"boost":0,"total":-0.0001582609499561638}} 
{"x":0,"y":241,"width":1159,"height":383,"score":{"detail":-21.00452786437013,"saturation":14.527971499002678,"skin":-0.7795081188924486,"boost":0,"total":-0.00008512186345513793}} 
{"x":0,"y":265,"width":1159,"height":383,"score":{"detail":-20.15399038870834,"saturation":14.18834988216667,"skin":-0.9678796888294225,"boost":0,"total":-0.00008928286026529612}} 
{"x":0,"y":289,"width":1159,"height":383,"score":{"detail":-20.463943223041927,"saturation":13.139495507556804,"skin":-2.8497882106712598,"boost":0,"total":-0.0001621649006123067}} 
{"x":0,"y":314,"width":1159,"height":383,"score":{"detail":-23.719379163248988,"saturation":7.768022591345811,"skin":-4.150555686691474,"boost":0,"total":-0.00023454055547817977}} 
{"x":0,"y":338,"width":1159,"height":383,"score":{"detail":-29.27577211811,"saturation":0.5480934018815907,"skin":-7.157569157327678,"boost":0,"total":-0.0003831194546961873}} 
{"x":0,"y":362,"width":1159,"height":383,"score":{"detail":-34.24686307723896,"saturation":-2.2046311509920615,"skin":-9.814085297634454,"boost":0,"total":-0.0005072012234721338}} 
{"x":0,"y":386,"width":1159,"height":383,"score":{"detail":-43.51412120549435,"saturation":-2.943339323742967,"skin":-16.556508747735762,"boost":0,"total":-0.0007955805839771476}} 

and topScore is:
{"x":0,"y":241,"width":1159,"height":383,"score":{"detail":-21.00452786437013,"saturation":14.527971499002678,"skin":-0.7795081188924486,"boost":0,"total":-0.00008512186345513793}}

What I don't understand is why I can't find the exact same best crop using the same code and the online photo. Are there some options I could use to make detection fit better ?

Can you link to an example of what you expect and what happens? I'm not sure I understand what you mean.