Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to load a sequence of images one by one for tracking it but I have a problem with getting it. I saved the sequence in "OpenHandLeft_BW"folder inside the" image" folder then I called it in the program.

What I have tried:

List<TemplatePyramid> fromFiles()
        {
            Console.WriteLine("Building templates from files...");

            var list = new List<TemplatePyramid>();

            
            string resourceDir = " D:\\image\\OpenHandLeft_BW'";
            string[] files = Directory.GetFiles(resourceDir, "*.bmp");

            object syncObj = new object();
            Parallel.ForEach(files, delegate(string file)
            //foreach(var file in files)
            {
                Gray<byte>[,] preparedBWImage = ImageIO.LoadGray(file).Clone();

                try
                {
                    var tp = TemplatePyramid.CreatePyramidFromPreparedBWImage(preparedBWImage, new FileInfo(file).Name /*"OpenHand"*/);
                    lock (syncObj)
                    { list.Add(tp); };
                }
                catch (Exception)
                { }
            });

            //XMLTemplateSerializer<ImageTemplatePyramid<ImageTemplate>, ImageTemplate>.ToFile(list, "C:/bla.xml");
            return list;
        }


when I run it ...get message "
Could not find a part of the path 'D:\image\OpenHandLeft_BW''.

I want help to fix this problem or get any advice to write it in another way
Posted
Updated 13-Oct-19 14:16pm

1 solution

The error message is very specific.

Look at the line where you define your path:
C#
string resourceDir = " D:\\image\\OpenHandLeft_BW'";

You have a space before the D in your path and you also ended the path with a ' character.
Remove those two characters and it should work.
 
Share this answer
 
Comments
Member 14129828 14-Oct-19 2:03am    
thank you I didn't see it

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900