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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:22:02+00:00 2026-06-17T09:22:02+00:00

I try again to do better my question (http://stackoverflow.com/questions/14349550/convert-image-in-a-binary-image-with-cv2-module-in-python) In this code (it’s a

  • 0

I try again to do better my question (http://stackoverflow.com/questions/14349550/convert-image-in-a-binary-image-with-cv2-module-in-python)

In this code (it’s a little bit changed from the first ) I can easily work with my converted binary image , extracting contours, calculating areas.. but it’s not again possible to execute this code line: cv2.imshow('gray_image',imgray).

it show me a total grey window and that’s all. I have to quit python because goes in loop.

imgray = cv2.cvtColor(im,cv2.COLOR_BGR2GRAY)
ret,thresh = cv2.threshold(imgray,127,255,0) 
contours, hierarchy = cv2.findContours(thresh, cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
print('oggetti trovati')
print(len(contours))
cnt = contours[0]
print(len(cnt))
cv2.imshow('gray_image',imgray)

What can I do?

  • 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-17T09:22:02+00:00Added an answer on June 17, 2026 at 9:22 am

    Here you need to add cv2.waitKey() after cv2.imshow('gray_image',imgray). This function is for handling any window event like creating or showing an image in OpenCV.

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

Sidebar

Related Questions

try: html = urlopen('http://glbse.com/api/asset/' + asset.name) except: print 'error while updating the price of
If my page says: Code incorect please try again then my URL redirect should
i use below code - Just try again. - to prevent deadlock. it seems
Not sure how you'll take this question but... Whenever I try to make my
Every now and then I start getting Unexpected. Please try again. for ANY query
I'm trying to get the backup RubyGem ( https://github.com/meskyanichi/backup ) working. When I try
We've seen plenty of questions about when and why to use try / catch
What is a good way of having an actor try something again on failure,
Try this code - import java.io.StringReader; public class StringReaderTest { public static void main(String[]
Try this piece of code - public class WhitespaceTest { public static void main(String[]

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.