Final:
Example with Glossy, Glass and Emission shader.
Overview and Node setup:
You can do this by Separate RGB node which, well, is separating RGB channels. Then use them as masks for your materials.
Important thing is that it would work even better if colors of the
image would be pure RGB values. For example now red channel is R: 0.85
G: 0.43 B: 0.43 and should be R: 1 G: 0 B: 0.
As a workaround for those color issue, you can add Math nodes and set them
to make channel only black and white (white should be selected channel). Example for green channel:
Edit:
1. Different materials.
You can change Diffuse shaders from original answer to any shader you want. They can have Image Textures, procedural textures, Bump Maps, anything you would normally do with texturing objects.
Going further with this:
I've created Node Group from original answer to make it even easier and less distracting for you:
As you can see here Image Texture is pure RGB and accordingly to the channels there are connected Principled Shaders (could be any shader).
Tweak Values are for non-pure RGB colors.
Blend file:
2. Different colors.
Simple answer is - no. You can't use this setup for images with other colors (except for black). There is possibility to create such setup but it will be mostly based on specific image rather then making one to rule them all.
This is because all colors are RGB based. You can try with Tweak Values but it will be pretty hard.
Also you can use only one color with this setup but only if everything else (background) is black.