1 | initial version |
cvtColor itself don't need temporary memory. The only memory it may allocate is the memory for output image, if it is not allocated (or it is allocated, but has different size). From what I see in your code that is the case. Do you release the memory used by those images when they are not needed anymore? If no, that is the source for your memory leak. Then you should release this memory yourself or use Mat instead of IplImage* (Mat has reference counting and will release the memory when it is not needed anymore). I recommened second option.
Just out of curiosity, why do you use value '3' in your imread function?