| I think [0,1] is a much better interval than [0,255]. [0,1] implies a real number, [0,255] implies an integer, indeed, a byte.
The row and column indexes are not real numbers, but they do not range between [0,255] either.
It is more mathematically natural to map [0,1] to [max(x), max(y)].
Regards,
Mike
-----Original Message-----
>From: Andres Cabrera
>Sent: Nov 19, 2007 10:28 AM
>To: csound@lists.bath.ac.uk
>Subject: [Csnd] Re: Image opcodes
>
>Hi Cesare,
>
>El dom, 18-11-2007 a las 20:40 +0100, Cesare Marilungo escribió:
>>
>> By default these two opcodes use values scaled from 0.0 to 1.0 so the
>> top left pixel is 0,0 and the r g b values are 0.0 to 1.0 too. As
>> Michael suggested I plan to add an extra parameter to choose if you want
>> to use the exact pixel indexes. So 0 would be default, 1 would be with
>> exact pixel indexes and r g b values.
>>
>Thanks for your work. Just one suggestion to keep values more in line
>with existing opcodes, it might be good to use ranges between 0 and 255
>to keep consistency with the existing FL opcodes like FLcolor, etc.
>Do you think these opcodes could be used to replace the bmopen opcode
>(which is currently only available on CsoundAV, but is designed to
>interact with other existing opcodes)?
>
>http://www.csounds.com/maldonado/Manual/index.htm
>
>Cheers,
>Andrés
>
>> I would like to hear from you about the naming conventions and such, if
>> there's a better way to name these opcodes. If you think they would be
>> useful or if they're worthless. Anything.
>>
>> Also, at the moment I'm using Imlib and Xlib for this and I developed it
>> on gnu/Linux. What library would you use for Windows and MacOS X?
>>
>> Thanks in advance for the feedback.
>>
>> Ciao,
>>
>> c.
>>
>> p.s. Here's a .csd to test everything:
>>
>>
>>
>>
>> sr=48000
>> ksmps=1
>> nchnls=2
>>
>> giimage1 imageload "image.png" ;edit this to point to a valid image path
>> and filename
>> giimage1w, giimage1h imagesize giimage1
>> prints "giImage1size: %d,%d\n", giimage1w, giimage1h
>>
>> giimage2 imagecreate 800, 600
>>
>> instr 1
>> kval linseg 0, p3, 1
>> kred, kgreen, kblue imagegetpixel giimage1, kval, 0 ;scans and print the
>> first line of the image (y=0)
>> printk 0, kblue
>> endin
>>
>> instr 2
>> kval linseg 0, p3, 1
>> kval2 lfo 1/6,2,0
>> kval3 lfo 1/6,4,0
>> kval4 lfo 1/6,8,0
>> imagesetpixel giimage2, kval,kval2+1/6,1,0,0
>> imagesetpixel giimage2, kval,kval3+3/6,0,1,0
>> imagesetpixel giimage2, kval,kval4+5/6,0,0,1
>> endin
>>
>> instr 3
>> imagesave giimage2, "imageout.png"
>> endin
>>
>>
>>
>>
>>
>> i1 0 0.1
>> i2 1 1
>> i3 2 1
>> e
>>
>>
>>
>>
>>
>
>
>
>Send bugs reports to this list.
>To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|