forked from zhxing001/code_of_paper_about_tracking
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
99 changed files
with
15,948 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 14 | ||
VisualStudioVersion = 14.0.23107.0 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KCF_WQ", "KCF_WQ\KCF_WQ.vcxproj", "{2A8E1851-CB4A-409F-8022-B25DEAB08298}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cut_video", "cut_video\cut_video.vcxproj", "{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}" | ||
EndProject | ||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BLOB", "BLOB\BLOB.vcxproj", "{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Debug|x64.ActiveCfg = Debug|x64 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Debug|x64.Build.0 = Debug|x64 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Debug|x86.Build.0 = Debug|Win32 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Release|x64.ActiveCfg = Release|x64 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Release|x64.Build.0 = Release|x64 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Release|x86.ActiveCfg = Release|Win32 | ||
{2A8E1851-CB4A-409F-8022-B25DEAB08298}.Release|x86.Build.0 = Release|Win32 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Debug|x64.ActiveCfg = Debug|x64 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Debug|x64.Build.0 = Debug|x64 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Debug|x86.Build.0 = Debug|Win32 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Release|x64.ActiveCfg = Release|x64 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Release|x64.Build.0 = Release|x64 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Release|x86.ActiveCfg = Release|Win32 | ||
{FA489F9D-D6BC-42EC-A0AD-9E9F0EF8F8B2}.Release|x86.Build.0 = Release|Win32 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Debug|x64.ActiveCfg = Debug|x64 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Debug|x64.Build.0 = Debug|x64 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Debug|x86.ActiveCfg = Debug|Win32 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Debug|x86.Build.0 = Debug|Win32 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Release|x64.ActiveCfg = Release|x64 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Release|x64.Build.0 = Release|x64 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Release|x86.ActiveCfg = Release|Win32 | ||
{36D23D52-5897-4E2D-A775-AC3A6DFE04D0}.Release|x86.Build.0 = Release|Win32 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{2A8E1851-CB4A-409F-8022-B25DEAB08298}</ProjectGuid> | ||
<RootNamespace>KCF_WQ</RootNamespace> | ||
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>Application</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v140</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Label="Shared"> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup /> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Console</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<SDLCheck>true</SDLCheck> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<SubSystem>Console</SubSystem> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="gradientMex.cpp" /> | ||
<ClCompile Include="kcf.cpp" /> | ||
<ClCompile Include="main.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="fhog.hpp" /> | ||
<ClInclude Include="getROI_Mouse.h" /> | ||
<ClInclude Include="get_rec_pos.h" /> | ||
<ClInclude Include="gradientMex.h" /> | ||
<ClInclude Include="kcf.hpp" /> | ||
<ClInclude Include="sse.hpp" /> | ||
<ClInclude Include="TemplateTracking.h" /> | ||
<ClInclude Include="wrappers.hpp" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="源文件"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="头文件"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="资源文件"> | ||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="gradientMex.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
<ClCompile Include="kcf.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
<ClCompile Include="main.cpp"> | ||
<Filter>源文件</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="fhog.hpp"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="gradientMex.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="kcf.hpp"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="sse.hpp"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="wrappers.hpp"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="getROI_Mouse.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="get_rec_pos.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
<ClInclude Include="TemplateTracking.h"> | ||
<Filter>头文件</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<LocalDebuggerCommandArguments>C:\\Users\\zhxing\\Desktop\\论文代码\\KCF_WQ\\KCF_WQ girl</LocalDebuggerCommandArguments> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<LocalDebuggerCommandArguments> | ||
</LocalDebuggerCommandArguments> | ||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor> | ||
</PropertyGroup> | ||
</Project> |
Empty file.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include<opencv2\opencv.hpp> | ||
using namespace std; | ||
using namespace cv; | ||
|
||
|
||
void tracking(Mat frame, Mat &model, Rect &trackBox) | ||
{ | ||
Mat gray; | ||
cvtColor(frame, gray, CV_RGB2GRAY); | ||
|
||
Rect searchWindow; | ||
searchWindow.width = trackBox.width * 3; | ||
searchWindow.height = trackBox.height * 3; | ||
searchWindow.x = trackBox.x + trackBox.width * 0.5 - searchWindow.width * 0.5; | ||
searchWindow.y = trackBox.y + trackBox.height * 0.5 - searchWindow.height * 0.5; | ||
searchWindow &= Rect(0, 0, frame.cols, frame.rows); | ||
|
||
Mat similarity; | ||
matchTemplate(gray(searchWindow), model, similarity, CV_TM_CCOEFF_NORMED); | ||
|
||
double mag_r; | ||
Point point; | ||
minMaxLoc(similarity, 0, &mag_r, 0,&point); | ||
trackBox.x = point.x + searchWindow.x; | ||
trackBox.y = point.y + searchWindow.y; | ||
model = 0.95*model+0.05*gray(trackBox); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
- c++ wrapper for the piotr toolbox | ||
Created by Tomas Vojir, 2014 | ||
*/ | ||
|
||
|
||
#ifndef FHOG_HEADER_7813784354687 | ||
#define FHOG_HEADER_7813784354687 | ||
|
||
#include <vector> | ||
#include <opencv2/opencv.hpp> | ||
|
||
#include "gradientMex.h" | ||
|
||
|
||
class FHoG | ||
{ | ||
public: | ||
//description: extract hist. of gradients(use_hog == 0), hog(use_hog == 1) or fhog(use_hog == 2) | ||
//input: float one channel image as input, hog type //输入是单通道的图像 | ||
//return: computed descriptor | ||
std::vector<cv::Mat> extract(const cv::Mat & img, int use_hog = 2, int bin_size = 4, int n_orients = 9, int soft_bin = -1, float clip = 0.2) | ||
{ | ||
// d image dimension -> gray image d = 1 | ||
// h, w -> height, width of image | ||
// full -> ?? | ||
// I -> input image, M, O -> mag, orientation OUTPUT | ||
int h = img.rows, w = img.cols,d = 1; | ||
bool full = true; | ||
if (h < 2 || w < 2) { | ||
std::cerr << "I must be at least 2x2." << std::endl; | ||
return std::vector<cv::Mat>(); | ||
} | ||
|
||
float * I = new float[h*w]; | ||
for (int x = 0; x < w; ++x) { | ||
for (int y = 0; y < h; ++y) { | ||
I[x*h + y] = img.at<float>(y, x); | ||
} | ||
} //得到每个点的像素值存入数组 | ||
|
||
float *M = new float[h*w], *O = new float[h*w]; | ||
gradMag(I, M, O, h, w, d, full); | ||
//这个算出每个点幅值的大小(M)和方向(O) | ||
|
||
int n_chns = (use_hog == 0) ? n_orients : (use_hog==1 ? n_orients*4 : n_orients*3+5); | ||
//通道数,看是否用0是9维,1是hog36维,2是fhog一共32维(最后一维是全零) | ||
int hb = h/bin_size, wb = w/bin_size; //bin_size是每个cell的大小应该是 | ||
|
||
float *H = new float[hb*wb*n_chns]; //看需要多少存储空间来存这个 | ||
memset(H, 0, hb*wb*n_chns*sizeof(float)); //分配空间 | ||
|
||
if (use_hog == 0) | ||
{ | ||
full = false; //by default | ||
gradHist( M, O, H, h, w, bin_size, n_orients, soft_bin, full ); //这个函数是算梯度统计中方图 | ||
} else if (use_hog == 1) { | ||
full = false; //by default | ||
hog( M, O, H, h, w, bin_size, n_orients, soft_bin, full, clip ); | ||
} else { | ||
fhog( M, O, H, h, w, bin_size, n_orients, soft_bin, clip ); | ||
} | ||
|
||
//convert, assuming row-by-row-by-channel storage | ||
std::vector<cv::Mat> res; | ||
int n_res_channels = (use_hog == 2) ? n_chns-1 : n_chns; //last channel all zeros for fhog | ||
res.reserve(n_res_channels); //需要这么多通道,这个是分配空间用 | ||
for (int i = 0; i < n_res_channels; ++i) { | ||
//output rows-by-rows | ||
// cv::Mat desc(hb, wb, CV_32F, (H+hb*wb*i)); | ||
|
||
//output cols-by-cols | ||
cv::Mat desc(hb, wb, CV_32F); | ||
for (int x = 0; x < wb; ++x) { | ||
for (int y = 0; y < hb; ++y) { | ||
desc.at<float>(y,x) = H[i*hb*wb + x*hb + y]; | ||
} | ||
} | ||
res.push_back(desc.clone()); | ||
} | ||
|
||
//clean | ||
delete [] I; | ||
delete [] M; | ||
delete [] O; | ||
delete [] H; | ||
|
||
return res; | ||
} | ||
}; | ||
|
||
#endif | ||
//FHOG_HEADER_7813784354687 |
Oops, something went wrong.