Can I change the pen width & color of the bbox?
AnsweredAs the title, I'm using "pushMetadataPacket" to draw the bbox. Can I change the pen width & color of the bbox?
-
Hi 高偉恆
Thanks for your question. Just to confirm - You will be asking the object boundary box on the client.
1 -
Hi, Ichiro
Yes. Sorry for my poor English.
Thx
0 -
Hi 高偉恆
There are two parts - the color and the width.
1.For the color of a boundary box, yes, this is doable.
You would need to define it accordingly in thegenerateObjectMetadataPacketfunction.
For example, the follow sample is to change for every new frame to a random color for the Sample plugin(in SDK sample):
// Calculate bounding box coordinates each frame so that it moves from the top left corner
// to the bottom right corner during kTrackFrameCount frames.
staticconstexprfloatd = 0.5F / kTrackFrameCount;
staticconstexprfloatwidth = 0.5F;
staticconstexprfloatheight = 0.5F;
constintframeIndexInsideTrack = m_frameIndex % kTrackFrameCount;
constfloatx = d * frameIndexInsideTrack;
constfloaty = d * frameIndexInsideTrack;
objectMetadata->setBoundingBox(Rect(x, y, width, height));
std::srand(time(NULL));
intRR = rand() % 0xFF;
intGG = rand() % 0xFF;
intBB = rand() % 0xFF;
std::stringstreamcolorCode;
colorCode<<std::hex<<RR<<std::hex<<GG<<std::hex<<BB;
NX_PRINT<<"nx.sys.color "<<colorCode.str();
objectMetadata->addAttribute(makePtr<Attribute>("nx.sys.color", "#"+colorCode.str()));
objectMetadataPacket->addItem(objectMetadata.get());
Please be noticed that the bounding boxes color information will be kept within the archive as a part of the metadata stream.
2. For the width of the boundary box, currently it is not supported unfortunately, but we will put this request in our backlog and will be discussed with our product and SDK team.
Thanks for your feedback and understandings.
1
Please sign in to leave a comment.
Comments
3 comments