Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error with correcting straight images #395

Closed
jugoprex opened this issue Apr 6, 2023 · 1 comment
Closed

error with correcting straight images #395

jugoprex opened this issue Apr 6, 2023 · 1 comment

Comments

@jugoprex
Copy link

jugoprex commented Apr 6, 2023

I've run into what I'm guessing is a bug,
I'm running a script that deskews a whole dataset of .tif images, and i've encountered some problems with apparently straight images.
this is the original image(s): out
out_2

this is the ouput from running the following program:
out
out_2

for file in os.listdir(indir):
    if file.endswith(".jpg") or file.endswith(".jpeg") or file.endswith(".png") or file.endswith(".tif"):
        image = cv2.imread(indir +'/'+ file)
        grayscale = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        angle = determine_skew(grayscale)
        rotated = rotate(image, angle, (0, 0, 0))

where rotate is the open cv example here.

The output angle is -45 for both images.

@sbrunner
Copy link
Owner

sbrunner commented Apr 8, 2023

By adding the following argument, you will have a better result: min_angle=-30, max_angle=30, min_deviation=0.1
If the speed performance is important, keep the min_deviation to 1 (default value) :-)

@sbrunner sbrunner closed this as completed Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants