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
 SeparateObjects in C++ Builder

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
mlatos Posted - Jul 24 2012 : 01:11:27
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
2   L A T E S T    R E P L I E S    (Newest First)
mlatos Posted - Jul 26 2012 : 02:04:07
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]'.
fab Posted - Jul 26 2012 : 01:04:51
Hi,
the code seems ok. Please could you send a full app with a sample image?