cgkit-user Mailing List for Python Computer Graphics Kit (Page 2)
Brought to you by:
mbaas
You can subscribe to this list here.
2005 |
Jan
(1) |
Feb
|
Mar
(2) |
Apr
(1) |
May
(3) |
Jun
(3) |
Jul
|
Aug
|
Sep
(2) |
Oct
(3) |
Nov
|
Dec
(7) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(48) |
Jun
(14) |
Jul
(9) |
Aug
(5) |
Sep
|
Oct
(3) |
Nov
(7) |
Dec
(6) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
(7) |
Apr
(15) |
May
(12) |
Jun
(7) |
Jul
(24) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(20) |
May
(3) |
Jun
(4) |
Jul
(10) |
Aug
(21) |
Sep
(1) |
Oct
(5) |
Nov
|
Dec
(3) |
2009 |
Jan
(7) |
Feb
(4) |
Mar
(7) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(3) |
Oct
(4) |
Nov
|
Dec
(7) |
2010 |
Jan
(2) |
Feb
(6) |
Mar
|
Apr
(2) |
May
(7) |
Jun
(4) |
Jul
|
Aug
(6) |
Sep
(6) |
Oct
(4) |
Nov
(7) |
Dec
(2) |
2011 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
(8) |
May
|
Jun
(3) |
Jul
(3) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
(1) |
Feb
(9) |
Mar
(8) |
Apr
(7) |
May
(3) |
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
|
2013 |
Jan
(3) |
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(7) |
Nov
(3) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(2) |
Jul
(9) |
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2016 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
|
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Baptiste L. <bap...@gm...> - 2013-11-18 19:21:58
|
Good evening, I am trying to use CGKIT for python 2.7 on my computer which is running ubuntu 13.04 64 bits, but I have some issues with libboost dependencies. In fact the problem, is not when installing cgkit, but when using it, due to libboost dependencies. Below is the error I got: bat@bat-UX32VD:~/00PythonSoftware/FreeKiteSim/3D_Viewer$ ./FreeKiteViewer.sh Traceback (most recent call last): File "/usr/local/bin/viewer.py", line 63, in <module> from cgkit.all import * File "/usr/local/lib/python2.7/dist-packages/cgkit/all/__init__.py", line 46, in <module> from cgkit import _core ImportError: libboost_python-py27.so.1.46.1: cannot open shared object file: No such file or directory I can install libboost-python1.49 and libboost-python1.53 from ubuntu repository but not 1.46.1 I am using 64 bit. bat@bat-UX32VD:~$ uname -a Linux bat-UX32VD 3.8.3-030803-generic #201303141650 SMP Thu Mar 14 20:51:08 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Has anybody suceeded in installing it on 13.04? What would be the best steps? Many thanks, Baptiste LABAT PS: due to this problem, I am switching to html5 webgl, but cgkit is still in use in many python projects. |
From: Timothy W. G. <tim...@si...> - 2013-10-16 21:34:13
|
Hello Folks! In an earlier post I mentioned how I achieved success at displaying video in a PyQt4 widget by converting a numpy array into a QImage through the use of qimage2ndarray . Now I'm trying to play the audio from the video's audio stream, and I'm getting another headache; I don't see many tutorials around for how to use cgkit.mediafile for this. Any suggestions? My initial attempts look something like the following but without any sound. I'm not worrying about syncing or playing at proper speed for now; just trying to get some noise through my speakers! Best regards, Tim Grove ## reader = //cgkit.mediafile.Media_Read object ## stream = //cgkit.mediafile.AudioStream object format = QAudioFormat() format.setSampleRate(self.stream.sampleRate) format.setChannelCount(self.stream.numChannels) ## unsure of arguments for next 4 lines - example values taken from www format.setCodec("audio/pcm") format.setSampleSize(16) format.setByteOrder(QAudioFormat.LittleEndian) format.setSampleType(QAudioFormat.SignedInt) ## The 'theory' behind the following is to read audio data into a buffer for output through ## my system's (Windows 7, 32-bit) default audio device output = QAudioOutput(QAudioDeviceInfo.defaultOutputDevice(), format) buffer = QBuffer() buffer.open(QIODevice.ReadWrite) for data in reader.iterData([stream]): buffer.write(QByteArray(data.samples)) self.output.start(buffer) ## finished buffer.close() output.stop() reader.close() |
From: Timothy W. G. <tim...@si...> - 2013-10-16 21:03:00
|
Just to say that I've had some success in displaying videos with cgkit.mediafile, thanks to https://github.com/hmeine/qimage2ndarray. I didn't succeed at installing/compiling it from source myself, but thanks to the work of Christoph Gohlke, there are Windows installers for Python2.6 through 3.3 available at http://www.lfd.uci.edu/~gohlke/pythonlibs/#qimage2ndarray. I had to back off from using PyQt4.10 to PyQt4.9, but that was a small price to pay for success! Instead of my failed attempts to load a QImage from a QByteArray (below), I can do the following now: qimage = qimage2ndarray.array2qimage(ndArray) ## ndArray from /class /cgkit.mediafile.VideoData.numpyArray Just to add that in my case I also had to flip and rotate the array 90 degrees for it to display correctly; otherwise it was sideways and reversed. Video display solved; now if I can only figure out how to play the audio stream ... Best regards, Tim Grove On 10/10/2013 21:32, Matthias Baas wrote: > On 09.10.13 23:30, Timothy W. Grove wrote: >> Anyone with successful experience of using cgkit.mediafile with PyQt4 >> and Python3 ? >> [...] >> # convert ndArray into a QByteArray NOTE: is this correct ??? >> byteArray = QByteArray(ndArray.data.tobytes()) >> img.fromData(byteArray) > I have never tried passing an image from mediafile to PyQt, so I can't > give you a working example, but I believe the above fromData() call > expects an encoded image file, not the raw image data. So you could use > it if you had a jpg image, for example, but for passing raw data, you > would have to use one of the constructors that take a raw data pointer > (at least if you were using C++). I'm not sure if/how that is exposed in > Python though. > > Cheers, > > - Matthias - > > |
From: Timothy W. G. <tim...@si...> - 2013-10-11 12:57:18
|
Dear Matt, Thanks for your reply. Comments below. On 10/10/2013 21:32, Matthias Baas wrote: > On 09.10.13 23:30, Timothy W. Grove wrote: >> Anyone with successful experience of using cgkit.mediafile with PyQt4 >> and Python3 ? >> [...] >> # convert ndArray into a QByteArray NOTE: is this correct ??? >> byteArray = QByteArray(ndArray.data.tobytes()) >> img.fromData(byteArray) > I have never tried passing an image from mediafile to PyQt, so I can't > give you a working example, but I believe the above fromData() call > expects an encoded image file, not the raw image data. I've found a program which should convert a numpy array into a QImage (https://github.com/hmeine/qimage2ndarray), so I'll give that a try if I can ever get it installed! (sip problems :-} ) > So you could use > it if you had a jpg image, for example, but for passing raw data, you > would have to use one of the constructors that take a raw data pointer > (at least if you were using C++). I'm not sure if/how that is exposed in > Python though. I've only ever worked with FFmpeg as a standalone executable, launching it in a python subprocess. Awhile ago I experimented with exporting video frames as jpg files (or png? can't remember) and then loading them back into a QLabel for display. The results were better than I expected but I abandoned the idea thinking that this was an inefficient and heavy handed approach compared to working more directly with the frames themselves. But is it really? No need to reply to that, but if you do have any comments I'd be interested. Best regards, Tim > > Cheers, > > - Matthias - > > |
From: Matthias B. <mat...@gm...> - 2013-10-10 20:32:57
|
On 09.10.13 23:30, Timothy W. Grove wrote: > Anyone with successful experience of using cgkit.mediafile with PyQt4 > and Python3 ? > [...] > # convert ndArray into a QByteArray NOTE: is this correct ??? > byteArray = QByteArray(ndArray.data.tobytes()) > img.fromData(byteArray) I have never tried passing an image from mediafile to PyQt, so I can't give you a working example, but I believe the above fromData() call expects an encoded image file, not the raw image data. So you could use it if you had a jpg image, for example, but for passing raw data, you would have to use one of the constructors that take a raw data pointer (at least if you were using C++). I'm not sure if/how that is exposed in Python though. Cheers, - Matthias - |
From: Matthias B. <mat...@gm...> - 2013-10-10 20:29:18
|
Hi Timothy, On 09.10.13 10:14, Timothy W. Grove wrote: > I realize that cgkit.ffmpeg is built around an older version of FFmpeg > and I've downloaded the shared libraries for v0.7.1 for Win32 from > http://ffmpeg.zeranoe.com/builds/win32/shared/. I'm not that familiar > with ctypes yet, but is it a HUGE task to build this module for a more > current version of FFmpeg? I'd like to update as I actually cannot run it myself at the moment because meanwhile I also have a newer version of ffmpeg. But the entire approach is probably not such a good idea anyway as it's too hard to maintain. In the past, the ffmpeg API has changed quite a lot and you would have to track their changes constantly which I don't have the time to do. Furthermore, if using ctypes, it's not enough if ffmpeg stays source code compatible, it would have to stay binary compatible which is even less likely. So I'm not sure if I should actually keep those ffmpeg bindings in cgkit. > ## Determine required buffer size and allocate buffer > numBytes = > ffmpeg.avcodec.avpicture_get_size(ffmpeg.decls.PIX_FMT_RGB24, > codecCtx.contents.width, codecCtx.contents.height) > buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); ## not > converted into python yet; still c > > This last line is where I get stuck since I'm not sure how to translate > the C into Python; "buffer = av_malloc(numBytes)" perhaps? In any case, > [...] I also would have referred you to the mediafile module which already does what you need, so you could have a look inside that one. As I noticed from your other mail, you have found that module already. :) - Matthias - |
From: Timothy W. G. <tim...@si...> - 2013-10-09 22:30:48
|
Anyone with successful experience of using cgkit.mediafile with PyQt4 and Python3 ? Since I'm working with Python 3 the use of PIL Images isn't available to me (or is it?), so I'm attempting to paint a video frame to a QImage instead. Below is an attempt to do so with the first frame from a sample video found in Windows 7, but no joy yet. Any ideas are most welcome. Best regards, Tim Grove import sys from PyQt4.QtCore import * from PyQt4.QtGui import * from cgkit import mediafile import numpy as np if __name__ == '__main__': app = QApplication(sys.argv) ## setup widgets to display video frames widget = QWidget(None) widget.resize(QSize(400, 300)) videoLabel = QLabel(widget) videoLabel.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) videoLabel.setPixmap(QPixmap(QSize(400, 300))) layout = QVBoxLayout() layout.addWidget(videoLabel) widget.setLayout(layout) widget.show() fileName = "C:\\Users\\Public\\Videos\\Sample Videos\\Wildlife.wmv" vid = mediafile.open(fileName) # open file frame = next(vid.iterData()) # get data for first frame # Get the current video frame as a numpy.ndarray. ndArray = frame.numpyArray() w = ndArray.shape[0] h = ndArray.shape[1] # paint data into a QImage img = QImage(w, h, QImage.Format_RGB32) img.ndarray = ndArray # keep ndArray for image; NOTE: necessary??? # convert ndArray into a QByteArray NOTE: is this correct ??? byteArray = QByteArray(ndArray.data.tobytes()) img.fromData(byteArray) # convert QImage to a QPixmap and paint it into the video QLabel videoLabel.pixmap().convertFromImage(img) ## NOTE: NOTHING HAPPENS !!! vid.close() #close file sys.exit(app.exec_()) |
From: Timothy W. G. <tim...@si...> - 2013-10-09 09:15:04
|
Thanks for including the ffmpeg module within cgkit. For awhile I've been using FFmpeg as a standalone executable; now I'd like to get my hands a little 'dirtier' and learn how to work more directly with audio/video frames. I'm programming with Python 3.3.2 and PyQt4 on Windows 7 and OS X 10.8. I realize that cgkit.ffmpeg is built around an older version of FFmpeg and I've downloaded the shared libraries for v0.7.1 for Win32 from http://ffmpeg.zeranoe.com/builds/win32/shared/. I'm not that familiar with ctypes yet, but is it a HUGE task to build this module for a more current version of FFmpeg? Cgkit.ffmpeg seems to be working okay for me with the FFmpeg libraries that I've downloaded, but I have a couple of questions on how to use it. I'm following an FFmeg tutorial which I've found at http://dranger.com/ffmpeg/ffmpeg.html. It's based on C code, but I'm doing my best to translate it into Python. My results so far follow with some comments/questions further down the page. from cgkit import ffmpeg ffmpeg.avformat.av_register_all() fileName = "C:\\Users\\Public\\Videos\\Sample Videos\\Wildlife.wmv" formatCtx = ffmpeg.avformat.av_open_input_file(fileName, format=None, buf_size=0, params=None) ffmpeg.avformat.av_find_stream_info(formatCtx) codecCtx = ffmpeg.decls.AVCodecContext() ##Find the first video stream videoStream = -1 for i in range(formatCtx.nb_streams): if formatCtx.streams[i].contents.codec.contents.codec_type == ffmpeg.decls.CODEC_TYPE_VIDEO: videoStream = i break ## Get a pointer to the codec context for the video stream codecCtx = formatCtx.streams[videoStream].contents.codec ## Find the decoder for the video stream pCodec = ffmpeg.avcodec.avcodec_find_decoder(codecCtx.contents.codec_id) if pCodec is None: print("Unsupported codec!\n") ## Open codec ffmpeg.avcodec.avcodec_open(codecCtx.contents, pCodec) ## Allocate video frame pFrameRGB = ffmpeg.avcodec.avcodec_alloc_frame() ## Determine required buffer size and allocate buffer numBytes = ffmpeg.avcodec.avpicture_get_size(ffmpeg.decls.PIX_FMT_RGB24, codecCtx.contents.width, codecCtx.contents.height) buffer = (uint8_t *)av_malloc(numBytes*sizeof(uint8_t)); ## not converted into python yet; still c This last line is where I get stuck since I'm not sure how to translate the C into Python; "buffer = av_malloc(numBytes)" perhaps? In any case, I can't find the function "av_malloc" within the cgkit.ffmpeg module. A friend suggested "avpicture_alloc" since it both calculates the picture size and allocates its space. So this is what I would use to replace the last section of code above: picture = ffmpeg.decls.AVPicture() ffmpeg.avcodec.avpicture_alloc(picture, ffmpeg.decls.PIX_FMT_RGB24, codecCtx.contents.width, codecCtx.contents.height) This works okay, but the next step in the Dranger tutorial requires a pointer to the buffer I would have created above. Would there be a pointer to this required buffer somewhere else? // Assign appropriate parts of buffer to image planes in pFrameRGB // Note that pFrameRGB is anAVFrame <http://dranger.com/ffmpeg/data.html#AVFrame>, but AVFrame is a superset // ofAVPicture <http://dranger.com/ffmpeg/data.html#AVPicture> avpicture_fill <http://dranger.com/ffmpeg/functions.html#avpicture_fill>((AVPicture <http://dranger.com/ffmpeg/data.html#AVPicture> *)pFrameRGB, buffer, PIX_FMT_RGB24, pCodecCtx->width, pCodecCtx->height); This Dranger tutorial is teaching me alot but I'm guessing that it is probably working with a different FFmpeg version than cgkit.ffmpeg and I'm also finding that much of the C code doesn't translate directly into Python. Still, its a good place to start. Any other tutorials that you would suggest? My friend also pointed out that there was a 'higher-level' module in cgkit for working with ffmpeg, 'cgkit.mediafile', so I'm going to have a look at that also. Thanks for any comments. Best regards, Tim Grove |
From: Matthias B. <mat...@gm...> - 2013-02-20 22:47:26
|
Hi, On 20.02.13 05:04, A Read wrote: > Im trying to use the ply file importer (its the only one i can find for > python) just to access the vertices for further processing with other > modules. > > i do this... > > from cgkit.all import * > importer = cgkit.plyimport.PLYImporter() > importer.importFile("test.1.ply") > b = cgkit.worldobject.WorldObject(name="test.1") > > and b exists but b.geom is None With your last line you are creating a *new* WorldObject instance. Try running listWorld() after your command and you should see two objects. By default, WorldObjects have no geometry which is why b.geom is None. To get a reference to an existing object, you have to use the worldObject() function. Two more notes, instead of using importer plugins directly, the preferred method would be to use the load() function and as you imported everything into your namespace you don't need the module prefixes. So an updated version of the above would be this: from cgkit.all import * load("test.1.ply") b = worldObject("test.1") # b.geom should now be a PolyhedronGeom object containing your model Cheers, - Matthias - |
From: A R. <are...@gm...> - 2013-02-20 05:04:43
|
Hi, Im new to CGkit so this could be a very simple question. Im trying to use the ply file importer (its the only one i can find for python) just to access the vertices for further processing with other modules. i do this... from cgkit.all import * importer = cgkit.plyimport.PLYImporter() importer.importFile("test.1.ply") b = cgkit.worldobject.WorldObject(name="test.1") and b exists but b.geom is None ive modified importFile to return the Polyhedron which gives me the geometry i expected. It would be nice to know how to use this properly. Thanks A |
From: Matthias B. <mat...@gm...> - 2013-02-17 14:41:11
|
Finally, I managed to get a new release out. You can now download v2.0.0 binaries for OSX (32/64bit, Intel) or Windows (32bit only, unfortunately) or source archives for either Python 2.x or Python 3.x. Besides support for Python 3, the package does not depend on PyProtocols anymore which should make it a bit easier to get it running. The new release contains a number of smaller fixes and enhancements that have accumulated over time. See the changelog for a full list. - Matthias - |
From: Jonathan P. <jon...@gm...> - 2013-01-18 18:10:54
|
On 09/01/2013 23:11, Matthias Baas wrote: > Hi Jonathan, > > On 08.01.13 11:08, Jonathan Peirce wrote: >> So... I've built libavformat, libavcodec, ffmpeg etc. and these seem to >> be found/imported successfully by cgkit.ffmpeg but when I try to load my >> movie file I'm getting an erroneous error message about the file not >> being found: >> >> >>> from ffmpeg import findlib, avformat #I've dragged your ffmpeg to a >> separate loc >> >>> print os.path.isfile('jwpIntro.mov') >> True >> >>> ff = avformat.av_open_input_file('jwpIntro.mov') >> Traceback (most recent call last): >> File "/Users/jwp/Desktop/cgKit_ffmpeg.py", line 7, in <module> >> ff = avformat.av_open_input_file('jwpIntro.mov') >> File "/Users/jwp/code/ffmpeg/avformat.py", line 142, in >> av_open_input_file >> raise AVFormatError(ret) >> ffmpeg.avformat.AVFormatError: No such file or directory >> >> I'm a bit stumped about how to debug this further. Any idea what would >> cause the message? > First of all, those ffmpeg wrappers are quite experimental at this stage > and for the next release I have actually removed them from the docs and > the changelog. > The wrappers were built against a particular version of ffmpeg (I > believe it was 0.7 which I got from MacPorts) and currently, they won't > work with 1.0, for example. > > So, the first thing to check is the version of ffmpeg you have > installed. You can actually use the bindings to query the version. Every > module has a function such as avcodec_version() which will return the > version as reported by the dynamic library. In ffmpeg.cppdefs you will > find the version numbers of the ffmpeg libs that the wrappers were built > against (LIBAVCODEC_VERSION_MAJOR|MINOR|MACRO, etc.). > I don't actually know what the policy of the ffmpeg guys is concerning > version numbers, but I guess once the major version number gets > increased there is probably some API change which will break any wrappers. > > The wrappers probably need to be regenerated for the version you are > using and depending on the API changes, the mediafile module (which is > supposed to provide high-level access to audio/video files) needs to be > updated as well. > > Cheers, > > - Matthias - > OK, it turns out the erroneous error message about the file not existing was caused by me not doing av_register_all() first - just a lisleading message in the lib. My ffmpeg is v0.8.5 and seems to work on the few things I've tried. So your wrapping work has definitely been useful - there are lots of half-baked or non-working ffmpeg wrappers around ;-) And mediafile is also useful for me. Converting frames into numpy/PIL was the next job I was going to have to do - looks like I won't have to :-) thanks Jon -- Jonathan Peirce Nottingham Visual Neuroscience http://www.peirce.org.uk/ |
From: Matthias B. <mat...@gm...> - 2013-01-09 23:11:38
|
Hi Jonathan, On 08.01.13 11:08, Jonathan Peirce wrote: > So... I've built libavformat, libavcodec, ffmpeg etc. and these seem to > be found/imported successfully by cgkit.ffmpeg but when I try to load my > movie file I'm getting an erroneous error message about the file not > being found: > > >>> from ffmpeg import findlib, avformat #I've dragged your ffmpeg to a > separate loc > >>> print os.path.isfile('jwpIntro.mov') > True > >>> ff = avformat.av_open_input_file('jwpIntro.mov') > Traceback (most recent call last): > File "/Users/jwp/Desktop/cgKit_ffmpeg.py", line 7, in <module> > ff = avformat.av_open_input_file('jwpIntro.mov') > File "/Users/jwp/code/ffmpeg/avformat.py", line 142, in > av_open_input_file > raise AVFormatError(ret) > ffmpeg.avformat.AVFormatError: No such file or directory > > I'm a bit stumped about how to debug this further. Any idea what would > cause the message? First of all, those ffmpeg wrappers are quite experimental at this stage and for the next release I have actually removed them from the docs and the changelog. The wrappers were built against a particular version of ffmpeg (I believe it was 0.7 which I got from MacPorts) and currently, they won't work with 1.0, for example. So, the first thing to check is the version of ffmpeg you have installed. You can actually use the bindings to query the version. Every module has a function such as avcodec_version() which will return the version as reported by the dynamic library. In ffmpeg.cppdefs you will find the version numbers of the ffmpeg libs that the wrappers were built against (LIBAVCODEC_VERSION_MAJOR|MINOR|MACRO, etc.). I don't actually know what the policy of the ffmpeg guys is concerning version numbers, but I guess once the major version number gets increased there is probably some API change which will break any wrappers. The wrappers probably need to be regenerated for the version you are using and depending on the API changes, the mediafile module (which is supposed to provide high-level access to audio/video files) needs to be updated as well. Cheers, - Matthias - |
From: Jonathan P. <jon...@no...> - 2013-01-08 11:10:12
|
Hi there, I'm one of the authors of a python app called PsychoPy for presenting stimuli in psychology/neuroscience experiments and I'm looking into the ctypes wrappers that you've built to ffmpeg as a part of cgkit. I Have an opengl-based rendering engine and for movie inputs I currently use avbin as a way to fetch the current frame which I then convert to a texture, but I've had a number of headaches with avbin and looking for alternatives. Right now I'm testing on a mac, but this will ultimately be x-platform. And I'm currently restricted to using 32bit on all platforms for reasons of other dependencies. So... I've built libavformat, libavcodec, ffmpeg etc. and these seem to be found/imported successfully by cgkit.ffmpeg but when I try to load my movie file I'm getting an erroneous error message about the file not being found: >>> from ffmpeg import findlib, avformat #I've dragged your ffmpeg to a separate loc >>> print os.path.isfile('jwpIntro.mov') True >>> ff = avformat.av_open_input_file('jwpIntro.mov') Traceback (most recent call last): File "/Users/jwp/Desktop/cgKit_ffmpeg.py", line 7, in <module> ff = avformat.av_open_input_file('jwpIntro.mov') File "/Users/jwp/code/ffmpeg/avformat.py", line 142, in av_open_input_file raise AVFormatError(ret) ffmpeg.avformat.AVFormatError: No such file or directory I'm a bit stumped about how to debug this further. Any idea what would cause the message? cheers, Jon -- Jonathan Peirce Nottingham Visual Neuroscience http://www.peirce.org.uk This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham. This message has been checked for viruses but the contents of an attachment may still contain software viruses which could damage your computer system: you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation. |
From: Spacecookies <spa...@ho...> - 2012-11-16 10:19:21
|
Hi there, I was just wondering if we could possibly get a new built distribution released... It’s been quite a few years (and a lot of commits!) since the last one (2.0.0 alpha9) was made available. It would also be great if cgkit could install via “pip install cgkit”. I see it’s listed in PyPI (http://pypi.python.org/pypi/Python%20Computer%20Graphics%20Kit%20%28cgkit%29/1.1.0) but that’s rather old and there’s no distribution. Anyway, thanks for the great library! Cheers, Spacecookies |
From: Matthias B. <mat...@gm...> - 2012-09-30 13:41:43
|
Hi Nick, On 30.09.12 11:22, Nick Deboar wrote: > ptc = pointcloud.open("test.ptc", "r", "3delight") > buf = numpy.zeros(shape=(5, 7+ptc.datasize), dtype=numpy.float32) > ptc.readDataPoints(5, buf) > > But I get this error: > > Traceback (most recent call last): > File "C:\ndPtc\ndPtc.py", line 7, in <module> > ptc.readDataPoints(7, buf) > File "C:\Python27\lib\site-packages\cgkit\pointcloud.py", line 325, in readDat > aPoints > pntPtr = _arrayPointer(buffer, pntStride*numPoints) > File "C:\Python27\lib\site-packages\cgkit\pointcloud.py", line 83, in _arrayPo > inter > raise TypeError("Unsupported array type (data pointer is not an int)") > TypeError: Unsupported array type (data pointer is not an int) > > Any ideas? Is this on a 64bit system? Can you run the following snippet in a Python shell: >>> import numpy >>> buf = numpy.zeros(shape=(5, 7), dtype=numpy.float32) >>> type(buf.__array_interface__.get("data")[0]) <type 'int'> My suspicion is that you will get a long type instead of an int. If that's the case and you are in a position to change the cgkit code, you could try to change line 82 in pointcloud.py from if type(data[0]) is not int: to if type(data[0]) not in [int, long]: Let me know if that fixes the problem. Cheers, - Matthias - |
From: Nick D. <nic...@gm...> - 2012-09-30 10:22:20
|
Hey, I tried loading a ptc with the example code: from cgkit.cgtypes import * from cgkit import pointcloud import numpy ptc = pointcloud.open("test.ptc", "r", "3delight") buf = numpy.zeros(shape=(5, 7+ptc.datasize), dtype=numpy.float32) ptc.readDataPoints(5, buf) But I get this error: Traceback (most recent call last): File "C:\ndPtc\ndPtc.py", line 7, in <module> ptc.readDataPoints(7, buf) File "C:\Python27\lib\site-packages\cgkit\pointcloud.py", line 325, in readDat aPoints pntPtr = _arrayPointer(buffer, pntStride*numPoints) File "C:\Python27\lib\site-packages\cgkit\pointcloud.py", line 83, in _arrayPo inter raise TypeError("Unsupported array type (data pointer is not an int)") TypeError: Unsupported array type (data pointer is not an int) Any ideas? I have no problems with this: for p in ptc.iterPoints(): print p But it seems using Numpy arrays will give me a speed boast. Cheers, Nick Deboar |
From: Matthias B. <mat...@gm...> - 2012-05-08 22:40:02
|
Hi Maik, On 07.05.12 15:57, Maik Riechert wrote: > I try to figure out how to do orthographic projection but the only thing > I could find is the RenderMan specific RiProjection(RI_ORTHOGRAPHIC). Is > this the only way? Also, how would I then set the viewing box? Are you talking about rendering a cgkit scene or do you have your own script that produces RIB? So far, there is no orthographic camera in cgkit, so if you are rendering a cgkit scene, you may have to tweak the RIB. If you are producing the RIB yourself, then you would use the RiProjection() call to set an orthographic projection and use regular transformation calls to set up the view transformation. - Matthias - |
From: Maik R. <mai...@ar...> - 2012-05-07 14:57:42
|
Hi, I try to figure out how to do orthographic projection but the only thing I could find is the RenderMan specific RiProjection(RI_ORTHOGRAPHIC). Is this the only way? Also, how would I then set the viewing box? Thanks Maik |
From: Matthias B. <mat...@gm...> - 2012-05-02 22:16:33
|
On 01.05.12 21:57, Alejandro Aguilera Martínez wrote: > $ python tst.py > Traceback (most recent call last): > File "tst.py", line 7, in <module> > print (testmod.err(-1)) > RuntimeError: Test error > > I guess this was expected to throw a seg fault and it didn't. Just after > that I ran "from cgkit.all import *" in a python interpreter and it > threw a seg fault. What should I do now? Well, looks like just throwing an exception is not the problem, there must be some other condition to trigger the segfault and we still need to find what that is. We could now reduce the cgkit module step by step until we reach this very simple example. While doing so, there must be a point where we switch from a module that does not work (current cgkit) to a module that does work (the simple example). When we have found that transition point we might have found the problematic piece of code. But before doing that, let's change the example a little bit so that it actually matches what's done in cgkit. I have attached an updated wrapper.cpp. This version throws a custom exception and registers an exception translator which is also what's done in cgkit. This means instead of receiving a RuntimeError in Python, you should instead see a ValueError. If that example still works, you could try and remove stuff from wrappers/py_wrapper.cpp (which is the main wrapper file). The main function is the one at the bottom which begins with BOOST_PYTHON_MODULE(_core). Initially, you could comment out everything in that function except for the call to class_vec3(). That means, the generated module will only contain the vec3 class. If that results in a module that does not segfault anymore, you could try and add stuff back in step by step and see when the segfault comes back. Cheers, - Matthias - |
From: Matthias B. <mat...@gm...> - 2012-04-29 22:15:22
|
Hi Alejandro, On 28.04.12 19:07, Alejandro Aguilera Martínez wrote: > setup(name = "Exception Test", > ext_modules = [Extension("testmod", ["wrapper.cpp"] > ,include_dirs=["/usr/include/boost"] > ,library_dirs=["/usr/lib"] > ,libraries=["libboost_python-py26.so.1.40.0"] > )] > ) > [...] > g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions > build/temp.linux-i686-2.6/wrapper.o -l libboost_python-py26.so.1.40.0 -o > build/lib.linux-i686-2.6/testmod.so > /usr/bin/ld: cannot find -l libboost_python-py26.so.1.40.0 When the linker searches for libraries that were passed using the -l option, it implicitly prepends the prefix "lib". So in the above case, it actually looks for liblibboost_python-py26.so.1.40.0 The error message is not really helpful here, I agree. Another thing is that it also adds the suffix itself. By default, it will pick a shared library (.so) and fall back to the static library (.a) if the shared library doesn't exist. So the library name you have to pass to the -l option would just be "boost_python-py26" (or "boost_python-mt-py26" or "boost_python" as you have all those on your system. I would suggest picking the same one that was used for building cgkit). > $ python tst.py > Traceback (most recent call last): > File "tst.py", line 5, in <module> > import testmod > ImportError: build/lib.linux-i686-2.6/testmod.so: undefined symbol: > _ZNK5boost6python7objects21py_function_impl_base9max_arityEv This is just a follow-up error. It couldn't find a symbol that is part of Boost.Python. This is not surprising as the linker couldn't find the boost_python library when you built the module. Cheers, - Matthias - |
From: Alejandro A. M. <fe...@gm...> - 2012-04-28 18:07:24
|
Hello again! > Maybe let's try to come up with a minimal example that triggers the > segfault, so that it's easier to investigate. I have attached a tiny > extension module (wrapper.cpp) that only has a single function err() > that will throw an exception when it's called with a negative argument. > If you could compile that one (you will have to adjust the paths in > setup.py) and run tst.py (again, you need to adjust the path to the > module) and let me know if this also triggers a segfault or not. I'm having some problems with this. My setup.py file looks like this: setup(name = "Exception Test", ext_modules = [Extension("testmod", ["wrapper.cpp"] ,include_dirs=["/usr/include/boost"] ,library_dirs=["/usr/lib"] ,libraries=["libboost_python-py26.so.1.40.0"] )] ) But when I run "python setup.py build" I get: running build running build_ext building 'testmod' extension gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/boost -I/usr/include/python2.6 -c wrapper.cpp -o build/temp.linux-i686-2.6/wrapper.o cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions build/temp.linux-i686-2.6/wrapper.o -l libboost_python-py26.so.1.40.0 -o build/lib.linux-i686-2.6/testmod.so /usr/bin/ld: cannot find -l libboost_python-py26.so.1.40.0 collect2: ld returned 1 exit status error: command 'g++' failed with exit status 1 But the file and all the links are there: $ ls /usr/lib/libboost_python* /usr/lib/libboost_python.a /usr/lib/libboost_python-mt-py26.so /usr/lib/libboost_python-py26.so /usr/lib/libboost_python.so /usr/lib/libboost_python-mt-py26.a /usr/lib/libboost_python-py26.a /usr/lib/libboost_python-py26.so.1.40.0 Doing some random searches on the internets I tried to add the dir to the lib, so: ,libraries=["/usr/lib/libboost_python-py26.so.1.40.0"] Then it compiles, but it throws the warning: 'warning: no library file corresponding to '/usr/lib/libboost_python-py26.so.1.40.0' found (skipping) And then when I try to run tst.py I get: $ python tst.py Traceback (most recent call last): File "tst.py", line 5, in <module> import testmod ImportError: build/lib.linux-i686-2.6/testmod.so: undefined symbol: _ZNK5boost6python7objects21py_function_impl_base9max_arityEv I guess all this is not what we are searching for... I'm sorry if I'm missing anything, I'm new to all this. Am I doing something wrong? or is this part of the issue? What do I try now? Thanks, Alejandro |
From: Maik R. <mai...@ar...> - 2012-04-23 11:51:56
|
On 05.04.2012 22:51, Matthias Baas wrote: > In an obj material, the transparency is specified using the "d" > (=dissolve) parameter which is also what's implemented in the > corresponding RenderMan shader in cgkit. So you have to store your alpha > channel as a separate image and set that image as the map_d parameter. > Alternatively, you could grab the generated shader, tweak it and use the > modified version instead of the default one (using a RMMaterial object). Works perfectly, thanks! :) Using a separate alpha map increases rendering time for me from 6s to 8s. But I guess a separate map is the only way here. Maik |
From: Matthias B. <mat...@gm...> - 2012-04-15 15:47:35
|
On 13.04.12 07:46, Alejandro Aguilera Martínez wrote: >> Let me know if this works and I will add this option to the setup script. > > I'm afraid it doesn't work :/ > > I added that line to the config file and recompiled the python wrappers, > but still happens the same. I can see that option in the compiling > process, for example: > > [...] > All the test we did in the last emails give the same thing, seg fault. > > What to do now? Hm, back to square one then. Meanwhile I tried compiling my own version of Python and Boost.Python on Linux (Fedora). I compiled Python 2.6.8 out of the box without any special configuration and the build options then look similar to the ones you have, so no -fexceptions option either. But when I build cgkit against this version, I still don't get the segfault, I just see the exception as expected. Maybe let's try to come up with a minimal example that triggers the segfault, so that it's easier to investigate. I have attached a tiny extension module (wrapper.cpp) that only has a single function err() that will throw an exception when it's called with a negative argument. If you could compile that one (you will have to adjust the paths in setup.py) and run tst.py (again, you need to adjust the path to the module) and let me know if this also triggers a segfault or not. By the way, I could imagine the -fexceptions option had no effect because the wrapper source files use the suffix *.cpp, so gcc already knows that this is C++ source code. - Matthias - |
From: Alejandro A. M. <fe...@gm...> - 2012-04-13 06:47:10
|
El vie, 30-03-2012 a las 11:11 +0100, Matthias Baas escribió: Hello! And sorry (again) for the very late answer. > Looks like we are close. To set that option, you have to add the > following line to your config.cfg: > > CC_ARGS += ["-fexceptions"] > > (see this page in the docs if you haven't used a config file before: > http://cgkit.sourceforge.net/doc2/building.html#building-from-the-sources) > > Then you should rebuild the wrappers. Simply delete the build directory > and run the setup script again. It's not necessary to rebuild the C++ > support lib, the config file only affects the wrappers. > > Let me know if this works and I will add this option to the setup script. I'm afraid it doesn't work :/ I added that line to the config file and recompiled the python wrappers, but still happens the same. I can see that option in the compiling process, for example: gcc -pthread -fno-strict-aliasing -DNDEBUG -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DBOOST_PYTHON_MAX_ARITY=18 -Isupportlib/include -I/usr/include/python2.6 -c wrappers/rply/py_rply_write.cpp -o build/temp.linux-i686-2.6/wrappers/rply/py_rply_write.o -fexceptions cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ All the test we did in the last emails give the same thing, seg fault. What to do now? Thanks, Alejandro |