ShareCG Main Forums
   >> Open Discussion
Thread views: 37529 View all threadsNext thread*Threaded Mode

giulia_87
(Stranger)
06/07/11 03:36 AM
poserpython Report this article as Inappropriate to us !!!Login to Reply

Does anyone know how saving the rendering of  an image into an array and not on file? thanks





adp__
(Journeyman)
06/10/11 05:34 PM
Re: poserpython new [re: giulia_87]Report this article as Inappropriate to us !!!Login to Reply

poser.Scene().CopyToClipboard() is what I use to get Posers current displays into PIL for further processing.





giulia_87
(Stranger)
06/13/11 06:51 AM
Re: poserpython new [re: adp__]Report this article as Inappropriate to us !!!Login to Reply

Thanks for the previous information. Let me know how can I then "reload" the image; I'll explain: I am writing an algorithm that at each iteration move some parts of the body of the actor, then it renders the current scene in order to obtain an image.I save this image into a file and then I open it to use it as an array of pixels. Here is the code :


actorFig=TheFig.Actor("waist")
actorFig.ParameterByCode(poser.kParmCodeYROT).SetValue(xloc[0])
actorFig=TheFig.Actor("Right Forearm")
actorFig.ParameterByCode(poser.kParmCodeYROT).SetValue(xloc[1])


scene.Render()
scene.SaveImage("bmp","C:\Documents and Settings\posizionefin.bmp")
immagine2 = Image.open('C:\Documents and Settings\posizionefin.bmp')
pix2 = immagine2.load()



How can I do the same thing without saving a file? Thanks





adp__
(Journeyman)
06/13/11 08:35 AM
Re: poserpython new [re: giulia_87]Report this article as Inappropriate to us !!!Login to Reply

Is there a special reason why you don't want a saved copy?

How an inmage copied to the clipboad can be used depends on the graphic-lib you are using.
I use PIL (Python Image Library). PIL supports windows clipboard and is included in Poser 8. For previous versions of Poser one can install it manually for use in Poser-Python.



giulia_87
(Stranger)
06/15/11 12:50 AM
Re: poserpython new [re: adp__]Report this article as Inappropriate to us !!!Login to Reply

I would not save a copy of each image as this slows the algorithm. So I want to be able to directly access the memory that is the image after the render to be able to work as an array of pixels. Thanks





adp__
(Member)
06/15/11 02:06 AM
Re: poserpython new [re: giulia_87]Report this article as Inappropriate to us !!!Login to Reply

My test on modern hardware says, there is no notably difference for a couple of saved images of size up to 1024x768. For bigger images it may be a good idea to not use files.

I do a "real-time" preview of Posers main-window in another program via file exchange every time something has changed. This works pretty smooth even over a local network.



giulia_87
(Stranger)
07/11/11 07:04 AM
Re: poserpython new [re: adp__]Report this article as Inappropriate to us !!!Login to Reply

Hi!!


Thanks for the previous informations;I succeded in my purpose. Another question: my program renders the scene with 807x544 pixels, how to render less pixels, in order to make the program faster?


Thanks





adp__
(Member)
07/11/11 08:10 AM
Re: poserpython new [re: giulia_87]Report this article as Inappropriate to us !!!Login to Reply

Try:

poser.Scene().SetOutputRes(, )

Maybe you want to have a look at my python site at http://www.poserprofis.de/python

One of the scripts there creates a Poser-Python docu in HTML right for the Poser version you're using.



giulia_87
(Stranger)
07/12/11 12:04 AM
Re: poserpython new [re: adp__]Report this article as Inappropriate to us !!!Login to Reply

Thanks for the info, I have been a great help.





giulia_87
(Stranger)
07/13/11 12:31 AM
Re: poserpython new [re: giulia_87]Report this article as Inappropriate to us !!!Login to Reply

Hi!


I have a question: I'm making an algoritm that moves the parts of body of rayn casual in order to put him in a certain position. I'm notice that I have problem of convergence with the "left parts " of body, such as left shin,left shoulder,and so on..


Is there a special reason for this behavior?


thanks






View all threadsNext thread*Threaded Mode
Jump to

 

GENEQ



© 2024 Internet Business Systems, Inc.
670 Aberdeen Way, Milpitas, CA 95035
+1 (408) 882-6554 — Contact Us
ShareCG™ is a trademark of Internet Business Systems, Inc.

Report a Bug Report Abuse Make a Suggestion About Privacy Policy Contact Us User Agreement Advertise