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

Image convolution function ImageKernelConvolution #3528

Merged
merged 5 commits into from
Nov 18, 2023

Conversation

Kimo-s
Copy link
Contributor

@Kimo-s Kimo-s commented Nov 11, 2023

Please refer to the issue for more info: #3527

examples/textures/textures_image_kernel.c Outdated Show resolved Hide resolved
projects/Notepad++/raylib_npp_parser/raylib_to_parse.h Outdated Show resolved Hide resolved
src/rtextures.c Outdated Show resolved Hide resolved
src/rtextures.c Outdated Show resolved Hide resolved
src/rtextures.c Outdated Show resolved Hide resolved
src/rtextures.c Outdated Show resolved Hide resolved
src/rtextures.c Show resolved Hide resolved
@raysan5
Copy link
Owner

raysan5 commented Nov 12, 2023

@Kimo-s Thanks for the addition, just added some points to review or further discuss.

Also, as commented on Discord:

I've been thinking about input parameter kernelWidth and I prefer to provide the full length of the array (kernelSize), for security reasons, it would be consistent with other functions that expect an array of values and it can be more easely validated internally if it is square.

For example:

int columns = (int)sqrtf((float)kernelSize);
if (columns*columns != kernelSize)
{
    TRACELOG(LOG_WARNING, "IMAGE: Convolution kernel must be square to be applied");
    return;
}

Another option could be appending zeros if (columns*columns < kernelSize)
But not worries, I can review it after merge

Also, the example window should be 800x450 pixels for consistency with the other examples and web display
the loaded image can be ImageCrop() to 200x450 to fit the 4 images

@raysan5
Copy link
Owner

raysan5 commented Nov 15, 2023

@Kimo-s thank you very much for all the reviews! I will merge this new function as soon as raylib 5.0 gets released.

@raysan5 raysan5 merged commit 21469e9 into raysan5:master Nov 18, 2023
@raysan5
Copy link
Owner

raysan5 commented Nov 18, 2023

@Kimo-s thanks for this great addition!

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

Successfully merging this pull request may close these issues.

3 participants