If we just give low-level access to the buffer, the first thing anyone 
will 
do is write 
basic pixel opsin Python anyway. 
Generally speaking, in the progression of 2.5, we could just give a very low 
level api,
and see what python classes are written and the eventually convert them 
into C. 
However that would be frustrating to the user community, so if we could 
pre-plan this,
it would be wonderful - so thanks for asking!

My desire for the API is for both pixel and region operations. 

At the Pixel level, I immediately think of the compositing nodes and pynodes in 
that area. 
Comparing a pixel to see if it falls into a value range, and finding the list 
of pixels that 
match a value range (in terms of YUV/RGB/YCbCr/HSV values) is pretty basic. In 
particular,
motion tracking is an application I have been wanting to dive into for some 
time, but am
waiting for other efforts to either mature or fizzle out. 

Region operations akin to open source Image Magick's would be a dream, 
but specifically when we create sprite sheets, we need the ability to move/copy 
a region of pixels from one location to another. The current is way too slow; 
I know there is a an assembler memory block move, so it should be nearly 
instantaneous. 

Another region operation is a basic difference; for "dumb" masking where you 
just subtract
one image (the actor against a background) from a matte plate (just the 
background).

Some node operations should be nearly instantaneous; computing the average value
of an image/block of pixels should be really fast (in preparation for 
bright/contrast etc)

 --Roger


Check out my website at www.rogerwickes.com for a good deal on my book and 
training course, as well as information about my latest activities. Use coupon
Papasmurf for $15 off!




________________________________
From: Campbell Barton <[email protected]>
To: bf-blender developers <[email protected]>
Sent: Tue, April 27, 2010 11:52:40 AM
Subject: Re: [Bf-committers] pixel get & image processing

This is an area of the api Id like to look into but think that
getpixel functions via rna are too slow.
I did some simple tests and the overhead for an function call was
roughly 8X, compared to the blender 2.4x python api.

While this is generally bad practice to give such low level access to
python, Id favor memory buffer access to the image, or not at all,
since functions per pixels are incredible slow.

On Tue, Apr 27, 2010 at 5:46 PM, Sebastian Korczak
<[email protected]> wrote:
> I'm sorry for Thunderbird formating error, that's the correct text:
>
> I'm working on 2.5 implementation of old image.getPixelI(x,y) for returning 
> the color
> of the (x,y) pixel in the format [r,g,b,a].
> getPixelI(x,y) is an instance method in image class (2.49b).
>
> Maybe I'm wrong, but Blender 2.5 haven't methods like this we can access from 
> python code.
>
>
> So, first I made get pixel property in bpy.types.image:
>     bpy.data.images['image_name'].pixels
>
> - property have access to ImBbuf but can't take any arguments like 
> pixels(x,y).
> -  image properties are in \source\blender\makesrna\intern\rna_image.c
>
>
> Then I made getpixel operator in bpy.ops.image:
>        bpy.ops.image.pixel(image='im', x=1, y=1)
>
> - it takes arguments but there are problems:
>         - how to access image with it's name only (context.space is 
> text_editor) or
>                with it's struct from bpy.data.images['image_name'] or
>                with it's pointer from 
> bpy.data.images['image_name'].as_pointer()
>        - how to return rgba values
> - image operators are in source\blender\editors\space_image\image_ops.c
>
> Any ideas?
>
> What do you think about start Blender Image Processing module with operators 
> like this:
> bip.getPixel(image=im, x=1, y=1)
> bip.filter(image=im, filter='greyscale')
> bip.threshold(image=im, R=128, G=128, B=128, A=255)
>
> _______________________________________________
> Bf-committers mailing list
> [email protected]
> http://lists.blender.org/mailman/listinfo/bf-committers
>



-- 
- Campbell
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers



      
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers

Reply via email to