How can I mark the central point in annotate box

3 次查看(过去 30 天)
Currently, I'm working on a vehicle detection project. I want to know how can I mark central point in annotate frame.
  2 个评论
dpb
dpb 2023-10-29
Show us a snippet of code that creates what you mean by "annotate frame"; the annotation function has no type of 'frame' so we don't have any way to know what you're talking about...

请先登录,再进行评论。

回答(3 个)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023-10-29
If you're plotting the results, then you can put the text or symbol, arrow, etc at specific coordinate points using annotation.

dpb
dpb 2023-10-29
I=imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1524096/image.png');
imshow(I)
figure
colormap gray
B=imagesc(I(:,:,1)>=175 & I(:,:,2)<75,[0 1]);
seems able to find the bounding boxes; one would presume, however, you would already have those from somewhere else, of is that part of the problem? What you're not providing is anything that is specific to your actual problem; yes, we can see the image but we don't know other than that it is a link how you got to this point with it -- there are tools in the Image Processing TB (that I don't have and don't really have a klew about image processing, the above was just a crude way to locate the red line in the image on the assumption it was almost pure red and so the first plane would be pretty big number and the others pretty small; this is pretty easy in the given image as there aren't other reds/pinks in the image to confuse matters).
The Q? is how were those bounding boxes drawn and do you not have the identification of them from the TB? If not, then locating them starting with something like the above is probably the way, but I simply don't know enough about actually using it to do so quickly. @Image Analyst has prepared a lot of tutorials in the area; search for answers or the File Exchange for his postings and you'll learn a lot...

Walter Roberson
Walter Roberson 2023-10-29
Suppose you have BB, an N x 4 array of bounding boxes of the form [x y width height] . These might have come from regionprops('BoundingBox') or they might have come from some kind of object detector.
Then
centers = BB(:,1:2) + BB(:,3:4)/2;
pointsize = 6;
scatter(centers(:,1), centers(:,2), pointsize, 'g')

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by