mhr,
Thanks again for writing this great tool! Adding the 16 bit ppm capability is a nice addition. That should make some of the RAW stuff easier. Thanks also for giving us another option for automatically determining DPI. Royeven's method seems to be pretty accurate in my tests, but I'm very interested to try your approach too! I'll have to update my scripts again to add that new option for DPI calculation.
Thanks for making it so flexible. I can't see a scenario where we might need x and y dpi to be different, but it's great that it's there for the future when someone figures out a practical usage scenario.
You mentioned awhile back that you were considering buiding a curved scanning rig. How did that work for you? It's an interesting idea.
Dewarping with a regular calibration point grid
Moderator: peterZ
-
- Posts: 37
- Joined: 07 May 2012, 10:12
- E-book readers owned: onyx-boox-m92 sony-trs-t1
- Number of books owned: 500
- Country: Germany
Re: Dewarping with a regular calibration point grid
Hello abmartin,
nice to see that my program is useful for You!
Actually I discarded the idea of a curved scanning rig a while ago.
It was based on an erroneous idea about depth of field.
So I use a flat platen as all others also do.
I have a one camera setup with fixed geometry between camera and platen.
I might show my scanner in the buildt thread in the future if I have some spare time for that,
but it is based on different ideas already presented there.
nice to see that my program is useful for You!
Actually I discarded the idea of a curved scanning rig a while ago.
It was based on an erroneous idea about depth of field.
So I use a flat platen as all others also do.
I have a one camera setup with fixed geometry between camera and platen.
I might show my scanner in the buildt thread in the future if I have some spare time for that,
but it is based on different ideas already presented there.
-
- Posts: 37
- Joined: 07 May 2012, 10:12
- E-book readers owned: onyx-boox-m92 sony-trs-t1
- Number of books owned: 500
- Country: Germany
Re: Dewarping with a regular calibration point grid
I splitted the identical parts of the programs ppmunwarp and ppmwhitebalancing into a library
and eliminated a bug in ppmunwarp due to regression (version 1.0 was not affected).
Here are both programs in version 1.4 together with the library and a primitive makefile. Just drop the .txt ending as always to compile. For use of ppmwhitebalance see thread
http://www.diybookscanner.org/forum/vie ... =19&t=2891.
and eliminated a bug in ppmunwarp due to regression (version 1.0 was not affected).
Here are both programs in version 1.4 together with the library and a primitive makefile. Just drop the .txt ending as always to compile. For use of ppmwhitebalance see thread
http://www.diybookscanner.org/forum/vie ... =19&t=2891.
-
- Posts: 37
- Joined: 07 May 2012, 10:12
- E-book readers owned: onyx-boox-m92 sony-trs-t1
- Number of books owned: 500
- Country: Germany
Re: Dewarping with a regular calibration point grid
Hier is version 1.5 of the programs.
ppmwhitebalance was enhanced to accept a rectangle
by using the new options -gx, -gy, -gw and -gh.
The rectangle should roughly specify the area of the gray card in the picture.
Outside the rectange, the gray card pixels are set to the mean color value from the rectangle.
This relaxes unwanted border effects somewhat.
If an additional percentage value is given by the new option -go, then all pixels whose color
differs by more then the specified percentage from the mean value are also set to the mean value.
This can reduce the unwanted effects due to paper clips holding the gray card.
ppmwhitebalance was enhanced to accept a rectangle
by using the new options -gx, -gy, -gw and -gh.
The rectangle should roughly specify the area of the gray card in the picture.
Outside the rectange, the gray card pixels are set to the mean color value from the rectangle.
This relaxes unwanted border effects somewhat.
If an additional percentage value is given by the new option -go, then all pixels whose color
differs by more then the specified percentage from the mean value are also set to the mean value.
This can reduce the unwanted effects due to paper clips holding the gray card.
Re: Dewarping with a regular calibration point grid
Could someone post a simple instruction for compiling this in Windows (presupposing no knowledge of c++ compilers) or post a binary?
-
- Posts: 37
- Joined: 07 May 2012, 10:12
- E-book readers owned: onyx-boox-m92 sony-trs-t1
- Number of books owned: 500
- Country: Germany
Re: Dewarping with a regular calibration point grid
In Microsoft Visual Studio there is a Batchfile called 'vcvarsall.bat'
This can be called within a console 'cmd.exe' to set up all variables to compile on the command line.
The files can be compiled with a command like
Anyway, here are the 64bit executables (compiled under Windows 7, Visual Studio 10):
This can be called within a console 'cmd.exe' to set up all variables to compile on the command line.
The files can be compiled with a command like
Code: Select all
cl /Ox ppmunwarp.cc ppmroselib.cc
cl /Ox ppmwhitebalance.cc ppmroselib.cc
Re: Dewarping with a regular calibration point grid
Thanks. I didn't get your vcvarsall.bat instruction at first so here are a few more details just in case anyone else comes along and stumbles at the same stage as I did.
1. Download Visual Studio Express 2012 for Windows Desktop and install.
2. Open a command prompt.
3. First send this command to set things up for compiling into x64 files
4. navigate the command prompt to whatever folder you have the source files in. For example C:\stuff
5. Then send one of these commands
which outputs ppmunwarp.exe in the same folder as the ppmunwarp.cc files, and so on.
If you close the command prompt window you need to redo step 3 again.
1. Download Visual Studio Express 2012 for Windows Desktop and install.
2. Open a command prompt.
3. First send this command to set things up for compiling into x64 files
Code: Select all
call "c:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86_amd64
Code: Select all
cd C:\stuff
Code: Select all
cl /Ox ppmunwarp.cc ppmroselib.cc
cl /Ox ppmwhitebalance.cc ppmroselib.cc
If you close the command prompt window you need to redo step 3 again.
Re: Dewarping with a regular calibration point grid
Can you say a bit more about the gray card. Does it require a special purchased gray card? Or would any uniformly gray paper sheet do?
-
- Posts: 37
- Joined: 07 May 2012, 10:12
- E-book readers owned: onyx-boox-m92 sony-trs-t1
- Number of books owned: 500
- Country: Germany
Re: Dewarping with a regular calibration point grid
Just homogene gray is fine.
The gray card should fill the whole area of interest (and a bit more).
If the options -nx and -ny are specified, a local varying correction based on a gray color grid of the
calibration input is used to correct spatially varying color (e.g. due to uneven lighting conditions).
You can now specify a rectangular window (-gx, -gy, -gw, -gh) if the gray card is only part of the image.
This tool is not really needed for BW scanning (with scantailor).
But for gray shades or color images it might be useful.
The gray card should fill the whole area of interest (and a bit more).
If the options -nx and -ny are specified, a local varying correction based on a gray color grid of the
calibration input is used to correct spatially varying color (e.g. due to uneven lighting conditions).
You can now specify a rectangular window (-gx, -gy, -gw, -gh) if the gray card is only part of the image.
This tool is not really needed for BW scanning (with scantailor).
But for gray shades or color images it might be useful.