I am trying to import into openCV (c++) an image .TIF which has several bands. Using command imread it shows just the first band. How can I access to the others?
More over I tried to access the file with ifstream but it looks like I made some mistakes!
Thanks for your help,!
Best
Some code would be helpful here to see what went wrong.
However, it seems that you are accessing only the first band instead of all the bands you want.
Try something like this (This example has 3 bands, thus Vec3b):
This stores the image in a 3-band vector (There are several types with different amounts of bands, like Vec4b or Vec5b). You can then access each band just like accessing an element in a vector:
If what I am assuming is correct, you are attempting to access by using something along the lines of
or something similar. Remember that referencing the name of a vector (or array) is the same as accessing the first element in that vector (or array)