Ask Your Question

nakano's profile - activity

2018-12-30 14:29:42 -0500 received badge  Popular Question (source)
2018-08-09 04:00:53 -0500 received badge  Notable Question (source)
2016-10-12 15:02:14 -0500 received badge  Popular Question (source)
2016-06-21 08:55:27 -0500 received badge  Popular Question (source)
2015-05-29 05:00:46 -0500 received badge  Famous Question (source)
2014-11-19 04:01:53 -0500 received badge  Famous Question (source)
2014-08-21 08:10:39 -0500 received badge  Notable Question (source)
2014-06-11 10:00:57 -0500 received badge  Notable Question (source)
2014-05-11 05:32:02 -0500 received badge  Popular Question (source)
2014-05-09 09:03:42 -0500 received badge  Popular Question (source)
2013-11-20 01:37:58 -0500 commented answer trouble launching app with opencv 2.4.7 on IOS

Thank you for your answer.

as my target deployment is set to 5.1, is it OK to set minimum target to iOS6.0? I mean, minimum target to iOS6.0 concern the Base SDK or the deployment target?

I've tried to download the openCV2.4.6.1 for linux and mac, edit the python file for ios but when launching the python command I get an error saying that an error occured due to unexpected indentation (I've copy/paste the 2 lines from your url).

Furthermore I guess also an error when trying to compile the original file (sh: cake: command not found).

I launched the python file from the platform/ios folder.

Could you please tell me what I did wrong?

2013-11-13 01:27:25 -0500 asked a question memory issue with iOS7

Hello everyone,

I'm following another post about iOS7 issue ( which has no answer so far.

I've made some test even with the openCV 2.4.7 and the trouble still appearing on iOS7 only.

the memory issue start appearing using cvvideocamera when I use the stop and start function for the 5 times.

In my application I have 2 UIViewController. The first one is using cvvideoCamera which is stop only when the view disappear ( present the second view controller) and start cvvideoCamera when my view controller is appearing.

My second view controller is using AR with the metaio SDK.

the trouble appears when I return from the AR view controller for the 5th times. From this point my application become more and more slow for loading the AR screen and return to the cvvideoCamera view controller. Generally during the 7th times I have to kill my application.

This trouble only happen with iOS7 device.

Is there any workaround to fix the memory issue? I still don't understand why this trouble only appears on iOS7 only.

Furthermore why the cvvideoCamera is re creating from scratch when I call the start method?

Could you please tell me if this error is a known issue? can something be done?

I really thank you for your help

2013-11-13 01:14:05 -0500 asked a question trouble launching app with opencv 2.4.7 on IOS

Hello everyone,

I've just downloaded the openCV 2.4.7 for iOS and when I try to launch my application, it crash during application launch if the iOS version is 6.X (works fine on iOS7).

Here is the error I get when I try to launch it using iOS6.X :

dyld: lazy symbol binding failed: Symbol not found: ___sincos_stret Referenced from: /var/mobile/Applications/49869F6C-A31E-4A14-BF09-344150448E78/ Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: ___sincos_stret Referenced from: /var/mobile/Applications/49869F6C-A31E-4A14-BF09-344150448E78/ Expected in: /usr/lib/libSystem.B.dylib

I've seen some post on the internet about this kind of error but none of them fix my issue. I'm using the last Xcode version (5.0.2).

Could you please tell me how can I fix this issue?

I really thank you for your help

2013-10-24 01:27:36 -0500 commented question CvVideoCamera on iOS7

I'm also facing memory issue with iOS7.

Following the image detection, I'm calling [videoCamera stop]; when I detect an image then [videoCamera start]; if something when wrong during the retrieving image process on the main thread but the more I use stop and start function, the more my application become slow until my camera stop moving :S

Furthermore due to iOS7 I'm getting 4 warning when calling [videoCamera start] function due to deprecated method which are :

AVCaptureConnection - isVideoMinFrameDurationSupported

AVCaptureConnection - setVideoMinFrameDuration:

AVCaptureConnection - isVideoMaxFrameDurationSupported

AVCaptureConnection - setVideoMaxFrameDuration:

is something can be done for not getting CvVideoCamera slow?

2013-10-06 20:21:30 -0500 commented answer copy part of a image Mat to another one

I'm trying to do it this way (not drawing in the original image directly) because when I do it this way, I can set any color the result will be always the same : the filled color is always white.

I think that thanks to tutorial my method until findContour() should be fine but the next part of my code (detecting edge) may be wrong/ not correct which explain that my filled color is always white.

I've heard in another thread I made someone talking about dilate and convexHull method but I don't get how to use it (I've already saw the referential page), I guess I'll take more time for studying these method and search the best way for detecting image contour.

2013-10-04 00:31:44 -0500 commented answer copy part of a image Mat to another one

Thank you for your reply.

I think I'm pretty close but the result isn't as expected. When I launch my application my CV_UC3 image overlap my original image without doing any mask (I'm still seeing a full black screen with my filled rectangle).

Here is my source code:

Mat original_image = originalMat.clone(); //originalMatis the Mat image received from OpenCV Video Camera Manager

Mat drawing = Mat::zeros( original_image.size(), CV_8UC3 );//draw contours of my rectangle in red

drawContours( drawing, contours, maxAreaIdx, Scalar(255), -1, 8, hierarchy, 0, cv::Point() );

Mat mask_image( original_image.size(), CV_8U, Scalar(0));

drawContours(mask_image, contours, maxAreaIdx, Scalar(255), CV_FILLED);

drawing.copyTo(original_image, mask_image);

//display original_image

2013-10-03 11:23:02 -0500 received badge  Student (source)
2013-10-03 04:06:25 -0500 commented answer best way for detecting contour


Thank you for your comment :) I didn't tried to launch your code yet but as I can seen, you're drawing all rectangle in a black screen right? (due to CV_8U1). Isn't it possible to draw these rectangle in a mat image from the camera mat image? So far I can display a black screen with a colored rectangle followinf this url ( but now I don't know how to show the colored rectangle in my camera mat image :S

In any case I'll study your source code ^-^ again thank you for your help :)

2013-10-03 01:19:16 -0500 asked a question copy part of a image Mat to another one


Using the source code from this link ( I have a CV_8UC3 mat with which contain a black background and the contour of my image (I've filled the contour using CV_FILLED parameter).

I would like to know it is it possible to copy/insert only the contour from my CV_8UC3 mat to the original image? (both image have the same size).

I've searched on the internet and tried function like copyTo(), ROI but without success.

I really thank you for your help

2013-10-02 21:43:21 -0500 commented answer best way for detecting contour

I've tested both original code and the code in the link but in the findBlobs function my blob size is always 0.

(I've converted my Mat image to a binary image using the answer in the post : )

Here is the findBlob function:


cv::Mat label_image; binary.convertTo(label_image, CV_32SC1);

int label_count = 2;

for(int y=0; y < label_image.rows; y++) {

int row = (int)label_image.ptr(y);

for(int x=0; x < label_image.cols; x++) {

if(row[x] != 1) continue;

cv::Rect rect; cv::floodFill(label_image, cv::Point(x,y), label_count, &rect, 0, 0, 4);




when I called this function I never enter to the part cv::floodFill(); with the blobs.push_back(blob)

2013-10-02 20:13:00 -0500 commented answer best way for detecting contour


Thank you for your help

In fact I found code source for finding contour but this code isn't correct and clean. As you can in the link of my previous post where I post the source code I'm using one told me I had error on almost every line and that may be the reason I fail to fill correctly the contour of a square.

In any case I'll check the link you gave.

If it doesn't bother you, could you please explain me/ show me the good way to detect contour?

2013-10-01 01:49:01 -0500 asked a question change orientation

Hello everyone,

I know a lot of post have been created for changing the orientation camera to portrait (especially this post : but I failed to find the right method for the workaround (run() method in the class).

I've tried to change the camera orientation from the class but when I launch the application I get an alert view saying the camera cannot be used.

As I have to display some picture in portrait only I have to change the camera view to portrait too.

Could you please tell me how to proceed for changing the camera view to portait mode with the 2.4.6 version?

I really thank you in advance for your help

2013-09-30 20:42:05 -0500 asked a question best way for detecting contour

Hello Everyone,

I have some trouble for detecting correctly contour of a square image and fill it with a specific color.

I've started to explain a little in a previous post ( but it's better I explain in more detail in this specific post.

First, I prefer to tell you now that for me openCV is really a powerful framework but it's also really hard for me to use it. So far I've used and tried to adapt source code of other person which explain that my current source code isn't clean (which result of a strange behavior for what I'm trying to do) so please explain me in detail :)

What I'm trying to do is to used cvVideoCamera on iOS (I also have to do it on Android but I'll be able to do it by adapting the iOS version on my own) and detecting square image (my image is embedded in a black rectangle). once I've detected the square I would like to fill this rectangle (so in any case I have to use the function drawContours and use CV_FILLED parameter) in a specific color with an alpha for letting the user be able to still see the image behind my drawing rectangle.

The purpose of the function is to show a rectangle on a detected square until I have a match with a reference image.

I've already done the function for testing if I have a match with my reference image (I guess this function is not clean too...) but I don't understand what I can do in order to achieve the function explained above.

I've heard about dilate and convexHull function but I don't know/understand what I need and how to proceed to achieve it.

Could you please explain/ show me how to do it?

I really thank you for your help

2013-09-30 03:15:27 -0500 commented answer fill contour with drawContours

if It doesn't bother you, could you please show me/explain me how to do it properly? I don't really understand what are the step for detecting properly a rectangle and fill its contents with a specific color ;(

2013-09-30 03:12:13 -0500 commented answer fill contour with drawContours

I really thank you for your comment. I think openCV is really useful and powerful but to be honest I don't really understand how to use it properly :S so far I've almost always took function/ part of source code for other which did the same I'm trying to do so I guess the more I use function of other people the more my source code is not "clean".

In fact what I'm trying to do is: I have a reference image I have to detect when the user is using the camera. the function I'm trying to do is to display a red rectangle with an alpha (in order for the user to be able to see what there is in the rectangle) when a rectangle is detected. Once I have a match between my reference image and the image on the camera, I ... (more)

2013-09-30 01:45:46 -0500 commented answer fill contour with drawContours

I didn't had enough space for writing all I wanted so I continue here :) imgSource and targetMat are both a copy of the original Mat from the ProcessImage (called by video camera manager) Here is the code for copying the original image (my trouble came from here?) cv::Mat targetMat;

cv::cvtColor(originalMat, targetMat, CV_BGRA2RGBA);

cv::Mat imgSource;

cv::cvtColor(originalMat, imgSource, CV_BGRA2RGBA);

I'm using imgSource for getting contours and I display the result in the targetMat

I've tried using rectangle function this morning but due to the image perspective, my rectangle doesn't fill the image contour.

Could you please tell me what I did wrong? PS: just before displaying the Mat image i've inverted color using cv::cvtColor(result, image, CV_BGRA2RGBA);

2013-09-30 01:37:29 -0500 commented answer fill contour with drawContours

thank you for your reply. I don't think I can use the rectangle function due to the perspective of my rectangle, I get the contour of my image using findContours function. Maybe I did something wrong for filling what is inside the contour:

cv::cvtColor(imgSource, imgSource, CV_BGRA2GRAY);

cv::Canny(imgSource, imgSource, 50, 50);

cv::GaussianBlur(imgSource, imgSource, cv::Size(5,5), 5);

std::vector<std::vector<cv::Point> > contours;

cv::findContours(imgSource, contours, cv::RETR_LIST, cv::CHAIN_APPROX_SIMPLE);

double maxArea = -1;int maxAreaIdx = -1;

std::vector<cv::Point> temp_contour = contours[0];//the largest is at the index 0 for starting point

//get largest contour [...]

cv::drawContours(targetMat, contours, maxAreaIdx, cv::Scalar(255,0,0),CV_FILLED);

2013-09-29 21:48:10 -0500 asked a question fill contour with drawContours


I have a question concerning the drawContours function.

I've searched on the internet and on the openCV forum but without any success.

What I'm looking for is when I have a square contour, fill the inside of this contour using a specific color.

So far when I draw the contour, the border is red and the inside is filled with white :

cv::drawContours(targetMat, contours, maxAreaIdx, cv::Scalar(255,0,0),CV_FILLED);

What can I do for filling the inside with a specific color (if possible using RGBA)?

I've tried using cvRectangle function but I don't know how to convert a cv::Mat to CVArr (I'm not sure this function will help btw).

I really thank you for your help

2013-09-26 05:02:57 -0500 received badge  Scholar (source)
2013-09-26 05:02:50 -0500 commented answer openCVManager on android

I've checked another post for the same trouble ( and I figured out what was wrong :). I just had to replace OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_5, this, mLoaderCallback) by mLoaderCallback.onManagerConnected(LoaderCallbackInterface.SUCCESS);

Now everything works fine :) thank you for your help ^-^

2013-09-26 04:04:00 -0500 commented answer openCVManager on android

after relaunching the application, I received more information in the logcat. Below are the trouble :

dalvikvm(3983): Could not find class '', referenced from method

VFY: unable to resolve new-instance 60 (Landroid/graphics/SurfaceTexture;) in Lorg/opencv/android/JavaCameraView;

VFY: replacing opcode 0x22 at 0x0282

VFY: dead code 0x0284-0297 in Lorg/opencv/android/JavaCameraView;.initializeCamera (II)Z

2013-09-26 03:55:38 -0500 commented answer openCVManager on android

Thank you, I've forgotten to remove these 2 parts^^' .

However when I launch my application I have a full black screen. As I don't have any jni part, I suppose I don't have to create a jni folder and add the file?

In my logcat, I only have 3 lines :

CameraBridge(3810): Attr count: 6

CameraBridge(3810): Attr count: 6

CameraBridge(3810): call surfaceChanged event

Could you please tell me what's wrong?

2013-09-26 03:40:02 -0500 commented answer openCVManager on android


Thank you for your message :) It looks like I'm looking for static initialization but after doing the 4 steps, when I launch my application I'm still asking to download the openCVManager (I'm using openCV SDK 2.4.5). What I've done so far is:

1- import openCV Library - 2.4.5

2- In my project, I've added the openCV Library <my project>/properties/Android and add the library

3- as My project doesn't have jni part, I've copied all folder from <openCV Library 2.4.5>/sdk/native/libs to <my project>/libs

4- In my activity, I've added static { OpenCVLoader.initDebug() }

Am I missing something? Could you please tell me what I've done wrong/forget?

2013-09-26 03:07:39 -0500 asked a question openCVManager on android


I have a question concerning openCVManager.

So far when I launch a sample or launch my own project, I always have to download the application "openCVManager".

Due to the project manager in my company, my application must not need to download another application for working :S

As a result I would like to know if it is possible to launch openCV without having to download the openCVManager application?

I really thank you in advance for your help

2013-09-18 21:20:16 -0500 commented answer cannot run sample on Android

Thank you for your answer :) I've downloaded the 2.4.5 SDK and it still didn't works with the last openCVManager (v2.10) so I uninstalled the latest openCVManager and install an old one using the right apk.

What I would like to know now is, is there a way from an application, let's say tutorial1 to check if the openCVManager have been installed or not and if not find the right apk to install. Saying differently, from an application, can we automatically install openCVManager from an apk stored in the application raw folder in order to user to not go to the google play for downloading the last version?