-
Notifications
You must be signed in to change notification settings - Fork 9
feat(filter): add edge detection (-D flag) using Sobel operator #29
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
feat(filter): add edge detection (-D flag) using Sobel operator #29
Conversation
harshsankhla18
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look I am not expecting you to remove // gets all filter flags and checks validity
for(int i=0; i<argc; i++){
char temp = getopt(argc,argv,filters);
if(temp == -1) break;
filterArr[i]= temp;
if(filterArr[i] == '?') {
printf("Invalid filter option");
return 1;
}
}
and adding while ((opt = getopt(argc, argv, filters)) != -1)
{
if (opt == '?')
{
printf("Usage: ./filter [flag] infile outfile\n");
return 3;
printf("Invalid filter option\n");
return 2;
}
filterArr[filterCount++] = (char)opt;
}
so dont change that in filter.c
|
@swastijain132005 Everything is fine but this opt logic changing is causing error , so remove this and work with mine written logic to check flags and also show me output.bmp in your next PR as it is having error in my vs code. In short what you need to do is keep my filter.c as it is just add D in the end of filter string and in switch case add case D(then function call inside) thats it. No extra change i filter.c would be accepted |
|
Okay I will fix it |
- Implement detect_edges() function in helpers.c to apply edge detection using pixel intensity gradients (Sobel operator). - Update helpers.h with function prototype for detect_edges(). - Add small 'd' flag handling in filter.c to apply the filter via CLI. - Running .\filter.exe d input.bmp output.bmp now generates an output.bmp with highlighted edges. - Verified functionality on sample BMP image; edges appear as black-and-white outlines. - Enhances image filtering suite with a new algorithm for outline detection.
|
@swastijain132005 resolve conflicts and attach screenshot of the code working , then I will merge. |
6af2202
into
OPCODE-Open-Spring-Fest:main

Adds a new Edge Detection filter (-D flag) using the Sobel operator.
This filter highlights sharp changes in color intensity, producing a pencil-sketch-like outline of the image. It works on each color channel (R, G, B) by computing horizontal and vertical gradients with a 3×3 Sobel kernel.
Semver Changes
✅Minor (new features, no breaking changes)
Issues
Closes #24
Checklist
✅ I have read the Contributing Guidelines
✅My code follows the project style guidelines
✅I have tested the filter locally and verified it works correctly