Rotate Images in a Parallel For

pablobhz

Member
Joined
Sep 4, 2018
Messages
6
Programming Experience
1-3
Hello Everyone .
I've come to ask help with a problem that has been annoying me for days.

I'm trying to create five images (read TIFFS from the harddisk), rotate and add them to a collection (List<Image<Bgra,byte>>)(Image<Bgra,byte> is an OpenCV Image).
However i'm always having memory problems.
Tried to rotate them using:
GDI+
MagickNET
OpenCV

and they all always give some kind of memory problem. Always, no matter what i do.
There are 4 20MB +- TIFFS and one smaller.
Is there something i can do ? Also, i can't seem to change the target build platform to x64 - i change the configuration but nothing happens.
Thanks in advance !

method to rotate Images:


  • private List<Image<Bgra,byte>> UpdateListWithRotatedImages(List<string> Images, int RotationIndex)
  • {
  • List<Image<Bgra, byte>> Rotated = new List<Image<Bgra, byte>>();
  • Parallel.For(0, Images.Count, i =>
  • {
  • var ImgRotated = new ImageProcessing.RotateImage(Images.ElementAt(i), RotationIndex).rotatedImage;
  • Rotated.Add(ImgRotated);
  • //RotatedStuff.Add(ImagesToRotate.ElementAt(i).Key, ImgRotated);
  • });
  • return Rotated;
  • }


My call:
C#:
[COLOR=#1D2129][FONT=Helvetica]var CMYKRotatedImages = Task.Run(() => UpdateListWithRotatedImages(ImageListSorted.Result.CMYKImages, ImageRotationNumber), cancelParallelWorker.Token);[/FONT][/COLOR]
[COLOR=#1D2129][FONT=Helvetica]Task.WaitAll(CMYKRotatedImages);
[/FONT][/COLOR]
 
Back
Top Bottom