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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:55:15+00:00 2026-05-26T04:55:15+00:00

After doing some research and reading information about OpenCV object detection, I am still

  • 0

After doing some research and reading information about OpenCV object detection, I am still not sure on how can I detect a stick in a video frame. What would be the best way so i can detect even if the user moves it around. I’ll be using the stick as a sword and make a lightsaber out of it. Any points on where I can start? Thanks!

  • 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-05-26T04:55:16+00:00Added an answer on May 26, 2026 at 4:55 am

    The go-to answer for this would usually be the Hough line transform. The Hough transform is designed to find straight lines (or other contours) in the scene, and OpenCV can parameterize these lines so you get the endpoints coordinates. But, word to the wise, if you are doing lightsaber effects, you don’t need to go that far – just paint the stick orange and do a chroma key. Standard feature of Adobe Premiere, Final Cut Pro, Sony Vegas, etc. The OpenCV version of this is to convert your frame to HSV color mode, and isolate regions of the picture that lie in your desired hue and saturation region.

    http://opencv.itseez.com/doc/tutorials/imgproc/imgtrans/hough_lines/hough_lines.html?highlight=hough

    Here is an old routine I wrote as an example:

    //Photoshop-style color range selection with hue and saturation parameters.
    //Expects input image to be in Hue-Lightness-Saturation colorspace.
    //Returns a binary mask image. Hue and saturation bounds expect values from 0 to 255.
    IplImage* selectColorRange(IplImage *image, double lowerHueBound, double upperHueBound, 
                    double lowerSaturationBound, double upperSaturationBound) {
        cvSetImageCOI(image, 1);  //select hue channel
        IplImage* hue1 = cvCreateImage(cvSize(image->width, image->height), IPL_DEPTH_8U, 1);
        cvCopy(image, hue1); //copy hue channel to hue1
        cvFlip(hue1, hue1); //vertical-flip
        IplImage* hue2 = cvCloneImage(hue1); //clone hue image
        cvThreshold(hue1, hue1, lowerHueBound, 255, CV_THRESH_BINARY); //threshold lower bound
        cvThreshold(hue2, hue2, upperHueBound, 255, CV_THRESH_BINARY_INV); //threshold inverse upper bound
        cvAnd(hue1, hue2, hue1); //intersect the threshold pair, save into hue1
        cvSetImageCOI(image, 3); //select saturation channel
        IplImage* saturation1 = cvCreateImage(cvSize(image->width, image->height), IPL_DEPTH_8U, 1);
        cvCopy(image, saturation1); //copy saturation channel to saturation1
        cvFlip(saturation1, saturation1); //vertical-flip
        IplImage* saturation2 = cvCloneImage(saturation1); //clone saturation image
        cvThreshold(saturation1, saturation1, lowerSaturationBound, 255, CV_THRESH_BINARY); //threshold lower bound
        cvThreshold(saturation2, saturation2, upperSaturationBound, 255, CV_THRESH_BINARY_INV); //threshold inverse upper bound
        cvAnd(saturation1, saturation2, saturation1); //intersect the threshold pair, save into saturation1
        cvAnd(saturation1, hue1, hue1); //intersect the matched hue and matched saturation regions
        cvReleaseImage(&saturation1);
        cvReleaseImage(&saturation2);
        cvReleaseImage(&hue2);
        return hue1;
    }
    

    A little verbose, but you get the idea!

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

Sidebar

Related Questions

I think it is not complicated but after doing some research I can't find
after doing some research it seems that AppDomains are not really a tool for
After doing some research I feel this should work, however it is not saving
After doing some research here, and using Google I'm still confused as to why
After doing some research on the subject, I've been experimenting a lot with patterns
After doing some research I heard only PHP 5.3.6+ supports PDO and SSL. I
I have a specific task and after doing some research, I feel a little
Edit Ok, after doing some research it seems to be the clearfix I am
After doing some research on this issue, I couldn't find any satisfying fix. The
I need some functionality in an ASP.NET MVC application and after doing some research,

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.