Displaying 3 results from an estimated 3 matches for "ycbcr2rgb".
2009 Jun 16
2
YCbCr <-> RGB conversion question
...conversion, both using
floating point numbers and using integer arithmetics, code is
attached.
Let's say I want to convert from RGB to YCbCr and back. First the
integer arithmetics:
In [1]: from colors import *
In [2]: a = [255, 0, 255]
In [3]: RGB2YCbCr(a)
Out[3]: (107, 202, 222)
In [4]: YCbCr2RGB(RGB2YCbCr(a))
Out[4]: array([255, 1, 255])
As you can see, the G component was increased from 0 to 1. Those
routines are the same as here:
http://msdn.microsoft.com/en-us/library/ms893078.aspx
Now let's try floating point conversions:
In [3]: RGB2YCbCr_precise(a)
Out[3]: array([106, 202,...
2009 Jun 14
3
python bindings to libtheora
...s.scipy.org/doc/scipy/reference/tutorial/ndimage.html
Also here is a script to show the image in matplotlib:
In [1]: from theora import Theora
In [2]: a = Theora("bbb_theora_325kbit.ogv")
In [3]: a.seek(10)
In [4]: A = a.get_frame_array()
In [5]: import pylab
In [6]: pylab.imshow(a.YCbCr2RGB(A))
Out[6]: <matplotlib.image.AxesImage object at 0x44e3510>
In [7]: pylab.show()
[and a window pops up with the image]
So as you can see, it's very trivial to open the ogv file and then
interactively play with it in Python, retreive the data as an arary
and then do all kinds of things...
2010 Jan 21
0
python-theora: some comments
...yx
index 4abca20..78722be 100644
--- a/theora.pyx
+++ b/theora.pyx
@@ -678,7 +678,7 @@ cdef class Theora:
<Image.Image instance at 0x...>
"""
- from scipy.misc import toimage
+ from scipy.misc.pilutil import toimage
return toimage(self.YCbCr2RGB(self.get_frame_array()), channel_axis=2)
def read_headers(self):
and was then able to run
#!/usr/bin/python
import theora
import sys
t = theora.Theora(sys.argv[1])
t.seek(frame=1200)
img = t.get_frame...