This Go program takes a stack of PGM images with different focuses and creates an extended depth of field (EDOF) image by combining all the sharp details from each image in the stack.
Combines multiple PGM images with different focus points into a single EDOF image Automatically detects and uses the sharpest regions from each image in the stack Simple command-line interface for easy usage
Currently, this program does not align the images, and thus objects are assumed to be aligned across all images in the stack.
Go programming language installed on your system
git clone https://github.com/TomasMen/go-edof.git
cd go-edof
- Create a file named stack.txt in the project directory and list the names of the PGM images you want to stack, one per line.
- Place the PGM images either in the same directory as the main.go file or in a ./stack/ subdirectory.
- Run the program using one of the following methods:
go run main.go stack.txt
go build main.go
./main stack.txt
The program will process the images and generate an EDOF image named result.pgm in the same directory.
Here's an example of the program's input and output:
To reproduce this example:
- Create
stack.txt
with the following content:
wasp1.pgm
wasp2.pgm
wasp3.pgm
- Place the corresponding PGM images (
wasp1.pgm
,wasp2.pgm
,wasp3.pgm
) (which can be found in the./examples/example1/
directory) in the ./stack/ directory or in the base directory. - Run the program:
go run main.go stack.txt
- The program will generate an EDOF image named
edof.pgm
in the same directory.
More examples can be found under the ./examples/ directory.
Contributions to this package are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository. License
This package is licensed under the MIT License. See the LICENSE file for more information.
- This Go program is a reimplementation of a Python script I created for a computer vision module assignment at my university. The reimplementation process served as an opportunity to deepen my understanding of Go and explore its potential for computer vision tasks.