Skip to content

Commit

Permalink
Fix bugs on drawing boundary rects
Browse files Browse the repository at this point in the history
  • Loading branch information
imistyrain committed Jul 3, 2018
1 parent 13c37a3 commit 9d9945e
Show file tree
Hide file tree
Showing 15 changed files with 47 additions and 75 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Debug/
Release/
x64/
MRFacelabeler/
MRLabeler/Debug/
MRLabeler/Release/
MRLabeler/x64/
Expand Down
6 changes: 4 additions & 2 deletions AnnoUtil/AnnoUtil.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def get_all_labels(args):
cv2.imwrite(gt_path,image)
else:
for name in names:
color=colors[name]
show=image.copy()
for rect in objs[name]:
if rect[1]<20:
Expand All @@ -233,6 +234,7 @@ def get_all_labels(args):

else:
for name in names:
color=colors[name]
for rect in objs[name]:
if rect[1]<20.0:
cv2.putText(image,name,(int(rect[0]),20),1,1,color)
Expand Down Expand Up @@ -350,10 +352,10 @@ def get_args():
"D:/Detection/CKdemo/CK2018"
)
parser.add_argument('--show_annotations', type=bool,help='show annotations on label analysis',default=False)
parser.add_argument('--show_alllabels', type=bool,help='whether show all labels',default=False)
parser.add_argument('--show_alllabels', type=bool,help='whether show all labels',default=True)
parser.add_argument('--save_gt', type=bool,help='classified show gt',default=True)
parser.add_argument('--gt_dir', type=str,help='gt dir',default="gt")
parser.add_argument('--save_classified', type=bool,help='classified show gt',default=True)
parser.add_argument('--save_classified', type=bool,help='classified show gt',default=False)

parser.add_argument('--images_dir', type=str,help='dataset image file dir',default=
"images"
Expand Down
16 changes: 16 additions & 0 deletions MRLabeler.sln
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DataGenerator", "DataGenera
EndProject
Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "AnnoUtil", "AnnoUtil\AnnoUtil.pyproj", "{05723B22-BD45-499C-8016-DEC0777ADD7C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MRFaceLabeler", "MRFacelabeler\MRFaceLabeler.vcxproj", "{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -70,6 +72,20 @@ Global
{05723B22-BD45-499C-8016-DEC0777ADD7C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{05723B22-BD45-499C-8016-DEC0777ADD7C}.Release|Win32.ActiveCfg = Release|Any CPU
{05723B22-BD45-499C-8016-DEC0777ADD7C}.Release|x64.ActiveCfg = Release|Any CPU
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|Win32.ActiveCfg = Debug|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|Win32.Build.0 = Debug|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|x64.ActiveCfg = Debug|x64
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Debug|x64.Build.0 = Debug|x64
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|Any CPU.ActiveCfg = Release|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|Mixed Platforms.Build.0 = Release|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|Win32.ActiveCfg = Release|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|Win32.Build.0 = Release|Win32
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|x64.ActiveCfg = Release|x64
{309D2DFC-9DDA-4EE0-A066-5B09B15EA19E}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
33 changes: 22 additions & 11 deletions MRLabeler/MFCLabelerDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,17 +314,28 @@ void CMFCLabelerDlg::OnLButtonDown(UINT nFlags, CPoint point)
tracker.m_nStyle = CRectTracker::dottedLine | CRectTracker::resizeInside;
tracker.TrackRubberBand(this, point, TRUE);
tracker.m_rect.NormalizeRect();
CClientDC dc(this);
tracker.Draw(&dc);
m_trackers.push_back(tracker);
CRelativeRect rr;
rr.strName = tracker.m_strName;
rr.ptStart.x = tracker.m_rect.left*1.0 / m_Picrect.Width();
rr.ptStart.y = tracker.m_rect.top*1.0 / m_Picrect.Height();
rr.ptEnd.x = tracker.m_rect.right*1.0 / m_Picrect.Width();
rr.ptEnd.y = tracker.m_rect.bottom*1.0 / m_Picrect.Height();
m_relrects.push_back(rr);
m_bDragMode = true;
if (tracker.m_rect.left < m_Picrect.right&&tracker.m_rect.top < m_Picrect.bottom)
{
if (tracker.m_rect.left < 0)
tracker.m_rect.left = 0;
if (tracker.m_rect.top < 0)
tracker.m_rect.top = 0;
if (tracker.m_rect.right > m_Picrect.right)
tracker.m_rect.right = m_Picrect.right;
if (tracker.m_rect.bottom > m_Picrect.bottom)
tracker.m_rect.bottom = m_Picrect.bottom;
CClientDC dc(this);
tracker.Draw(&dc);
m_trackers.push_back(tracker);
CRelativeRect rr;
rr.strName = tracker.m_strName;
rr.ptStart.x = tracker.m_rect.left*1.0 / m_Picrect.Width();
rr.ptStart.y = tracker.m_rect.top*1.0 / m_Picrect.Height();
rr.ptEnd.x = tracker.m_rect.right*1.0 / m_Picrect.Width();
rr.ptEnd.y = tracker.m_rect.bottom*1.0 / m_Picrect.Height();
m_relrects.push_back(rr);
m_bDragMode = true;
}
}
else
{
Expand Down
8 changes: 4 additions & 4 deletions MRLabeler/MFCLabelerDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
// const std::string databasename = "Mobile2017";
// const std::string rootdir = "../../Datasets";
//const std::string databasename = "Face2017";
const std::string databasename = "CK2018";
const std::string rootdir = "./";
//const std::string databasename = "CK2018";
//const std::string rootdir = "./";
//const std::string rootdir = "C:/Users/yanhe.gong/Desktop";
// const std::string databasename = "WiderFace";
// const std::string rootdir = "D:/Face/Datasets/";
//const std::string databasedir = "E:/Detection/Datasets/ibm2017Q4";
//const std::string databasedir = "../bin/Face2017";
const std::string databasedir = "../bin/Face2017";

const std::string databasedir = rootdir + "/" + databasename;
//const std::string databasedir = rootdir + "/" + databasename;

class CRelativeRect
{
Expand Down
28 changes: 0 additions & 28 deletions bin/Face2017/Annotations/001.xml

This file was deleted.

28 changes: 0 additions & 28 deletions bin/Face2017/Annotations/005.xml

This file was deleted.

1 change: 0 additions & 1 deletion bin/Face2017/labels/001.txt

This file was deleted.

1 change: 0 additions & 1 deletion bin/Face2017/labels/005.txt

This file was deleted.

Binary file added bin/MRFaceLabeler.exe
Binary file not shown.
Binary file added bin/MRFaceLabeler.iobj
Binary file not shown.
Binary file added bin/MRFaceLabeler.ipdb
Binary file not shown.
Binary file modified bin/MRLabeler.exe
Binary file not shown.
Binary file added bin/MRLabeler.iobj
Binary file not shown.
Binary file added bin/MRLabeler.ipdb
Binary file not shown.

0 comments on commit 9d9945e

Please sign in to comment.