PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, July 29, 2022

[FIXED] How to make an image red?

 July 29, 2022     image, python     No comments   

Issue

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.


Solution

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]


Answered By - Sala
Answer Checked By - Terry (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing