Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8930093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T08:48:26+00:00 2026-06-15T08:48:26+00:00

There is a task of recognition red areas on an image and it requires

  • 0

There is a task of recognition red areas on an image and it requires maximum of accuracy. But the quality of a source image is quite bad. I’m trying to minimize a noise on a mask with detected red areas using cvThreshold. Unfortunately, there is no expected effect – gray artifacts stay.

//Converting from Bgr to Hsv
Image<Hsv, Byte> hsvimg = markedOrigRecImg.Convert<Hsv, Byte>();
Image<Gray, Byte>[] channels = hsvimg.Split();

Image<Gray, Byte> hue = channels[0];
Image<Gray, Byte> saturation = channels[1];
Image<Gray, Byte> value = channels[2];

Image<Gray, Byte> hueFilter = hue.InRange(new Gray(0), new Gray(30));
Image<Gray, Byte> satFilter = saturation.InRange(new Gray(100), new Gray(255));
Image<Gray, Byte> valFilter = value.InRange(new Gray(50), new Gray(255));

//Mask contains gray artifacts        
Image<Gray,Byte> mask = (hueFilter.And(satFilter)).And(valFilter);

//Gray artifacts stays even if threshold (the third param.) value is 0...
CvInvoke.cvThreshold(mask, mask, 100, 255, THRESH.CV_THRESH_BINARY);

mask.Save("D:/img.jpg");

In the same time here it works fine – saved image is purely white:

#region test

Image<Gray,Byte> some = new Image<Gray, byte>(mask.Size);
some.SetValue(120);
CvInvoke.cvThreshold(some, some, 100, 255, THRESH.CV_THRESH_BINARY);
some.Save("D:/some.jpg");

#endregion

Mask before threshold example:
http://dl.dropbox.com/u/52502108/input.jpg

Mask after threshold example:
http://dl.dropbox.com/u/52502108/output.jpg

Thank You in advance.
Constantine B.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T08:48:27+00:00Added an answer on June 15, 2026 at 8:48 am

    The reason of an appearing of that gray artifacts on saved images after applying of any kind of a threshold is… *.JPG standard saving format of Image<TColor, TDepth>! More precisely, a jpeg compression applied by it. So there was no problem with thresholding itself. Just a spoiled output image. It was confusing strongly though. The right way of saving such images (without artifacts) is, for example: Image<TColor,TDepth>.Bitmap.Save(your_path, ImageFormat.Bmp)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a task to display an image, which is placed to a Google
Assuming there is a task (e.g. an image processing method with a lot math)
There is a task needs to draw N images on a NSView. But at
There's a task connected with changing state of an entity . And I'm quite
There is a Task.Factory.StartNew(Action<Object> action, Object state) method. This looks generic. But, if my
This seems like a simple task but there may be an easier way. I
I have the following task: there are a simple table from mysql database: <html>
There is a task to write a crawler to crawl the webpage by python.
Is there a MSBuild task for setting custom attribute in AssemblyInfo.cs? I found AssemblyInfo
Is there an equivalent of the Visual Studio Task List in MS Access? I'd

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.