Skip to content

Commit

Permalink
change arrow sad calculation to observer arrow recognize .
Browse files Browse the repository at this point in the history
  • Loading branch information
skyforcetw committed Oct 9, 2020
1 parent 740d575 commit 3c0f1c7
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 12 deletions.
16 changes: 11 additions & 5 deletions GoogleMap_Arrow_Recognize/PatternRecognize/PatternRecognize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ void pixel_compare_method() {
image_recognize(ref_dir);
}

if (false) { //直接用原圖比
if (true) { //直接用原圖比
string target_filename = "arrow0.png";
auto& target_image = cv::imread(target_filename);
auto target_size = target_image.size();
Expand All @@ -351,21 +351,27 @@ void pixel_compare_method() {


int sad = get_sad_in_green(arrow_img, scale_image);
//int sad = get_sad_in_not_white_count(arrow_img, scale_image);
if (sad < min_sad) {
min_index = index;
min_sad = sad;
}
cout << index << " " << sad << " " << filename << endl;
index++;
}
cout << "min_index: " << min_index << endl;
cout << "min_sad: " << min_sad << endl;
int a = 1;
}
if (true) ////直接用原圖比 & scan
{

int index = 0;

for (auto& filename : getAllImageFileNamesWithinFolder(ref_dir)) {
auto vec = getAllImageFileNamesWithinFolder(ref_dir);
auto rit = vec.rbegin();
//for (auto& filename : getAllImageFileNamesWithinFolder(ref_dir)) {
for(; rit!= vec.rend();rit++) {
auto filename = *rit;
auto& arrow_img = cv::imread(ref_dir + filename);

cv::Mat scale_image;
Expand Down Expand Up @@ -426,9 +432,9 @@ void feature_matching_method() {
}

int main() {
if (false)
pixel_compare_method();
if (true)
pixel_compare_method();
if (false)
feature_matching_method();

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
</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" />
<Import Project="..\sky4sOpencvPropertySheet_d.props" />
<!-- <Import Project="..\sky4sOpencvPropertySheet_d.props" /> -->
</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" />
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
2 changes: 1 addition & 1 deletion GoogleMaps_HUD/GoogleMaps_HUD.iml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
</content>
<orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
<orderEntry type="jdk" jdkName="JDK" jdkType="JavaSDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -844,14 +844,20 @@ private int getArrowV2Index(Bitmap image) {

final int targetWidth = mArrowBitmaps[0].getWidth();
final int targetHeight = mArrowBitmaps[0].getHeight();
Bitmap scaleImage = ImageUtils.getScaleBitmap(image, targetWidth, targetHeight);
scaleImage = ImageUtils.removeAlpha(scaleImage);
Bitmap noAlphaImage = ImageUtils.removeAlpha(image);
Bitmap scaleImage = ImageUtils.getScaleBitmap(noAlphaImage, targetWidth, targetHeight);
// scaleImage = ImageUtils.removeAlpha(scaleImage);
final int length = mArrowBitmaps.length;

sArrowMinSad = Integer.MAX_VALUE;
int minSADIndex = -1;
int sadArray[]=new int [mArrowBitmaps.length ];

for (int x = 0; x < length; x++) {
int sad = getNotWhiteSAD(scaleImage, mArrowBitmaps[x]);
// int sad = getNotWhiteSAD(scaleImage, mArrowBitmaps[x]);
//getGreenSAD better than getNotWhiteSAD(?)
int sad = getGreenSAD(scaleImage, mArrowBitmaps[x]);
sadArray[x] = sad;
if (-1 != sad && sad < sArrowMinSad) {
sArrowMinSad = sad;
minSADIndex = x;
Expand Down
4 changes: 2 additions & 2 deletions GoogleMaps_HUD/gmaps_hud/version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#Thu Oct 08 12:43:25 CST 2020
#Sat Oct 10 02:36:44 CST 2020
VERSION_NAME=0.8.3
VERSION_CODE=1989
VERSION_CODE=2004

0 comments on commit 3c0f1c7

Please sign in to comment.