Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

images from opencv displayed in blue

# matplotlib interprets images in RGB format, but OpenCV uses BGR format

# so to convert the image so that it's properly loaded, convert it before loading

img = cv2.imread('filename.ext')		# this is read in BGR format
rgb_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)		# this converts it into RGB

plt.imshow(rgb_img)
plt.show()
Comment

PREVIOUS NEXT
Code Example
Python :: python install pandas for linux 
Python :: discord.py add role on member join 
Python :: python mean and standard deviation of list 
Python :: how to open any application using python 
Python :: how to check for a particular word in a text file using python 
Python :: numpy array with random numbers 
Python :: python pip not working 
Python :: save list pickle 
Python :: split string every n characters python 
Python :: python how to read a xlsx file 
Python :: how to create a keylogger in python 
Python :: python hand tracking module 
Python :: save dictionary python 
Python :: python flask query params 
Python :: python get human readable file size 
Python :: cv2.imshow 
Python :: each line in a text file into a list in Python 
Python :: numpy merge arrays 
Python :: throw error python 
Python :: python roman to integer 
Python :: matplotlib grid 
Python :: python pandas drop column by index 
Python :: python random 
Python :: django queryset group by count 
Python :: initialize pandas dataframe with column names 
Python :: python read csv 
Python :: matplotlib remove ticks and lines 
Python :: os get current directory 
Python :: python write to file 
Python :: xarray add coordinate 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =