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? |
|
|