Tutorial: Generate BBox or Rectangle to locate the target obejct

  

 1 clc;close all;clear all;
 2 Img=imread(‘/home/wangxiao/Documents/files/Visual_Tracking/MDNet-CVPR2016/MDNet-master/attentionMap/Basketball/0001.png‘);
 3 if ndims(Img)==3
 4     I=rgb2gray(Img);
 5 else
 6     I=Img;
 7 end
 8 I=im2bw(I,graythresh(I));
 9 [m,n]=size(I);
10 imshow(I);title(‘binary image‘);
11 txt=get(gca,‘Title‘);
12 set(txt,‘fontsize‘,16);
13 L=bwlabel(I);
14 stats=regionprops(L,‘all‘);
15 set(gcf,‘color‘,‘w‘);
16 set(gca,‘units‘,‘pixels‘,‘Visible‘,‘off‘);
17 q=get(gca,‘position‘);
18 q(1)=0;%设置左边距离值为零
19 q(2)=0;%设置右边距离值为零
20 set(gca,‘position‘,q);
21 for i=1:length(stats)
22     hold on;
23     rectangle(‘position‘,stats(i).BoundingBox,‘edgecolor‘,‘y‘,‘linewidth‘,2);
24     temp = stats(i).Centroid;
25     plot(temp(1),temp(2),‘r.‘);
26     drawnow;
27 end
28 frame=getframe(gcf,[0,0,n,m]);
29 im=frame2im(frame);
30 imwrite(im,‘a.jpg‘,‘jpg‘);%可以修改保存的格式

  

时间: 2024-12-14 17:52:29

Tutorial: Generate BBox or Rectangle to locate the target obejct的相关文章

selenium docs

Note to the Reader - Docs Being Revised for Selenium 2.0! Introduction Test Automation for Web Applications To Automate or Not to Automate? Introducing Selenium Brief History of The Selenium Project Selenium’s Tool Suite Choosing Your Selenium Tool S

BumpMapping [转]

http://fabiensanglard.net/bumpMapping/index.php Fabien Sanglard's Website Home About FAQ Email Rss Twitter March 19th, 2009 BumpMapping with GLSL When I got started learning bump mapping and parallax mapping, I found a lot of tutorial involving a sim

selenium-Locating Elements

There are vaious strategies to locate elements in a page. You can use the most appropriate one for your case. Selenium provides the following methods to locate elements in a page: find_element_by_id find_element_by_name find_element_by_xpath find_ele

跨浏览器插件框架FireBreath安装与使用之Mac下的插件

Requirements CMake version 2.8.8 or later, from http://www.cmake.org/cmake/resources/software.html. Make sure to grab the Binary distribution (cmake-ver-Darwin[64]-universal.dmg). Apple's Xcode, available from your Mac App Store. Xcode's Command-Line

一种远程修改sqlite数据库的方法

一.实际需求 工业设备DA660是专门用来实现工业上可编程设备之间交换信息的交换机.现在要使得DA660采集下行设备的实时数据,然后传送到上位机显示.上位机还可以远程修改DA660的数据库配置. 二.数据库设计 我在DA660中设计了sqlite3数据库,名为da660.db,里面存放很多表,其中有一张表示baseinfo,其结构定义如下: 通道号是从0到15之间的正整数,从机地址是从0到256之间的正整数,设备类型定义为0到5之间的正整数,设备类型可从{"xz2000", "

Hibernate 第一个Hibernate应用程序

Chapter 1. Tutorial   第一章 使用说明书 Table of Contents   目录 1.1. Part 1 - The first Hibernate Application   第一节 第一个Hibernate应用程序 1.1.1. Setup   设置开发环境 1.1.2. The first class  创建第一个类 1.1.3. The mapping file  创建类与数据库表的映射文件 1.1.4. Hibernate configuration  Hi

[Selenium+Java] Implicit Wait & Explicit Wait in Selenium

https://www.guru99.com/handling-dynamic-selenium-webdriver.html here are two types of HTML tables published on the web- Static tables: Data is static i.e. Number of rows and columns are fixed. Dynamic tables: Data is dynamic i.e. Number of rows and c

.NET Core 3.0中IAsyncEnumerable<T>有什么大不了的?

.NET Core 3.0和C# 8.0最激动人心的特性之一就是IAsyncEnumerable<T>(也就是async流).但它有什么特别之处呢?我们现在可以用它做哪些以前不可能做到的事? 在本文中,我们将了解IAsyncEnumerable<T>要解决哪些挑战,如何在我们自己的应用程序中实现它,以及为什么IAsyncEnumerable<T>将在很多情况下取代Task<IEnumerable<T>>. 也许最好的证明IAsyncEnumera

mask-rcnn-model

"""Mask R-CNNThe main Mask R-CNN model implementation. Copyright (c) 2017 Matterport, Inc.Licensed under the MIT License (see LICENSE for details)Written by Waleed Abdulla""" import osimport randomimport datetimeimport reimpo