本文整理汇总了Python中GafferImageTest.processTiles方法的典型用法代码示例。如果您正苦于以下问题:Python GafferImageTest.processTiles方法的具体用法?Python GafferImageTest.processTiles怎么用?Python GafferImageTest.processTiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GafferImageTest
的用法示例。
在下文中一共展示了GafferImageTest.processTiles方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testShaderNetworkGeneratedInGlobalContext
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testShaderNetworkGeneratedInGlobalContext( self ) :
constant = GafferImage.Constant()
outLayer = GafferOSL.OSLCode()
outLayer["out"]["layer"] = GafferOSL.ClosurePlug(
direction = Gaffer.Plug.Direction.Out,
flags = Gaffer.Plug.Flags.Default | Gaffer.Plug.Flags.Dynamic
)
outLayer["code"].setValue( 'layer = outLayer( "", color( 0, 1, 0) )' )
outImage = GafferOSL.OSLShader()
outImage.loadShader( "ImageProcessing/OutImage" )
outImage["parameters"]["in0"].setInput( outLayer["out"]["layer"] )
oslImage = GafferOSL.OSLImage()
oslImage["in"].setInput( constant["out"] )
oslImage["shader"].setInput( outImage["out"] )
with Gaffer.ContextMonitor( outImage) as cm :
GafferImageTest.processTiles( oslImage["out"] )
cs = cm.combinedStatistics()
self.assertEqual( cs.numUniqueContexts(), 1 )
self.assertNotIn( "image:tileOrigin", cs.variableNames() )
self.assertNotIn( "image:channelName", cs.variableNames() )
示例2: __writeImage
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def __writeImage( self, script, args ) :
import GafferImage
import GafferImageTest
image = script.descendant( args["image"].value )
if isinstance( image, Gaffer.Node ) :
image = next( ( x for x in image.children( GafferImage.ImagePlug ) ), None )
if image is None :
IECore.msg( IECore.Msg.Level.Error, "stats", "Image \"%s\" does not exist" % args["image"].value )
return
if args["preCache"].value :
GafferImageTest.processTiles( image )
memory = _Memory.maxRSS()
with _Timer() as imageTimer :
with self.__performanceMonitor or _NullContextManager(), self.__contextMonitor or _NullContextManager() :
GafferImageTest.processTiles( image )
self.__timers["Image generation"] = imageTimer
self.__memory["Image generation"] = _Memory.maxRSS() - memory
self.__memory["OIIO cache limit"] = _Memory( GafferImage.OpenImageIOReader.getCacheMemoryLimit() )
self.__memory["OIIO cache usage"] = _Memory( GafferImage.OpenImageIOReader.cacheMemoryUsage() )
items = [
( "Format", image["format"].getValue() ),
( "Data window", image["dataWindow"].getValue() ),
( "Channel names", image["channelNames"].getValue() ),
]
self.__output.write( "\nImage :\n\n" )
self.__writeItems( items )
示例3: __printImage
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def __printImage( self, script, args ) :
import GafferImage
import GafferImageTest
image = script.descendant( args["image"].value )
if isinstance( image, Gaffer.Node ) :
image = next( ( x for x in image.children( GafferImage.ImagePlug ) ), None )
if image is None :
IECore.msg( IECore.Msg.Level.Error, "stats", "Image \"%s\" does not exist" % args["image"].value )
return
memory = _Memory.maxRSS()
with _Timer() as sceneTimer :
with self.__performanceMonitor or _NullContextManager() :
GafferImageTest.processTiles( image )
self.__timers["Image generation"] = sceneTimer
self.__memory["Image generation"] = _Memory.maxRSS() - memory
items = [
( "Format", image["format"].getValue() ),
( "Data window", image["dataWindow"].getValue() ),
( "Channel names", image["channelNames"].getValue() ),
]
print "\nImage :\n"
self.__printItems( items )
示例4: testCancellation
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testCancellation( self ) :
c = GafferImage.Constant()
r = GafferImage.Resample()
r["in"].setInput( c["out"] )
r["filterScale"].setValue( imath.V2f( 2000 ) )
bt = Gaffer.ParallelAlgo.callOnBackgroundThread( r["out"], lambda : GafferImageTest.processTiles( r["out"] ) )
# Give background tasks time to get into full swing
time.sleep( 0.1 )
# Check that we can cancel them in reasonable time
acceptableCancellationDelay = 0.25 if "TRAVIS" not in os.environ else 4.0
t = time.time()
bt.cancelAndWait()
self.assertLess( time.time() - t, acceptableCancellationDelay )
# Check that we can do the same when using a non-separable filter
r["filter"].setValue( "disk" )
bt = Gaffer.ParallelAlgo.callOnBackgroundThread( r["out"], lambda : GafferImageTest.processTiles( r["out"] ) )
time.sleep( 0.1 )
t = time.time()
bt.cancelAndWait()
self.assertLess( time.time() - t, acceptableCancellationDelay )
示例5: testParallelProcessEmptyDataWindow
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testParallelProcessEmptyDataWindow( self ) :
d = GafferImage.Display()
self.assertEqual( d["out"]["dataWindow"].getValue(), imath.Box2i() )
GafferImageTest.processTiles( d["out"] )
d["out"].image()
d["out"].imageHash()
示例6: testSamplerBoundsViolationCrash
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testSamplerBoundsViolationCrash( self ) :
c = GafferImage.Constant()
c["format"].setValue( GafferImage.Format( 3792, 3160 ) )
r = GafferImage.Resize()
r["in"].setInput( c["out"] )
r["format"].setValue( GafferImage.Format( 1920, 1080 ) )
r["fitMode"].setValue( r.FitMode.Vertical )
GafferImageTest.processTiles( r["out"] )
示例7: testDownsizingSamplerBounds
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testDownsizingSamplerBounds( self ) :
c = GafferImage.Constant()
c["format"].setValue( GafferImage.Format( 50, 53 ) )
r = GafferImage.Resize()
r["in"].setInput( c["out"] )
r["fitMode"].setValue( r.FitMode.Distort )
# Downsize to every single size smaller than the input,
# to check for sampler bounds violations similar to those
# which motivated the test above.
for width in range( 1, 50 ) :
for height in range( 1, 53 ) :
r["format"].setValue( GafferImage.Format( width, height ) )
GafferImageTest.processTiles( r["out"] )
示例8: testNegativeDataWindowOrigin
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testNegativeDataWindowOrigin( self ) :
reader = GafferImage.ImageReader()
reader["fileName"].setValue( os.path.dirname( __file__ ) + "/images/checker.exr" )
constant = GafferImage.Constant()
constant["color"].setValue( imath.Color4f( 0.5, 0, 0, 1 ) )
offset = GafferImage.Offset()
offset["in"].setInput( constant["out"] )
offset["offset"].setValue( imath.V2i( -200, -250 ) )
vectorWarp = GafferImage.VectorWarp()
vectorWarp["in"].setInput( reader["out"] )
vectorWarp["vector"].setInput( offset["out"] )
GafferImageTest.processTiles( vectorWarp["out"] )
示例9: testCrashWithResizedInput
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def testCrashWithResizedInput( self ) :
b = GafferImage.Constant()
b["format"].setValue( GafferImage.Format( 2048, 1556 ) )
bResized = GafferImage.Resize()
bResized["in"].setInput( b["out"] )
bResized["format"].setValue( GafferImage.Format( 1920, 1080 ) )
bResized["fitMode"].setValue( bResized.FitMode.Fit )
a = GafferImage.Constant()
a["format"].setValue( GafferImage.Format( 1920, 1080 ) )
merge = GafferImage.Merge()
merge["operation"].setValue( merge.Operation.Over )
merge["in"][0].setInput( bResized["out"] )
merge["in"][1].setInput( a["out"] )
GafferImageTest.processTiles( merge["out"] )
示例10: computeImage
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def computeImage() :
with self.__context( script, args ) as context :
for frame in self.__frames( script, args ) :
context.setFrame( frame )
GafferImageTest.processTiles( image )
示例11: processer
# 需要导入模块: import GafferImageTest [as 别名]
# 或者: from GafferImageTest import processTiles [as 别名]
def processer() :
try :
GafferImageTest.processTiles( g["out"] )
except Exception, e :
exceptions.append( e )