Home > Blockchain >  How to make an image red
How to make an image red

Time:07-18

I am working with image processing in python. How can I transform a scalar image to colored, and then select only the red channel?

I briefly looked into OpenCV and SimpleITK but I cannot manage to find a correct answer.

Thanks for helping

CodePudding user response:

nebula,

  1. Welcome to SO.
  2. I actually did this a couple of weeks ago, the pattern is something along the lines of
import SimpleITK as sitk
image = sitk.ReadImage(image_path)
rgb = sitk.ScalarToRGB(image)
rgb_array = sito.GetArrayFromImage(rgb)
red_only = [:,:,0]

I'm not entirely sure but it was something like this. Tell me if it works

  • Related