c++

Accessing negative pixel values OpenCV

Hello, I am attempting to perform a zero-crossing edge detection on an image in OpenCV. I blur and use the cvLaplace() then scale it from (0, max). My question is: How can I access the pixel values in that image in such a way as to correctly identify negative values? Using the function provided by OpenCV (cvPtr2D) returns unsigned chars...

C++ append one vector to another

I fully understand this question has been asked a lot, but I'm asking for a specific variation and my search-foo has given up, as I've only found algorithms that append one existing vector to another, but not one returned to from a function. I have this function that lists all files in a directory: vector<string> scanDir( const string&...

variable "undeclared" in "#pragma" command?

I'm compiling a branch of the Blender 3D modeling program from source (using SCONS), on a Fedora 8 box, and am running into an error that I didn't encounter compiling the same source on a CentOS 5 box, and I'm thinking it has to do with the variable definition. The error is: source/blender/blenkernel/intern/implicit.c: In function ‘mul_...

Why it is not possible to animate the "maximumWidth" parameter of the QWidget?

I wanted to animate the QWidget maximumWidth in order to change thd widgets size in a layout with animation, but it does not work. I have tried to do the following: QPropertyAnimation *animation1 = new QPropertyAnimation(m_textEditor2, "maximumWidth"); animation1->setStartValue(0); animation1->setEndValue(100); animation1->start(); ED...

typedef declaration of template class

is there a difference, from prospective of meta-programming for example, between the two declarations? template<typename T> struct matrix { typedef matrix self_type; // or typedef matrix<T> self_type; }; thank you ...

Call class constructor from new operator on GNU - use invalid class

The closest thread to my question is here. I am trying to compile the following code with gcc: #include <malloc.h> class A { public: A(){}; ~A(){}; };//class A int main() { A* obj = (A*) malloc( sizeof(A) ); if(obj==0) return 1 ; obj->A::A(); /*error: invalid use of 'class A' */ obj->A::~A(); free(obj); return 0; }...

Determining XAML parse error locations on CE

We're evaluating using Silverlight on C++ for an embedded project and are prototyping some screens for a demonstration. What I'm finding is that Expression Blend will create XAML files that work fine on the desktop but, when porting them over to the CE device results in parse errors (apparently not all tags and elements are supported on...

Class needs to handle a new type - duplicate or extend?

Suppose I have a C++ application for a pet store that started out just with Cats. The app has a class that does some data handling for a Cat dialog box: CatDlg.cpp: CatDlg::CatDlg() {//ctor stuff} CatDlg::onInitDialog() { DBAccess db; db.open(); CatRec cat; cat = db.findRec(m_catID); CString name = cat.getName(); Na...

Performance evaluation tools for C++

Hi everyone, I am really not sure if such a tool exits but let me describe it in few words. I want to measure the performance of a small library I am writing. Basically the library does arbitrary precision arithmetic. I would like to compare the performance of the library against available libraries and get the statistics of the tests. ...

setting max frames per second in openGL

Is there any way to calculate how much updates should be made to reach desired frame rate, NOT system specific? I found that for windows, but I would like to know if something like this exists in openGL itself. It should be some sort of timer. Or how else can I prevent FPS to drop or raise dramatically? For this time I'm testing it on ...

(C/C++/C#) DirectX 9 Overlay, preferably the same way xfire or Steam does it

Hello! I wonder what techniques xfire and/or Steam uses to overlay into games. I'm trying to do something similar and I really would like to know what is the least intrusive way, I.e. won't alert any anti-cheat systems. I don't need any kind of information from the game (no wall-hack BS). I would basically just like to display a rectang...

C++ template function gets erronous default values

I have hit upon a real brain scorcher in C++, it has never happened to me before. The gist of the problem is that upon invocation of my (template) function the arguments I have defined defaults for have their values scrambled. It only happens if I call the function with the defaults. My template function is declared like this: templat...

Template specialization with struct and bool

I have a template class in which I am specializing a couple of methods. For some reason, when I added a specialization for a struct, it seems to be conflicting with the specialization for bool. I am getting a type conversion error because it is trying to set the struct = bool (resolving to the wrong specialization). Here is some code ...

Image blurring in C++. Problem with copy of matrix

I am inputting a matrix of black/white pixel values and then I am blurring the inside using an averaging technique. I have the program looping through properly but I need a constant copy of the original matrix for the for loops to use when stepping through. How can I do this? #include<iostream> using namespace std; /****blurImage*****...

Can I compile using VS2008's C++ compiler using VS2010 and only the Server 2008 Platform SDK?

I'd rather not install the entire VS 2008 installation given that I'm not going to be using anything other than the compiler. Will VS 2010's multitargeting work correctly using only the Platform SDK instead of the full VS2008 install? ...

What is the end of line character when reading a file in using C++ get(char& c);?

My issue is I am trying my first attempt at writing a very basic lexical analyzer for ascii text files. so far, it reads and compares to my token list properly, however I am unable to grab the final token without a space or pressing enter. I've tried using the delimiter ^Z ASCII 26 as another selection before comparing the string to my t...

Implementing a stack based virtual machine for a subset of C

Hello everyone I'm currently implementing a simple programming language for learning experience but I'm in need of some advice. Currently I'm designing my Interpreter and I've come into a problem. My language is a subset of C and I'm having a problem regarding the stack interpreter implementation. In the language the following will comp...

Any good recursive tutorials? Python?

Wondering if anyone could point me towards a good recursion tutorial. I am a bit rusty on it as I learned about it in my Data Structures class first semester. Would like to brush up on my recursion...any help? ...

My C++ code runs perfectly on MS C++ compiler but gives me NaN on g++ compiler. Why?

I'm simulating a biological model involving several (27) stiff ordinary differential equations using C++. My program runs perfectly under MS C++ 2010 expression compiler but fails under the g++ compiler (NetBeans 6.8, Ubuntu 10.04 LTS). The problem is that some of the variables become NaN. The following are the values of the variable Vm ...

Is it valid to compare iterators which are got from the container separately?

For example, it this expression valid in semantic? container.begin() == container.begin(); ...