'MSize' is not a member of cv::Mat - c++

I'm trying to run this repo for curiosity: https://github.com/jzeimen/PuzzleSolver/tree/master/PuzzleSolver
Eclipse throws the title error "'MSize' is not a member of cv::Mat' whenever I try to run the following line of code from PuzzleDisjointSet.cpp:
cv::Mat::MSize size_of_a = sets[rep_a].locations.size;
Where locations is defined like so:
struct forest{
cv::Mat_<int> locations;
cv::Mat_<int> rotations;
int representative;
int id;
};
and sets is a vector version of the forest structure. I'm mainly confused as to why this is occurring, when documentation clearly refutes this.
I believe the header files I am including are the correct ones (PuzzleDisjointSet.h includes the above forest structure definition as well as the sets definition.
#include "PuzzleDisjointSet.h"
#include <algorithm>
#include <opencv2/core.hpp>
#include <opencv/cv.h>
#include <opencv2/core/mat.hpp>

the struct was removed in this commit
https://github.com/Itseez/opencv/commit/d8c8339bec83b77978d2a0e1a62b764fb9d9c599#diff-bc1d784738cd852f5b1e95ce10a56d06
maybe you can checkout a version before that and use it, or i suspect it may have been moved to a different class, you can try looking for that

OpenCV version: 4.3.0
cv::MatSize size_of_a = sets[rep_a].locations.size;

Related

TActorIterator initialization in c++ using unreal engine 5 and visual studio 2022

I am trying to loop through all StaticMeshActor in my game world to identify them by tags.
To try and solve this I have tried the following TActorIterator initializations, but all of them give the same error: Incomplete type is not allowed and Local variable is not initialized. This is the exact error message.
TActorIterator<AStaticMeshActor> ActorItr(GetWorld());
TActorIterator<AStaticMeshActor> ActorItr =
TActorIterator(GetWorld());
TActorIterator<AStaticMeshActor> ActorItr = TActorIterator(GetWorld());
What can I do to initialize ActorItr?
Update: I use the following code and includes
#include "Engine/World.h"
#include "Engine/Engine.h"
#include "Kismet/KismetMathLibrary.h"
#include <Engine/StaticMeshActor.h>
for (TActorIterator<AStaticMeshActor> ActorItr(GetWorld());
ActorItr; ++ActorItr)
Solved this by adding an include
#include "Engine.h"
instead of
#include "Engine/Engine.h"

How to export STEP to STL into separate files using OpenCascade and C++

I'm looking for methods to export a STEP file into separate STL ones, and extracting relevant information from each of the parts (such as position in the whole model, rotation [if any], colors, and material [if possible]), so I use those in another program that needs STL inputs.
So far I have been trying to work with OpenCascade, but I'm a complete newbie there, and haven't had the proper progress. The code I've been working with so far is shown below (it's just a sample I found in the examples, but I don't really understand the outputs).
#include <iostream>
#include <STEPControl_Reader.hxx>
//#include <STEPCAFControl_Reader.hxx>
#include <Interface_Static.hxx>
#include <string>
int main(){
STEPControl_Reader CAFReader;
IFSelect_ReturnStatus Status = CAFReader.ReadFile("/home/User/Geometry/Module.step");
Standard_Integer ic = Interface_Static::SetIVal("read.precision.mode",1);
Standard_Real rp = Interface_Static::SetRVal("read.precision.val",0.0001);
cout<<ic<<endl;
cout<<rp<<endl;
What I would really need would be the export separate files in .stl and ideally vector(s) containing (for each of the parts):
Position
Rotation
Color
Material
Any inputs would be highly appreciated :)
Thank you in advance.

C++: Why can't I access the Node class using Opencv?

Hi I am writing a C++ program using OpenCV. I make sure to include the necessary files:
#include "opencv2/core/core.hpp"
#include "opencv2/ml/ml.hpp"
Everything using opencv works fine and dandy. But when I refer to Node in the following line:
std::vector<Node> nodeList = forest->getNodes();
I get the following error:
error: use of undeclared identifier 'Node'
I don't understand why, because it recognizes all the other opencv classes. There is probably a simple explanation for this but I don't see it right now. Any help would be greatly appreciated!
Try the full name of the node class cv::ml::DTrees::Node. and if you want to define a vector with a certain size do this:
std::vector<Node> nodeList(forest->getNodes().size());

C++ - RapidJSON has no member Writer

Im using this snippet of code to stringify a dom with rapidjson:
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
document.Accept(writer);
But i get the error that Writer is not a member of the rapidjson namespace.
My includes are:
#include "rapidjson/document.h"
#include "rapidjson/writer.h"
#include "rapidjson/stringbuffer.h"
#include <iostream>
as mentioned in the example simpledom.cpp.
So my question is if this is a bug or does it need another writer class for this?
Did i miss any includes? I use the latest version of rapidjson.
I switched to an older version (0.11) https://code.google.com/p/rapidjson/downloads/detail?name=rapidjson-0.11.zip and the error didnt show up anymore.
The first version i have used was from github: https://github.com/miloyip/rapidjson
Im not sure if the error was related to my dev environment or a bug in rapidjson.
It is a late response but I think it would help other people who come here. In place of Writer<StringBuffer>
you code use PrettyWriter<StringBuffer>
after including prettywriter.h, of course.

boost::geometry multi_point can't be constructed like polygon

First off, a big thanks to the people behind the new boost::geometry library!
This question replaces an earlier one which I have now split into two as two separate issues have become clearer.
I have read http://www.boost.org/doc/libs/1_47_0/libs/geometry/doc/html/geometry/design.html which explains the traits mechanism but am none the wiser as to why this code doesn't compile...
//code to calculate area of convex hull from a set of points
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/multi/geometries/multi_point.hpp>
double convex_hull_area()
{
using boost::geometry::model::d2::point_xy;
using boost::geometry::append;
using boost::geometry::make;
//this bit works if I use a polygon instead of multi_point
boost::geometry::model::multi_point<point_xy<float> > all_points_in_radius;
append(all_points_in_radius,make<point_xy<float> >(0,0));
append(all_points_in_radius,make<point_xy<float> >(3,0));
append(all_points_in_radius,make<point_xy<float> >(3,3));
append(all_points_in_radius,make<point_xy<float> >(2,1));
boost::geometry::model::polygon<point_xy<float> > hull;
boost::geometry::convex_hull(all_points_in_radius,hull);
return boost::geometry::area(hull);
}
The first error is
Error 1 error C2039: 'apply' : is not a member of 'boost::geometry::dispatch::for_each_range<Tag,Geometry,Actor,IsConst>' d:\boost\boost_1_47_0\boost\geometry\algorithms\detail\for_each_range.hpp 115 boost_geom_test
If I use a polygon instead of a multipoint, the code works just fine, though presumably with overheads I don't need. What is going on?
This turned out to be a bug in boost. It is now fixed in the head revision and should roll out in 1.49.0.