Detect only red pixels in Java

I need to detect all the red pixels in an image using Java. What 's the best way to do this?

Only supposing a pixel is red when the Red RGB-value is > 200 isn't good enough (see this table).

So is there a better way to do this? Or is there some red-color-rgb algorithm?


Take a look at YCrCb color space.

Simple algorithm: convert your RGB image to YCrCb, extract red channel and make a threshold.

Convert RGB to HSL, and threshold the hue (H) component.

As you suggested, you probably want to do some comparison in HSB space. You'll probably want to define an appropriate rage for all three values based on what your expectations are.

You can use Color.RGBtoHSB to get the values from a given color.

Need Your Help

Setting up Discourse on Ubuntu 12.04 LTS

ruby-on-rails ubuntu rails-migrations hstore discourse

I have setup a new database for installing Discourse in PostgreSQL. When I run rake db:migrate, it creates most of the tables, but it then fails:

How to generate core dump file in Linux?

linux gcc gdb

I am trying to generate the core dump file using the below program in Linux.