How Can I Define Red Color In HSV Space - - MathWorks

Skip to content
  • MATLAB Answers
  • File Exchange
  • Cody
  • AI Chat Playground
  • Discussions
  • Contests
  • Blogs
  • More
    • Communities
    • Treasure Hunt
    • Community Advisors
    • Virtual Badges
    • About
  • More

You are now following this question

  • You will see updates in your followed content feed.
  • You may receive emails, depending on your communication preferences.
How can I define red color in HSV space Follow 3 views (last 30 days) Show older comments THUONG NGUYEN VAN THUONG NGUYEN VAN on 4 May 2013
  • Vote0
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space

    Cancel Copy to Clipboard
  • Vote0
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space

    Cancel Copy to Clipboard
Commented: Image Analyst on 10 Nov 2013 Accepted Answer: Walter Roberson Open in MATLAB Online I have problem when using webcam to detect and track object by masking colors in HSV space. my code work well with yellow, green or blue color but red color.I already define the threshold for these colorsplease help me.here is my code% red hueThresholdLowred1 = 0.05; hueThresholdHighred1 = 0.97; saturationThresholdLowbred1 = 0.3; saturationThresholdHighred1 = 1; valueThresholdLowred1 = 0.01; valueThresholdHighred1 = 1;% find red color hueMaskred1 = (hImage1 <= hueThresholdLowred1)&(hImage1 >= hueThresholdHighred1); saturationMaskred1 = (sImage1 >= saturationThresholdLowbred1) & (sImage1 <= saturationThresholdHighred1); valueMaskred1 = (vImage1 >= valueThresholdLowred1) & (vImage1 <= valueThresholdHighred1); redObjectsMask1 = hueMaskred1 & saturationMaskred1 & valueMaskred1;
0 Comments Show -2 older commentsHide -2 older comments

Sign in to comment.

Sign in to answer this question.

Accepted Answer

Walter Roberson Walter Roberson on 4 May 2013
  • Vote0
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#answer_84360

    Cancel Copy to Clipboard
  • Vote0
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#answer_84360

    Cancel Copy to Clipboard
Open in MATLAB Online It is not possible for a number to be both less than 0.05 and greater than 0.97. Your statementhueMaskred1 = (hImage1 <= hueThresholdLowred1)&(hImage1 >= hueThresholdHighred1);is wrong (at least in terms of the values you set for those thresholds.)Are you looking for values that are between 0.97 and 1, together with values that are between 0 and 0.05 ? Sounds like a narrow range to me, but if it is what you are looking for, change the "&" to "|"
3 Comments Show 1 older commentHide 1 older comment
THUONG NGUYEN VAN THUONG NGUYEN VAN on 15 May 2013

https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#comment_149006

Cancel Copy to Clipboard
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#comment_149006

    Cancel Copy to Clipboard
thanks for your help, I already changed as follow your advice. finally it work. aldi aldi on 10 Nov 2013

https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#comment_179063

Cancel Copy to Clipboard
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#comment_179063

    Cancel Copy to Clipboard
how define green object on live webcam ? please code.. Image Analyst Image Analyst on 10 Nov 2013

https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#comment_179101

Cancel Copy to Clipboard
  • Link

    https://www.mathworks.com/matlabcentral/answers/74567-how-can-i-define-red-color-in-hsv-space#comment_179101

    Cancel Copy to Clipboard
See several color segmentation demos in my File Exchange:http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862 Feel free to modify any of them.

Sign in to comment.

More Answers (0)

Sign in to answer this question.

See Also

Categories

Image Processing and Computer Vision Image Processing Toolbox Image Segmentation and Analysis Object Analysis Find more on Object Analysis in Help Center and File Exchange

Tags

  • color detection

Products

  • MATLAB

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

An Error Occurred

Unable to complete the action because of changes made to the page. Reload the page to see its updated state.

Close MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • (English)
  • (Deutsch)
  • (Français)
  • (简体中文)
  • (English)

You can also select a web site from the following list

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom(English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

Từ khóa » Hsv Color Space Red