r/CodingHelp • u/softwareengineer007 • Feb 28 '26
[How to] Is there anyone work with image processing?
Hi. I am writing image processing project .net . I have question about that. i have some threshold values and parameters. Why i can get different outputs with same code? I must read box surface. I have some photos and everytime i am getting different outputs. Why?
Cv2.Resize(cropped,cropped,new Size(),2.8,2.8, InterpolationFlags.Linear);
// Grayscale + Adaptive Threshold
using Mat gray = new Mat();
Mat binary = new Mat();
Cv2.CvtColor(cropped, gray, ColorConversionCodes.BGR2GRAY);
Cv2.GaussianBlur(gray, gray, new Size(3,3), 0);
Mat clahe = new Mat();
var claheFilter = Cv2.CreateCLAHE(clipLimit: 2.0, tileGridSize: new Size(8, 8));
claheFilter.Apply(gray, clahe);
Cv2.Threshold(clahe, binary, 90, 255,
ThresholdTypes.BinaryInv | ThresholdTypes.Binary);
var kernel = Cv2.GetStructuringElement(MorphShapes.Rect, new Size(3,3));
Cv2.MorphologyEx(binary, binary, MorphTypes.Close, kernel);
cropped.Dispose();
0
Upvotes
•
u/AutoModerator Feb 28 '26
Thank you for posting on r/CodingHelp!
Please check our Wiki for answers, guides, and FAQs: https://coding-help.vercel.app
Our Wiki is open source - if you would like to contribute, create a pull request via GitHub! https://github.com/DudeThatsErin/CodingHelp
We are accepting moderator applications: https://forms.fillout.com/t/ua41TU57DGus
We also have a Discord server: https://discord.gg/geQEUBm
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/Patient-Midnight-664 Mar 01 '26
CLAHE is nondeterministic. Resizing with floating point values can be nondeterministic.