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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:21:35+00:00 2026-06-15T00:21:35+00:00

I think it should be a very simple problem, but I cannot find a

  • 0

I think it should be a very simple problem, but I cannot find a solution or an effective keyword for search.

I just have this image.

the original image

The black edges are useless so that I want to cut them, only leaving the Windows icon (and the blue background).

I do not want to calculate the coordinate and the size of the Windows icon. GIMP and Photoshop have sort of autocrop function. OpenCV does not have one?

  • 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-15T00:21:37+00:00Added an answer on June 15, 2026 at 12:21 am

    I am not sure whether all your images are like this. But for this image, below is a simple python-opencv code to crop it.

    first import libraries :

    import cv2
    import numpy as np
    

    Read the image, convert it into grayscale, and make in binary image for threshold value of 1.

    img = cv2.imread('sofwin.png')
    gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    _,thresh = cv2.threshold(gray,1,255,cv2.THRESH_BINARY)
    

    Now find contours in it. There will be only one object, so find bounding rectangle for it.

    contours,hierarchy = cv2.findContours(thresh,cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE)
    cnt = contours[0]
    x,y,w,h = cv2.boundingRect(cnt)
    

    Now crop the image, and save it into another file.

    crop = img[y:y+h,x:x+w]
    cv2.imwrite('sofwinres.png',crop)
    

    Below is the result :

    enter image description here

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

Sidebar

Related Questions

This should be a very simple problem you would think. I have a box
I have what I think should be a fairly simple mapping issue, but not
I guess this is a quite simple (read: very simple) question, but I have
So this is most likely a very simple problem which i just can't figure
I think this has to be a very simple question but I am not
This might be something very straight forward and I really think it should work
I'm stuck on what I think should be a minor problem, but I couldn't
I have some code which I think should compile, but doesn't: import java.io.InputStream; import
I basically have a simple problem in my program that I just want to
I'm developing a very simple but (hopefully) solid framework that just fits my needs.

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.