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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:57:19+00:00 2026-06-07T02:57:19+00:00

Currently I’am developing project on image processing on javacv. In that I have to

  • 0

Currently I’am developing project on image processing on javacv. In that I have to identify U shape inside a particular polygon.

This are the two types of images and I have to identify whether image have two U shapes or single U shape in images. I had went through many tutorials but I couldn’t able to find proper guide line to clarify this. So please can expert person give some help to clarify this problem. Its really appreciate if you can provide some code example using opencv or javacv.

Image with two U shape

Image with single U shape

  • 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-07T02:57:22+00:00Added an answer on June 7, 2026 at 2:57 am

    If all your images have similar pattern, you simply use aspect ratio (width / height) of the bounding rect of the contours to filter them out.

    ie, if you find bounding rect of all the contours, outer shape has an aspect_ratio close to 1.

    But U shape will have an aspect_ratio of more than 10.

    Below is a python code :

    import cv2
    import numpy as np
    
    img = cv2.imread('sofud.jpg')
    
    gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
    
    ret,thresh = cv2.threshold(gray,127,255,1)
    
    contours,hierarchy = cv2.findContours(thresh,cv2.RETR_LIST,cv2.CHAIN_APPROX_SIMPLE)
    
    for cnt in contours:
        x,y,w,h = cv2.boundingRect(cnt)
        if 10 < w/float(h) or w/float(h) < 0.1:
            cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),2)
    
    
    cv2.imshow('res',img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
    

    Below are the results :

    enter image description here

    enter image description here

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

Sidebar

Related Questions

Currently I have a class that looks like this: public class MyClass : IMyClass
Currently developing an application using the newest version of symfony, obtained through PEAR. This
Currently I have a UITableview, I have enough data that cannot be shown entirely
Currently I have alot of information that are in several different divs. I want
Currently I'm learning C++ and I've been trying to create a simple image processing
Currently, my ListViews look like this: How can I achieve that Windows 7 native
Currently we have a project with a standard subversion repository layout of: ./trunk ./branches
Currently, I'm working on a project where I have a server - client relationship
Currently I have this code: <?php echo '<meta name=robots content=noindex>'; $arr = json_decode(file_get_contents(http://media1.clubpenguin.com/play/en/web_service/game_configs/ paper_items.json),true);
Currently I have this: var x = Convert.ToString(dateTimePicker2.Value.Subtract(dateTimePicker1.Value)); int xDays = Convert.ToInt32(x.Substring(0,1)); But it's

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.