Ask Your Question

Convert 4 channel Blue, Green, Red, Yellow to RGB?

asked 2018-06-11 10:26:55 -0500

shogun gravatar image

updated 2018-06-11 10:33:47 -0500

I have 4 color channels for Nikon microscope images (nd2 file format), where one of the color channels is (1, 1, 0) which corresponds to yellow. How do I handle the 4th channel? I'm assuming that I need to convert all the channel to RGB.

edit retag flag offensive close merge delete


opencv does not have any means to read or decode this format. you'll probably need some 3rd party lib like nd2reader

berak gravatar imageberak ( 2018-06-11 10:39:07 -0500 )edit

I actually use nd2reader to read the file formats, the question, is how to convert these 4 color channels into a visibie/usable image.

shogun gravatar imageshogun ( 2018-06-11 10:41:02 -0500 )edit

i looked around a bit, but could not find any information about the format, or pixel structure, sorry, no idea.

and btw, opencv uses bgr, not rgb.

berak gravatar imageberak ( 2018-06-11 10:50:19 -0500 )edit

The image is read as a normal numpy matrix of Y by X, so I can make (Y, X, channel) 3 color RGB images easily usable with opencv or any other packages. Problem is, I still haven't found anything on the yellow (1, 1, 0) channel.

shogun gravatar imageshogun ( 2018-06-11 10:52:22 -0500 )edit

It seems you are dealing with a multispectral image (more than the 3 basic channels). It's probably because you can have some interesting data in the yellow wavelength.

In this case use the different channels to process the image. Take the image as a combination of 4 single band images and see what can you do with it.

To display, you can ignore the yellow channel, and use the RGB part (a subarray of the original image). If the size of the array is im[w,h,4], then (if I'm not mistaken):

kbarni gravatar imagekbarni ( 2018-06-11 12:44:02 -0500 )edit

I would like to conver the RGBY to RGB, so instead of [Y,X,4] I'd have [Y,X,3]. The only thing I can think of is getting the intensity of the yellow channel, and replacing the red and green channels with an equal value so the resulting viewed image has yellow it.. however, then I lose any single channel red and green information.

shogun gravatar imageshogun ( 2018-06-11 13:03:53 -0500 )edit

Please read again my previous comment!

For processing, use the 4 channels. Use the Y channel to detect the position of those fluorescent DNA probes.

To display, use the first 3 channels. Do not replace the R and G channels with the Y value. Just forget the Y channel.

kbarni gravatar imagekbarni ( 2018-06-12 03:18:46 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-06-11 17:56:02 -0500

updated 2018-06-12 00:07:17 -0500

berak gravatar image

Please mention that in which format are you in. Are you trying to say that you are in CMY domain and you want to convert it into RGB domain. For coversion from RGB to CMY you need to do 1 - RGB in matrix form.

edit flag offensive delete link more


i removed your spam link.

berak gravatar imageberak ( 2018-06-12 00:07:38 -0500 )edit

I am in the RGB domain, I have a normal [Y, X, 3] RGB image, so red, green, and blue channels.. but I also have an extra channel [Y,X, 1] which is color intensity of yellow which is identified by the nikon system as RGB channel (1, 1, 0) so it is comprised of both Red and Green. Ultimiately, this is not it's own color space, it is used for FISH (fluorescent in situ hybridization) Wikipedia

shogun gravatar imageshogun ( 2018-06-12 00:24:53 -0500 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-06-11 10:26:55 -0500

Seen: 34 times

Last updated: Jun 12