Black_Kaiser Posted June 27, 2021 Share Posted June 27, 2021 Image manipulation with C. Beginners guide. As an image is a collection of pixels grouped together in a certain order and each pixels is a byte which contains Red Green and Blue value, we can change the position or the values according to what we like to achieve. Here is a program which has four functions Grayscale, Reflect, Blur and Edge detection which converts an image into each of the respective functions. Gray scale: Nothing much to explain here. The new value of each RGB value of each pixel is the average value of the current RGB value. Eg:- Red = 126, Green = 211 and Blue = 107 and so the average value of these 3 RGB value is (Red + Green + Blue)/3 = 444/3 = 148. So Red = 148, Green = 148 and Blue = 148. Reflect: Loop through width/2 and copy the pixels of the first half to the right. Blur Image algorithm explanation:- https://medium.com/mobile-app-development-publication/blurring-image-algorithm-example-in-android-cec81911cd5e Edge detection algorithm explanation:- https://medium.com/@nikatsanka/comparing-edge-detection-methods-638a2919476e Note: I know i hard code blur function instead of nesting more loops. Its mainly to show beginners how the algorithm behind blur image works. filter.zip 24 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.