请帮我,
Android上的Convex Hull有问题.我使用Java和OpenCV 2.3.
在我使用Java之前,我使用Visual Studio 2008在C++上创建它.
此代码可以在C++上成功运行.
现在,我想在Android上将它从C++转换为Java.当我在SDK Android模拟器上运行它时,我发现了像"强制关闭"这样的错误.
这是我在C++上的代码:
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
findContours( canny_output, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
drawing = Mat::zeros( canny_output.size(), CV_64F );
/// Find the convex hull object for each contour
vector<vector<Point> > hull ( contours.size() );
for( int i = 0; i < contours.size(); i++ )
{ convexHull( Mat(contours[i]), hull[i], false );
}
for(size_t i = 0; i < contours.size(); i++){
drawContours( drawing, hull, i, Scalar(255, 255, 255), …Run Code Online (Sandbox Code Playgroud) 大家请帮帮我 我有个问题。我从图像进行凸包检测。
然后,我有一个问题要在ConvexHull边界内的区域上填充颜色。
是否有人可以帮助我在ConvexHull边界内的区域填充颜色?
请帮助我实现源代码。
我使用的是OpenCV 2.3。
这是一个源代码:
#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
Mat src; Mat src_gray;
int thresh = 240;
int max_thresh = 255;
RNG rng(12345);
/// Function header
void thresh_callback(int, void* );
/** @function main */
int main( int argc, char** argv )
{
/// Load source image and convert it to gray
src = imread( "kubis1.jpg", 1 );
/// Convert image to gray and …Run Code Online (Sandbox Code Playgroud)