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

Options for Specifying Skew Angle #41

Open
hamxahbhatti opened this issue May 25, 2021 · 2 comments
Open

Options for Specifying Skew Angle #41

hamxahbhatti opened this issue May 25, 2021 · 2 comments

Comments

@hamxahbhatti
Copy link

I am looking for a cmd option that can be used to specify the angle that is being calculated before but i was not able to find it in the given set of options. I am applying some preprocessing on same image but has different preprocessed version. But when I run deskew on both of these images I get different skew angles. I want to use same angle for both versions of same image.

@hamxahbhatti hamxahbhatti changed the title Options for Specifyuing Skew Angle Options for Specifying Skew Angle May 25, 2021
@galfar
Copy link
Owner

galfar commented Jun 8, 2021

You could run Deskew in detection only mode and then rotate both images in some other tool.

@GitHubRulesOK
Copy link

GitHubRulesOK commented Jun 9, 2021

If by cmd you refer to windows then

@echo off
deskew -g d file1.png|find "[deg]" > out1.txt
deskew -g d file2.png|find "[deg]" >> out1.txt
type NUL > out2.txt
FOR /F "tokens=1,2* delims=:" %%A in (out1.txt) do echo %%B >> out2.txt

gives me in the out2.txt file

 -0.310
 -0.390

Note I have not tidied up the leading space nor added any other averaging to get perhaps a common value of -0.350
Since cmd has exceptionally poor integer math you need to move decimal points three digits right, do addition and divide by 1000
so in this case roughly we strip the decimal points and any leading zeros and using variables would attempt

setlocal ENABLEDELAYEDEXPANSION
set /A "V1=-310"
set /A "V2=-390"
set /A "Avg=(V1+V2)/2"
echo !Avg!

result is -350 as expected so needs to be returned as -0.350

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

3 participants