ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Problem in saving lots of ROI to files

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
zhengyuanyi27 Posted - Dec 29 2019 : 00:28:20
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
begin
          ImageEnMView1.SelectedImage:=i;
ImageEnVect1.Bitmap.Assign(ImageEnMView1.GetBitmap(ImageEnMView1.SelectedImage));
          Imageenvect1.Update;
          imageenvect1.CopySelectionToBitmap(tempImageEnVect.Bitmap) ;
          tempImageEnVect.Update;
          tempImageEnVect.IO.SaveToFile(imagedir+'\sel_'+inttostr(i)+'.JPG');
          caption:=inttostr(i)+'/'+inttostr(ef);
end;
2   L A T E S T    R E P L I E S    (Newest First)
zhengyuanyi27 Posted - Jul 19 2020 : 05:06:31
Dear Nigel,
Thanks a lot.
Your code works perfect and the efficiency is greatly improved.
xequte Posted - Jan 01 2020 : 17:41:13
Hi

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
begin
  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);
end;
bmp.Free;


See also: https://www.imageen.com/help/TIEBitmap.CopyRectTo.html


Nigel
Xequte Software
www.imageen.com