PixelMath: how to build a Grayscale image

aworonow

Well-known member
I need a grayscale image from something like the following PM code:

G = min (B, I(C) )

where B is a grayscale image and C is a color image with pixel intensities I(C). But both images are built in the code above this point, so I(C) does not seem to work, so I substituted C[0]+C[1]+C[2] (as in a uniform RGBWS). But I still get G as a color image. If there is no way to make the rhs recognized as grayscale inputs, is there a way to take the RGB version of G and make a grayscale image from that?

Thanks much,
Alex
 
there's a section of the pixelmath process that deals with what the output image format should be. (Destination > replace target image/ create new image). you need to switch that to "create new image" and then in the Color Space dropdown, select Grayscale. that should do what you want.

maybe also on image I you should set the RGBWS to equal, the gamma to 1.0 and then extract L*, then do min (B,new_L_image)

rob
 
This is an intermediate image that I uses later in the code, so the output options is not viable. Likewise, if I try CIEL(G) it aborts with an error saying that G is not a static image (or words to that effect), meaning it only works of images that exist in the current PI workspaces, not images created within the the code. But thanks for the try.

Alex
 
well, in light of that i was going to suggest trying to "cast" G to an L image then but if CIEL(G) doesn't work then i guess that's done.

but can you say CIEL(min(B, C[0]+C[1]+C[2]) or does that not work either? might have the same problem as trying to do it after the assignment.

otherwise i guess @Juan Conejero would have to answer.
 
Back
Top