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
 Questions about using TrackObject

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
tylin123 Posted - May 09 2018 : 03:22:50
Dear sir,

I am a user of c++ builder (under CB 10.1 + ImageEn 7.5 + IEVision 4.0)

I use the TrackObjects sample from IEVision demos, and after translate delphi to the C++ syntax.
After compiling and linking, it looks like everything is normal, but after the execution, the tracked object is opposite to the rectangular area.
(When the object being tracked goes up, the red rectangle goes down)

I listed some of the code below. Where is the problem?

P.S:
I'm not familiar with Delpi, but the example is only delphi, so please tell me where is a bug in the program.

Thank You .

James Lin.


                                :
                                :                                        
oImageEnView->IO->DShowParams->GetSample(oImageEnView->->IEBitmap);
// ------------------------------------------------------------
// localize object (use CamShift)
Robj_IEBitmap_BKPROJ->GetIEVisionImage()->flip(ievY_AXIS, obj_IEVisionImage);
// --------------------------------------------
ObjTracker->locateNewPosition(obj_IEVisionImage, obj_IEVisionImageBKPROJ,
                              stru_rotRect);
// ------------------------------------------------------------
// localized?
if((stru_rotRect.size.width > 0)  &&
   (stru_rotRect.size.height > 0) &&
    obj_IEVisionImageBKPROJ!= NULL )
{
    // display back projected image (just for testing)
    obj_IEVisionImage->getScanline(0, mvp_SRCBUFF);
    // --------------------------------------------
    obj_IEVisionImage->getWidth(mi_Width);
    obj_IEVisionImage->getHeight(mi_Height);
    obj_IEVisionImage->getRowLen(mi_RowLen);
    // --------------------------------------------
    // show rect
    IECanvas->Translate(stru_rotRect.center.x,
                                    stru_rotRect.center.y);
    IECanvas->Rotate(stru_rotRect.angle);
    // --------------------------------------------
    // show rect
    IECanvas->Pen->Color = clRed;
    IECanvas->Pen->Width = 3;
    IECanvas->Brush->Style = bsClear;
    IECanvas->Rectangle(-1 * stru_rotRect.size.width  / 2,
                        -1 * stru_rotRect.size.height / 2,
                             stru_rotRect.size.width  / 2,
                             stru_rotRect.size.height / 2);
                                :
                                :                                    
8   L A T E S T    R E P L I E S    (Newest First)
tylin123 Posted - May 15 2018 : 21:50:48
Hi Nigel,

Thank you very much for your code to help me solve the problem.

James Lin.
xequte Posted - May 14 2018 : 17:47:00
I have attached a C++Builder version of our demo for Object Tracking:

attach/xequte/2018514174653_TrackObjects_CPP.zip
61.33 KB

Nigel
Xequte Software
www.imageen.com
tylin123 Posted - May 12 2018 : 02:16:09
Dear Nigel,

I have sent the download URL of the code to your mail.
Thank you very much for your patience.

James Lin.
xequte Posted - May 11 2018 : 22:43:33
Hi James

Yes, your code above should be identical. Can you email your test project to us so we can try it here.



Nigel
Xequte Software
www.imageen.com
tylin123 Posted - May 11 2018 : 00:44:01
Hi Nigel,

Yes. I tried all three methods, but the problem is the same.

Because I'm not familiar with Delphi, so I would like to ask whether the following code syntax is equivalent? (Delphi v.s C++)
Is it possible that this part of the code caused problems?

p.s:
I have a suggestion.
Will there be more C++ example programs in future releases?


James Lin.

Delphi Code:

    RECT.Left   = -trunc(rotRect.size.width/2);
    RECT.Top    = -trunc(rotRect.size.height/2);
    RECT.Right  = trunc(rotRect.size.width/2);
    RECT.Bottom = trunc(rotRect.size.height/2);

C++ Builder Code:

    RECT->Left   = -1*((int)(rotRect.size.width  / 2.0));
    RECT->Top    = -1*((int)(rotRect.size.height / 2.0));
    RECT->Right  =     (int)(rotRect.size.width  / 2.0);
    RECT->Bottom =     (int)(rotRect.size.height / 2.0);
xequte Posted - May 10 2018 : 21:06:28
Hi James

That's weird, what if you use one of the other flips: ievX_AXIS or ievXY_AXISES?

Nigel
Xequte Software
www.imageen.com
tylin123 Posted - May 10 2018 : 03:28:51
Hi, Nigel:

Thanks for your reply.

Unfortunately, after modifying the code based on your suggestions, the problem is still not resolved.
When I after removing the flip(ievY_AXIS,...) in the code, the image Left and right directions will be reversed. However, the Vertical direction of the red box and the object is still in the opposite direction.

The result of the test is in the following video.
Video URL >> http://mis.gotech.biz/file/video/20180510_150034.mp4

Is there any other suggestion?

Thank you.

James Lin
xequte Posted - May 09 2018 : 15:40:56
Hi

Please try removing the "flip".

Change this:

// localize object (use CamShift)
Robj_IEBitmap_BKPROJ->GetIEVisionImage()->flip(ievY_AXIS, obj_IEVisionImage);
// --------------------------------------------
ObjTracker->locateNewPosition(obj_IEVisionImage, obj_IEVisionImageBKPROJ,
                              stru_rotRect);


To:

// localize object (use CamShift)
ObjTracker->locateNewPosition(Robj_IEBitmap_BKPROJ->GetIEVisionImage(), obj_IEVisionImageBKPROJ,
                              stru_rotRect);



Nigel
Xequte Software
www.imageen.com