Code Monkey home page Code Monkey logo

autocrop's People

Contributors

z80z80z80 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

autocrop's Issues

order_rect() can fail in some cases

If a photo is really in diagonal, this function fails:

 ---------------------------------
|                          *tr
|
|       * tl
|
|                                *br
|
|             *bl
|

I propose the following code:

def order_rect(points):
    # initialize result -> rectangle coordinates (4 corners, 2 coordinates (x,y))
    res = np.zeros((4, 2), dtype=np.float32)

    left_to_right = points[points[:, 0].argsort()] # Sorted by x

    left_points = left_to_right[:2,:]
    left_points = left_points[left_points[:, 1].argsort()] # Sorted by y
    right_points = left_to_right[2:,:]
    right_points = right_points[right_points[:, 1].argsort()] # Sorted by y

    res[0] = left_points[0]
    res[1] = right_points[0]
    res[2] = right_points[1]
    res[3] = left_points[1]

    return res

One closing bracket missing

Hey,
Thanks a lot for your this code!

I noted that one bracket is not being closed on line 114 currently:

print("WARNING: This seems to be an edge case. If the result isn't satisfying try lowering the threshold using -t"

should be
print("WARNING: This seems to be an edge case. If the result isn't satisfying try lowering the threshold using -t")

Cheers.

Does This Python Auto Cropping Tool Work with RAW (CR2) Captures?

These are questions before I start experimenting with this autocropping tool. It was not clear in the description on these items.

Does this work with RAW (Canon CR2) input files? Can the tool produce JPG and preferably TIFF output files on the cropped images?

How fast (cropped files per minute)?

Thanks for your help and time.

IndexError

I am getting error in this line.
for f in files[0]:

IndexError: list index out of range

Cut black borders

Hi,
I just stumbled uppon your very cool script:) Would it also be possible to cut black borders?
Which variables would have to be changed for this? I looked at the code but my python is to basic to fully understand it. I assume it would be somewhere in the cont function?
I am digitizing old dias for my mother and they look as follows:
DSC_00324.JPG

Thank your for your work done with this script, and I would be very happy to hear from you :)

Algorithm does not terminate

My scanner produces images like the attached example. The algorithm does not terminate with the attached file.
test

Script error - syntax error

Hi
I am trying to run the script, but it gives me an error:

python autocrop.py

File "autocrop.py", line 87
print(f"Adjust Threshold: {user_thresh}")
^
SyntaxError: invalid syntax

What could be the problem?

Enormous post-conversion file size

Found your script useful for a similar issue I'm running into for photo scans. It works well for me, but the file size increases significantly. E.g. uncropped, my images are 300-500kB but cropped they are about 1.5-2.5MB. Any idea why this is happening?

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.