我是OpenCV的初学者.我正在尝试使用OpenCV模板匹配来做一个示例Android应用程序来匹配给定图像中的模板图像.我在互联网上搜索,找不到符合我要求的合适的android或java代码.但我有C++代码.我不知道如何翻译它. http://docs.opencv.org/doc/tutorials/imgproc/histograms/template_matching/template_matching.html
你能帮我找一个合适的java或android代码吗?或者请帮我把这个C++代码翻译成java,我可以在android应用程序中使用它.
先感谢您.
C++代码
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
/// Global Variables
Mat img; Mat templ; Mat result;
char* image_window = "Source Image";
char* result_window = "Result window";
int match_method;
int max_Trackbar = 5;
/// Function Headers
void MatchingMethod( int, void* );
/** @function main */
int main( int argc, char** argv )
{
/// Load image and template
img = imread( argv[1], 1 );
templ = imread( argv[2], 1 …Run Code Online (Sandbox Code Playgroud) 嗨,我是Android和图像加密的新手.我的情况是这样的,
(请参阅我已经使用的所有需要方法的底部..)
但是我得到了javax.crypto.BadPaddingException:解密时pad块被破坏了.我读了一些关于这个例外的文章,但都是关于文本加密的.你能帮我避免这个吗?先感谢您
Image Encrption使用...
private byte[] encrypt(byte[] raw, byte[] clear) throws Exception
{
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(clear);
return encrypted;
}
Run Code Online (Sandbox Code Playgroud)
在这里我也保存了其他几张图片,所有图像都成功保存在SD卡中...
for (int i = 0; i < imageUrls.size(); i++)
{
File file = new File(imageUrls.get(i));
String metapath = CommonUtils.getDataFromPreferences("metaPath", "");
Log.d("metapath", metapath);
String extStorageDirectory = metapath + file.getName();
File wallpaperDirectory = new File(extStorageDirectory);
if (!wallpaperDirectory.exists() || wallpaperDirectory.length() == 0)
{
new DownloadImagesTask() …Run Code Online (Sandbox Code Playgroud)