<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="pt-BR">
	<id>http://wiki.nosdigitais.teia.org.br/index.php?action=history&amp;feed=atom&amp;title=AHTcode</id>
	<title>AHTcode - Histórico de revisão</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.nosdigitais.teia.org.br/index.php?action=history&amp;feed=atom&amp;title=AHTcode"/>
	<link rel="alternate" type="text/html" href="http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;action=history"/>
	<updated>2026-04-20T22:10:36Z</updated>
	<subtitle>Histórico de revisões para esta página neste wiki</subtitle>
	<generator>MediaWiki 1.39.0</generator>
	<entry>
		<id>http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;diff=3079&amp;oldid=prev</id>
		<title>V1z em 13h28min de 15 de setembro de 2011</title>
		<link rel="alternate" type="text/html" href="http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;diff=3079&amp;oldid=prev"/>
		<updated>2011-09-15T13:28:34Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pt-BR&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Edição anterior&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Edição das 10h28min de 15 de setembro de 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l434&quot;&gt;Linha 434:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linha 434:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pode comentar, se precisar de me contatar veja meus contatos [[Nivaldo Bondança|aqui]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pode comentar, se precisar de me contatar veja meus contatos [[Nivaldo Bondança|aqui]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:Lab Macambira]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>V1z</name></author>
	</entry>
	<entry>
		<id>http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;diff=3066&amp;oldid=prev</id>
		<title>Hick209 em 23h23min de 14 de setembro de 2011</title>
		<link rel="alternate" type="text/html" href="http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;diff=3066&amp;oldid=prev"/>
		<updated>2011-09-14T23:23:50Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;pt-BR&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Edição anterior&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Edição das 20h23min de 14 de setembro de 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l1&quot;&gt;Linha 1:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Linha 1:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Aí está o código, na íntegra&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Aí está o código, na íntegra&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;lt;i&gt; Em Breve: &amp;lt;/i&gt; More comments!&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Hick209</name></author>
	</entry>
	<entry>
		<id>http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;diff=3039&amp;oldid=prev</id>
		<title>Hick209: Nova página: Aí está o código, na íntegra  &lt;pre&gt; /*     Programa esqueleto da AirHackTable  */  #include &quot;opencv/highgui.h&quot; #include &quot;opencv/cv.h&quot; #include &lt;stdio.h&gt;   using namespace cv;   voi...</title>
		<link rel="alternate" type="text/html" href="http://wiki.nosdigitais.teia.org.br/index.php?title=AHTcode&amp;diff=3039&amp;oldid=prev"/>
		<updated>2011-09-13T00:13:13Z</updated>

		<summary type="html">&lt;p&gt;Nova página: Aí está o código, na íntegra  &amp;lt;pre&amp;gt; &lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Programa esqueleto da AirHackTable: &lt;/span&gt;  #include &amp;quot;opencv/highgui.h&amp;quot; #include &amp;quot;opencv/cv.h&amp;quot; #include &amp;lt;stdio.h&amp;gt;   using namespace cv;   voi...&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nova&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Aí está o código, na íntegra&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
    Programa esqueleto da AirHackTable&lt;br /&gt;
 */&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;opencv/highgui.h&amp;quot;&lt;br /&gt;
#include &amp;quot;opencv/cv.h&amp;quot;&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using namespace cv;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
void pausef(void);&lt;br /&gt;
&lt;br /&gt;
class ColorHistogram&lt;br /&gt;
{&lt;br /&gt;
private:&lt;br /&gt;
    int histSize[3];&lt;br /&gt;
    float hranges[2];&lt;br /&gt;
    const float* ranges[3];&lt;br /&gt;
    int channels[3];&lt;br /&gt;
public:&lt;br /&gt;
    ColorHistogram()&lt;br /&gt;
    {&lt;br /&gt;
        // Prepare arguments for a color histogram&lt;br /&gt;
        histSize[0]= histSize[1]= histSize[2]= 256;&lt;br /&gt;
        hranges[0]= 0.0;    // BRG range&lt;br /&gt;
        hranges[1]= 255.0;&lt;br /&gt;
        ranges[0]= hranges; // all channels have the same range&lt;br /&gt;
        ranges[1]= hranges;&lt;br /&gt;
        ranges[2]= hranges;&lt;br /&gt;
        channels[0]= 0;     // the three channels&lt;br /&gt;
        channels[1]= 1;&lt;br /&gt;
        channels[2]= 2;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    cv::MatND getHistogram(const cv::Mat &amp;amp;image)&lt;br /&gt;
    {&lt;br /&gt;
        cv::MatND hist;&lt;br /&gt;
        // Compute histogram&lt;br /&gt;
        cv::calcHist(&amp;amp;image,&lt;br /&gt;
                     1,         // histogram of 1 image only&lt;br /&gt;
                     channels,  // the channel used&lt;br /&gt;
                     cv::Mat(), // no mask is used&lt;br /&gt;
                     hist,      // the resulting histogram&lt;br /&gt;
                     3,         // it is a 3D histogram&lt;br /&gt;
                     histSize,  // number of bins&lt;br /&gt;
                     ranges     // pixel value range&lt;br /&gt;
                    );&lt;br /&gt;
        return hist;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
// Computes the 1D Hue histogram with a mask.&lt;br /&gt;
// BGR source image is converted to HSV&lt;br /&gt;
// Pixels with low saturation are ignored&lt;br /&gt;
    cv::MatND getHueHistogram(const cv::Mat &amp;amp;image,&lt;br /&gt;
                              int minSaturation=0)&lt;br /&gt;
    {&lt;br /&gt;
        cv::MatND hist;&lt;br /&gt;
&lt;br /&gt;
        // Convert to HSV color space&lt;br /&gt;
        cv::Mat hsv;&lt;br /&gt;
        cv::cvtColor(image, hsv, CV_BGR2HSV);&lt;br /&gt;
&lt;br /&gt;
        // Mask to be used (or not)&lt;br /&gt;
        cv::Mat mask;&lt;br /&gt;
        if (minSaturation&amp;gt;0)&lt;br /&gt;
        {&lt;br /&gt;
            // Spliting the 3 channels into 3 images&lt;br /&gt;
            std::vector&amp;lt;cv::Mat&amp;gt; v;&lt;br /&gt;
            cv::split(hsv,v);&lt;br /&gt;
&lt;br /&gt;
            // Mask out the low saturated pixels&lt;br /&gt;
            cv::threshold(v[1],mask,minSaturation,255,&lt;br /&gt;
                          cv::THRESH_BINARY);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        // Prepare arguments for a 1D hue histogram&lt;br /&gt;
        hranges[0]= 0.0;&lt;br /&gt;
        hranges[1]= 180.0;&lt;br /&gt;
        channels[0]= 0; // the hue channel&lt;br /&gt;
&lt;br /&gt;
        // Compute histogram&lt;br /&gt;
        cv::calcHist(&amp;amp;hsv,&lt;br /&gt;
                     1,         // histogram of 1 image only&lt;br /&gt;
                     channels,  // the channel used&lt;br /&gt;
                     mask,      // binary mask&lt;br /&gt;
                     hist,      // the resulting histogram&lt;br /&gt;
                     1,         // it is a 1D histogram&lt;br /&gt;
                     histSize,  // number of bins&lt;br /&gt;
                     ranges     // pixel value range&lt;br /&gt;
                    );&lt;br /&gt;
&lt;br /&gt;
        return hist;&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
class ContentFinder&lt;br /&gt;
{&lt;br /&gt;
private:&lt;br /&gt;
    float hranges[2];&lt;br /&gt;
    const float* ranges[3];&lt;br /&gt;
    int channels[3];&lt;br /&gt;
    float threshold;&lt;br /&gt;
    cv::MatND histogram;&lt;br /&gt;
public:&lt;br /&gt;
    ContentFinder() : threshold(-1.0f)&lt;br /&gt;
    {&lt;br /&gt;
        ranges[0]= hranges; // all channels have same range&lt;br /&gt;
        ranges[1]= hranges;&lt;br /&gt;
        ranges[2]= hranges;&lt;br /&gt;
    }&lt;br /&gt;
    // Sets the threshold on histogram values [0,1]&lt;br /&gt;
    void setThreshold(float t)&lt;br /&gt;
    {&lt;br /&gt;
        threshold= t;&lt;br /&gt;
    }&lt;br /&gt;
    // Gets the threshold&lt;br /&gt;
    float getThreshold()&lt;br /&gt;
    {&lt;br /&gt;
        return threshold;&lt;br /&gt;
    }&lt;br /&gt;
    // Sets the reference histogram&lt;br /&gt;
    void setHistogram(const MatND&amp;amp; h)&lt;br /&gt;
    {&lt;br /&gt;
        histogram= h;&lt;br /&gt;
        cv::normalize(histogram,histogram,1.0);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Mat find(const cv::Mat&amp;amp; image)&lt;br /&gt;
    {&lt;br /&gt;
        Mat result;&lt;br /&gt;
&lt;br /&gt;
        hranges[0]= 0.0;	// range [0,255]&lt;br /&gt;
        hranges[1]= 255.0;&lt;br /&gt;
        channels[0]= 0;		// the three channels&lt;br /&gt;
        channels[1]= 1;&lt;br /&gt;
        channels[2]= 2;&lt;br /&gt;
&lt;br /&gt;
        cv::calcBackProject(&amp;amp;image,&lt;br /&gt;
                            1,            // one image&lt;br /&gt;
                            channels,     // vector specifying what histogram dimensions belong to what image channels&lt;br /&gt;
                            histogram,    // the histogram we are using&lt;br /&gt;
                            result,       // the resulting back projection image&lt;br /&gt;
                            ranges,       // the range of values, for each dimension&lt;br /&gt;
                            255.0         // the scaling factor is chosen such that a histogram value of 1 maps to 255&lt;br /&gt;
                           );&lt;br /&gt;
&lt;br /&gt;
        // Threshold back projection to obtain a binary image&lt;br /&gt;
        if (threshold&amp;gt;0.0)&lt;br /&gt;
            cv::threshold(result, result, 255*threshold, 255, cv::THRESH_BINARY);&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    Mat find(const cv::Mat&amp;amp; image, float minValue, float maxValue, int *channels, int dim) {&lt;br /&gt;
&lt;br /&gt;
		cv::Mat result;&lt;br /&gt;
&lt;br /&gt;
		hranges[0]= minValue;&lt;br /&gt;
		hranges[1]= maxValue;&lt;br /&gt;
&lt;br /&gt;
		for (int i=0; i&amp;lt;dim; i++)&lt;br /&gt;
			this-&amp;gt;channels[i]= channels[i];&lt;br /&gt;
&lt;br /&gt;
//  NOT USING THIS PART&lt;br /&gt;
//		if (isSparse) { // call the right function based on histogram type&lt;br /&gt;
//&lt;br /&gt;
//		   cv::calcBackProject(&amp;amp;image,&lt;br /&gt;
//                      1,            // we only use one image at a time&lt;br /&gt;
//                      channels,     // vector specifying what histogram dimensions belong to what image channels&lt;br /&gt;
//                      shistogram,   // the histogram we are using&lt;br /&gt;
//                      result,       // the resulting back projection image&lt;br /&gt;
//                      ranges,       // the range of values, for each dimension&lt;br /&gt;
//                      255.0         // the scaling factor is chosen such that a histogram value of 1 maps to 255&lt;br /&gt;
//		   );&lt;br /&gt;
//&lt;br /&gt;
//		} else {&lt;br /&gt;
&lt;br /&gt;
		   cv::calcBackProject(&amp;amp;image,&lt;br /&gt;
                      1,            // we only use one image at a time&lt;br /&gt;
                      channels,     // vector specifying what histogram dimensions belong to what image channels&lt;br /&gt;
                      histogram,    // the histogram we are using&lt;br /&gt;
                      result,       // the resulting back projection image&lt;br /&gt;
                      ranges,       // the range of values, for each dimension&lt;br /&gt;
                      255.0         // the scaling factor is chosen such that a histogram value of 1 maps to 255&lt;br /&gt;
		   );&lt;br /&gt;
//		}&lt;br /&gt;
&lt;br /&gt;
        // Threshold back projection to obtain a binary image&lt;br /&gt;
		if (threshold&amp;gt;0.0)&lt;br /&gt;
			cv::threshold(result, result, 255*threshold, 255, cv::THRESH_BINARY);&lt;br /&gt;
&lt;br /&gt;
		return result;&lt;br /&gt;
	}&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
// AirHackTable&lt;br /&gt;
class AHT&lt;br /&gt;
{&lt;br /&gt;
private:&lt;br /&gt;
//    int pad;&lt;br /&gt;
#define TAM 1&lt;br /&gt;
#define PAD 15&lt;br /&gt;
    // amount of circles to be detected&lt;br /&gt;
    ContentFinder circleFinder;&lt;br /&gt;
    ColorHistogram hist;&lt;br /&gt;
    Point circleCenter;&lt;br /&gt;
    Point circleCenter2;&lt;br /&gt;
&lt;br /&gt;
    void sharpen(Mat &amp;amp;image)&lt;br /&gt;
    {&lt;br /&gt;
        // Construct kernel (all entries initialized to 0)&lt;br /&gt;
        Mat kernel(3,3,CV_32F,Scalar(0));&lt;br /&gt;
&lt;br /&gt;
        // assigns kernel values&lt;br /&gt;
        kernel.at&amp;lt;float&amp;gt;(1,1)= 5.0;&lt;br /&gt;
        kernel.at&amp;lt;float&amp;gt;(0,1)= -1.0;&lt;br /&gt;
        kernel.at&amp;lt;float&amp;gt;(2,1)= -1.0;&lt;br /&gt;
        kernel.at&amp;lt;float&amp;gt;(1,0)= -1.0;&lt;br /&gt;
        kernel.at&amp;lt;float&amp;gt;(1,2)= -1.0;&lt;br /&gt;
&lt;br /&gt;
        // filter the image&lt;br /&gt;
        filter2D( image, image, image.depth(), kernel);&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void colorReduce(Mat &amp;amp;image, int div=64)&lt;br /&gt;
    {&lt;br /&gt;
        int nl = image.rows; // number of lines&lt;br /&gt;
        // total number of elements per line&lt;br /&gt;
        int nc = image.cols * image.channels();&lt;br /&gt;
        for (int j = 0; j &amp;lt; nl; j++)&lt;br /&gt;
        {&lt;br /&gt;
            // get the address of row j&lt;br /&gt;
            uchar* data = image.ptr&amp;lt;uchar&amp;gt;(j);&lt;br /&gt;
            for (int i = 0; i &amp;lt; nc; i++)&lt;br /&gt;
            {&lt;br /&gt;
                data[i] = data[i]/div*div + div/2;&lt;br /&gt;
            } // end of line&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
public:&lt;br /&gt;
    Mat process(Mat &amp;amp;image)&lt;br /&gt;
    {&lt;br /&gt;
        Mat result, thres;&lt;br /&gt;
&lt;br /&gt;
        flip( image, image, 1 );&lt;br /&gt;
&lt;br /&gt;
        sharpen( image );&lt;br /&gt;
&lt;br /&gt;
        colorReduce( image, 32 );&lt;br /&gt;
&lt;br /&gt;
        cvtColor( image, result, CV_RGB2GRAY );&lt;br /&gt;
&lt;br /&gt;
        equalizeHist( result, result );&lt;br /&gt;
&lt;br /&gt;
//        Canny( result, result, 0, 255);&lt;br /&gt;
&lt;br /&gt;
        GaussianBlur( result, result, Size(7,7) , 3);&lt;br /&gt;
&lt;br /&gt;
//        threshold( result, thres, 110, 255, CV_THRESH_BINARY);&lt;br /&gt;
&lt;br /&gt;
//        result += thres/10;&lt;br /&gt;
&lt;br /&gt;
        return result;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
// old version, not using anymore&lt;br /&gt;
// it is still here so I can use its code&lt;br /&gt;
    void findCircles(Mat &amp;amp;image, Mat result, int minSaturation=0)&lt;br /&gt;
    {&lt;br /&gt;
        circleFinder.setThreshold(0.05f);&lt;br /&gt;
&lt;br /&gt;
//        pad = 15;&lt;br /&gt;
&lt;br /&gt;
        double count, sx[TAM] = { 0 }, sy[TAM] = { 0 };&lt;br /&gt;
&lt;br /&gt;
        // holds the detected circles&lt;br /&gt;
        vector&amp;lt;Vec3f&amp;gt; circles;&lt;br /&gt;
&lt;br /&gt;
        HoughCircles( result( Rect( PAD, PAD, result.cols-PAD, result.rows-PAD) ), circles, CV_HOUGH_GRADIENT, 1.65, 32);&lt;br /&gt;
&lt;br /&gt;
// TODO&lt;br /&gt;
        // To be improved&lt;br /&gt;
        for( size_t i = 0, count = 0; i &amp;lt; circles.size() &amp;amp;&amp;amp; count &amp;lt; TAM; i++, count++ )&lt;br /&gt;
        {&lt;br /&gt;
            Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));&lt;br /&gt;
&lt;br /&gt;
//            if ( (center.x - sx[count] &amp;lt; 5) &amp;amp;&amp;amp; ( center.y - sy[count] &amp;lt; 5) )&lt;br /&gt;
            {&lt;br /&gt;
                Mat ROI = image( Rect( center.x-PAD, center.y-PAD, 2*PAD, 2*PAD ) );&lt;br /&gt;
                circleFinder.setHistogram(hist.getHueHistogram(ROI, minSaturation));&lt;br /&gt;
&lt;br /&gt;
//                hist = f.find(image);&lt;br /&gt;
//                hist += f.find(image);&lt;br /&gt;
&lt;br /&gt;
                circle( image, Point(center.x+PAD, center.y+PAD) , 19, 255, 2 );&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            sx[count] = center.x;&lt;br /&gt;
            sy[count] = center.y;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void getCircles(Mat image, Mat result, int minSaturation=0)&lt;br /&gt;
    {&lt;br /&gt;
        // holds the detected circles&lt;br /&gt;
        vector&amp;lt;Vec3f&amp;gt; circles;&lt;br /&gt;
&lt;br /&gt;
        HoughCircles( result( Rect( PAD, PAD, result.cols-PAD, result.rows-PAD) ), circles, CV_HOUGH_GRADIENT, 1.65, 32);&lt;br /&gt;
&lt;br /&gt;
// TODO&lt;br /&gt;
        if( circles.size() )&lt;br /&gt;
        {&lt;br /&gt;
            Point center(cvRound(circles[0][0]), cvRound(circles[0][1]));&lt;br /&gt;
&lt;br /&gt;
            Mat ROI = image( Rect( center.x-PAD, center.y-PAD, 2*PAD, 2*PAD ) );&lt;br /&gt;
            circleFinder.setHistogram(hist.getHueHistogram(ROI, minSaturation));&lt;br /&gt;
&lt;br /&gt;
            circleCenter = center;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
// not using yet&lt;br /&gt;
    void nextPosition(Mat image, int minSaturation=0)&lt;br /&gt;
    {&lt;br /&gt;
        Mat hsv;&lt;br /&gt;
        // Convert to HSV space&lt;br /&gt;
        cvtColor( image, hsv, CV_BGR2HSV );&lt;br /&gt;
&lt;br /&gt;
        std::vector&amp;lt;Mat&amp;gt; v;&lt;br /&gt;
        // Split the image&lt;br /&gt;
        split( hsv, v );&lt;br /&gt;
&lt;br /&gt;
        // Identify pixels with low saturation&lt;br /&gt;
        threshold( v[1], v[1], minSaturation, 255, THRESH_BINARY );&lt;br /&gt;
&lt;br /&gt;
        int ch[1]={0};&lt;br /&gt;
        // Get back-projection of hue histogram&lt;br /&gt;
        Mat result = circleFinder.find( hsv, 0.0f, 180.0f, ch,1 );&lt;br /&gt;
&lt;br /&gt;
        // Eliminate low stauration pixels&lt;br /&gt;
        bitwise_and( result, v[1], result );&lt;br /&gt;
&lt;br /&gt;
        Rect rect(circleCenter.x+PAD,circleCenter.y+PAD,1,1);&lt;br /&gt;
//        rectangle(image, rect, cv::Scalar(0,0,255));&lt;br /&gt;
&lt;br /&gt;
        TermCriteria criteria( cv::TermCriteria::MAX_ITER, 10, 0.01 );&lt;br /&gt;
&lt;br /&gt;
        meanShift( result, rect, criteria );&lt;br /&gt;
&lt;br /&gt;
        circleCenter2.x = rect.x;&lt;br /&gt;
        circleCenter2.y = rect.y;&lt;br /&gt;
//        return result;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    void drawCircle(Mat &amp;amp;image)&lt;br /&gt;
    {&lt;br /&gt;
        if( circleCenter.x != 0 )&lt;br /&gt;
            circle( image, Point(circleCenter.x+PAD, circleCenter.y+PAD) , 19, 255, 2 );&lt;br /&gt;
        if( circleCenter2.x != 0 )&lt;br /&gt;
            circle( image, Point(circleCenter2.x, circleCenter2.y) , 19, 0, 2 );&lt;br /&gt;
    }&lt;br /&gt;
};&lt;br /&gt;
&lt;br /&gt;
int main( int argc, char** argv )&lt;br /&gt;
{&lt;br /&gt;
    char c;&lt;br /&gt;
    int minSat = 65;&lt;br /&gt;
&lt;br /&gt;
    namedWindow( &amp;quot;player&amp;quot;, 0 );&lt;br /&gt;
//    namedWindow( &amp;quot;mod&amp;quot;, 0 );&lt;br /&gt;
//    namedWindow( &amp;quot;Histogram&amp;quot;, 0 );&lt;br /&gt;
&lt;br /&gt;
    CvCapture *cam;&lt;br /&gt;
&lt;br /&gt;
    if( argc != 2 )&lt;br /&gt;
        cam = cvCreateCameraCapture(0);&lt;br /&gt;
//    else&lt;br /&gt;
//        cam.open( string(argv[1]) )&lt;br /&gt;
    Mat frame, modframe;&lt;br /&gt;
&lt;br /&gt;
    AHT image;&lt;br /&gt;
&lt;br /&gt;
    while(1)&lt;br /&gt;
    {&lt;br /&gt;
        // gets the next frame&lt;br /&gt;
        frame = cvQueryFrame(cam);&lt;br /&gt;
&lt;br /&gt;
        if(!frame.data) break;&lt;br /&gt;
&lt;br /&gt;
        modframe = image.process(frame);&lt;br /&gt;
&lt;br /&gt;
        // look for the circles&lt;br /&gt;
//        image.findCircles(frame, modframe);&lt;br /&gt;
        if( c == 'g' )&lt;br /&gt;
            image.getCircles(frame, modframe, minSat);&lt;br /&gt;
        if( c == 'n' )&lt;br /&gt;
            image.nextPosition(frame, minSat);&lt;br /&gt;
&lt;br /&gt;
        image.drawCircle(frame);&lt;br /&gt;
&lt;br /&gt;
        // show results&lt;br /&gt;
//        imshow(&amp;quot;Histogram&amp;quot;, hist);&lt;br /&gt;
        imshow( &amp;quot;player&amp;quot;, frame );&lt;br /&gt;
//        imshow( &amp;quot;mod&amp;quot;, modframe );&lt;br /&gt;
&lt;br /&gt;
        c = cvWaitKey(3);&lt;br /&gt;
        //  c == ESC&lt;br /&gt;
        if( c == 27 ) break;&lt;br /&gt;
        else if( c == ' ' || c == 'p' ) pausef();&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    destroyWindow(&amp;quot;player&amp;quot;);&lt;br /&gt;
//    destroyWindow(&amp;quot;mod&amp;quot;);&lt;br /&gt;
//    destroyWindow(&amp;quot;Histogram&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
    return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
void pausef()&lt;br /&gt;
{&lt;br /&gt;
    char c = 0;&lt;br /&gt;
    while( c != 'p' &amp;amp;&amp;amp; c != ' ' )&lt;br /&gt;
        c = cvWaitKey(0);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Pode comentar, se precisar de me contatar veja meus contatos [[Nivaldo Bondança|aqui]]&lt;/div&gt;</summary>
		<author><name>Hick209</name></author>
	</entry>
</feed>