Ask Your Question

manmedia's profile - activity

2019-06-06 13:29:15 -0500 received badge  Famous Question (source)
2017-10-26 03:35:49 -0500 received badge  Notable Question (source)
2017-06-12 12:14:36 -0500 received badge  Taxonomist
2017-06-08 09:57:08 -0500 received badge  Popular Question (source)
2017-04-18 01:49:11 -0500 received badge  Notable Question (source)
2016-11-11 05:58:20 -0500 received badge  Famous Question (source)
2016-05-31 16:59:36 -0500 received badge  Popular Question (source)
2015-09-02 01:11:49 -0500 received badge  Famous Question (source)
2015-07-14 12:53:46 -0500 received badge  Nice Question (source)
2015-05-28 10:18:25 -0500 received badge  Famous Question (source)
2015-04-01 08:05:57 -0500 received badge  Notable Question (source)
2015-02-05 00:03:03 -0500 received badge  Popular Question (source)
2014-12-09 13:45:31 -0500 marked best answer Cannot Do Anything With OpenCV Anymore on Windows 7 64-bit

Hi,

I have tried to work with OpenCV 2.2, 2.3, 2.4.0, 2.4.2 and none of them gave my any luck at all. I have Windows 7 64-bit installed in my i5 machine with L3 cache, 8 GB RAM, and 500 GB Hard Drive. I do this to integrate OpenCV:

1) Download the stable version from http://www.sourceforge.net

2) Download CMake 2.8

3) Add C:\OpenCV\build\x86\vc10\bin folder to SYSTEM PATH.

4) Make OpenCV files in a folder called "vs2010build" in OpenCV installation folder.

5) Open the opencv solution in "vs2010build" folder and then build all the libraries again.

When I am at step 5. My windows become really and phenomenally slow like the a browser window, file explorer window, or even the simply volume control menu in the task bar takes nearly a minute to pop-up. Ironically, it is only with OpenCV and no other Visual C++ Express 2010 solution or project will cause this mess! The problem was the same when I tried to install with Code::Blocks IDE and MingGW compiler.

I have been trying to draw attention to people of OpenCV community to actually investigate whether or not they have the same problem and if no, how do you go about doing it. People simply point me towards the OpenCV's own website but I am finding it really misleading. I want a solution to this problem by people who actually did it themselves rather than blinding pointing me towards OpenCV's installation guideline (outdated anyway). Most importantly, some of the important documentations and guidelines are not even quality controlled i.e. no feedbacks or productive comments that it actually does or doesn't work!

I have been following posts from <answers.opencv.org>, <code.opencv.org>, <www.stackoverflow.com>, and other possible Google Search Results but no one is addressing this issue. This is really serious for me I cannot work because of this problem now! I would really appreciate if someone can verify what I am talking about. Most importantly, I would be grateful if someone has pretty much the same setup of Visual Studio/Visual C++ Express 2010, OpenCV, and Windows 7 64-bit as mine, but DO NOT HAVE THIS PROBLEM!!! PLEASE I NEED HELP!!!

N.B. I believe pointing to x86 library files is correct because my Visual C++ Express 2010 ACTUALLY gets registered in the process list as a 32-bit application running on Windows 7 64-bit. However, I changed it also to x64 library files but SAME RESULT!!! JUST SO YOU KNOW THAT WE ALL ARE GOOD PEOPLE TRYING TO SORT OUT ERRORS/FAILURES/BUGS by considering any/every possible combination of solutions.

Just to tell you what I am on about, If you have OpenCV and Windows 7 64-bit, take my source code (below) and use it to build a simple project and see if your PC is dying slowly.

 #include <opencv2/core/core.hpp>
 #include <opencv2/highgui/highgui ...
(more)
2014-07-29 07:53:35 -0500 received badge  Notable Question (source)
2014-07-29 06:58:05 -0500 received badge  Popular Question (source)
2014-05-13 07:41:47 -0500 marked best answer different step size output for cv::Mat::step1

Hi,

I am trying to understand why row and column cv::Mat objects have different outputs for when step1() is invoked. For Example, if I declare matrices and do the following:

cv::Mat rowMatrix(cv::Mat::ones(1,4,CV_8UC1)); // 1x4 matrix
cv::Mat columnMatrix(cv::Mat::ones(4,1,CV_8UC1)); //4x1 matrix

// knowing beforehand that the matrices have continous data
rowMatrix.step1() // outputs 4
columnMatrix.step1() // outputs 1

I got this problem when I was iterating through elements of my row matrix and tried to do some manipulation operation. I got an exception which was not supposed to happen. But that is when I found the disparity between my expected and received value of rowMatrix.step1(). I wonder why it was like that. If I was to do this:

rowMatrix = cv::Mat(rowMatrix.t().col(0));
rowMatrix.step1();

It reveals 1 which is what I wanted originally. Could anyone explain how this is working? Because the manual seems to be saying something different here http://docs.opencv.org/2.4.3rc/modules/core/doc/basic_structures.html#mat-step1

I will try and find the source code and walk through it! But in case anyone has better understanding of it, please suggest an explanation.

2014-04-07 11:03:14 -0500 marked best answer cv::reduce gives unsupported format exception

Hello,

I have been trying to use cv::reduce to get row and column projection sums for my image processing operations. However, I am getting an exception about unsupported format for source and destination matrices. My source-code (dev. stage) is given below


    #include "iostream"
    #include "cmath"
    #include "opencv2/core/core.hpp"
    #include "typeinfo"

using namespace std;

int main() {

cv::Mat rt(cv::Mat::ones(5,5,CV_8UC1));
cv::Mat gg(cv::Mat::zeros::(1,5,CV_8UC1));
cv::reduce(rt,gg,0,0, -1);
return 0;

}

I don't know what is wrong with it!! I have got all the necessary libraries and path setup, otherwise it won't even compile, link, or run. But it is throwing an exception. Could someone educate me or point me to the right direction.

2014-03-13 02:58:48 -0500 received badge  Popular Question (source)
2013-10-23 11:52:57 -0500 received badge  Notable Question (source)
2013-04-22 00:00:52 -0500 received badge  Popular Question (source)
2013-03-01 06:46:31 -0500 answered a question Opencv fails to allocate memory

Solved this problem now!!!!

The issue is that my algorithm was relying on an image stabiliser that used some offsets to summarise to detect velocity and indicate whether or not the camera has moved. This stabiliser outputs were a bit sluggish and led to this problem (don't want to explain much details).

I solved it by using a flag that would stop allocating any memory when the camera is in motion. Was tricky to find it though!!

2013-03-01 01:50:09 -0500 asked a question Correct way of cropping an IplImage

I have a set of mask images that I need to use everytime I recognise a previously-known scene on my camera. All the mask images are in IplImage format. There will be instances where, for example, the camera has panned to a slightly different but nearby location. this means that if I do a template matching somewhere in the middle of the current scene, I will be able to recognise the scene with some amount of shift of the template in this scene. All I need to do is use those shifts to adjust the mask image ROIs so that they can be overlayed appropriately based on the template-matching. I know that there are functions such as:

cvSetImageROI(Iplimage* img, CvRect roi)
cvResetImageROI(IplImage* img);

Which I can use to set crop/uncrop my image. However, it didn't work for me quit the way I expected. I would really appreciate if someone could suggest an alternative or what I am doing wrong, or even what I haven't thought of!

2013-02-17 02:41:58 -0500 commented answer Opencv fails to allocate memory

I am certain that the OpenCV uses its own malloc wrapper to allocate memory and probably uses a wrapper for free (alloc.cpp file in modules)...isn't there any way to ask OpenCV allocate more memory :(

2013-02-04 11:47:49 -0500 answered a question Opencv fails to allocate memory

__Solved this problem (temporarily) by doing the following:__

I was saving 4 IplImage* images each of size 288h x 352w. But what I wasn't doing before is releasing (clearing) the images in my currentSceneObject once I save them. The trick was to save and load - but not to __HOLD__ it for long. However, that only helps me in short run when I am saving my history images under Long, Short, and Not-Allowed cateogories whereas there are total 6 categories (Long, Long_New, Short, Short_New, Not_Allowed, Not_Allowed_New). However, I think if I manage to convince my tech. lead to stop using pointer references for masks and use values in, e.g. cv::Mat types, it will be better and more efficient.

One key thing is NOT to mix up C and C++ codes in OpenCV. Some stuff are better buried under and unearthing them simply makes life painful. And if possible, minimise usage of pointers in your designs and use __ONLY__ if you have no choice.

2013-02-04 04:54:25 -0500 commented answer Opencv fails to allocate memory

@sammy I agree with your comment where you mentioned about keeping it for C++ rather than C and C++ mixed. However, buying a server will probably not be in my control (or I might get fired!). I am struggling because the legacy code cannot be changed! And even after clearing all the images, it still gives me errors...aaargh....don't know!!

2013-02-03 10:50:24 -0500 commented answer Opencv fails to allocate memory

@sammy thanks for your answer but this is unfortunately not a solution. I need to store those images and I have a routine that makes sure that images are stored only ocassionally, not all the time. For example, i have a flag called "ImageSaved" and it only stores those images when the flag is true. Once I save them, I don't store them anymore. Additionally, every time a set of images are stored in the vector, previous images are cleared from it beforehand so that this problem can be avoided. However, it seems that I am running out of memory anyway. Unfortunately, the design specification is to store those images anyway. I hope you understand why I am suffering now.

2013-02-01 09:54:35 -0500 asked a question Opencv fails to allocate memory

Hello,

In part of my code I am doing this!

// LONG_HIST, etc. are pre-defined
// getHistoryLong() etc. return IplImage*
myMasks.clear(); // Clear so that we only have one set at a time.
myMasks.push_back(std::make_pair<int, IplImage>(LONG_HIST, *cvCloneImage(repmo.getHistoryLong())));
myMasks.push_back(std::make_pair<int, IplImage>(LONG_HIST_NEW, *cvCloneImage(repmo.getHistoryLong())));
myMasks.push_back(std::make_pair<int, IplImage>(SHORT_HIST, *cvCloneImage(repmo.getHistoryLong())));

My image processing application is such that when I detect a certain event, I store the mask information of my current scene using a method called updateMasks() which, in essence, does the above. However, I only update the images only once. I have also in place a flag called "savedMasks" and this is what i do when I save the masks to my current scene object:

if(currentSceneObject->getSaveMasks == true) {
    repMo.updateMasks(); // Update mask image vector
    currentSceneObject->saveMasks(repMo.getMaskImages()); // save them against current scene
    currentSceneObject->setSaveMasks == false; // clear the flag
}

If my understand is correct, It will only save it once, but not multiple times.

__WHY AM I CLONING OR DEEP COPYING THE IplImage*(s)__

The reason I am cloning the image is that if I don't and simply dereference it, after stack call is returned, the information is gone! I mean partially. Because it turns out that when I am trying to fetch the saved values back into the main application It is having access violation errors.

This solves the problem except the fact that now I am getting memory allocation failures as:

OpenCV Error: Insufficient Memory (failed to allocate xyz bytes) in unknown function, file 
..\..\opecv\modules\core\src\alloc.cpp line 52.

from OpenCV. I believe that using cvCloneImage() I am making too many calls to malloc but not freeing the memory correctlyl. However, I might be wrong. Shall I store it as OpenCV and load it as IplImage* pointer to be safe?

2013-02-01 09:40:48 -0500 commented answer IplImage data access problem

@HarisMoonamkunnu Thanks for this...I actually use a grayscale image and sorted out the problem....thanks

2013-01-31 16:08:09 -0500 asked a question IplImage data access problem

Hello, I am newbee to OpenCV so if I am making silly mistakes and assumptions, please ignore me!

I am trying access the data contents of IplImage structure. To clarify, I am trying to access the data contents that are pointed by IplImage.imageData. I am trying to access it using widthStep and height like this:

uchar* ptr;
for(int i=0; i<myIplImage.height; i++) {
    ptr = (uchar*)(myIplImage.imageData + (i*myIplImage.widthStep));
   for(int j=0; j < myIplImage.width; j++) {
        std::cout << ptr[j];
   }
}

However, i am constantly getting exception and cannot even catch it to print the actual problem message so that I can fix it. Is it the correct way to access IplImage data? If not, what is it that I am doing wrong and where can I find more information about this?

2013-01-31 15:19:13 -0500 answered a question IplImage nChannels is always returning -1

I figured out the problem. Saving pointers and then calling them later in the design may not be a good idea eh? Also Deep Copy / Shallow Copy stuff!!

2013-01-29 02:36:33 -0500 asked a question IplImage nChannels is always returning -1

Hello

Due to the restricted nature of my program I cannot post the code. However, I can provide a very apt description of it so that the problem can be understood.

I have an image processing application where I need to store history of image masks. There are total 6 mask images that fit into a mask history. a history is made via a pair which has an integer type of identifier and the IplImage* for the mask. For this I have created a vector as:

   std::vector<std::pair<int, IplImage*>> maskVal; // (int = type for the Id - #defined)

I can confirm that I can save the correct mask values in a history i.e. the channels are correct as as processed by my program. Also, I have in place built-in macros that will __STOP__ the program if mismatches such as nChannels value is wrong, image is NULL, incorrect number of mask images saved, etc. However, when I try to reload the mask values for processing all of them seems to have the nChannels = -1.

I don't know if saving them as IplImage rather than IplImage* would make any difference. I have unit tests that prove that my mask history can correctly load the masks but I am having trouble understanding why the channels are always being returned as -1 even though when they are saved with nChannels = 1.

I know this is probably not as detailed as you would expect but I will try and put some more information up to my limit. I would appreciate if someone points me to the right direction.

2013-01-11 05:18:14 -0500 commented question C++ map with <cv::Mat, IplImage*> key-value format

@VladislavVinogradov thanks for your quick answer! At least there is nothing screwed up from my end!...Do you think I can somehow use std::pair to do this job?

2013-01-11 03:11:09 -0500 asked a question C++ map with <cv::Mat, IplImage*> key-value format

Hello,

I am trying to create a key-value pair (keyed by Mat images and associated values are in IplImage*). The fraction of my code that does the job is as follows:

   std::map<cv::Mat, IplImage*> testObj;
   cv::Mat testMat = cv::Mat();
   IplImage* testIplImagePtr = new IplImage();

   testObj[testMat] = testIplImagePtr; // So that it either inserts or updates

This is giving me error "cannot convert from cv::MatExpr to bool". I cannot understand why this is making a problem. Is it because IplImage is used in the internal structure of cv::Mat class?