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
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 SeparateObjects in C++ Builder
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

mlatos

2 Posts

Posted - Jul 24 2012 :  01:11:27  Show Profile  Reply
Hi,

I have a problem with using 'SeparateObjects' function in C++ Builder. For example, I want to outline each found object, as in Delphi demo. In Delphi everything works OK. In C++ Builder, some of the rectangles are located completely not as expected, they covers blank part of the image).

Below is the simle code, that I used.

TList *rects;
int l,r,t,b;
rects = Form1->ImageEnView1->Proc->SeparateObjects(4, false);
for (i = 0; i < rects->Count; i++)
{
l = ( (PRect) &(rects[i]) )->Left;
r = ( (PRect) &(rects[i]) )->Right;
t = ( (PRect) &(rects[i]) )->Top;
b = ( (PRect) &(rects[i]) )->Bottom;

ImageEnView1->IEBitmap->Canvas->Rectangle(l, t, r+1, b+1);
delete[] ( (PRect) &rects[i] );
}
Form1->ImageEnView1->Update();
rects->Free();

My question is where I made mistake? Could You post an example of proper code? I'm using C++ Builder 2010 and ImageEn 4.1.0.

Best regards,
Mariusz

fab

1310 Posts

Posted - Jul 26 2012 :  01:04:51  Show Profile  Reply
Hi,
the code seems ok. Please could you send a full app with a sample image?
Go to Top of Page

mlatos

2 Posts

Posted - Jul 26 2012 :  02:04:07  Show Profile  Reply
Hi,

thank You for an attempt to help, but I've already figured it out.
The problem lies in the impossibility to cast 'PRect' type on 'rects' list members (which are, in fact, pointers to TRect structures).
That's why I've tried to cast 'PRect' on the pointers to 'rects' list members, but this is of course mistake.
The proper sentence is '(PRect) rects->Items[i]' instead of '(PRect) &rects[i]' or (PRect) rects[i]'.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: