コード例 #1
0
    def set_data_cost(self, unary):
        """Set unary potentials, unary should be a matrix of size
        nb_sites x nb_labels. unary can be either integers or float"""

        if (self.nb_sites, self.nb_labels) != unary.shape:
            raise ShapeMismatchError(
                "Shape of unary potentials does not match the graph.")

        # Just a reference
        self._unary = self._convert_unary_array(unary)
        _cgco.gcoSetDataCost(self.handle, self._unary)
コード例 #2
0
ファイル: pygco.py プロジェクト: jgera/Segmentation-Code
    def setDataCost(self, unary):
        """Set unary potentials, unary should be a matrix of size 
        numSites x numLabels. unary can be either integers or float"""
        
        if (self.numSites, self.numLabels) != unary.shape:
            raise ShapeMismatchError(
                    "Shape of unary potentials does not match the graph.")

        # Just a reference
        self._unary = self._convertUnaryArray(unary)
        _cgco.gcoSetDataCost(self.handle, self._unary)