Beispiel #1
0
void
GL::EnableColorWrites()
{
  MOZ_ASSERT(IsCurrent());

  if (mColorWritesEnabled) {
    return;
  }

  ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
  mColorWritesEnabled = true;
}
Beispiel #2
0
void
GL::DisableColorWrites()
{
  MOZ_ASSERT(IsCurrent());

  if (!mColorWritesEnabled) {
    return;
  }

  ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
  mColorWritesEnabled = false;
}
Beispiel #3
0
std::ostream& operator << ( std::ostream& os, const Global* global )
{
    Global reference;
    reference._setupDefaults(); // ignore environment variables

    os << co::base::disableFlush << co::base::disableHeader
       << "#Equalizer " << global->getConfigFAttribute( Config::FATTR_VERSION )
       << " ascii" << std::endl << std::endl
       << "global" << std::endl
       << '{' << co::base::indent << std::endl;

    for( uint32_t i=0; i<ConnectionDescription::IATTR_ALL; ++i )
    {
        const int value = global->_connectionIAttributes[i];
        if( value == reference._connectionIAttributes[i] )
            continue;

        const std::string& name = ConnectionDescription::getIAttributeString( 
            static_cast<ConnectionDescription::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' );
                
        switch( i )
        { 
            case ConnectionDescription::IATTR_TYPE:
                os << static_cast< co::ConnectionType >( value );
                break;
            default:
                os << value;
        }
        os << std::endl;
    }

    for( uint32_t i=0; i<ConnectionDescription::SATTR_ALL; ++i )
    {
        const std::string& value = global->_connectionSAttributes[i];
        if( value == reference._connectionSAttributes[i] )
            continue;

        const std::string& name = ConnectionDescription::getSAttributeString( 
            static_cast<ConnectionDescription::SAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << "\"" << value << "\"" << std::endl;
    }

    for( uint32_t i=0; i<Config::FATTR_ALL; ++i )
    {
        if( i == Config::FATTR_VERSION )
            continue;

        const float value = global->_configFAttributes[i];
        if( value == reference._configFAttributes[i] )
            continue;

        const std::string& name = Config::getFAttributeString( 
            static_cast<Config::FAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << value << std::endl;
    }

    for( uint32_t i=0; i<Config::IATTR_ALL; ++i )
    {
        const int32_t value = global->_configIAttributes[i];
        if( value == reference._configIAttributes[i] )
            continue;

        const std::string& name = Config::getIAttributeString( 
            static_cast<Config::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << static_cast< fabric::IAttribute >( value ) << std::endl;
    }

    for( uint32_t i=0; i<Node::SATTR_ALL; ++i )
    {
        const std::string& value = global->_nodeSAttributes[i];
        if( value == reference._nodeSAttributes[i] )
            continue;

        const std::string& name = Node::getSAttributeString( 
            static_cast<Node::SAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << "\"" << value << "\"" << std::endl;
    }

    for( uint32_t i=0; i<Node::CATTR_ALL; ++i )
    {
        const char value = global->_nodeCAttributes[i];
        if( value == reference._nodeCAttributes[i] )
            continue;

        const std::string& name = Node::getCAttributeString( 
            static_cast<Node::CAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << "'" << value << "'" << std::endl;
    }

    for( uint32_t i=0; i < Node::IATTR_ALL; ++i )
    {
        const int32_t value = global->_nodeIAttributes[i];
        if( value == reference._nodeIAttributes[i] )
            continue;

        const std::string& name = Node::getIAttributeString( 
            static_cast<Node::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << static_cast< fabric::IAttribute >( value ) << std::endl;
    }

    for( uint32_t i=0; i<Pipe::IATTR_ALL; ++i )
    {
        const int value = global->_pipeIAttributes[i];
        if( value == reference._pipeIAttributes[i] )
            continue;

        const std::string& name = Pipe::getIAttributeString( 
            static_cast<Pipe::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << static_cast< fabric::IAttribute >( value ) << std::endl;
    }

    for( uint32_t i=0; i<Window::IATTR_ALL; ++i )
    {
        const int value = global->_windowIAttributes[i];
        if( value == reference._windowIAttributes[i] )
            continue;

        const std::string& name = Window::getIAttributeString( 
            static_cast<Window::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << static_cast< fabric::IAttribute >( value ) << std::endl;
    }

    for( uint32_t i=0; i<Channel::IATTR_ALL; ++i )
    {
        const int value = global->_channelIAttributes[i];
        if( value == reference._channelIAttributes[i] )
            continue;

        const std::string& name = Channel::getIAttributeString(
            static_cast<Channel::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' )
           << static_cast< fabric::IAttribute >( value ) << std::endl;
    }

    for( uint32_t i=0; i<Compound::IATTR_ALL; ++i )
    {
        const int value = global->_compoundIAttributes[i];
        if( value == reference._compoundIAttributes[i] )
            continue;

        const std::string& name = Compound::getIAttributeString(
            static_cast<Compound::IAttribute>( i ));
        os << name << std::string( GLOBAL_ATTR_LENGTH - name.length(), ' ' );

        switch( i )
        {
            case Compound::IATTR_STEREO_MODE:
                os << static_cast< fabric::IAttribute >( value ) << std::endl;
                break;

            case Compound::IATTR_STEREO_ANAGLYPH_LEFT_MASK:
            case Compound::IATTR_STEREO_ANAGLYPH_RIGHT_MASK:
                os << ColorMask( value ) << std::endl;
                break;

            default:
                EQASSERTINFO( 0, "unimplemented" );
        }
    }

    os << co::base::exdent << '}' << std::endl
       << co::base::enableHeader << co::base::enableFlush;
    return os;
}
IplImage* BouyBaseObject::GetMask(const IplImage * imgIn, IplImage * debugOut) const
{
    if(imgIn == NULL) return NULL;
    IplImage* colormask = NULL;
    IplImage* gvcolormask = NULL;
    //IplImage* shapemask = ShapeMask(imgIn);
    IplImage* segmentationmask = NULL;
    IplImage* histogrammask = NULL;
    //IplImage* edgemask = EdgeMask(imgIn);
    IplImage* templatemask = NULL;

//        if(colormask == NULL  || shapemask == NULL ||
//           segmentationmask== NULL || histogrammask == NULL ||
//           edgemask == NULL ) return NULL;

    //cvShowImage("colormask", colormask);
    //cvShowImage("channelmask", channelmask);
    IplImage * imgOut = cvCreateImage(cvGetSize(imgIn),IPL_DEPTH_8U, 1);
    IplImage * threshold = cvCreateImage(cvGetSize(imgIn),IPL_DEPTH_8U, 1);
    cvZero(imgOut);
    if(mEnableHist)
    {
        histogrammask = HistogramMask(imgIn);
    }
    if(mEnableColor)
    {
        colormask = ColorMask(imgIn);
    }
    if(mEnableSegment)
    {
         segmentationmask = SegmentationMask(imgIn);
    }
    if(mEnableGVColor)
    {
         gvcolormask = GVColorMask(imgIn);
    }
    int count = 1;
    if(VisionUtils::CombineMasks(imgOut,histogrammask,imgOut,count,mHistWeight))
    {
        count++;
    }
    if(VisionUtils::CombineMasks(imgOut,colormask,imgOut, count, mColorWeight))
    {
        count++;
    }
    if(VisionUtils::CombineMasks(imgOut,segmentationmask,imgOut,count,mSegmentWeight))
    {
        count++;
    }
    if(VisionUtils::CombineMasks(imgOut,gvcolormask,imgOut,count,mGVColorWeight))
    {
        count++;
    }


    //VisionUtils::CombineMasks(imgOut,edgemask,imgOut,2,1);
    //VisionUtils::CombineMasks(imgOut,histogrammask,imgOut,2,1);
    cvNormalize(imgOut,imgOut,255,0,CV_MINMAX);
    if(mDebug)
    {
        cvShowImage("combined", imgOut);
    }
    cvThreshold(imgOut,threshold,mMainThreshold,255,CV_THRESH_BINARY );
    std::list<CvBox2D> blobList;
    blobList = Zebulon::Vision::VisionUtils::GetBlobBoxes(threshold,0,mMinNoiseSizePercent);
    for(std::list<CvBox2D>::iterator it = blobList.begin(); it != blobList.end(); it++)
    {
        CvPoint2D32f boxCorners32[4];
        CvPoint boxCorners[4];
        cvBoxPoints(*it,boxCorners32);
        for(int i = 0; i < 4; i ++)
        {
            boxCorners[i] = cvPointFrom32f(boxCorners32[i]);
        }
        cvFillConvexPoly(threshold,boxCorners,4,cvScalar(0,0,0),4);
        //Zebulon::Vision::VisionUtils::DrawSquare(imgOut,*it);
    }
    //shapemask = FindCircles(imgOut);
    imgOut = TemplateMask(imgOut, threshold, mTemplate);
    //VisionUtils::CombineMasks(imgOut,templatemask,imgOut);
    if(mDebug)
    {
        cvShowImage("clean", threshold);
        cvShowImage("final", imgOut);
        cvShowImage("color", colormask);
        cvShowImage("hist", histogrammask);
        cvShowImage("segment", segmentationmask);
        cvShowImage("template", templatemask);
        cvShowImage("gvcolor", gvcolormask);
    }
    cvReleaseImage(&colormask);
    //cvReleaseImage(&shapemask);
    cvReleaseImage(&segmentationmask);
    cvReleaseImage(&histogrammask);
    cvReleaseImage(&gvcolormask);
    //cvReleaseImage(&edgemask);
    return imgOut;
}
Beispiel #5
0
ColorMask *ColorMask::getOrCreate(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
{
    return getOrCreateImpl(ColorMask(red, green, blue, alpha));
}