Git Product home page Git Product logo

crop's People

Contributors

cheesesucker avatar christiandavilakoobin avatar ecaron avatar jdeniau avatar mcuadros avatar nmcquay avatar themightychris avatar wapmorgan avatar willjosefi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

crop's Issues

Tabs vs Spaces

Hi,

I can make a PR fixing this, but i think is better if you do it, indentation is mixed between tabs and spaces.

Regards

Face detection

Implement a working version of the face aware cropping

CropEntropy doesn't work

I was playing around with CropEntropy and noticed it had mixed results, and very strong bias to the left side of the image.

Input (400x200):
input

Output (200x200):
output

The resulting image should not have black in it.

I decided to save the slices the script generates and discovered the script doesn't take the length of the short side of the image into account. As a result the slice sizes are incorrect.

aSlice 1:
a1

bSlice 1:
b1

aSlice 2:
a2

bSlice 2:
b2

aSlice 25:
a25

bSlice 25:
b25

Notice that the slices don't change position, just size.

Also, if the first bSlice has more entropy than any aSlice, it will never process any of the other slices on the b-side. This means the image will be cropped to the right side even though the middle part of the image might have more entropy.

I stopped trying to fix the script and wrote my own. My script only generates square images but will actually try to crop the area with the most total entropy in it. Feel free to use any of the code.

https://github.com/ElbertF/Shot.io/blob/master/Shot/Models/Image.php

Issue when resizing (not whole height)

I am trying to use the "crop" script on my website for generating thumbnails of panoramic pictures. I observe a very strange result (but maybe normal) when I use "CropEntropy". My goal is to extract a thumbnail with random size for many pictures (for building a mosaic).

My approach is:

  1. I resize (if necessary) my pictures using Imagick (I specify a maximum width of height of 4000px because panoramic pictures are really huge). These pictures can be consider as reference pictures.
  2. I resize these pictures for generating thumbnails using Imagick (maximum height=400px).
  3. I use the "CropEntropy" function on the 400px pictures for extracting thumbnails using a box that I have computed the size (the height of the thumbnail will be equal to H=0.7*400 and the width (W) will be randomly chosen between two values (400 and 1000px in my case)).

For the third point, I use the following syntax (where $image is the 400px picture):
$cropperEntropy = new stojg\crop\CropEntropy($image);
$croppedImage = $cropperEntropy->resizeAndCrop(intval($DimCropWidth),intval($DimCropHeight));
$croppedImage->writeimage($ImageNameCrop);

Using this process, I obtain a HxW picture (height H, width W) but the function resize the original 400px-picture for obtaining a picture with a height of H. Maybe this issue is normal but in my case, I have commented the line "$this->originalImage->resizeImage($crop['width'], $crop['height'], \Imagick::FILTER_CUBIC, .5);" in the Crop.php file for avoiding this and obtaining crop picture with not the whole height of my orginal picture.

I don't know if I am very clear but maybe it can be interresting to correct this issue (if it is one) or adding the possibility of extracting one box inside of a picture (with not the whole height of the original picture).

The issue seems to come from the "getSafeResizeOffset" function that fixes the cropping height to $targetHeight in my case.

License?

Hi,

I'd love to add your library to a project I'm working on but I don't see any mention of a license. May I suggest including it in the README and/or adding a file like this?

Face detection doesn't work with GIF's, and has error

First face detection doesn't work with GIF, because the underlying CV library doesn't support it. See: http://opencv.jp/opencv-2svn_org/c/highgui_reading_and_writing_images_and_video.html

So bug 1 would be to convert the image from GIF if needed.

But 2 is that if you do this you get an error from the getFaceList() function because getFaceListFromClassifier() returns false instead of an array - and it's not expecting that.

So aside from supporting GIF's, presumably getFaceListFromClassifier() should check for false and return an empty array.

indicate required imagemagick version

hi, thanks a million for an excellent cropper!

on localhost, I've got the results I wanted however in the production on a debian squeeze box there were some hoops to jump over:

  • firstly I got segfaults that I traced back to the OpenMP feature of Imagemagick (how to disable it)
  • second problem is that the resulting cropping is different on the squeeze box, I've traced it only up to the grayscaleEntropy function, histograms from over there do differ on both boxes, ie the result of:
convert aslice.jpg -define histogram:unique-colors=true -format %c histogram:info:-

it seems to be connected with default colorspace being sRGB on newer IM versions,
however setting the colorspace in code didn't got me wanted results

I'm going to try to upgrade the imagemagick right now
(shame that composer's require directive is not helpful here :(

Face detection cropping is very slow because it uses the original image

Face detection cropping should run the detection on the resized image, not the original image.

It's far too slow otherwise.

This can be done in the getFaceListFromClassifier function - write the resized image to a temporary file, then check that for faces (and then use safeZone instead of safeZoneList in getSafeZoneList).

If you are worried about accuracy then make it an option.

Entropy Crop With AWS ImageMagick 6.7.8-9

I've installed AWS's version of ImageMagick(which is version ImageMagick 6.7.8-9). I cannot get the entropy crop to work correctly. However when I recompile with the ImageMagick source(this is version 6.9.1) the entropy crop works fine.

Does entropy crop not work with version 6.7.8-9?

Imagecow implementation

Hi. I'm the creator of oscarotero/imagecow, a simple library for basic image manipulations (resize, crop, rotate and not much more).
The library has a crop() and resizeCrop methods and I wanted to use this library to provide a way to use the Entropy and other methods. The best way to do it is include this library as a dependency (using composer) but all methods used for the calculations are protected so I had to copy/paste the code and do some changes here's the result. According to the license, this is allowed (Redistribution and use in source and binary forms, with or without modification, are permitted...) and, of course, your copyright is included in Imagecow.

I just wanted to let you know about this and, if this library changes to a more reusable aproach, I will change Imagecow to include it as a dependency.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.