Ask Your Question

Problem with Red And Blue

asked 2018-02-28 08:15:19 -0500

cjacquel gravatar image


When I save my images, they look like to have a lot of blue component.

Do OpenCV use BGR or RGB for saving or processing images ?

How to switch from one to another ?

Thank you, cjacquel

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2018-02-28 08:26:06 -0500

LBerger gravatar image

updated 2018-02-28 08:36:45 -0500

Opencv uses BGR format to store data in memory

When image is save using imwrite then channels are in good order relatively to file extension (jpg, png, ....)

Mat img=imread("fruits.jpg",IMREAD_COLOR);

results 13,62,130 check in your favourite image editor : Blue=13 Green = 62 Red=130

In previous code i don't use cvtcolor to change bgr to rgb : when you use opencv function everything is done internally.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-02-28 08:15:19 -0500

Seen: 390 times

Last updated: Feb 28 '18