Thalia

1

votes
1

answer
4.9k

views

Channel order in OpenCV

I have been reading in a few forums that OpenCV has the BGR channel order by default. It is also possible that a cv::Mat may have RGB channel order. A gray conversion would specify CV_BGR2GRAY or CV_RGB2GRAY as a parameter. 1) Are there any other options, than RGB and BGR ? 2) Is there any way to fi...
Thalia
1

votes
3

answer
1.1k

views

Linker error - linking two “application” type projects in order to use Google Test

I am trying to test a function with Google Test. It seems that everything is set up correctly, and it builds and executes fine without gtest... (There is a bit of complexity in the code, so I cannot list all the source files here, but without adding gtest, the files are linking properly, and running...
Thalia
1

votes
2

answer
66

views

Optimization and testability at the same time - how to break up code into smaller units

I am trying to break up a long "main" program in order to be able to modify it, and also perhaps to unit-test it. It uses some huge data, so I hesitate: What is best: to have function calls, with possibly extremely large (memory-wise) data being passed, (a) by value, or (b) by reference (by extrem...
Thalia
1

votes
1

answer
471

views

Inheriting from OpenCV class - compiling error

i need to inherit from an openCV class. The purpose - adding a custom metric. #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" class SomeChild : public BFMatcher { public: SomeChild(int _normType, bool _crossCheck); ~SomeChild(); void knnMatchImpl( const Mat& queryDescri...
Thalia
1

votes
2

answer
1.1k

views

Is it possible to set data for testing in separate method in qt unit testing?

I saw that Qt supports a data function associated to a test function. http://qt-project.org/doc/qt-4.8/qtestlib-tutorial2.html Is it possible to have some similar type of data function for multiple tests ? Example: void Test::Test1() { SomeClass::SomeDataType a; a.manyValuesComplicatedToSet = 1; Som...
Thalia
1

votes
1

answer
361

views

Qt app with dependencies on mac - dependent sdk has @executable_path in otool list… how do I change it?

I am trying to build/run/deploy a qt app on mac. It has, among other dependencies, an sdk that I have placed in a lib folder... and set the path in the pro file. The app builds fine, but I cannot execute it. Running otool -L myapp shows, for this particular sdk: @executable_path/../Frameworks/blah.0...
Thalia
1

votes
2

answer
630

views

Scaling a rotated item based on top left moves the item

I would like to be able to rotate a QGraphicsItem based on its center, and scale it based on the top left corner. When I try to combine rotation and scaling, the item also apparently moves... #include #include #include void testTransformations(QGraphicsScene* s) { qreal angle = 30, scaleX = 2, sc...
Thalia
1

votes
1

answer
6.1k

views

FRIEND_TEST in Google Test - possible circular dependency?

I am trying to figure out how FRIEND_TEST works in Google Tests. https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#testing-private-code I am looking at the following item, trying to implement it in my code: // foo.h #include "gtest/gtest_prod.h" // Defines FRIEND_TEST. cl...
Thalia
2

votes
1

answer
3.1k

views

Moving an item with the mouse on QGraphicsView / QGraphicsScene

I have a QGraphicsView area that displays some Item items. I would like to have mouse move implemented. class Item { public: Item(); void update(); int x, y; // position int z; // order - should correspond also to index in item list }; class Collection : public QGraphicsView { Q_OBJECT public: Colle...
Thalia
6

votes
1

answer
4.7k

views

Setting up depth for a cv::Mat

I want to test a function that is looking for specific mat depth && number of channels It has a test... if (image.channels() == 1 && image.depth() == 8) ... else if (image.channels() == 1 && image.depth() == 16) ... else if (image.channels() == 1 && image.depth() == 32) ... else { if ((image.ch...
Thalia
5

votes
1

answer
313

views

QGraphicsItem leaves artifacts when changing boundingRect

My LineItem inheriting from QGraphicsLineItem can change its pen width. I have created a boundingRect that uses the QGraphicsLineItem::boundingRect adjusted by pads that get calculated based on pen width and arrows. It works. void LineItem::calculateStuff() // called on any change including pen widt...
Thalia
5

votes
1

answer
5k

views

How can I build openssl with debug symbols ? [add libeay.pdb]

I am using openssl, and I get lots and lots of warnings during build about missing libeay.pdb. Can somebody suggest how to add it ? the build.cmd looks like this (significant piece I think): ... perl util\mk1mf.pl debug dll no-asm VC-WIN64A >ms\ntdll64.dbg.mak perl util\mkdef.pl 32 libeay > ms\libe...
Thalia
4

votes
1

answer
3k

views

Create relative path using boost

I am trying to create relative paths using boost. My initial plan was: string base_directory; // input boost::filesystem::path base_path; string other_directory; // input boost::filesystem::path other_path; // assume base_path is absolute - did that already (using complete() // if path is relativ...
Thalia
2

votes
1

answer
1k

views

How can I show/hide background drawing on QGraphicsScene or QGraphicsView?

I would like to have certain things drawn on QGraphicsScene, but not be QGraphicsItem (it would interfere with the processing of the QGraphicsItem collection). Example: a scene bounding rectangle, a grid I am overriding the drawBackground(QPainter *painter, const QRectF &rect) for that purpose. (I s...
Thalia
1

votes
1

answer
796

views

What would be a good algorithm to convert an image to a limited size color palette

I am trying to figure out an algorithm that would convert an image - 8 or 32 bit - to a limited palette of 3 or 4 custom colors (not grayscale). Is this possible ? I am trying to use C++ (but I could get it from other languages) It seems that Qt already has a palette - though I don't understand its...
Thalia
2

votes
1

answer
135

views

Forward declaration of (sdk) class containing template

I have been doing forward declarations in header files, and including the actual class files in cpp. But I run into problems when the classes are templated: class MyClass { public: MyClass(); void aFunction(); private: QList m_member; }; To get it to build I need to give this class info about QList....
Thalia
5

votes
3

answer
14.2k

views

Copy boost::shared_ptr

typedef boost::shared_ptr data_ptr; data_ptr cached_ptr; // class member bool someWork(data_ptr& passed_ptr) { // must copy passed_ptr = cached_ptr under some conditions // without pointing at the same memory // I saw somewhere that I should do // passed_ptr.reset(new SomeData(???)) // I don't...
Thalia
2

votes
1

answer
646

views

Unit-test multiple c++ projects and export results to TeamCity

I am introducing unit testing with Google Tests in my c++ projects. The projects are organized in multiple solutions, each solution containing one (main) project and its dependencies. There is also one build solution, containing all projects. Each project will add its own [project]_test project to...
Thalia
2

votes
1

answer
258

views

QGraphicsView fitInView on view created in Design mode doesn't work

I have been struggling with the QGraphicsView and fitInView(). I have created a scene (very large), and a rectangle that must be shown on loading. But when loaded, the view is always zoomed very far out. So I created a small test program, and the fitInView worked just fine ! After much struggle, tr...
Thalia
4

votes
3

answer
3.3k

views

PhantomJS QUnitTeamCityDriver QUnit test run

I would like to use unit testing for JavaScript in TeamCity. I am using QUnit, and I have seen a couple of places that suggest using phantomjs and QUnitTeamCityDriver. I just have not been able to get it to work... I don't have a lot of experience in this, and can't seem to even get phantomjs to r...
Thalia
4

votes
2

answer
5.4k

views

Get XML Reports in TeamCity from Google Test

I am trying to figure out how to run unit tests, using Google Test, and send the results to TeamCity. I have run my tests, and output the results to an xml, using a command-line argument --gtest_output="xml:test_results.xml". I am trying to get this xml to be read in TeamCity. I don't see how I can...
Thalia
4

votes
2

answer
207

views

Finding best color match - and reject if no shades of color available

Is there a way to identify colors, given by their hex codes, as being shades of a certain color ? I think I found a way, not sure how accurate - but how can I tell if the color match I found is not good enough ? I need to be able to identify color matches for specific colors - a fixed set (red, yell...
Thalia
1

votes
2

answer
1.9k

views

Unsupported depth in Opencv

I am trying to learn some basics, but I keep getting errors. I am trying to resize a cv::Mat Edit to clarify why I am not loading an image: I am trying to test without having access to external files. Inside the code, though, I put int x = M.depth(); and it read 0 cv::Mat M(2,2, CV_8UC3, cv::Scalar(...
Thalia
2

votes
1

answer
2.8k

views

Canon SDK example for image processing

I would like to use the canon EDSDK in a c# or VB.NET program, to view cr2 files. I have found sample code on how to control the camera - example: https://github.com/esskar/Canon.Eos.Framework but nothing about opening the files, extracting the image data and displaying it - or saving the thumbs or...
Thalia
3

votes
1

answer
1.8k

views

Open DTE solution from another program (not add-in)

Is it possible to modify a solution, and use envdte tools, from a command-line project ? I have an add-in that modifies a solution. But... the changes are required for over a hundred projects... So I'd like to make a c# program that has the same logic, only it iterates through all solution files. Th...
Thalia
5

votes
1

answer
9.4k

views

System.BadImageFormatException: Could not load file or assembly 'x_Accessor,…' This assembly is built by a runtime newer

System.BadImageFormatException: Could not load file or assembly 'x_Accessor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. I am having a hard time finding a cure...
Thalia
5

votes
2

answer
9k

views

OpenCV save CV_32FC1 images

A program I am using is reading some bitmaps, and expects 32FC1 images. I am trying to create these images cv::Mat M1(255, 255, CV_32FC1, cv::Scalar(0,0,0)); cv::imwrite( "my_bitmap.bmp", M1 ); but when I check the depth - it is always CV_8U How can I create the files so that they will contain the c...
Thalia
3

votes
4

answer
81

views

Changing defined function fragment into testable function, how to pass argument?

I am trying to refactor some code, to make it testable. A large part of it uses #define to fill in repetitive code in functions. I am trying to change it in actual functions, but I ran into a stumbling block. Note: the original code is from dithering algorithm typedef struct{ unsigned char R, G, B;...
Thalia
1

votes
1

answer
3.3k

views

Set a button of custom color to a disabled style

I have a class that inherits QWidget. Under certain circumstances, I wish to set it disabled. The widget has some color buttons, that are set from a list of colors: void MyWidget::colorUpdate(QString color) { if(!color.isEmpty()) { QString foreground = (QColor(color).lightness() < 125 ? "white" : "b...
Thalia
2

votes
3

answer
1.6k

views

C++ how to check if file is in use - multi-threaded multi-process system

C++: Is there a way to check if a file has been opened for writing by another process/ class/ device ? I am trying to read files from a folder that may be accessed by other processes for writing. If I read a file that is simultaneously being written on, both the read and the write process give me er...
Thalia
3

votes
1

answer
1k

views

QGraphicsItem customize selection when adding to a group - weird inconsistent results

This question may or may not relate to QGraphicsItemGroup - I have never seen this behavior before though.... Briefly: I am deselecting an item, yet the action doesn't take place unless I call the read-only scene().selectedItems() - even if I don't use it. Details: I have a custom QGraphicsScene cla...
Thalia
4

votes
1

answer
4.6k

views

Multi-line centered text in svg rendered in qt

I am trying to make an svg that will be read in a QGraphicsSvgItem. I read some documentation, and it seems this is what I want: No Arrow This creates a rectangle - and a multi-line text centered inside: This is what it looks like in the browser. In Qt though, when loaded in QGraphicsSvgItem, it loo...
Thalia
2

votes
2

answer
366

views

array of overloaded functions in c++

I have several overloaded functions in c++ and I would like to make an array of them, so that I can use them in a loop (in fact I want to call them randomly). Could you help ? Tutorials only show how to do arrays of function pointers with identical function arguments.
Thalia
2

votes
5

answer
171

views

Can I create class factory for a constructor with parameter?

I am using a class factory to create objects dynamically. I used this answer for its simplicity (and because I am using Qt). But now I realize I must add an argument to my constructor Item(bool newItem /* = true*/); instead of Item(); for the code in the referred answer: template class ClassFacto...
Thalia
2

votes
1

answer
2.2k

views

GetDirectories from network in c#

I am trying to create a listing of folders on the system (actually I am trying to make a custom "explorer"). I need to be able to list network drives, but I don't know how. The only thing I know how to do is: string[] localDrives = Directory.GetLogicalDrives(); If I even try string[] initDrives =...
Thalia
33

votes
3

answer
31.4k

views

Cannot create an instance of the variable type 'Item' because it does not have the new() constraint

I am trying to test a method - and getting an error: Cannot create an instance of the variable type 'Item' because it does not have the new() constraint Required information for below: public interface IHasRect { Rectangle Rectangle { get; } } Helper class: class Item : IHasRect { public Item(Point...
Thalia
2

votes
2

answer
1.8k

views

How can I check if a QString contains only “invisible” characters?

I would like to check if a QString is made up of only non-printable or non-visible characters. The QString could contain unicode... I imagine a regular expression may work, but I have no idea how to create such a regex. How can I check if a QString contains only "invisible" characters ? (space, \n,...
Thalia
13

votes
1

answer
29.1k

views

dll missing dependencies on Windows 7 files

I have built a C++ dll to use from dot net. When I run the progran I get an error, dll not found. The dll is there - but I checked it with dependency walker - and got for the following: API-MS-WIN-CORE-COM-L1-1-0.DLL API-MS-WIN-CORE-WINRT-ERROR-L1-1-0.DLL API-MS-WIN-CORE-WINRT-L1-1-0.DLL API-MS-WIN-...
Thalia
2

votes
3

answer
217

views

Find first item inside angular brackets after occurrence of other item, using RegEx, in C#

I have an xml-like text, in which I would like to find the item that occurs in the first occurrence of a certain pattern: typically: ... true.... .... Could also be ... true ... ... In the above, I need to extract the "name". My initial assumption was that all occurrences were to be in one line, and...
Thalia
2

votes
1

answer
2.5k

views

Qt: Apply a font change on an entire form

I have a number of forms, created using the Qt Designer. (Qt 4.8) I would like to change the font for all the forms ... from somewhere. In Windows, QApplication::setFont(font); works perfectly. Unfortunately there seems to be a bug (i don't know if this bug report is exactly related)... And the QAp...
Thalia

View additional