开发者

Proper disposal of Images in EMGU

Im using EMGU (opencv wrapper) for image processing. I want to load images one by one from a folder to perform some operations on them. I use the following code and would do some operations in the using block.

        string[] filenames开发者_开发知识库 = Directory.GetFiles(directory);


        foreach(string filename in filenames)
        {

            using (Image<Bgr, Byte> image = new Image<Bgr, byte>(filename))
            {



            }

        }

However, when I run the code the application uses a growing chunk of memory till I get some exception regarding addressing or being out of memory.

Any advice?


This code looks fine. My guess would be one or more of the operations you are performing for each image is allocating a copy of the image that's not being cleaned up.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜