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
 CreatePolygonsFromSelection out of memory

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
AndyColmes Posted - Feb 15 2016 : 13:26:28
I am unable to call ImageEnVect1.CreatePolygonsFromSelection to create a polygon object since it keeps giving me a "out of memory" error. Is there an alternative to create a polygon object from a selection?

Thanks in advance.

Andy
20   L A T E S T    R E P L I E S    (Newest First)
AndyColmes Posted - Mar 12 2016 : 23:57:04
Hi Nigel, GetObjFromIndex helped to get his solved. Thanks very much for solving this very nagging issue for a while now.

Andy
AndyColmes Posted - Mar 09 2016 : 04:32:12
Thanks Nigel, I will make the changes and report back.

Andy
xequte Posted - Mar 07 2016 : 18:47:23
Hi Andy

Your first bit of code is wrong. You can't use ImageEnVect1.ObjKind[ 0 ], because TImageEnVect objects are not indexed, but listed by hObj, so you must call:

    ihobj := ImageEnVect1.GetObjFromIndex( 0 );
    if (ImageEnVect1.ObjKind[ ihobj ] = IEKPolyLine) or (ImageEnVect1.ObjKind[ ihobj ] = IEKEllipse) then
    begin
      for x:=0 to ImageEnVect1.ObjPolylinePointsCount[ ihobj ]-1 do
         ImageEnVect1.AddSelPoint( ImageEnVect1.ObjPolylinePoints[ ihobj, x ].x, ImageEnVect1.ObjPolylinePoints[ ihobj, x ].y );
      ImageEnVect1.EndSelect();
    end;


Also, what is the purpose of FTempVect? If it is just for saving your BMP, then you can just make BMP a TIEBitmap and call BMP.write( fsc );

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
AndyColmes Posted - Mar 07 2016 : 11:55:36
Hi Bill, yes I am compiling with Win32 because I don't have a choice. The other libraries that are in the application are not 64-bit compliant...yet. So, I am in a bind...

Andy
w2m Posted - Mar 06 2016 : 07:59:35
I assume you are compiling with Win32 platform. Try compiling with Win64 platform and see if the error still occurs.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
AndyColmes Posted - Mar 04 2016 : 01:23:17
I did a test where I created a rectangle object instead of a polygon and it also seems to fail. There is no error but it appears to hang:


                    if (ImageEnVect1.ObjKind[0] = IEKBOX) then begin
                       x1:=ImageEnVect1.ObjLeft[0];
                       y1:=ImageEnVect1.ObjTop[0];
                       x2:=(ImageEnVect1.ObjWidth[0]+ImageEnVect1.ObjLeft[0]);
                       y2:=(ImageEnVect1.ObjHeight[0]+ImageEnVect1.ObjTop[0]);

                       ImageEnVect1.Select( x1, y1, x2, y2, iespReplace  );
                    end;


It looks like the issue is the CopySelectionToBitmap for all cases, at least with my sample file.

Andy
AndyColmes Posted - Mar 03 2016 : 23:22:47
Hi Nigel, thanks for the updated code. Unfortunately, I am still getting the error. I created a polygon object using the same image file by manually drawing it. I then save it to .iev file. I would load it back and do the following:



                    if (ImageEnVect1.ObjKind[0] = IEKPolyLine) or (ImageEnVect1.ObjKind[0] = IEKEllipse) then begin
                      for x:=0 to ImageEnVect1.ObjPolylinePointsCount[0]-1 do
                         ImageEnVect1.AddSelPoint( ImageEnVect1.ObjPolylinePoints[0, x].x, ImageEnVect1.ObjPolylinePoints[0, x].y );
                      ImageEnVect1.EndSelect();
                    end;

                    ImageEnVect1.RemoveAllObjects;
                    ImageEnVect1.Update;

                    Bmp := TBitmap.Create;
                    try
                      ImageEnVect1.CopySelectionToBitmap( Bmp, True );

                      FTempVect.Bitmap.Assign( Bmp );
                      FTempVect.Update;

                      FTempVect.IO.SaveToFileBMP( fsc );         <--- Error (Floating point)
                    finally
                      Bmp.Free;
                    end;



I get a floating point error. This code works with smaller files or smaller selection but not with this file for some reason.

Can you verify if you can reproduce this error?

Thanks again.

Andy
AndyColmes Posted - Mar 01 2016 : 03:57:50
Hi Nigel,

My associate, Jenny have sent you an email requesting the update. Thanks again, Nigel.

Andy
xequte Posted - Feb 28 2016 : 20:54:58
Hi

We have an update to improve the memory handling (though still not fast with very large selections). Email us if you want the updated source.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
AndyColmes Posted - Feb 25 2016 : 09:25:09
Thank you spetric and Nigel. I have also encountered "Floating point error" when calling CopySelectionToBitmap after making the polygon selection with the same file. I think the issue could be related.

Andy
xequte Posted - Feb 23 2016 : 13:10:39
OK, thanks. We wil investigate.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
spetric Posted - Feb 23 2016 : 06:49:48
Hi,

I've tried with C++ XE5 32-bit and Ien 6.2.2 and the error "out of memory" is thrown in CreatePolygonsFromSelection method.

I've used lasso selection and selected four labels (roughly).
This is selection scenario that produces error:



AndyColmes Posted - Feb 22 2016 : 07:46:53
Hi Nigel, I am using Delphi Seattle 10 with the latest ImageEn 6.2.2, although I have similar results with XE6 Update 1 as well.

Andy
xequte Posted - Feb 21 2016 : 19:42:39
Hi Andy

Tested that TIFF and still had no failure. What version of Delphi are you on?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
AndyColmes Posted - Feb 19 2016 : 15:17:34
Thanks very much Spetric. I am doing the same functions too. I hope there is a fix for this.

Andy
spetric Posted - Feb 19 2016 : 14:28:35
Hi Andy,

I've tried with my prog. (built with Ien 5.2.0) and yes, it crashes when four selections are marked (using shift key). I'm converting selections into vector polygons and draw strokes through polygon points. Here is Eurekalog screen (if it can be of any help):

AndyColmes Posted - Feb 19 2016 : 08:15:20
Hi Nigel, thanks for checking this for me. It seems to happen when my file is a TIF file. I converted it to a JPG which reduces its size dramatically and the error disappears. But the TIF file definitely gives the error.

I am trying to make a selection around each label image in the TIF file and convert the selection to a polygon object.

https://onedrive.live.com/redir?resid=3C7651B735240773!61019&authkey=!AC_PrsJJ7QhryBg&ithint=file%2czip

Thanks Nigel. I hope you can reproduce this on your end.

Andy
xequte Posted - Feb 18 2016 : 17:02:41
Hi Andy

I cannot reproduce that even with highly complex selections.



Is there any more information you can give me?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
AndyColmes Posted - Feb 16 2016 : 01:12:55
Hello Nigel, I am using the latest version 6.2.2. I just set the MouseInteract to allow making a Polygon selection and when it is closed, I called CreatePolygonsFromSelection.

ImageEnVect1.MouseInteract := [miSelectPolygon];

ImageEnVect1.CreatePolygonsFromSelection;

If I make a small selection, the error does not happen. Is there a way to get around this? I am not allowed to resize the whole image to a smaller size.

Thanks Nigel.

Andy

xequte Posted - Feb 15 2016 : 17:32:08
Hi Andy

What version are you using? Can you give us the steps to reproduce this issue?

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com