Ask Your Question

HDM's profile - activity

2016-10-14 07:35:28 -0600 commented answer convexHull clockwise parameter inverted ?

Yes, I assumed they meant the coordinate system used for the hull.

Thanks for the reply.

2016-10-14 07:21:33 -0600 commented answer convexHull clockwise parameter inverted ?

However the documkentation explicitly states:

The assumed coordinate system has its X axis pointing to the right, and its Y axis pointing upwards.

2016-10-14 06:53:34 -0600 asked a question convexHull clockwise parameter inverted ?

Perhaps I'm misunderstanding the 3rd parameter to convexHull ? :

clockwise - Orientation flag. If it is true, the output convex hull is oriented clockwise. Otherwise, it is oriented counter-clockwise. The assumed coordinate system has its X axis pointing to the right, and its Y axis pointing upwards.

When I run the following code:

#include <iostream>
#include <vector>

#include <opencv2/core/base.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>

int main(int argc, char **argv)
{
   std::vector<cv::Point2i> points, hull_points;
   points.push_back(cv::Point2i(114, 22));
   points.push_back(cv::Point2i(329, 245));
   points.push_back(cv::Point2i(37, 98));
   points.push_back(cv::Point2i(43, 272));
   points.push_back(cv::Point2i(120, 150));
   cv::convexHull(points, hull_points, false);
   cv::Mat img(350, 460, CV_8UC3, cv::Scalar::all(0));   
   int no = 1;
   for (auto it = hull_points.begin(); it != hull_points.end(); ++it)
   {
      cv::Point2i &pt = *it;
      cv::circle(img, pt, 3, cv::Scalar(0, 255, 0), 1, cv::LINE_AA);      
      std::stringstream ss;
      ss << no++ << ":(" << pt.x << "," << pt.y << ")";
      cv::putText(img, ss.str(), cv::Point2i(pt.x+1, pt.y-1), CV_FONT_HERSHEY_COMPLEX_SMALL, 1.0, cvScalar(0, 255, 255), 1, CV_AA);
      std::cout << ss.str() << " ";
   }
   std::cout << std::endl;
   cv::imwrite("img.png", img);      
}

I get the following image:

image description

which appears to be clockwise unless its supposed to be traversed in descending order.

2015-12-13 04:06:48 -0600 asked a question Android OpenCV Manager for 64 bit Java/NDK project problem

I have encountered an issue when testing on a 64 bit Nexus 6P.

With a project that has no NDK code the following code reports the Java process as being 64 bit:

if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M)
      {
         boolean is64 = android.os.Process.is64Bit();
         if (is64)
            Log.i(TAG, "is 64 bit");
         else
            Log.i(TAG, "is 32 bit");
      }

On a project that includes NDK code with ABI targets that are both 32 bit and 64 bit the above code reports the process as 32 bit.

In the latter case the System.load in AsyncServiceHelper throws an exception loading libopencv_java3.so:

12-12 00:08:11.563 7802 7802 W System.err: java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app/org.opencv.engine-1/lib/arm64/libopencv_java3.so" is 64-bit instead of 32-bit 12-12 00:08:11.578 7802 7802 W System.err: at org.opencv.android.AsyncServiceHelper.loadLibrary(AsyncServiceHelper.java:347) 12-12 00:08:11.578 7802 7802 W System.err: at org.opencv.android.AsyncServiceHelper.initOpenCVLibs(AsyncServiceHelper.java:373) 12-12 00:08:11.578 7802 7802 W System.err: at org.opencv.android.AsyncServiceHelper.access$000(AsyncServiceHelper.java:18) 12-12 00:08:11.578 7802 7802 W System.err: at org.opencv.android.AsyncServiceHelper$3.onServiceConnected(AsyncServiceHelper.java:300) 12-12 00:08:11.579 7802 7802 D OpenCVManager/Helper: First attempt to load libs fails 12-12 00:08:11.579 7802 7802 D OpenCVManager/Helper: Init finished with status 255