< Back to IRCAM Forum

Image contour and data transfer to BPF/BPC

Hi!

I have a photo of an mountainous landscape wherefrom I want to extrapolate its contours and transfer it to BPF/BPC.
(The contours from the image I can extrapolate with other program and save it as separate image, but how to transfer it to BPF/BPC?)

Did anybody do something similar in OM?

Hoping for some help!

All the best!

Ališer

1 Like

Dear Aliser,

The ideal thing is to use SVG format. I have something like that which can suit you. However, i am having problems with the coordinates from the application (inkscape) to OM that appears not to be the same, i.e they are flipped. So for the time being this is a code in progress. Will let you know when it is ready, and will make it available ASAP.

Best
K

1 Like

Dear Karim,

So nice to hear from you and thank you for your fast reply!

I was trying also to approach the problem with transfer of image contours in a other way. I was using graphic tools (pen) in a picture to outline the contours in a photo by hand and afterwards to extrapolate a graphic-object relative to the height and width of the image in order to transfer it to BPF/BPC, but I don’t understand the third output [graph-point list of (x y)] from the graphic-object, which outputs a list of pairs of fractions (?). How to “translate” this kind of list to x and y inputs of a BPF/BPC?
Would this approach be easier or am I missing some basic concept?

Thank you once more and I wish you all the best!

Ališer

Dear Aliser,

Ok, got it !
Well the third output is all added drawings you will do and here is a way to do it:

Some explanations:
You will notice i have drawn (sorry i am a very lousy artist!) some contours, one in red, the other in green.

We will use the third output to retrieve these. (apparently it is in the order of creation)

Then i will use the graph-points access slot to obtain them

Then a mat-trans is ncessary to separate the xy pairs.

Notice here the *-1 necessary to flip the contour.

There you have it…

The patch with the picture. (on the picture is Giacometti)
Patch 5.omp (25.7 KB)

Best
K

Dear Karim,

As always, you are the saver! Now I can continue working!

Thank you very much and all the best!

Ališer

ps. As a complementary info, you can also directly load an image as the background of a BPF or BPC (right-click then “Background piture”), and draw points inside the the editor, directly on top of this picture.

Hi,

And is there any conceivable way of transforming raster pictures (Width X Height) into chord-objects ( Milliseconds X MIDIcents, with pixel brightness as velocity)? It would be an awesome way of doing graphical scores in OpenMusic.

All the best,
António

You could give a try to the “pixels” library:

The library comes with a set of help patches. It provides different means access and filter the pixels as a 2D array. You can probably use the output values to do whatever you want :slight_smile:

1 Like

Hi Jean,

Thanks, time to permanently scarr my neighbor’s sweet cocker spaniel — bad joke, no animal abuse shall occur during my experiments (other than on myself, probably.)

All the best,
António

1 Like