資源簡介
通過C#+emgucv建立的工程,可用做圖像目標框的標注,把標注文件存成txt文件,可以用于VOC2007數(shù)據(jù)集的制作

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?Emgu.CV;
using?Emgu.Util;
using?Emgu.CV.Structure;
using?System.IO;
namespace?Annotation
{
????public?partial?class?Form1?:?Form
????{
????????private?int?ImageCount;
????????private?List?ImagePaths?=?new?List();
????????private?int?nowCount?=?0;
????????private?int?FirstX;
????????private?int?FirstY;
????????private?int?EndX;
????????private?int?EndY;
????????private?Rectangle?rect;
????????public?Form1()
????????{
????????????InitializeComponent();
????????????//Image?SrcImage=new?Image(@“D:\src.jpg“);//從文件加載圖片
????????????//Image?SrcImage?=?new?Image(@“001.jpg“);//從文件加載圖片
????????????//this.imgbox.Image?=?SrcImage;
????????????//if?(this.imgbox.Height?????????????//{
????????????//????this.imgbox.VerticalScrollBar.Visible?=?true;
????????????//????this.imgbox.VerticalScrollBar.Maximum?=?SrcImage.Height?-?imgbox.Height?+?imgbox.HorizontalScrollBar.Height;
????????????//}
????????????//if?(this.imgbox.Width?????????????//{
????????????//????this.imgbox.HorizontalScrollBar.Visible?=?true;
????????????//????this.imgbox.HorizontalScrollBar.Maximum?=?SrcImage.Width?-?imgbox.Width?+?imgbox.VerticalScrollBar.Width;
????????????//}
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????if?(nowCount?????????????{
????????????????StreamWriter?sw?=?new?StreamWriter(“File.txt“?true);??
????????????????string?s?=?ImagePaths[nowCount];
????????????????Image?SrcImage?=?new?Image(@s);//從文件加載圖片
????????????????this.imgbox.Image?=?SrcImage;???????????????
????????????????int?resultleftX?=?Math.Min(FirstX?EndX);
????????????????int?resultleftY?=?Math.Min(FirstYEndY);
????????????????int?resultrightX?=?Math.Max(FirstXEndX);
????????????????int?resultrightY?=?Math.Max(FirstYEndY);???????????
????????????????if?(nowCount?!=?0)
????????????????{
????????????????????string?ss?=?ImagePaths[nowCount-1];
????????????????????string?filename?=?System.IO.Path.GetFileName(ss);
????????????????????string?cate?=?this.textBox1.Text;
????????????????????sw.WriteLine(filename?+?“?“?+?cate?+?“?“?+?resultleftX.ToString()?+?“?“?+?resultleftY.ToString()?+?“?“?+?resultrightX.ToString()?+?“?“?+?resultrightY.ToString());
????????????????????File.Delete(ss);
????????????????}???????????????
????????????????sw.Close();
???????????????
????????????????nowCount++;
????????????}
????????}
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{
????????????
????????????foreach?(string?Path?in?Directory.GetFiles(@“G:\fasterrcnn\data“))
????????????{
????????????????ImagePaths.Add(Path);
????????????}
????????????if?(ImagePaths.Count?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????4482??2017-05-18?20:52??Annotation\Annotation\Annotation.csproj
?????文件??????11776??2017-05-20?11:30??Annotation\Annotation\bin\Debug\Annotation.exe
?????文件??????26112??2017-05-20?11:30??Annotation\Annotation\bin\Debug\Annotation.pdb
?????文件??????11600??2017-05-20?11:37??Annotation\Annotation\bin\Debug\Annotation.vshost.exe
?????文件????????490??2010-03-17?22:39??Annotation\Annotation\bin\Debug\Annotation.vshost.exe.manifest
?????文件?????307200??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.CV.dll
?????文件??????36864??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.CV.ML.dll
?????文件?????146004??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.CV.ML.xm
?????文件?????126976??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.CV.UI.dll
?????文件??????35149??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.CV.UI.xm
?????文件????1227435??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.CV.xm
?????文件??????32768??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.Util.dll
?????文件??????22455??2013-09-23?20:41??Annotation\Annotation\bin\Debug\Emgu.Util.xm
?????文件??????33835??2017-05-20?11:35??Annotation\Annotation\bin\Debug\File.txt
?????文件?????307200??2013-02-09?07:33??Annotation\Annotation\bin\Debug\ZedGraph.dll
?????文件???????4295??2017-05-20?11:39??Annotation\Annotation\Form1.cs
?????文件???????5049??2017-05-20?11:38??Annotation\Annotation\Form1.Designer.cs
?????文件???????5817??2017-05-20?11:38??Annotation\Annotation\Form1.resx
?????文件???????1149??2017-05-20?11:37??Annotation\Annotation\obj\x86\Debug\Annotation.csproj.FileListAbsolute.txt
?????文件????????975??2017-05-20?11:30??Annotation\Annotation\obj\x86\Debug\Annotation.csproj.GenerateResource.Cache
?????文件??????33168??2017-05-18?20:52??Annotation\Annotation\obj\x86\Debug\Annotation.csprojResolveAssemblyReference.cache
?????文件??????11776??2017-05-20?11:30??Annotation\Annotation\obj\x86\Debug\Annotation.exe
?????文件????????180??2017-05-20?11:30??Annotation\Annotation\obj\x86\Debug\Annotation.Form1.resources
?????文件??????26112??2017-05-20?11:30??Annotation\Annotation\obj\x86\Debug\Annotation.pdb
?????文件????????180??2017-05-18?20:52??Annotation\Annotation\obj\x86\Debug\Annotation.Properties.Resources.resources
?????文件??????27494??2017-05-19?17:32??Annotation\Annotation\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
?????文件???????6707??2017-05-20?11:30??Annotation\Annotation\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件????????543??2017-05-18?21:10??Annotation\Annotation\Program.cs
?????文件???????1370??2017-05-18?20:28??Annotation\Annotation\Properties\AssemblyInfo.cs
?????文件???????2872??2017-05-18?20:28??Annotation\Annotation\Properties\Resources.Designer.cs
............此處省略17個文件信息
評論
共有 條評論