This project applies texture to an input image using OpenCV and C++.
Input Image: Original image used for texture mapping. - Luca Bravo @Unsplash |
Texture: Image used as a texture overlay. -Annie Sprat Unsplash |
Final Image: Resulting image with applied texture. |
Before running the program, ensure you have the following installed:
- C++ compiler
- OpenCV (version 4.x) installed
- Clone the Repository:
git clone https://github.com/LeannAlexandra/imageTexturing.git cd imageTexturing
- Compile the Program:
OR, use the makefile:
g++ -std=c++11 -o addTexture main.cpp `pkg-config --cflags --libs opencv4`
make
# Makefile for Image Texturing Project
CXX = g++
CXXFLAGS = -std=c++11 `pkg-config --cflags opencv4`
LIBS = `pkg-config --libs opencv4`
SRCS = main.cpp
OBJS = $(SRCS:.cpp=.o)
TARGET = addTexture
all: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) -o $@ $^ $(LIBS)
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c -o $@ $<
clean:
rm -f $(OBJS) $(TARGET)
- Run the Program:
./addTexture
- Expected Output:
- The program will display the final texture in a window.
- if the saveImage flag is set to true, the output image'output.jpg' will be saved in the project directory.
The program reads an input image (inputImage.jpg) and a texture image (canvas.jpg) from the project directory.
It overlays the texture onto the input image and adjusts brightness based on texture intensity.
The resulting image is displayed and optionally saved to disk (exampleoutput.jpg).
Contributions are welcome! If you have ideas for improvements or find any issues, please open an issue or submit a pull request.
This project is licensed under the MIT License.