IplImage nChannels is always returning -1
Hello
Due to the restricted nature of my program I cannot post the code. However, I can provide a very apt description of it so that the problem can be understood.
I have an image processing application where I need to store history of image masks. There are total 6 mask images that fit into a mask history. a history is made via a pair which has an integer type of identifier and the IplImage* for the mask. For this I have created a vector as:
std::vector<std::pair<int, IplImage*>> maskVal; // (int = type for the Id - #defined)
I can confirm that I can save the correct mask values in a history i.e. the channels are correct as as processed by my program. Also, I have in place built-in macros that will __STOP__ the program if mismatches such as nChannels value is wrong, image is NULL, incorrect number of mask images saved, etc. However, when I try to reload the mask values for processing all of them seems to have the nChannels = -1.
I don't know if saving them as IplImage rather than IplImage* would make any difference. I have unit tests that prove that my mask history can correctly load the masks but I am having trouble understanding why the channels are always being returned as -1 even though when they are saved with nChannels = 1.
I know this is probably not as detailed as you would expect but I will try and put some more information up to my limit. I would appreciate if someone points me to the right direction.