Skip to content

Conversation

@swastijain132005
Copy link
Contributor

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

Copy link
Collaborator

@harshsankhla18 harshsankhla18 left a 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

@harshsankhla18
Copy link
Collaborator

harshsankhla18 commented Oct 23, 2025

@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

@swastijain132005
Copy link
Contributor Author

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.
@harshsankhla18
Copy link
Collaborator

@swastijain132005 resolve conflicts and attach screenshot of the code working , then I will merge.

@swastijain132005
Copy link
Contributor Author

image output.bmp

@harshsankhla18 harshsankhla18 merged commit 6af2202 into OPCODE-Open-Spring-Fest:main Oct 26, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Add a new -D flag to apply an Edge Detection filter that highlights image outlines using gradient intensity (Sobel operator).

2 participants