移除不必要的build文件

This commit is contained in:
lishaobo
2018-07-24 16:55:27 +08:00
parent dc487adae1
commit 6c78de6c31
523 changed files with 191 additions and 18034 deletions
+4 -1
View File
@@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pr.platerecognization">
<uses-feature android:name="android.hardware.camera" />
<uses-feature android:name="android.hardware.camera.autofocus" />
<!-- 4.2以上的手机需要的权限 -->
@@ -33,6 +35,7 @@
<!-- 开启闪光灯权限 -->
<uses-permission android:name="android.permission.FLASHLIGHT"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
@@ -40,7 +43,7 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name="pr.platerecognization.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
View File
View File
View File
View File
+18 -18
View File
@@ -17,9 +17,9 @@
namespace pr{
const std::vector<std::string> CH_PLATE_CODE{"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
"B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
"Y", "Z","","","使","","","","","","","广","","","","","","","",""};
"", "", "", "", "", "", "", "", "", "", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A",
"B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "U", "V", "W", "X",
"Y", "Z","","","使","","","","","","","广","","","","","","","",""};
@@ -27,25 +27,25 @@ namespace pr{
const int SEGMENTATION_BASED_METHOD = 1;
class PipelinePR{
public:
GeneralRecognizer *generalRecognizer;
PlateDetection *plateDetection;
PlateSegmentation *plateSegmentation;
FineMapping *fineMapping;
SegmentationFreeRecognizer *segmentationFreeRecognizer;
public:
GeneralRecognizer *generalRecognizer;
PlateDetection *plateDetection;
PlateSegmentation *plateSegmentation;
FineMapping *fineMapping;
SegmentationFreeRecognizer *segmentationFreeRecognizer;
PipelinePR(std::string detector_filename,
std::string finemapping_prototxt,std::string finemapping_caffemodel,
std::string segmentation_prototxt,std::string segmentation_caffemodel,
std::string charRecognization_proto,std::string charRecognization_caffemodel,
std::string segmentationfree_proto,std::string segmentationfree_caffemodel
);
~PipelinePR();
PipelinePR(std::string detector_filename,
std::string finemapping_prototxt,std::string finemapping_caffemodel,
std::string segmentation_prototxt,std::string segmentation_caffemodel,
std::string charRecognization_proto,std::string charRecognization_caffemodel);
// std::string segmentationfree_proto,std::string segmentationfree_caffemodel
// );
~PipelinePR();
std::vector<std::string> plateRes;
std::vector<PlateInfo> RunPiplineAsImage(cv::Mat plateImage,int method);
std::vector<std::string> plateRes;
std::vector<PlateInfo> RunPiplineAsImage(cv::Mat plateImage,int method);
+3 -2
View File
@@ -6,8 +6,9 @@
#define SWIFTPR_PLATEDETECTION_H
#include <opencv2/opencv.hpp>
#include <PlateInfo.h>
#include <vector>
#include "PlateInfo.h"
namespace pr{
class PlateDetection{
public:
@@ -22,7 +23,7 @@ namespace pr{
private:
public:
cv::CascadeClassifier cascade;
View File
+1 -1
View File
@@ -6,7 +6,7 @@
#define SWIFTPR_PLATESEGMENTATION_H
#include "opencv2/opencv.hpp"
#include <opencv2/dnn.hpp>
#include "opencv2/dnn.hpp"
#include "PlateInfo.h"
namespace pr{
View File
View File
View File
+10 -7
View File
@@ -49,10 +49,8 @@ Java_pr_platerecognization_PlateRecognition_InitPlateRecognizer(
pr::PipelinePR *PR = new pr::PipelinePR(detector_path,
finemapping_prototxt_path, finemapping_caffemodel_path,
segmentation_prototxt_path,
segmentation_caffemodel_path,
charRecognization_proto_path,
charRecognization_caffemodel_path);
segmentation_prototxt_path, segmentation_caffemodel_path,
charRecognization_proto_path, charRecognization_caffemodel_path);
return (jlong) PR;
}
@@ -65,10 +63,14 @@ Java_pr_platerecognization_PlateRecognition_SimpleRecognization(
pr::PipelinePR *PR = (pr::PipelinePR *) object_pr;
cv::Mat &mRgb = *(cv::Mat *) matPtr;
cv::Mat rgb;
// cv::cvtColor(mRgb,rgb,cv::COLOR_RGBA2GRAY);
cv::cvtColor(mRgb,rgb,cv::COLOR_RGBA2BGR);
cv::imwrite("/sdcard/demo.jpg",rgb);
std::vector<pr::PlateInfo> list_res= PR->RunPiplineAsImage(rgb);
// cv::imwrite("/sdcard/demo.jpg",rgb);
//1表示SEGMENTATION_BASED_METHOD在方法里有说明
std::vector<pr::PlateInfo> list_res= PR->RunPiplineAsImage(rgb,1);
// std::vector<pr::PlateInfo> list_res= PR->RunPiplineAsImage(rgb,1);
std::string concat_results;
for(auto one:list_res)
{
@@ -80,13 +82,14 @@ Java_pr_platerecognization_PlateRecognition_SimpleRecognization(
return env->NewStringUTF(concat_results.c_str());
}
JNIEXPORT jstring JNICALL
JNIEXPORT void JNICALL
Java_pr_platerecognization_PlateRecognition_ReleasePlateRecognizer(
JNIEnv *env, jobject obj,
jlong object_re) {
// std::string hello = "Hello from C++";
pr::PipelinePR *PR = (pr::PipelinePR *) object_re;
delete PR;
}
}
@@ -4,7 +4,13 @@
#include <../include/FastDeskew.h>
#include "../include/FastDeskew.h"
#include <cmath>
#include <vector>
#include <opencv2/core/types.hpp>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/opencv.hpp>
namespace pr{
@@ -67,7 +73,7 @@ namespace pr{
cv::Size size(skewPlate.cols + extend_padding ,skewPlate.rows);
float interval = abs(sin((angle /180) * 3.14)* skewPlate.rows);
float interval = std::abs(sin((angle /180) * 3.14)* skewPlate.rows);
// std::cout<<interval<<std::endl;
cv::Point2f pts1[4] = {cv::Point2f(0,0),cv::Point2f(0,size_o.height),cv::Point2f(size_o.width,0),cv::Point2f(size_o.width,size_o.height)};
@@ -2,7 +2,7 @@
// Created by 庾金科 on 22/09/2017.
//
#include "FineMapping.h"
#include "../include/FineMapping.h"
namespace pr{
const int FINEMAPPING_H = 60 ;
@@ -13,13 +13,13 @@ namespace pr {
PipelinePR::PipelinePR(std::string detector_filename,
std::string finemapping_prototxt, std::string finemapping_caffemodel,
std::string segmentation_prototxt, std::string segmentation_caffemodel,
std::string charRecognization_proto, std::string charRecognization_caffemodel,
std::string segmentationfree_proto,std::string segmentationfree_caffemodel) {
std::string charRecognization_proto, std::string charRecognization_caffemodel){
// std::string segmentationfree_proto,std::string segmentationfree_caffemodel) {
plateDetection = new PlateDetection(detector_filename);
fineMapping = new FineMapping(finemapping_prototxt, finemapping_caffemodel);
plateSegmentation = new PlateSegmentation(segmentation_prototxt, segmentation_caffemodel);
generalRecognizer = new CNNRecognizer(charRecognization_proto, charRecognization_caffemodel);
segmentationFreeRecognizer = new SegmentationFreeRecognizer(segmentationfree_proto,segmentationfree_caffemodel);
// segmentationFreeRecognizer = new SegmentationFreeRecognizer(segmentationfree_proto,segmentationfree_caffemodel);
}
@@ -29,7 +29,7 @@ namespace pr {
delete fineMapping;
delete plateSegmentation;
delete generalRecognizer;
delete segmentationFreeRecognizer;
// delete segmentationFreeRecognizer;
}
@@ -16,9 +16,10 @@ namespace pr{
void PlateDetection::plateDetectionRough(cv::Mat InputImage,std::vector<pr::PlateInfo> &plateInfos,int min_w,int max_w){
cv::Mat processImage;
cv::Mat processImage(InputImage);
// cv::Mat processImage;
cv::cvtColor(InputImage,processImage,cv::COLOR_BGR2GRAY);
// cv::cvtColor(InputImage,processImage,cv::COLOR_BGR2GRAY);
std::vector<cv::Rect> platesRegions;
@@ -68,7 +68,7 @@ namespace pr{
int w = candidatePts[5] - candidatePts[4];
int cols = plateImage.cols;
int rows = plateImage.rows;
for(int i = 0 ; i < candidatePts.size() ; i++)
for(int i = 0; i < candidatePts.size() ; i++)
{
int left = 0;
int right = 0 ;
@@ -84,8 +84,9 @@ namespace pr{
computeSafeMargin(right,cols);
computeSafeMargin(left,cols);
cv::Rect roi(left,0,right - left,rows-1);
cv::Mat roiImage;
// plateImage.copyTo(roiImage);
cv::Rect roi(left,0,right-left,rows-1);
plateImage(roi).copyTo(roiImage);
if (i>=1)
@@ -191,7 +192,8 @@ namespace pr{
}
delete filterd;
delete[] filterd;
// delete filterd;
}
void PlateSegmentation::templateMatchFinding(const cv::Mat &respones,int windowsWidth,std::pair<float,std::vector<int>> &candidatePts){
@@ -80,6 +80,7 @@ namespace pr {
}
std::string decodeResults(cv::Mat code_table,std::vector<std::string> mapping_table)
{
cv::MatSize mtsize = code_table.size;
View File
+12
View File
@@ -58,6 +58,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
}
public Button btn;
public Button recogBtn;
public TextView resbox;
public TextView runtimebox;
@@ -69,6 +70,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
private static final int REQUEST_CODE_OP = 3;
private Uri mPath;
Bitmap latestBitmap;
// public PlateRecognition pr;
@@ -261,6 +263,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
float dp_asp = dp/10.f;
imgv.setImageBitmap(bmp);
// Mat mat_src = new Mat(bmp.getWidth(), bmp.getHeight(), CvType.CV_8UC1);
Mat mat_src = new Mat(bmp.getWidth(), bmp.getHeight(), CvType.CV_8UC4);
float new_w = bmp.getWidth()*dp_asp;
@@ -290,6 +293,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
} else {
Log.i(TAG, "bmp [" + bmp.getWidth() + "," + bmp.getHeight());
}
latestBitmap = bmp;
SimpleRecog(bmp,sb.getProgress());
// startOilPainting(bmp, file);
@@ -304,6 +308,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
} else if (requestCode == REQUEST_CODE_IMAGE_CAMERA && resultCode == RESULT_OK) {
String file = getPath(mPath);
Bitmap bmp = decodeImage(file);
latestBitmap = bmp;
SimpleRecog(bmp,sb.getProgress());
// startOilPainting(bmp, file);
}
@@ -326,6 +331,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
}
btn = (Button)findViewById(R.id.button);
recogBtn = (Button)findViewById(R.id.button_recog);
imgv = (ImageView)findViewById(R.id.imageView);
resbox = (TextView)findViewById(R.id.textView);
sb = (SeekBar)findViewById(R.id.seek);
@@ -334,6 +340,7 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
initRecognizer();
btn.setOnClickListener(this);
recogBtn.setOnClickListener(this);
//
// btn.setOnClickListener(new View.OnClickListener() {
// @Override
@@ -394,6 +401,11 @@ public class MainActivity extends Activity implements AlertDialog.OnClickListene
.setItems(new String[]{"打开图片"}, this)
.show();
break;
case R.id.button_recog:
if(latestBitmap!=null){
SimpleRecog(latestBitmap,sb.getProgress());
}
break;
}
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ public class PlateRecognition {
String segmentation_prototxt,String segmentation_caffemodel,
String charRecognization_proto,String charRecognization_caffemodel);
static native long ReleasePlateRecognizer(long object);
static native void ReleasePlateRecognizer(long object);
static native String SimpleRecognization(long inputMat,long object);
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 810 KiB

@@ -20,6 +20,14 @@
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="@+id/imageView"
app:layout_constraintVertical_bias="0.62" />
<Button
android:id="@+id/button_recog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="识别"
app:layout_constraintTop_toTopOf="@id/button"
app:layout_constraintRight_toLeftOf="@id/button"
/>
<ImageView
android:id="@+id/imageView"
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 15 KiB

@@ -1,3 +1,3 @@
<resources>
<string name="app_name">PlateRecognization</string>
<string name="app_name">PrjAndroid</string>
</resources>