Ask Your Question

renV's profile - activity

2017-05-09 06:58:15 -0600 commented question Findcontours() deallocation error

no I am testing with both, console application and CLR class library project. I am using Visual Studio 2015. Okey I am going to try in a new project.

2017-05-09 06:25:22 -0600 commented question Findcontours() deallocation error

@berak I guess we found the difference. I am using opencv version 2.4.12 but you are using 3.2

2017-05-09 06:03:27 -0600 commented question Findcontours() deallocation error

can you try with delete vector pre-allocations and use these input images;

http://imgur.com/a/yAClR

http://imgur.com/a/yAClR

2017-05-09 05:47:44 -0600 commented question Findcontours() deallocation error

@berak can you check my question again ? I updated the post

2017-05-08 05:17:11 -0600 commented question Findcontours() deallocation error

I checked my linker settings and it has already fine, I know that pre-allocate of those vectors is not professional practise but before I make this, I get more exceptions. Most probably my exception related with vector size or elements. but I couldn't detect.

2017-05-08 03:23:47 -0600 asked a question Findcontours() deallocation error

I am using a function like this;

Mat large = imread(path+name);
Mat rgb;
if (large.rows > 2500 || large.cols > 1250)
{
    pyrDown(large, rgb);
}
else
{
    rgb = large.clone();
}
cv::Mat smallx;
cvtColor(rgb, smallx, CV_BGR2GRAY);
Mat grad,connected,bw;

Mat morphKernel = getStructuringElement(MORPH_ELLIPSE, Size(3, 3));
cv::morphologyEx(smallx, grad, MORPH_GRADIENT, morphKernel);
cv::threshold(grad, bw, 100, 255, THRESH_BINARY + THRESH_OTSU);
morphKernel = getStructuringElement(MORPH_RECT, Size(9, 1));
cv::morphologyEx(bw, connected, MORPH_CLOSE, morphKernel);

Mat mask = Mat::zeros(bw.size(), CV_8UC1);
vector<vector<Point>> contours(50000);
vector<Vec4i> hierarchy(50000);

cv::findContours(connected, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

Some input images prompt exception when function returns, it throws me to "_Mybase::deallocate(_Ptr, _Count);" code block in xmemory0 class. I must catch this kind of errors and prevent this process from unexpected suspensions

--------------UPDATE--------------

After my debug, I found that exception thrown by

cv::findContours(connected, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

statement. --------------UPDATE2-------------- I tried that code block with 30 different input but it gave error in a few image. after findcontours it thrown an exception break and show me this message.

Unhandled exception at 0x74477fb2 (ucrtbase.dll) in ImageRecognizer.exe: 0xC0000409: 0xc0000409.

in that time , "vector" class opening in my Visual Studio with these lines ;

~vector() _NOEXCEPT
    {   // destroy the object
    _Tidy();
    }

or "xmemory" class opening with these lines;

void deallocate(pointer _Ptr, size_type _Count)
    {   // deallocate object at _Ptr, ignore size
    _Mybase::deallocate(_Ptr, _Count);
    }
2017-04-17 05:36:10 -0600 asked a question Exception in xmemory _Mybase::deallocate(_Ptr, _Count);

This is my function. It has memory error after finis process at return statememt in some inputs.

    Mat large = imread(path);
Mat rgb;

pyrDown(large, rgb);

Mat small;
cvtColor(rgb, small, CV_BGR2GRAY);

Mat grad;
Mat morphKernel = getStructuringElement(MORPH_ELLIPSE, Size(3, 3));
morphologyEx(small, grad, MORPH_GRADIENT, morphKernel);

Mat bw;
threshold(grad, bw, 0.0, 255.0, THRESH_BINARY | THRESH_OTSU);

Mat connected;
morphKernel = getStructuringElement(MORPH_RECT, Size(9, 1));
morphologyEx(bw, connected, MORPH_CLOSE, morphKernel);

Mat mask = Mat::zeros(bw.size(), CV_8UC1);
vector<vector<Point>> contours;
vector<Vec4i> hierarchy;
findContours(connected, contours, hierarchy, CV_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));


int counter = 0;
std::string coordinates = "";


for (int idx = 0; idx >= 0; idx = hierarchy[idx][0])
{   
    Rect rect = boundingRect(contours[idx]);


    Mat maskROI(mask, rect);
    maskROI = Scalar(0, 0, 0);

    drawContours(mask, contours, idx, Scalar(255, 255, 255), CV_FILLED);

    double r = (double)countNonZero(maskROI) / (rect.width*rect.height);

    if (r > .45  && (rect.height > 8 && rect.width > 8) )
    {
        rectangle(rgb, rect, Scalar(0, 255, 0), 1);
        coordinates = coordinates + (std::to_string(counter) + "," + std::to_string(rect.x) + ", " + std::to_string(rect.y) + ", " + std::to_string(rect.width) + ", " + std::to_string(rect.height) + "#");

        string disp =  std::to_string(rect.x) + ", " + std::to_string(rect.y) +  ", " + std::to_string(rect.width) + ", "  + std::to_string(rect.height);
        cv::putText(rgb, disp, Point(rect.x, rect.y), FONT_HERSHEY_SIMPLEX,0.35, Scalar(0, 0, 0),1);            
        counter++;
    }
}
return coordinates;
2017-01-23 07:03:47 -0600 commented question sift and surf in opencv 3.2

is it in release mode ?

2017-01-23 06:22:26 -0600 commented question sift and surf in opencv 3.2

it seems like linker error. which version of visual studio you use ?

2017-01-23 05:24:56 -0600 commented question sift and surf in opencv 3.2

Please post the error message

2017-01-20 00:59:03 -0600 received badge  Enthusiast
2017-01-19 09:22:16 -0600 commented question OpenCV 2.4.12 dependencies

StevenPuttemans, I made same steps without opencv. I developed dll project (C++/CLR) than used it in ASP.NET MVC project than published it locally. It is working each computer. But when I add opencv again, it give that dll dependency error. It is weird I don't know what to do.

2017-01-19 02:48:19 -0600 commented question OpenCV 2.4.12 dependencies

Error message is ; Could not load file or assembly 'MyOpenCV.DLL' or one of its dependencies. The specified module could not be found

If you need details; I post my problem there "http://stackoverflow.com/questions/41258788/could-not-load-file-or-assembly-myclr-dll-or-one-of-its-dependencies-the-spec"

2017-01-19 02:25:22 -0600 commented question OpenCV 2.4.12 dependencies

LBerger it is exactly opencv problem. If we don't know, what opencv need, how can we integrate our works to others?

2017-01-19 02:18:18 -0600 commented question OpenCV 2.4.12 dependencies

I used dependency walker, I tried my project with 3 different computer;

  • First one is my own computer ( I developed project in mine) it is working
  • In second one I add local published project and it is working in this computer
  • Third one I tried but it gave "Could not load file or assembly 'myDll.DLL' or one of its dependencies"

I was run dependency walker in all computers and checked differences between results. Results was very strange,

  1. All of them has missed dlls API-MS-WIN-.dll and EXT-MS-WIN-.dll's.All of them also missed
  2. Third one (not worked) has some missing dlls like ;
  • EXT-MS-WIN*.'s
  • API-MS-WIN-*.DLL's
  • DEVICELOCKHELPERS.DLL

And these below dlls has warning; - EMCLIENT.DLL - KERNEL32.DLL - MSVCRT.DLL - NTDLL.DLL
- OLE32.DLL

2017-01-19 01:50:42 -0600 received badge  Scholar (source)
2017-01-19 01:43:43 -0600 asked a question OpenCV 2.4.12 dependencies

I used opencv 2.4.12 for develop a dll project. I am using that dll with an http://ASP.NET MVC project. When i try to use this http://asp.net mvc project in other machines, My dll give dependency error. it is working mine an one other computer but it is not working some other computers, All computers I used have mostly same configurations;

  • Windows 10
  • 64 Bit
  • IIS Manager 10.

Question is, which redistributables I need to check and which system components(System32 dlls) opencv2.4.12 needs ?

2017-01-19 01:38:08 -0600 commented question imencode() buffer exception

Thanks for your reply LBerger. your first bad idea solved my problem. I will upgrade my project to opencv3.2 as soon as possible for more clear solution.

2017-01-13 15:41:03 -0600 commented question imencode() buffer exception

Firstly thanks for your reply LBerger. Checked what you said. Small image size : [86 x 39] Channel : 1 it is working with this image Large image size . [194 x 180] Channel : 1 it has gave exception with this and larger images All dll's imported for release mode i checked again with your advice

When project give exception it's showing from Microsoft Visual Studio 14.0\VC\include\vector's this line;

        this->_Getal().deallocate(this->_Myfirst(),
2017-01-13 09:43:41 -0600 received badge  Organizer (source)
2017-01-13 08:54:17 -0600 received badge  Editor (source)
2017-01-13 08:53:48 -0600 asked a question imencode() buffer exception

I am using these codes for encode Mat image to .jpg format. It is working with small images, but when I put a large image, project give exception

Unhandled exception at 0x76377fb2 (ucrtbase.dll) in ImageRecognition.exe: 0xC0000409: 0xc0000409.

I am using opencv2.4.12 in Visual Studio 2015 and my OS is Windows 10 here is my code block.

cv::threshold(image, image, 100, 255, cv::THRESH_BINARY + cv::THRESH_OTSU);
std::vector<uchar> buf;
imencode(".jpg", image, buf);
2017-01-12 01:55:15 -0600 commented question Deploying a asp.net website containing a managed C++/Cli DLL that is using OpenCV Libraries

It is exactly an OpenCV issue. When you try to do same thing without opencv it works properly. But with opencv it couldn't. I faced with same problem.