How to count pixels with certain conditions

I would like to know if with ImageJ it is possible to count the number of pixels whose value of green is greater than that of red. And if possible, some idea of ​​how to do it.

[Note that I’ve edited this]

  1. Open both channels as separate images, or split channels of an RGB image (Image>Color>Split channels…) [I assume each channel is either 8 or 16-bit; 8-bit would be the case with a typical RGB image]
  2. Subtract red from green (Process>Image Calculator, set Image1 to your green channel and Image2 to your red channel)
  3. Threshold the result image (Image>Adjust>Threshold) with a value of 1
  4. Rescale the pixel intensities (because thresholding sets pixels to 255) by using Calculator Plus (Process>Calculator Plus) with i1 and i2 set to your result image and k1 to 1/255 (which is 0.003921568627)
  5. Select the entire result image (Edit>Selection>Select All)
  6. Measure the selection (Analyze>Measure)
  7. Multiply area by the mean value. The result of this is the number of pixels where green is greater than red.

Thanks kephale, I’ll try to do it as you say. Regards