This commit is contained in:
Star Brilliant 2014-06-15 15:35:27 +08:00
parent f9576e81de
commit 61e4682a05

View File

@ -536,7 +536,7 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, width, height):
try: try:
scaleXY = FOV/(FOV+trZ) scaleXY = FOV/(FOV+trZ)
except ZeroDivisionError: except ZeroDivisionError:
logging.error('Rotation makes object behind the camera: trZ == %.0f' % trZ); logging.error('Rotation makes object behind the camera: trZ == %.0f' % trZ)
scaleXY = 1 scaleXY = 1
trX = (trX-width/2)*scaleXY+width/2 trX = (trX-width/2)*scaleXY+width/2
trY = (trY-height/2)*scaleXY+height/2 trY = (trY-height/2)*scaleXY+height/2
@ -544,7 +544,7 @@ def ConvertFlashRotation(rotY, rotZ, X, Y, width, height):
scaleXY = -scaleXY scaleXY = -scaleXY
outX += 180 outX += 180
outY += 180 outY += 180
logging.error('Rotation makes object behind the camera: trZ == %.0f < %.0f' % (trZ, FOV)); logging.error('Rotation makes object behind the camera: trZ == %.0f < %.0f' % (trZ, FOV))
return (trX, trY, WrapAngle(outX), WrapAngle(outY), WrapAngle(outZ), scaleXY*100, scaleXY*100) return (trX, trY, WrapAngle(outX), WrapAngle(outY), WrapAngle(outZ), scaleXY*100, scaleXY*100)
@ -713,7 +713,7 @@ def ConvertColor(RGB, width=1280, height=576):
if width < 1280 and height < 576: if width < 1280 and height < 576:
return '%02X%02X%02X' % (B, G, R) return '%02X%02X%02X' % (B, G, R)
else: # VobSub always uses BT.601 colorspace, convert to BT.709 else: # VobSub always uses BT.601 colorspace, convert to BT.709
ClipByte = lambda x: 255 if x > 255 else 0 if x < 0 else round(x); ClipByte = lambda x: 255 if x > 255 else 0 if x < 0 else round(x)
return '%02X%02X%02X' % ( return '%02X%02X%02X' % (
ClipByte(R*0.00956384088080656+G*0.03217254540203729+B*0.95826361371715607), ClipByte(R*0.00956384088080656+G*0.03217254540203729+B*0.95826361371715607),
ClipByte(R*-0.10493933142075390+G*1.17231478191855154+B*-0.06737545049779757), ClipByte(R*-0.10493933142075390+G*1.17231478191855154+B*-0.06737545049779757),