Mzk
Mzk

Reputation: 1120

Confusion on cvSplit function

what is the proper way of using cvSplit function? I saw different version of it. should it be

cvSplit(oriImg, r,g,b, NULL);

or

cvSplit(oriImg, b,g,r, NULL);

Upvotes: 2

Views: 320

Answers (2)

Abhishek Walia
Abhishek Walia

Reputation: 19

It is exactly the same thing I was puzzled by when I started using OpenCV. OpenCV uses BGR instead of RGB so you should use

cvSplit(img,b,g,r,NULL);

Upvotes: 0

Sassa
Sassa

Reputation: 3334

Both of them are ok, it depends on the channel ordering. By default OpenCV uses BGR, so in this case it would be cvSplit(oriImg, b,g,r, NULL);, but you can convert it to RGB and then use the other one.

Upvotes: 3

Related Questions