<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Parameter einer Klasse ändern. mit Vererbung?]]></title><description><![CDATA[<p>Hallo</p>
<p>ich verwende die Klasse von ORB aus OpenCV aus Features2D.<br />
Die KLasse sieht so aus:</p>
<pre><code>class CV_EXPORTS_W ORB : public Feature2D
{
public:
    // the size of the signature in bytes
    enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };

    CV_WRAP explicit ORB(int nfeatures = 40, float scaleFactor = 1.4142, int nlevels = 5, int edgeThreshold = 31,
        int firstLevel = 0, int WTA_K=2, int scoreType=ORB::FAST_SCORE, int patchSize=31 );

    // returns the descriptor size in bytes
    int descriptorSize() const;
    // returns the descriptor type
    int descriptorType() const;

    // Compute the ORB features and descriptors on an image
    void operator()(InputArray image, InputArray mask, vector&lt;KeyPoint&gt;&amp; keypoints) const;

    // Compute the ORB features and descriptors on an image
    void operator()( InputArray image, InputArray mask, vector&lt;KeyPoint&gt;&amp; keypoints,
                     OutputArray descriptors, bool useProvidedKeypoints=false ) const;

    AlgorithmInfo* info() const;

protected:

    void computeImpl( const Mat&amp; image, vector&lt;KeyPoint&gt;&amp; keypoints, Mat&amp; descriptors ) const;
    void detectImpl( const Mat&amp; image, vector&lt;KeyPoint&gt;&amp; keypoints, const Mat&amp; mask=Mat() ) const;

    CV_PROP_RW int nfeatures;
    CV_PROP_RW double scaleFactor;
    CV_PROP_RW int nlevels;
    CV_PROP_RW int edgeThreshold;
    CV_PROP_RW int firstLevel;
    CV_PROP_RW int WTA_K;
    CV_PROP_RW int scoreType;
    CV_PROP_RW int patchSize;
};

typedef ORB OrbFeatureDetector;
typedef ORB OrbDescriptorExtractor;
</code></pre>
<p>Nun deklarier ich bisher immer so:</p>
<pre><code>ORB orb;
</code></pre>
<p>Und kann dann: verschiedene Funktionen auf das Objekt anwenden.</p>
<p>Nun möchte ich aber diese Parameter ändern:</p>
<pre><code>CV_WRAP explicit ORB(int nfeatures = 40, float scaleFactor = 1.4142, int nlevels = 5, int edgeThreshold = 31,
        int firstLevel = 0, int WTA_K=2, int scoreType=ORB::FAST_SCORE, int patchSize=31 );
</code></pre>
<p>Wie kann ich aus meinem normalen Programm - Code diese Parameter ändern und dann ein neues Objekt erzeugen?<br />
Ich kann entweder nur das Objekt erzeugen oder nur die Parameter ändern.<br />
Ich möchte aber gerne beides.</p>
<p>wenn jemand einen Hinweis hat, dann wäre ich sehr dankbar <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/323142/parameter-einer-klasse-ändern-mit-vererbung</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Jul 2026 09:14:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/323142.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 19 Jan 2014 15:11:54 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 15:11:54 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>ich verwende die Klasse von ORB aus OpenCV aus Features2D.<br />
Die KLasse sieht so aus:</p>
<pre><code>class CV_EXPORTS_W ORB : public Feature2D
{
public:
    // the size of the signature in bytes
    enum { kBytes = 32, HARRIS_SCORE=0, FAST_SCORE=1 };

    CV_WRAP explicit ORB(int nfeatures = 40, float scaleFactor = 1.4142, int nlevels = 5, int edgeThreshold = 31,
        int firstLevel = 0, int WTA_K=2, int scoreType=ORB::FAST_SCORE, int patchSize=31 );

    // returns the descriptor size in bytes
    int descriptorSize() const;
    // returns the descriptor type
    int descriptorType() const;

    // Compute the ORB features and descriptors on an image
    void operator()(InputArray image, InputArray mask, vector&lt;KeyPoint&gt;&amp; keypoints) const;

    // Compute the ORB features and descriptors on an image
    void operator()( InputArray image, InputArray mask, vector&lt;KeyPoint&gt;&amp; keypoints,
                     OutputArray descriptors, bool useProvidedKeypoints=false ) const;

    AlgorithmInfo* info() const;

protected:

    void computeImpl( const Mat&amp; image, vector&lt;KeyPoint&gt;&amp; keypoints, Mat&amp; descriptors ) const;
    void detectImpl( const Mat&amp; image, vector&lt;KeyPoint&gt;&amp; keypoints, const Mat&amp; mask=Mat() ) const;

    CV_PROP_RW int nfeatures;
    CV_PROP_RW double scaleFactor;
    CV_PROP_RW int nlevels;
    CV_PROP_RW int edgeThreshold;
    CV_PROP_RW int firstLevel;
    CV_PROP_RW int WTA_K;
    CV_PROP_RW int scoreType;
    CV_PROP_RW int patchSize;
};

typedef ORB OrbFeatureDetector;
typedef ORB OrbDescriptorExtractor;
</code></pre>
<p>Nun deklarier ich bisher immer so:</p>
<pre><code>ORB orb;
</code></pre>
<p>Und kann dann: verschiedene Funktionen auf das Objekt anwenden.</p>
<p>Nun möchte ich aber diese Parameter ändern:</p>
<pre><code>CV_WRAP explicit ORB(int nfeatures = 40, float scaleFactor = 1.4142, int nlevels = 5, int edgeThreshold = 31,
        int firstLevel = 0, int WTA_K=2, int scoreType=ORB::FAST_SCORE, int patchSize=31 );
</code></pre>
<p>Wie kann ich aus meinem normalen Programm - Code diese Parameter ändern und dann ein neues Objekt erzeugen?<br />
Ich kann entweder nur das Objekt erzeugen oder nur die Parameter ändern.<br />
Ich möchte aber gerne beides.</p>
<p>wenn jemand einen Hinweis hat, dann wäre ich sehr dankbar <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378278</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378278</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 15:11:54 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 15:33:31 GMT]]></title><description><![CDATA[<p>Du rufst mittels &quot;Orb orb&quot; ja auch nur den Default-Konstruktor auf (d.h. der mit den vordefinierten Parametern). Rufe einfach explizit den Konstruktor mit den passenden Parametern auf, z.B.</p>
<pre><code class="language-cpp">Orb orb(42, 1.0, 1, 1, 0, 1, ORB::FAST_SCORE, 32); // or whatever you want
</code></pre>
<p>Oder hast du &quot;Orb orb&quot; als Member deiner eigenen Klasse so deklariert? Dann mußt du im Konstruktor deiner Klasse obigen Aufruf (innerhalb der Initialisierungliste) vornehmen:</p>
<pre><code class="language-cpp">class MyClass
{
public:
  MyClass()
    : orb(42, 1.0, /*...*/) // &lt;- hier die Initialisierung
  {
  }
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2378283</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378283</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Sun, 19 Jan 2014 15:33:31 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 15:34:01 GMT]]></title><description><![CDATA[<p>Wie kommst du darauf, dass dort Parameter geändert werden? Das ist der Konstruktor. Die Parameter haben alle Default-Argumente, aber man kann die natürlich angeben, wenn man will:</p>
<pre><code class="language-cpp">ORB o; // alle Parameter auf Default-Wert
ORB o2(30, 2); // nfeatures = 30, scaleFactor = 2, Rest default. Immer von links.
// usw.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/2378284</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378284</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sun, 19 Jan 2014 15:34:01 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 15:55:39 GMT]]></title><description><![CDATA[<p>Ok, super, ich probiere das mal.</p>
<p>Ich hatte bisher: ORB(x,y, usw.) orb;</p>
<p>kann ich jetzt ORB orb(x,y, usw.);<br />
und x , y und so weiter kann ich also im Programm irgendwo definieren, richtig?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378293</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 15:55:39 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:07:20 GMT]]></title><description><![CDATA[<p>Ja, das sind einfach Funktionsargumente.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378296</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378296</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:07:20 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:13:43 GMT]]></title><description><![CDATA[<p>Genau, sobald ich Parameter eintrage, also zum Beispiel:</p>
<p>ORB orb(3,2, usw) und wenn ich dann übersetze, gibt es einen Fehler.<br />
Auffällig ist aber, dass nach der &quot;3&quot; und der Eingabe eines &quot;,&quot; mein VS2010 gar nicht reagiert. Normalerweise bekommt man ein Fenster, wo steht welchen Parameter man gerade eingibt (fett gedruckt). Und nach dem &quot;,&quot; müsste das fett gedruckte auf den zweiten Parameter umspringen, aber das passiert nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378297</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378297</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:13:43 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:21:10 GMT]]></title><description><![CDATA[<p>freekickchamp schrieb:</p>
<blockquote>
<p>Genau, sobald ich Parameter eintrage, also zum Beispiel:</p>
<p>ORB orb(3,2, usw) und wenn ich dann übersetze, gibt es einen Fehler.</p>
</blockquote>
<p>Aha. Steht da wie im Film groß rot blinkend &quot;ERROR&quot; oder gibts vielleicht doch eine Fehlermeldung?</p>
<p>Mein Tipp ist, dass du orb als Membervariable deklarieren willst. Dann halte dich an den Tipp von Th69 (und lern endlich mal das kleine Einmaleins von C++ ...)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378298</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378298</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:21:10 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:37:06 GMT]]></title><description><![CDATA[<p>Ok, ich werde es mal versuchen. Wobei ich bisher ohne eine selbst deklarierte KLasse ausgekommen bin. Aber dankeschön für die HInweise <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Folgende erste Fehlermeldung kommt dann:</p>
<blockquote>
<p>warning C4584: 'demo_orb' : base-class 'cv::Feature2D' is already a base-class of 'cv::ORB'</p>
</blockquote>
<p>Was ist denn das kleine 1x1 von C++?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378299</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:37:06 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:42:10 GMT]]></title><description><![CDATA[<p>freekickchamp schrieb:</p>
<blockquote>
<p>Ok, ich werde es mal versuchen. Wobei ich bisher ohne eine selbst deklarierte KLasse ausgekommen bin.</p>
</blockquote>
<p>Dann stimmt es vielleicht doch nicht? Schwer zu sagen, ich arbeite hier nur per Glaskugel.</p>
<blockquote>
<p>Folgende erste Fehlermeldung kommt dann:</p>
<blockquote>
<p>warning C4584: 'demo_orb' : base-class 'cv::Feature2D' is already a base-class of 'cv::ORB'</p>
</blockquote>
</blockquote>
<p>Das ist erstmal nur eine Warnung, kein Fehler. Das scheint sich aber auf Innereien von OpenCV zu beziehen, nicht auf deinen Code.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378305</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378305</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:42:10 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:44:53 GMT]]></title><description><![CDATA[<p>Also bisher habe ich einen solchen Ablauf:</p>
<p>Die Main macht irgendwas und ruft eine func auf.</p>
<p>Und die sieht bei mir bisher so aus:</p>
<pre><code>void func(image &amp;image) {
    Mat img = imread(image.ppm, CV_LOAD_IMAGE_GRAYSCALE);
	[b]ORB orb;[/b]
    vector&lt;KeyPoint&gt; key_points,key_points2;
    Mat descriptors,descriptors2;

.
.
.
</code></pre>
<p>Aber ich versuche jetzt den Hinweis von Th69 umzusetzen, denn hier geht es eben nicht, dass ich</p>
<pre><code>ORB orb(x,y,..);
</code></pre>
<p>aufrufe.<br />
Aber dankeschön erstmal.</p>
<p>Und ja, ich muss noch einiges lernen, aber das lernt man am besten durch selber programmieren und Hilfestellungen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378308</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:44:53 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 16:50:57 GMT]]></title><description><![CDATA[<p>Ich seh immer noch keine Fehlermeldung...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378309</guid><dc:creator><![CDATA[Bashar]]></dc:creator><pubDate>Sun, 19 Jan 2014 16:50:57 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 17:08:13 GMT]]></title><description><![CDATA[<pre><code>warning C4584: 'demo_orb' : base-class 'cv::Feature2D' is already a base-class of 'cv::ORB'
1&gt;          c:\opencv\build\include\opencv2\features2d\features2d.hpp(249) : see declaration of 'cv::Feature2D'
1&gt;          c:\opencv\build\include\opencv2\features2d\features2d.hpp(365) : see declaration of 'cv::ORB'
(36): warning C4250: 'demo_orb' : inherits 'cv::ORB::cv::ORB::info' via dominance
1&gt;          c:\opencv\build\include\opencv2\features2d\features2d.hpp(386) : see declaration of 'cv::ORB::info'
</code></pre>
<p>Die ersten 5 Meldungen. Die restlichen Meldungen bauen auf diesen Meldungen auf, deswegen spare ich mir die mal jetzt</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378313</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378313</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 17:08:13 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 17:14:18 GMT]]></title><description><![CDATA[<p>Bashar schrieb:</p>
<blockquote>
<p>Ich seh immer noch keine Fehlermeldung...</p>
</blockquote>
<p>Das sind lediglich Warnungen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378317</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378317</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Sun, 19 Jan 2014 17:14:18 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 17:20:04 GMT]]></title><description><![CDATA[<p>Ja, aber was sagen mir die Meldungen aus?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378319</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378319</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 17:20:04 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 17:33:30 GMT]]></title><description><![CDATA[<p>freekickchamp schrieb:</p>
<blockquote>
<p>Ja, aber was sagen mir die Meldungen aus?</p>
</blockquote>
<p>Nichts sinnvolles, die kannst du ignorieren. Aber vermutlich kommt das relevante danach, aber du weigerst dich ja, die Fehlermeldungen (error!) zu zeigen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378327</guid><dc:creator><![CDATA[manni66]]></dc:creator><pubDate>Sun, 19 Jan 2014 17:33:30 GMT</pubDate></item><item><title><![CDATA[Reply to Parameter einer Klasse ändern. mit Vererbung? on Sun, 19 Jan 2014 20:36:44 GMT]]></title><description><![CDATA[<p>Mittlerweile weigere ich mich wirklich, weil auf einmal kein Fehler auftritt.<br />
Vor 3h habe ich nur Syntak-Fehler bekommen, deswegen hatte ich Sie mir gespart hier aufzulisten, weil ich doch nur</p>
<blockquote>
<p>ORB orb(1,2,3, usw.);</p>
</blockquote>
<p>anstatt</p>
<blockquote>
<p>ORB orb;</p>
</blockquote>
<p>geschrieben hatte.<br />
Aber gerade eben scheint es zu funktionieren und ich bin total verwirrt. Zumal ich mir jetzt selber etwas blöd vorkomme, weil ich nicht verstehe, was jetzt anders war.<br />
Ich wollte alle Fälle probieren und euch die Fehlermeldungen posten und nun kommt keine. Das ärgert mich.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2378387</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2378387</guid><dc:creator><![CDATA[freekickchamp]]></dc:creator><pubDate>Sun, 19 Jan 2014 20:36:44 GMT</pubDate></item></channel></rss>