Zaktualizuj 'examples/example_win32_directx11/main.cpp'

This commit is contained in:
Jerzy Kwiatkowski 2023-07-08 11:06:33 +02:00
parent a5e5003040
commit 7be740c7d2

View File

@ -152,32 +152,32 @@ bool LoadTextureFromFile(unsigned char* image_data, int image_width, int image_h
// delete[] copy; // delete[] copy;
//} //}
// //
//void dilation(unsigned char* image, int width, int height) { void dilation(unsigned char* image, int width, int height) {
// int structuringElement[3][3] = { int structuringElement[3][3] = {
// {0, 255, 0}, {0, 255, 0},
// {255, 255, 255}, {255, 255, 255},
// {0, 255, 0} {0, 255, 0}
// }; };
//
// for (int y = 0; y < height; ++y) { for (int y = 0; y < height; ++y) {
// for (int x = 0; x < width; ++x) { for (int x = 0; x < width; ++x) {
// int maxPixelValue = 0; int maxPixelValue = 0;
// for (int j = -1; j <= 1; ++j) { for (int j = -1; j <= 1; ++j) {
// for (int i = -1; i <= 1; ++i) { for (int i = -1; i <= 1; ++i) {
// if (x + i >= 0 && x + i < width && y + j >= 0 && y + j < height) { if (x + i >= 0 && x + i < width && y + j >= 0 && y + j < height) {
// int imagePixelValue = image[(y + j) * width + (x + i)]; int imagePixelValue = image[(y + j) * width + (x + i)];
// int structuringElementValue = structuringElement[j + 1][i + 1]; int structuringElementValue = structuringElement[j + 1][i + 1];
// int newPixelValue = imagePixelValue + structuringElementValue; int newPixelValue = imagePixelValue + structuringElementValue;
// if (newPixelValue > maxPixelValue) { if (newPixelValue > maxPixelValue) {
// maxPixelValue = newPixelValue; maxPixelValue = newPixelValue;
// } }
// } }
// } }
// } }
// image[y * width + x] = static_cast<unsigned char>(maxPixelValue > 255 ? 255 : maxPixelValue); image[y * width + x] = static_cast<unsigned char>(maxPixelValue > 255 ? 255 : maxPixelValue);
// } }
// } }
//} }
void erosion(unsigned char* image, int width, int height) { void erosion(unsigned char* image, int width, int height) {