ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Problem in saving lots of ROI to files
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  


35 Posts

Posted - Dec 29 2019 :  00:28:20  Show Profile  Reply
I am using Imageenmview1 to load thousands of images and use ImageEnvect1 to display the image.I want to save the same range of ROI to file for each image which is loaded into the ImageenMview1.
I wrote the following program and it works well if I loads only a few hundreds of images. While I met the following problem when I tried to load thousands of images into Imageenmview1. It seems that I got the same ROI image from the same image after the program executed at a certain number of images.
To make it more clear, the problem is: For example, I load 1000 different images into Imaggenmview1. The following program could save the ROI of Imageenvect1 which load the image from Imageenmview1 to file very well before it comes to No. 231 image. After No. 231 image, all the ROI images saved are the same image. It seems athe after No. 231 image, the Imageenvect1 can't load image from Imageenmview1 and stops at No. 231, thus all the ROI images after No.231 keeps the same.
Might it be caused by full of cache memory? If yes, how to overcome this problem.
Thanks a lot.

for I := sf to ef do
          imageenvect1.CopySelectionToBitmap(tempImageEnVect.Bitmap) ;


5390 Posts

Posted - Jan 01 2020 :  17:41:13  Show Profile  Reply

I can't see any specifically wrong with the code, you'd need to email me a demo that reproduces it.

However there are more efficient ways to do this that will probably resolve the problem, for example (assuming a rectangular ROI), something like (untested):

bmp := TIEBitmap.create( selWidth, SelHeight );
for I := sf to ef do
  ImageEnMView1.GetTIEBitmap( i ).CopyRectTo( bmp, selX, selY, 0, 0, selWidth, SelHeight );
  bmp.Write( imagedir+'\sel_'+inttostr(i)+'.JPG' );
  ImageEnMView1.ReleaseBitmap( i, False );
  caption := inttostr(i)+'/'+inttostr(ef);

See also:

Xequte Software
Go to Top of Page


35 Posts

Posted - Jul 19 2020 :  05:06:31  Show Profile  Reply
Dear Nigel,
Thanks a lot.
Your code works perfect and the efficiency is greatly improved.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To: