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 8509321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:24:10+00:00 2026-06-11T03:24:10+00:00

I need to figure out if any given pixel is black or white on

  • 0

I need to figure out if any given pixel is black or white on a gray-scale image that I put through a thresholding algorithm before that. The image becomes basically blobs of black on a white background.

Mat falsetest;

...

cv::cvtColor(detected_edges, falsetest, CV_BGR2GRAY);    
threshold(falsetest, falsetest,128, 255,THRESH_BINARY);

...

printf("x:%d y:%d %d\n",x,y,falsetest.at<uchar>(x,y));

I expected the results to be either 0 or 255, however, that is not the case. The output for different pixels looks something like this:

x:1259 y:175 111
x:1243 y:189 184
x:1229 y:969 203
x:293 y:619 255
x:1123 y:339 183

Am I trying to do this in a wrong way, or does it seem that the error lies elsewhere?

  • 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-11T03:24:12+00:00Added an answer on June 11, 2026 at 3:24 am

    I have finally figured out what the problem was. I thought that when I called

    cv::cvtColor(detected_edges, falsetest, CV_BGR2GRAY); 
    

    all the matrix data was copied to falsetest. However, it seems that it was not the case, and when I proceeded to modify detected_edges, falsetest also became contaminated. Cloning the matrix solved the problem.

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

Sidebar

Related Questions

I need to figure out a way to set ValidateRequest at model...I understand that
I understand that I need to figure out my own homework, but seeing that
I need to figure out whether not a given location is considered urban or
Given a Delphi TPicture containing some TGraphic descendant, I need to figure pixel color
Given an assembly A, that refers to Assembly B, how can I figure out
I need to figure out a way to insert a record with a java.util.Date
I need to figure out the size of a remote file before I download
So i need to figure out how i can get a record count value
From the following HTML I need to figure out which List tag has class
I have a piece of code where I need to figure out if a

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.